:root {
  --paper: #FAFAF8;
  --paper-2: #F1F1EC;
  --ink: #121214;
  --graphite: #55555A;
  --ghost: #8B8B90;
  --line: #E2E2DC;
  --minium: #D9482B;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Golos Text", "Inter", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.ghost { color: var(--ghost); }
.minium { color: var(--minium); }
.draft-caption { font-style: italic; color: var(--graphite); letter-spacing: 0.04em; }

/* ── закреплённая полоса ─────────────────────────────── */
.topbar {
  position: fixed; top: 14px; left: 50%;
  transform: translate(-50%, -140%);
  width: calc(min(1560px, 100vw) - 2 * clamp(48px, 6vw, 96px));
  display: flex; align-items: center; gap: 22px;
  padding: 10px 18px;
  background: var(--paper);
  border: 1px solid var(--ink);
  transition: transform 0.5s cubic-bezier(.22,.61,.36,1);
  z-index: 50;
}
.topbar.show { transform: translate(-50%, 0); }
.topbar-name { font-weight: 600; letter-spacing: 0.06em; }
.topbar-nav {
  display: flex; gap: 18px; font-size: 12.5px; flex-wrap: wrap;
  position: absolute; left: 50%; transform: translateX(-50%);
}
.topbar .btn { margin-left: auto; }
.topbar-nav a { color: var(--graphite); text-decoration: none; padding-bottom: 2px; transition: color 0.3s ease, box-shadow 0.3s ease; }
.topbar-nav a:hover { color: var(--ink); }
.topbar-nav a.now { color: var(--ink); box-shadow: 0 1px 0 var(--minium); }

/* ── страница ────────────────────────────────────────── */
.page { padding: 0 clamp(48px, 6vw, 96px); max-width: 1560px; margin: 0 auto; }

.sheet { padding: clamp(80px, 12vh, 140px) 0; }
.sheet:not(.hero)::before {
  content: ""; position: absolute; top: 0; height: 1px; background: var(--line);
  left: calc(clamp(14px, 2vw, 34px) - clamp(48px, 6vw, 96px));
  right: calc(clamp(14px, 2vw, 34px) - clamp(48px, 6vw, 96px));
}
.sheet.hero { padding-top: 28px; }
.sheet.last { padding-bottom: 56px; }

.sheet-tag {
  font-size: 11px; color: var(--ghost);
  text-transform: uppercase; letter-spacing: 0.16em;
  margin-bottom: clamp(24px, 4vh, 44px);
}

/* ── типографика ─────────────────────────────────────── */
.display {
  font-size: clamp(2.6rem, min(7vw, 9.5vh), 6.9rem);
  line-height: 0.99;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.022em;
  text-wrap: balance;
  margin: 14px 0 10px;
}
.hero-overline { margin-top: clamp(22px, 4vh, 44px); }
.display-2 {
  font-size: clamp(2rem, 4.6vw, 4.2rem);
  line-height: 1.02;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.018em;
  text-wrap: balance;
  margin-bottom: 22px;
  max-width: 26ch;
}
.lead { font-size: clamp(1.05rem, 1.5vw, 1.3rem); color: var(--graphite); max-width: 56ch; margin-bottom: 28px; }
.overline { font-size: 12px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--graphite); }

h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.2; }

/* ── hero ────────────────────────────────────────────── */
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 16px; border-bottom: 1px solid var(--ink); }
.wordmark { font-weight: 600; font-size: 1.5rem; letter-spacing: 0.05em; }
.hero-nav { display: flex; gap: 26px; font-size: 13px; }
.hero-nav a { color: var(--graphite); text-decoration: none; transition: color 0.3s ease, box-shadow 0.3s ease; }
.hero-nav a:hover { color: var(--ink); box-shadow: 0 1px 0 var(--minium); }

.sheet.hero { position: relative; min-height: calc(100vh - 30px); }
.hero-grid { padding-top: clamp(16px, 3vh, 36px); }
.hero-copy { padding-top: 6px; max-width: 58ch; position: relative; z-index: 2; }
.display { position: relative; z-index: 2; }

.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 32px; }
.btn {
  display: inline-block; text-decoration: none;
  font-size: 15px; font-weight: 500;
  padding: 15px 26px; border: 1px solid var(--ink);
  color: var(--ink); background: transparent;
  transition: transform 0.3s cubic-bezier(.22,.61,.36,1), box-shadow 0.3s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 3px 0 var(--minium); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-sm { padding: 8px 16px; font-size: 13px; }

.stats { display: flex; gap: clamp(20px, 3vw, 48px); }
.stats div { border-left: 1px solid var(--line); padding-left: 14px; }
.stats dt { font-size: 11px; color: var(--ghost); text-transform: uppercase; letter-spacing: 0.1em; }
.stats dd { font-size: clamp(1rem, 1.6vw, 1.35rem); font-weight: 500; }

/* ── 3D-каркас ───────────────────────────────────────── */
.hero-figure {
  min-width: 0; position: absolute;
  top: 84px; right: 0; bottom: 20px;
  width: min(46%, 700px); z-index: 1;
}
#bim3d { width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: pan-y; }
figcaption { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 8px 2px 0; font-size: 13px; }
figcaption .ghost { font-size: 11px; }

/* ── чертёжные svg ───────────────────────────────────── */
.sheet-figure { cursor: crosshair; }
.sheet-figure svg { width: 100%; height: auto; display: block; background: var(--paper); }

.ax { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ax.ink { stroke: var(--ink); stroke-width: 1.5; }
.ax.g { stroke: var(--graphite); stroke-width: 1.1; }
.ax.pump { fill: var(--paper); }
.ax.minium-line { stroke: var(--minium); stroke-width: 1.3; }
.flow {
  fill: none; stroke: var(--minium); stroke-width: 1.6;
  stroke-dasharray: 6 9; opacity: 0; transition: opacity 1.2s ease;
}
svg.live .flow { opacity: 1; animation: flow 2.2s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -30; } }
svg.live .pump { transform-box: fill-box; transform-origin: center; animation: pulse 2.8s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.18); } }

.dims text { font-size: 11px; fill: var(--ghost); font-family: "JetBrains Mono", monospace; }
.dimline { stroke: var(--ghost); stroke-width: 0.8; fill: none; }

/* ── состав ──────────────────────────────────────────── */
.grid-marks { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); border: 1px solid var(--ink); border-right: 0; border-bottom: 0; }
@media (min-width: 1000px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }
.mark { border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 26px 22px 20px; display: flex; flex-direction: column; gap: 10px; transition: background 0.45s ease; position: relative; overflow: hidden; }
.mark::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 0; background: var(--minium); transition: width 0.5s cubic-bezier(.22,.61,.36,1); }
.mark:hover { background: var(--paper-2); }
.mark:hover::after { width: 100%; }
.mark-code { font-size: 30px; font-weight: 500; color: var(--minium); }
.mark p { font-size: 14.5px; color: var(--graphite); flex: 1; }
.mark-meta { font-size: 12px; color: var(--ghost); border-top: 1px solid var(--line); padding-top: 10px; }
.note { max-width: 62ch; margin-top: 26px; font-size: 15px; color: var(--graphite); }

/* ── листы ───────────────────────────────────────────── */
.sheets-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.sheet-card { border: 1px solid var(--ink); padding: 14px 14px 0; transition: transform 0.45s cubic-bezier(.22,.61,.36,1), box-shadow 0.45s ease; }
.sheet-card:hover { transform: translateY(-4px); box-shadow: 0 4px 0 var(--minium); }
.sheet-card figcaption { padding-bottom: 12px; }

/* ── демо-том ────────────────────────────────────────── */
.demo-mock { border: 1px solid var(--ink); max-width: 860px; }
.demo-head { display: flex; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--ink); font-size: 13px; font-weight: 500; }
.demo-tabs { display: flex; gap: 4px; padding: 0 10px; border-bottom: 1px solid var(--line); }
.dtab {
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12px; font-weight: 500;
  padding: 11px 10px; border: 0; background: transparent; color: var(--ghost);
  cursor: pointer; transition: color 0.25s ease, box-shadow 0.25s ease;
}
.dtab:hover { color: var(--ink); }
.dtab.on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--minium); }
.demo-pane { min-height: 218px; }
.demo-sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; padding: 14px; }
.dthumb { border: 1px solid var(--line); padding: 8px 8px 6px; margin: 0; transition: border-color 0.3s ease, transform 0.3s ease; cursor: crosshair; }
.dthumb:hover { border-color: var(--minium); transform: translateY(-2px); }
.dthumb svg { width: 100%; height: auto; display: block; }
.dthumb span { display: block; font-size: 10.5px; color: var(--ghost); padding-top: 6px; }
.demo-row { display: flex; gap: 14px; padding: 11px 18px; border-bottom: 1px solid var(--line); font-size: 12.5px; align-items: baseline; }
.demo-row span:nth-child(2) { flex: 1; color: var(--graphite); }
.demo-row:last-child { border-bottom: 0; }
.demo-ok { font-size: 11px; color: var(--ghost); white-space: nowrap; }
.dval { border-bottom: 1px solid var(--line); }
.dval:last-child { border-bottom: 0; }
.dval summary {
  display: flex; justify-content: space-between; gap: 16px; align-items: baseline;
  list-style: none; cursor: pointer; padding: 11px 18px; font-size: 12.5px;
}
.dval summary::-webkit-details-marker { display: none; }
.dval summary .ghost { font-size: 11px; }
.dval[open] summary .ghost { color: var(--minium); }
.dval p { padding: 0 18px 12px; font-size: 12px; color: var(--graphite); }
.dval p .minium { color: var(--minium); }
#demo .cta-row { margin-top: 24px; }

/* ── тарифы: конфигуратор сметы ──────────────────────── */
.calc-presets { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 26px; }
.preset, .sec, .bim-opt {
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 13px; font-weight: 500;
  padding: 9px 14px; border: 1px solid var(--ink); background: transparent; color: var(--ink);
  cursor: pointer; transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}
.preset.active, .sec.active, .bim-opt.active { background: var(--ink); color: var(--paper); }
.preset:hover, .sec:hover, .bim-opt:hover { transform: translateY(-1px); }

.calc-panel { display: grid; grid-template-columns: minmax(250px, 0.7fr) 1.3fr; gap: clamp(24px, 3.5vw, 56px); align-items: start; }
.calc-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ghost); margin: 16px 0 8px; }
.calc-side .calc-label:first-child { margin-top: 0; }
.calc-side input {
  width: 150px; font: 500 17px "JetBrains Mono", monospace;
  padding: 9px 12px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink);
}
.calc-side input:focus { outline: 2px solid var(--minium); outline-offset: 1px; }
.coef-note { font-size: 11.5px; margin-top: 8px; }
.sec-toggles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 340px; }
.sec { text-align: center; padding: 9px 6px; }
.bim-switch { display: inline-flex; }
.bim-switch .bim-opt + .bim-opt { border-left: 0; }

.estimate { width: 100%; border-collapse: collapse; font-size: 13px; }
.estimate th, .estimate td { border: 1px solid var(--ink); padding: 8px 12px; text-align: left; }
.estimate th { font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ghost); }
.est-r { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.est-mod td { color: var(--graphite); font-size: 12.5px; }
.est-total td { font-size: 15px; font-weight: 500; padding: 11px 12px; }
.calc-total {
  display: flex; justify-content: space-between; align-items: baseline;
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
  padding: 12px 2px; margin-top: 18px; font-size: 13px; color: var(--graphite);
}
.calc-total span:last-child { font-size: 18px; font-weight: 500; color: var(--ink); transition: color 0.4s ease; }
.calc-total span:last-child.tick { color: var(--minium); }
.btn-note { display: block; font-size: 11px; margin-top: 8px; text-align: center; }
#estTotal { transition: color 0.4s ease; }
#estTotal.tick { color: var(--minium); }
.calc-cta { margin-top: 22px; align-items: center; }
.calc-cta .ghost { font-size: 12px; }
.calc-side .calc-cta { margin-top: 18px; display: block; }
.calc-cta .btn { width: 100%; text-align: center; }

/* ── сроки ───────────────────────────────────────────── */
.timeline { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1.5px solid var(--ink); position: relative; }
.timeline::before {
  content: ""; position: absolute; top: -1.5px; left: 0; height: 1.5px;
  width: calc(var(--tl-x, 0px) + 4px); background: var(--minium);
  transition: width 1.1s cubic-bezier(.45,.05,.55,.95);
}
.timeline::after {
  content: ""; position: absolute; top: -5px; left: 0;
  width: 9px; height: 9px; border-radius: 50%; background: var(--minium);
  transform: translateX(var(--tl-x, 0px));
  transition: transform 1.1s cubic-bezier(.45,.05,.55,.95);
}
.timeline li { padding: 16px 16px 6px 0; position: relative; opacity: 0.45; transition: opacity 0.7s ease; }
.timeline li.tl-active { opacity: 1; }
.timeline li::before { content: ""; position: absolute; top: -1px; left: 0; width: 1px; height: 14px; background: var(--ink); }
.tl-day { display: block; font-size: clamp(1.2rem, 2vw, 1.8rem); font-weight: 500; color: var(--graphite); margin-bottom: 8px; transition: color 0.7s ease; }
.tl-active .tl-day { color: var(--minium); }
.tl-what { font-family: "Golos Text", sans-serif; font-size: 14px; color: var(--graphite); display: block; max-width: 24ch; }

/* ── монтаж и faq ────────────────────────────────────── */
.grid-why { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: clamp(20px, 3vw, 44px); margin-bottom: clamp(44px, 7vh, 80px); }
.why span { font-size: 13px; letter-spacing: 0.1em; }
.why h3 { margin: 10px 0 8px; }
.why p { font-size: 14.5px; color: var(--graphite); }

.faq-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--ghost); margin-bottom: 14px; }
.faq { border-top: 1px solid var(--ink); max-width: 760px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex; justify-content: space-between; gap: 20px; align-items: baseline;
  cursor: pointer; list-style: none; padding: 18px 2px;
  font-weight: 500; font-size: 16.5px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .ghost { transition: transform 0.4s ease, color 0.3s ease; display: inline-block; }
.faq details[open] summary .ghost { color: var(--minium); transform: rotate(45deg); }
.faq details p { padding: 0 2px 20px; color: var(--graphite); font-size: 15px; max-width: 60ch; }

/* ── штамп ───────────────────────────────────────────── */
.stamp { width: 100%; border-collapse: collapse; margin: clamp(40px, 7vh, 72px) 0 18px; font-size: 13px; }
.stamp td { border: 1px solid var(--ink); padding: 10px 14px; }
.s-dim { color: var(--ghost); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; width: 1%; white-space: nowrap; }
.s-title { font-family: "Golos Text", sans-serif; font-weight: 500; font-size: 15px; width: 44%; }
.colophon { font-size: 11px; }

/* ── появление ───────────────────────────────────────── */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.9s cubic-bezier(.22,.61,.36,1), transform 0.9s cubic-bezier(.22,.61,.36,1); }
.reveal.in { opacity: 1; transform: none; }

/* ── адаптив ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .page { padding: 0 22px; }
  .page::before, .page::after { display: none; }
  .sheet:not(.hero)::before { left: 0; right: 0; }
  .sheet:not(.hero)::after, .sheet:not(.hero) .sheet-tag::after { display: none; }
  .sec-toggles { max-width: none; }
  .topbar-nav { display: none; }
  .sheet.hero { min-height: 0; }
  .hero-figure { position: static; width: 100%; margin-top: 10px; }
  #bim3d { height: auto; aspect-ratio: 1 / 0.9; }
  .hero-nav { display: none; }
  .timeline { grid-template-columns: 1fr; border-top: 0; border-left: 1.5px solid var(--ink); }
  .timeline::after, .timeline::before { display: none; }
  .timeline li { padding: 10px 0 18px 18px; }
  .timeline li::before { top: 0; left: -1px; width: 14px; height: 1px; }
  .s-title { display: none; }
  .cta-row .btn { flex: 1 1 100%; text-align: center; }
  .calc-panel { grid-template-columns: 1fr; }
  .estimate { font-size: 12px; }
  .estimate th, .estimate td { padding: 8px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  svg.live .flow { animation: none; opacity: 1; }
  svg.live .pump { animation: none; }
  .timeline::after, .timeline::before { display: none; }
  .timeline li { opacity: 1; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .ax { stroke-dasharray: none !important; stroke-dashoffset: 0 !important; transition: none !important; }
}

/* ── бумага: зерно и оси ─────────────────────────────── */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 200;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.05; mix-blend-mode: multiply;
}
.page { position: relative; }
.page::before, .page::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 1px;
  background: var(--line); opacity: 0.7;
}
.page::before { left: clamp(14px, 2vw, 34px); }
.page::after { right: clamp(14px, 2vw, 34px); }
.sheet { position: relative; }
.sheet:not(.hero)::after, .sheet:not(.hero) .sheet-tag::after {
  content: "+"; position: absolute; top: -8.5px;
  font: 400 13px "JetBrains Mono", monospace; color: var(--ghost);
  line-height: 1; background: var(--paper); padding: 2px 1px;
}
.sheet:not(.hero)::after {
  left: calc(clamp(14px, 2vw, 34px) - clamp(48px, 6vw, 96px) - 4.5px);
}
.sheet:not(.hero) .sheet-tag::after {
  right: calc(clamp(14px, 2vw, 34px) - clamp(48px, 6vw, 96px) - 4.5px);
}
