:root {
  --bg: #F2EEE4;
  --surface: #F8F5EE;
  --raised: #E8E3D8;
  --raised-hover: #DFD9CD;
  --line: rgba(30, 27, 23, 0.1);
  --line-strong: rgba(30, 27, 23, 0.2);
  --text: #1E1B17;
  --text-2: #514742;
  --text-3: #675E56;
  --accent: #1E1B17;
  --accent-hover: #2E2A24;
  --on-accent: #F2EEE4;
  --dark: #24201B;
  --on-dark: #F2EEE4;
  --on-dark-2: #C9C0B3;
  --on-dark-3: #A39A8D;
  --dark-line: rgba(242, 238, 228, 0.14);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --serif: "EB Garamond", "PT Serif", Georgia, serif;
  --sans: "Commissioner", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --pad: 20px;
  --header-h: 64px;
  --section: 64px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 80px;
}

img, svg, iframe { display: block; max-width: 100%; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 500; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.icon { display: block; flex-shrink: 0; }

:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; border-radius: 4px; }
.dark :focus-visible { outline-color: var(--on-dark); }

.skip {
  position: absolute; left: 16px; top: -100px; z-index: 100;
  background: var(--accent); color: var(--on-accent);
  padding: 12px 16px; border-radius: 8px; text-decoration: none;
}
.skip:focus { top: 12px; }

.wrap { max-width: 1264px; margin-inline: auto; padding-inline: var(--pad); }

.h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(34px, 3.6vw, 46px);
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.lead { color: var(--text-2); font-size: 18px; line-height: 1.6; max-width: 34em; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 12px 20px;
  border-radius: 8px; border: 1px solid transparent;
  font-family: var(--sans); font-size: 16px; font-weight: 500; line-height: 1.25;
  text-decoration: none; text-align: center; cursor: pointer;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease), transform 160ms var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--raised); color: var(--text); border-color: var(--line); }
.btn-secondary:hover { background: var(--raised-hover); }
.btn-sm { min-height: 44px; padding: 10px 16px; }

/* Header */
.header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: background-color 180ms var(--ease), border-color 180ms var(--ease);
}
.header.is-scrolled { background: var(--surface); border-bottom-color: var(--line); }
.header-in {
  display: flex; align-items: center; gap: 24px;
  height: var(--header-h);
}
.brand { display: flex; flex-direction: column; text-decoration: none; line-height: 1.1; margin-right: auto; }
.brand-name { font-family: var(--serif); font-weight: 500; font-size: 24px; letter-spacing: -0.005em; }
.brand-sub { font-size: 14px; color: var(--text-3); margin-top: 2px; }

.nav { display: none; gap: 4px; }
.nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px;
  color: var(--text-2); text-decoration: none; font-size: 16px; border-radius: 8px;
  transition: color 160ms var(--ease), background-color 160ms var(--ease);
}
.nav a:hover { color: var(--text); background: var(--raised); }

.lang { display: flex; gap: 2px; }
.lang button {
  min-width: 44px; min-height: 44px; padding: 0 8px;
  border: 0; background: transparent; border-radius: 8px; cursor: pointer;
  font-family: var(--mono); font-size: 14px; color: var(--text-3);
  transition: color 160ms var(--ease), background-color 160ms var(--ease);
}
.lang button:hover { color: var(--text); }
.lang button[aria-pressed="true"] { color: var(--text); background: var(--raised); }

.header-tools { display: none; align-items: center; gap: 12px; }
.icon-link {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px;
  color: var(--text-2); transition: color 160ms var(--ease), background-color 160ms var(--ease);
}
.icon-link:hover { color: var(--text); background: var(--raised); }

.menu-btn {
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer;
}
.menu-btn .i-close { display: none; }
.menu-btn[aria-expanded="true"] .i-open { display: none; }
.menu-btn[aria-expanded="true"] .i-close { display: block; }

.menu {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--surface); border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
  padding: 8px var(--pad) 24px;
}
.menu[hidden] { display: none; }
.menu-nav a {
  display: flex; align-items: center; min-height: 48px;
  border-bottom: 1px solid var(--line); text-decoration: none; font-size: 18px;
}
.menu .lang { margin: 16px 0 8px -8px; }
.menu-links { display: grid; gap: 4px; margin-top: 8px; }
.menu-links a { display: flex; align-items: center; gap: 12px; min-height: 44px; text-decoration: none; color: var(--text-2); }

/* Hero */
.hero {
  position: relative;
  display: grid;
  gap: 32px;
  max-width: 1264px; margin-inline: auto;
  padding: 32px var(--pad) 48px;
}
.hero-text { position: relative; z-index: 1; }
.hero h1 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(42px, 5.8vw, 72px);
  line-height: 1.02; letter-spacing: -0.015em;
  text-wrap: balance;
}
html[lang="kk"] .hero h1 { font-size: clamp(38px, 4.6vw, 60px); line-height: 1.06; }
.hero .lead { margin-top: 20px; }
.hero-actions { display: grid; gap: 12px; margin-top: 28px; }
.status {
  display: flex; align-items: center; gap: 8px; margin-top: 16px;
  color: var(--text-2); font-size: 16px; font-variant-numeric: tabular-nums;
}
.status .icon { color: var(--text-3); }
.status[hidden] { display: none; }

.hero-media { position: relative; }
.sheet {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 12px 12px 0;
}
.drawing { width: 100%; height: auto; }
.sheet figcaption {
  display: flex; justify-content: space-between; gap: 16px;
  border-top: 1px solid var(--line);
  margin-top: 4px; padding: 12px 4px 14px;
  font-family: var(--mono); font-size: 14px; line-height: 1.4; color: var(--text-3);
}

/* Drawing strokes */
.d-line { stroke: var(--text); stroke-width: 1.25; fill: none; }
.d-front { stroke: var(--text); stroke-width: 1.25; fill: var(--surface); }
.d-soft { stroke: var(--text); stroke-width: 1.25; fill: var(--raised); }
.d-solid { fill: var(--text); }
.d-handle { stroke: var(--text); stroke-width: 2.25; stroke-linecap: round; fill: none; }
.d-hatch { stroke: var(--text-3); stroke-width: 1; fill: none; }
.d-dash { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 5 4; fill: none; }
.d-dim { stroke: var(--text-3); stroke-width: 1; fill: none; }
.d-num { font-family: var(--mono); font-size: 20px; fill: var(--text-3); font-variant-numeric: tabular-nums; }

/* Facts strip */
.facts { border-block: 1px solid var(--line); }
.facts-list { display: grid; grid-template-columns: 1fr 1fr; }
.fact {
  display: grid; grid-template-columns: 20px 1fr; column-gap: 12px; align-items: start;
  padding: 20px 12px 20px 0;
}
.fact:nth-child(2n) { padding-left: 16px; border-left: 1px solid var(--line); }
.fact:nth-child(n+3) { border-top: 1px solid var(--line); }
.fact .icon { color: var(--text-2); margin-top: 3px; }
.fact-label { font-size: 16px; color: var(--text-3); line-height: 1.6; }
.fact-value { grid-column: 2; font-size: 17px; font-weight: 500; line-height: 1.4; font-variant-numeric: tabular-nums; }

/* Sections */
.section { padding-block: var(--section); }
.section-head { display: grid; gap: 16px; margin-bottom: 32px; }
.calc-grid > .section-head { margin-bottom: 0; }

/* Calc */
.calc-grid { display: grid; gap: 32px; }
.calc-form { display: grid; gap: 28px; }
.field { border: 0; margin: 0; padding: 0; min-width: 0; }
.field legend, .field-title { display: block; padding: 0; margin-bottom: 12px; font-size: 17px; font-weight: 500; }
.options { display: flex; flex-wrap: wrap; gap: 8px; }
.option { position: relative; }
.option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.option span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface);
  font-size: 16px; cursor: pointer; user-select: none;
  transition: background-color 160ms var(--ease), color 160ms var(--ease), border-color 160ms var(--ease);
}
.option:hover span { background: var(--raised); }
.option input:checked + span { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.option input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 3px; }

.sizes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-wrap { display: grid; gap: 8px; }
.input-wrap label { font-size: 16px; color: var(--text-2); }
.input {
  width: 100%; height: 48px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px;
  font-family: var(--mono); font-size: 17px; font-variant-numeric: tabular-nums;
  transition: border-color 160ms var(--ease);
}
.input:hover { border-color: rgba(30, 27, 23, 0.32); }
.input:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; border-radius: 8px; }
.input::placeholder { color: var(--text-3); opacity: 1; }

.check { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; cursor: pointer; padding-top: 10px; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex-shrink: 0; cursor: pointer; }

.preview {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; display: grid; gap: 16px; align-self: start;
}
.preview-label { font-size: 16px; color: var(--text-3); }
.chat { background: var(--raised); border-radius: 8px; padding: 16px; display: grid; gap: 12px; }
.chat-head { display: flex; align-items: center; gap: 12px; }
.chat-ava {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface); color: var(--text-2); border: 1px solid var(--line);
}
.chat-name { font-weight: 500; line-height: 1.3; }
.chat-phone { font-family: var(--mono); font-size: 14px; color: var(--text-3); }
.bubble {
  justify-self: end; max-width: 92%;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px 8px 4px 8px; padding: 12px 14px;
  font-size: 16px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}
.preview .btn { width: 100%; }
.note { font-size: 16px; color: var(--text-3); line-height: 1.5; }

/* Process */
.dark { background: var(--dark); color: var(--on-dark); }
.dark .lead { color: var(--on-dark-2); }
.steps { display: grid; gap: 0; counter-reset: step; }
.step { border-top: 1px solid var(--dark-line); padding: 24px 0 28px; display: grid; gap: 8px; align-content: start; }
.step-num { font-family: var(--mono); font-size: 14px; color: var(--on-dark-3); font-variant-numeric: tabular-nums; }
.step h3 { font-family: var(--sans); font-size: 20px; font-weight: 500; line-height: 1.3; margin-top: 4px; }
.step p { color: var(--on-dark-2); }
.step a { color: var(--on-dark); text-underline-offset: 3px; white-space: nowrap; }

/* FAQ */
.faq-grid { display: grid; gap: 24px; }
.faq-list { border-top: 1px solid var(--line); }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 64px; padding: 16px 0; cursor: pointer; list-style: none;
  font-size: 18px; font-weight: 500; line-height: 1.4;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .icon { color: var(--text-3); transition: transform 180ms var(--ease); }
.faq-item[open] summary .icon { transform: rotate(180deg); }
.faq-item summary:hover { color: var(--text-2); }
.faq-item p { padding: 0 40px 24px 0; color: var(--text-2); max-width: 40em; }

/* Contacts */
.contacts-grid { display: grid; gap: 32px; }
.c-list { display: grid; border-top: 1px solid var(--line); }
.c-row {
  display: grid; grid-template-columns: 40px 1fr; column-gap: 16px; align-items: start;
  padding: 16px 0; border-bottom: 1px solid var(--line);
}
.c-ico {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px;
  background: var(--raised); color: var(--text-2);
}
.c-body { min-width: 0; padding-top: 0; }
.c-label { font-size: 16px; color: var(--text-3); line-height: 1.5; }
.c-value { font-size: 17px; font-weight: 500; line-height: 1.5; text-decoration: none; overflow-wrap: anywhere; }
a.c-value { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; transition: text-decoration-color 160ms var(--ease); }
a.c-value:hover { text-decoration-color: var(--text); }
.c-sub { color: var(--text-2); font-size: 16px; }
.c-value.mono, .mono { font-variant-numeric: tabular-nums; }

.hours { display: grid; margin-top: 8px; font-variant-numeric: tabular-nums; }
.hours li { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; color: var(--text-2); font-size: 16px; }
.hours li.is-today { color: var(--text); font-weight: 500; }
.hours li.is-today .day::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--text); margin-left: 8px; vertical-align: middle; }
.hours .closed { color: var(--text-3); }
.c-status { margin-top: 8px; }

.map-wrap { display: grid; gap: 16px; align-content: start; }
.map {
  width: 100%; aspect-ratio: 4 / 3; border: 1px solid var(--line); border-radius: 12px;
  background: var(--raised);
}
.map-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.map-note { font-size: 16px; color: var(--text-2); }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 40px 0 32px; }
.footer-grid { display: grid; gap: 24px; }
.footer .brand-name { font-size: 26px; }
.footer-sub { color: var(--text-2); margin-top: 4px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.footer-links a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--text-2); text-decoration: none; }
.footer-links a:hover { color: var(--text); }
.footer-links .icon { color: var(--text-3); }
.footer-note { font-size: 16px; color: var(--text-3); max-width: 46em; }

/* Mobile sticky bar */
.sticky {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
  transition: transform 300ms var(--ease), opacity 300ms var(--ease);
}
.sticky.is-away { transform: translateY(100%); opacity: 0; pointer-events: none; }
.sticky .btn { width: 100%; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Motion */
html.js .hero-text { animation: rise 480ms var(--ease) both; }
html.js .hero-media { animation: fade 600ms var(--ease) 80ms both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

html.reveal-on .reveal { opacity: 0; transform: translateY(10px); transition: opacity 420ms var(--ease), transform 420ms var(--ease); transition-delay: var(--d, 0ms); }
html.reveal-on .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html.js .hero-text, html.js .hero-media { animation: none; }
  html.reveal-on .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .faq-item summary .icon { transition: none; }
  .btn:active { transform: none; }
}

@media (max-width: 479px) {
  .sheet figcaption span + span { display: none; }
}

/* ≥ 480 */
@media (min-width: 480px) {
  .hero-actions { grid-template-columns: auto auto; justify-content: start; }
}

/* ≥ 720 */
@media (min-width: 720px) {
  :root { --pad: 32px; --section: 88px; }
  .sheet { padding: 20px 20px 0; }
  .facts-list { grid-template-columns: repeat(4, 1fr); }
  .fact, .fact:nth-child(2n), .fact:nth-child(n+3) { padding: 28px 20px 28px 24px; border-left: 1px solid var(--line); border-top: 0; }
  .fact:first-child { padding-left: 0; border-left: 0; }
  .steps { grid-template-columns: 1fr 1fr; column-gap: 32px; }
  .contacts-grid { grid-template-columns: 1fr 1fr; gap: 48px; }
  .footer-grid { grid-template-columns: 1fr auto; align-items: start; }
  .footer-note { grid-column: 1 / -1; }
}

/* ≥ 960: desktop composition */
@media (min-width: 960px) {
  :root { --header-h: 72px; --section: 112px; }
  body { padding-bottom: 0; }
  .sticky { display: none; }
  .header-tools { display: flex; }
  .hero {
    grid-template-columns: 0.9fr 1.1fr;
    align-items: center;
    gap: 64px;
    padding-block: 48px 72px;
    min-height: calc(100svh - var(--header-h) - 120px);
  }
  .hero .lead { font-size: 19px; }
  .hero-media { position: relative; inset: auto; }
  .sheet { padding: 28px 28px 0; }
  .sheet figcaption { padding: 16px 0 18px; }
  .section-head { margin-bottom: 48px; }
  .calc-grid { grid-template-columns: 7fr 5fr; gap: 40px 64px; align-items: start; }
  .calc-head { grid-column: 1; }
  .calc-form { grid-column: 1; }
  .preview { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: calc(var(--header-h) + 24px); padding: 24px; }
  .steps { grid-template-columns: repeat(4, 1fr); column-gap: 32px; }
  .step { padding-top: 28px; }
  .faq-grid { grid-template-columns: 5fr 7fr; gap: 64px; }
  .contacts-grid { grid-template-columns: 5fr 7fr; gap: 64px; }
  .map { aspect-ratio: 1 / 1; }
  .map-wrap { position: sticky; top: calc(var(--header-h) + 24px); }
}

@media (min-width: 1180px) {
  .nav { display: flex; }
  .menu-btn { display: none; }
  .menu { display: none !important; }
}
