/* Viirman OÜ – vrprojekt.ee */
:root {
  --paper: #f7f9f9;
  --ink: #1e2b33;
  --muted: #51616b;
  --grid: #d5dee2;
  --v1: #1565a6;   /* veevarustus / water supply */
  --k1: #7a4e22;   /* reovesi / sewer */
  --k2: #2e7d5b;   /* sademevesi / stormwater */
  --head: "Barlow Semi Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --body: "Barlow", "Helvetica Neue", Arial, system-ui, sans-serif;
  --wrap: 70rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--head);
  font-weight: 600;
  line-height: 1.1;
  margin: 0;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--v1); text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--v1); outline-offset: 3px; border-radius: 2px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1.5rem; }

.skip {
  position: absolute; left: 1rem; top: -3rem;
  background: var(--ink); color: #fff; padding: 0.5rem 0.9rem; z-index: 10;
}
.skip:focus { top: 1rem; color: #fff; }

/* Header */
.top {
  border-bottom: 1px solid var(--grid);
}
.top .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding-top: 1rem; padding-bottom: 1rem;
}
.brand {
  font-family: var(--head); font-weight: 700; font-size: 1.35rem;
  color: var(--ink); text-decoration: none; letter-spacing: 0.01em;
}
.brand:hover { color: var(--v1); }
.nav { display: flex; gap: 1.4rem; flex-wrap: wrap; font-size: 1rem; }
.nav a { color: var(--ink); text-decoration: none; }
.nav a:hover { color: var(--v1); text-decoration: underline; }
.nav .lang { color: var(--muted); padding-left: 1.4rem; border-left: 1px solid var(--grid); }

/* Hero */
.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 3rem;
  align-items: center;
  padding-top: 4rem; padding-bottom: 4.5rem;
}
.hero h1 {
  font-size: clamp(2.5rem, 5.2vw, 3.9rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 1.25rem;
}
.lead { font-size: 1.25rem; color: var(--muted); max-width: 32rem; margin-bottom: 2rem; }

.actions { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.btn {
  display: inline-block;
  background: var(--v1); color: #fff;
  font-family: var(--head); font-weight: 600; font-size: 1.15rem;
  padding: 0.8rem 1.4rem; border-radius: 3px; text-decoration: none;
}
.btn:hover { background: var(--ink); color: #fff; }
.tel { display: inline-flex; align-items: center; gap: 0.45em; font-family: var(--head); font-weight: 600; font-size: 1.3rem; color: var(--ink); text-decoration: none; }
.ico { width: 1em; height: 1em; flex: none; color: var(--v1); }
.tel-link { display: inline-flex; align-items: center; gap: 0.4em; }
.tel:hover { color: var(--v1); text-decoration: underline; }

.plan { margin: 0; }
.plan .sheet {
  border: 1px solid var(--grid);
  background-color: #fff;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: -1px -1px;
}
.plan svg { display: block; width: 100%; height: auto; }
.plan figcaption { font-size: 0.95rem; color: var(--muted); margin-top: 0.75rem; }
.plan figcaption b { font-family: var(--head); font-weight: 600; }
.plan figcaption .c-v1 { color: var(--v1); }
.plan figcaption .c-k1 { color: var(--k1); }
.plan figcaption .c-k2 { color: var(--k2); }

.plan .cap { display: block; }
.legend { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.3rem; }
.legend li { display: flex; align-items: center; gap: 0.55rem; }
.legend b { font-family: var(--head); font-weight: 600; min-width: 1.6rem; }
.sw { display: inline-block; width: 1.9rem; height: 4px; border-radius: 2px; flex: none; }
.sw-v1 { background: var(--v1); } .sw-k1 { background: var(--k1); } .sw-k2 { background: var(--k2); }

/* drawing */
.d-line { fill: none; stroke: var(--ink); }
.d-boundary { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 14 4 2 4; }
.d-house { fill: #fff; stroke: var(--ink); stroke-width: 4; }
.d-main { fill: none; stroke-width: 2; opacity: 0.55; }
.d-txt { font-family: var(--head); font-size: 14px; fill: var(--muted); }
.d-code { font-family: var(--head); font-weight: 600; font-size: 13px; }
.d-big { font-family: var(--head); font-weight: 600; font-size: 16px; fill: var(--ink); }
.pipe { fill: none; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.well { fill: #fff; stroke-width: 2.5; }
.s-v1 { stroke: var(--v1); } .f-v1 { fill: var(--v1); }
.s-k1 { stroke: var(--k1); } .f-k1 { fill: var(--k1); }
.s-k2 { stroke: var(--k2); } .f-k2 { fill: var(--k2); }

@media (prefers-reduced-motion: no-preference) {
  .pipe { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s ease-out forwards; }
  .pipe.s-k1 { animation-delay: 0.45s; }
  .pipe.s-k2 { animation-delay: 0.9s; }
  .well, .d-code { opacity: 0; animation: show 0.4s ease-out 1.6s forwards; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes show { to { opacity: 1; } }

/* Sections */
.section { padding: 4.5rem 0; border-top: 1px solid var(--grid); }
.section h2 { font-size: clamp(1.9rem, 3.4vw, 2.4rem); margin-bottom: 0.6rem; }
.intro { color: var(--muted); max-width: 40rem; margin-bottom: 2.5rem; }

/* Services */
.services {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.5rem 3.5rem;
}
.services li { border-top: 1px solid var(--ink); padding-top: 1rem; max-width: 34rem; }
.services li.v1 { border-top: 4px solid var(--v1); }
.services li.k1 { border-top: 4px solid var(--k1); }
.services li.k2 { border-top: 4px solid var(--k2); }
.services h3 { font-size: 1.35rem; margin-bottom: 0.5rem; }
.services .code { font-family: var(--head); font-weight: 600; font-size: 1rem; margin-left: 0.4rem; }
.services .v1 .code { color: var(--v1); }
.services .k1 .code { color: var(--k1); }
.services .k2 .code { color: var(--k2); }
.services p { color: var(--muted); }

/* Steps */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; max-width: 44rem; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 2.2rem 4rem;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: -0.15rem;
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: 2px solid var(--ink); background: var(--paper);
  font-family: var(--head); font-weight: 600; font-size: 1.15rem;
  display: grid; place-items: center;
}
.steps li:not(:last-child)::after {
  content: ""; position: absolute; left: calc(1.25rem - 1px); top: 2.4rem; bottom: 0.1rem;
  width: 2px; background: var(--ink);
}
.steps li:last-child { padding-bottom: 0; }
.steps h3 { font-size: 1.3rem; margin-bottom: 0.35rem; }
.steps p { color: var(--muted); }

/* Calculator */
.calc { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 3rem; align-items: start; }
.calc-type { border: 0; margin: 0 0 1.5rem; padding: 0; display: grid; gap: 0.6rem; }
.calc-type legend { font-family: var(--head); font-weight: 600; font-size: 1.2rem; margin-bottom: 0.6rem; padding: 0; }
.calc label { cursor: pointer; }
.calc-type label, .calc .check { display: flex; align-items: center; gap: 0.6rem; }
.calc input[type="radio"], .calc input[type="checkbox"] { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--v1); flex: none; }
.calc-panel { border-top: 1px solid var(--ink); padding-top: 1.25rem; display: grid; gap: 1rem; }
.calc-panel[hidden] { display: none; }
.calc .num { display: flex; align-items: center; justify-content: space-between; gap: 1rem; max-width: 26rem; }
.calc input[type="number"] {
  width: 6rem; font: inherit; font-family: var(--head); font-weight: 600; font-size: 1.15rem;
  padding: 0.4rem 0.6rem; border: 1px solid var(--muted); border-radius: 3px; background: #fff; color: var(--ink);
  text-align: right;
}
.calc input[type="number"]:focus-visible { outline: 3px solid var(--v1); outline-offset: 1px; }
.hint { font-size: 0.95rem; color: var(--muted); margin: 0; }
.fixtures { width: 100%; border-collapse: collapse; }
.fixtures th, .fixtures td { text-align: left; padding: 0.4rem 0; border-bottom: 1px solid var(--grid); font-weight: 400; vertical-align: middle; }
.fixtures thead th { font-family: var(--head); font-weight: 600; font-size: 1rem; color: var(--muted); border-bottom: 2px solid var(--ink); }
.fixtures td { width: 7rem; text-align: right; }
.fixtures .grp { color: var(--muted); font-size: 0.9em; }
.calc select {
  font: inherit; font-family: var(--head); font-weight: 600; font-size: 1.1rem;
  padding: 0.4rem 0.6rem; border: 1px solid var(--muted); border-radius: 3px; background: #fff; color: var(--ink); min-width: 6rem;
}
.calc select:focus-visible { outline: 3px solid var(--v1); outline-offset: 1px; }
.calc-panel .fixtures + .num, .calc-panel .hint + .fixtures { margin-top: 0; }
.fixtures.daily { margin-top: 0.25rem; }
.calc-result .r-day dd#r-day { font-size: 2.1rem; color: var(--ink); }
.calc-result .r-main dd.r-range { font-family: var(--body); font-weight: 400; font-size: 0.9rem; line-height: 1.4; color: var(--muted); margin-top: 0.25rem; }
.calc-result .r-range:empty { display: none; }
.r-form { border-left: 3px solid var(--v1); padding-left: 0.75rem; }
.calc-inputs { display: grid; gap: 2.25rem; }
.calc-type { margin-bottom: 0; }
.calc-block { border-top: 1px solid var(--ink); padding-top: 1.1rem; display: grid; gap: 0.75rem; }
.calc-block h3 { font-size: 1.3rem; }
.calc-block .calc-panel { border-top: 0; padding-top: 0; }
.fx .q, .fx .sum { text-align: right; white-space: nowrap; width: auto; padding-left: 1rem; }
.fx td.q { color: var(--muted); font-size: 0.95rem; }
.fx td.sum { font-family: var(--head); font-weight: 600; min-width: 4.5rem; }
.fx thead th.q, .fx thead th.sum { font-size: 0.9rem; }
.fixtures td:nth-child(2), .fixtures thead th:nth-child(2) { width: 6.5rem; text-align: right; }
.more { margin-top: 0.25rem; }
.more summary { cursor: pointer; color: var(--v1); padding: 0.35rem 0; }
.more[open] summary { margin-bottom: 0.5rem; }
.more .num { margin-top: 1rem; }
.total { display: flex; justify-content: space-between; gap: 1rem; margin: 0; padding: 0.6rem 0; border-top: 2px solid var(--ink); font-family: var(--head); font-weight: 600; font-size: 1.15rem; }
.total b { font-weight: 700; white-space: nowrap; }
.calc-result { position: sticky; top: 1.5rem; border: 2px solid var(--ink); background: #fff; padding: 1.25rem 1.25rem 1.4rem; display: grid; gap: 1rem; }
.calc-result dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem 1rem; }
.calc-result dt { font-size: 0.85rem; color: var(--muted); }
.calc-result dd { margin: 0; font-family: var(--head); font-weight: 600; font-size: 1.3rem; }
.calc-result .r-main { grid-column: 1 / -1; border-bottom: 1px solid var(--ink); padding-bottom: 0.9rem; }
.calc-result .r-main dd { font-size: 2.6rem; line-height: 1.05; color: var(--v1); }
.calc-result .r-msg:empty { display: none; }
.calc-result .r-msg { margin: 0; color: var(--k1); font-weight: 500; }
.calc-result.is-empty dl, .calc-result.is-empty .r-how { opacity: 0.35; }
.r-how summary { cursor: pointer; color: var(--v1); font-size: 0.95rem; }
.r-how p { font-family: var(--head); font-size: 1rem; margin: 0.5rem 0 0; overflow-wrap: anywhere; }
.calc-result .btn { text-align: center; }
.btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

/* Projects register */
.register { width: 100%; border-collapse: collapse; max-width: 56rem; }
.register th, .register td {
  text-align: left; vertical-align: top;
  padding: 0.9rem 1.25rem 0.9rem 0;
  border-bottom: 1px solid var(--grid);
}
.register thead th {
  font-family: var(--head); font-weight: 600; font-size: 1rem; color: var(--muted);
  border-bottom: 2px solid var(--ink); padding-top: 0;
}
.register tbody th { font-family: var(--head); font-weight: 600; font-size: 1.25rem; width: 38%; }
.register td { color: var(--muted); }

/* About */
.about { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 3rem; }
.about .text { max-width: 40rem; }

/* Contact / title block */
.contact .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 3rem; align-items: start; }
.contact .note { color: var(--muted); max-width: 30rem; }
.stamp {
  margin: 0;
  display: grid; grid-template-columns: 1fr 1fr;
  border: 2px solid var(--ink);
  background: #fff;
}
.stamp > div { padding: 0.75rem 1rem 0.9rem; border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.stamp > div:nth-child(2n) { border-right: 0; }
.stamp > div:nth-last-child(-n+2) { border-bottom: 0; }
.stamp .wide { grid-column: 1 / -1; border-right: 0; }
.stamp dt { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.15rem; }
.stamp dd { margin: 0; font-family: var(--head); font-weight: 600; font-size: 1.35rem; overflow-wrap: anywhere; }
.stamp dd a { color: var(--ink); }
.stamp dd a:hover { color: var(--v1); }

.foot { border-top: 1px solid var(--grid); padding: 1.5rem 0 2rem; font-size: 0.95rem; color: var(--muted); }

/* Responsive */
@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; gap: 2.5rem; padding-top: 2.5rem; padding-bottom: 3rem; }
  .services { grid-template-columns: 1fr; gap: 2rem; }
  .about, .contact .wrap, .calc { grid-template-columns: 1fr; gap: 1.5rem; }
  .calc-result { position: static; }
  .section { padding: 3.25rem 0; }
}
@media (max-width: 520px) {
  body { font-size: 1.0625rem; }
  .nav { gap: 1rem; }
  .nav .lang { padding-left: 0; border-left: 0; }
  .fx .q { display: none; }
  .calc input[type="number"] { width: 4.5rem; }
  .register thead { display: none; }
  .register, .register tbody, .register tr, .register th, .register td { display: block; width: 100%; }
  .register tr { border-bottom: 1px solid var(--grid); padding: 0.9rem 0; }
  .register th, .register td { border: 0; padding: 0; }
  .register tbody th { margin-bottom: 0.25rem; }
  .stamp { grid-template-columns: 1fr; }
  .stamp > div { border-right: 0; border-bottom: 1px solid var(--ink); }
  .stamp > div:nth-last-child(-n+2) { border-bottom: 1px solid var(--ink); }
  .stamp > div:last-child { border-bottom: 0; }
}
