/* Product-page rhythm: big headline, the calculator as the "product", then quiet sections. */
:root {
  --bg: #fbfbfd;
  --bg-alt: #f5f5f7;
  --card: #ffffff;
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --soft: #f0f0f3;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-ink: #ffffff;
  --danger: #e30000;
  --success: #1d9d4f;
  --grad: linear-gradient(90deg, #2f7cf6 0%, #8a5cf6 55%, #d65cb8 100%);
  --shadow: 0 2px 6px rgba(0, 0, 0, .04), 0 12px 40px rgba(0, 0, 0, .06);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, .06), 0 30px 80px rgba(0, 0, 0, .12);
  --radius: 28px;
  --radius-sm: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI Variable Display", "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.25, .1, .25, 1);
  --spring: cubic-bezier(.32, .72, 0, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --bg-alt: #0a0a0c; --card: #1c1c1e; --fg: #f5f5f7; --muted: #a1a1a6; --line: #38383a;
    --soft: #2c2c2e; --accent: #2997ff; --accent-hover: #47a6ff; --danger: #ff453a; --success: #30d158;
    --shadow: 0 0 0 1px rgba(255, 255, 255, .06); --shadow-lg: 0 0 0 1px rgba(255, 255, 255, .08), 0 30px 80px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --bg-alt: #0a0a0c; --card: #1c1c1e; --fg: #f5f5f7; --muted: #a1a1a6; --line: #38383a;
  --soft: #2c2c2e; --accent: #2997ff; --accent-hover: #47a6ff; --danger: #ff453a; --success: #30d158;
  --shadow: 0 0 0 1px rgba(255, 255, 255, .06); --shadow-lg: 0 0 0 1px rgba(255, 255, 255, .08), 0 30px 80px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font);
  font-size: 17px; line-height: 1.47; letter-spacing: -.022em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 700; }
p { margin: 0; }
svg { flex: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 1080px; margin: 0 auto; padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
@media (min-width: 720px) { .wrap { padding-inline: 32px; } }
.narrow { max-width: 820px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
}
.nav-inner { display: flex; align-items: center; gap: 24px; height: 52px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--fg); font-weight: 650; font-size: 18px; letter-spacing: -.03em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 26px; height: 26px; }
.brand-mark rect { fill: var(--fg); }
.brand-mark path { fill: none; stroke: var(--bg); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.nav-links { display: flex; gap: 26px; margin-left: auto; font-size: 13px; }
.nav-links a { color: var(--fg); opacity: .78; transition: opacity .2s; }
.nav-links a:hover { opacity: 1; text-decoration: none; }
@media (max-width: 720px) { .nav-links { display: none; } .icon-btn#theme-toggle { margin-left: auto; } }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; cursor: pointer; color: var(--fg);
  transition: background-color .2s;
}
.icon-btn:hover { background: var(--soft); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#theme-toggle svg { display: none; }
#theme-toggle[data-mode="auto"] .ic-auto, #theme-toggle[data-mode="light"] .ic-light, #theme-toggle[data-mode="dark"] .ic-dark { display: block; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 24px; border: 0; border-radius: 999px;
  font-size: 17px; font-weight: 500; cursor: pointer; text-decoration: none;
  transition: background-color .2s var(--ease), transform .2s var(--ease), opacity .2s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: .45; cursor: default; transform: none; }
.btn-link { color: var(--accent); padding: 0 8px; }
.btn-link:hover { text-decoration: underline; }
.btn-block { width: 100%; min-height: 54px; font-size: 17px; font-weight: 600; border-radius: 16px; }

/* ---------- Hero ---------- */
.hero { text-align: center; padding-top: clamp(64px, 12vw, 128px); padding-bottom: 40px; }
.eyebrow { color: var(--muted); font-size: clamp(17px, 2vw, 21px); font-weight: 600; margin-bottom: 12px; }
h1 { font-size: clamp(44px, 8.4vw, 88px); line-height: 1.04; letter-spacing: -.05em; text-wrap: balance; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { max-width: 640px; margin: 22px auto 0; font-size: clamp(19px, 2.4vw, 25px); line-height: 1.32; color: var(--muted); text-wrap: balance; letter-spacing: -.025em; }
.hero-cta { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px 20px; margin-top: 34px; }

/* ---------- Calculator ---------- */
.calc-section { padding-block: 24px 40px; }
.calc { position: relative; max-width: 560px; margin: 0 auto; padding: 20px; box-shadow: var(--shadow-lg); }
@media (min-width: 600px) { .calc { padding: 28px; } }
.field-box {
  background: var(--soft); border-radius: 20px; padding: 16px 18px 14px;
  border: 1.5px solid transparent; transition: border-color .2s, background-color .4s;
}
.field-box:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.field-box.invalid { border-color: color-mix(in srgb, var(--danger) 55%, transparent); }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: -.01em; }
.field-row { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.amount {
  flex: 1; min-width: 0; display: block; padding: 0; border: 0; background: none; outline: none;
  font-size: clamp(30px, 7vw, 40px); font-weight: 650; letter-spacing: -.035em; line-height: 1.2;
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.amount::placeholder { color: var(--muted); opacity: .5; }
output.amount { color: var(--fg); }
@media (max-width: 420px) {
  .amount { font-size: 28px; }
  .select-pill select { font-size: 14px; padding: 8px 28px 8px 12px; }
  .select-pill::after { right: 12px; }
}
.field-hint { margin-top: 4px; font-size: 13px; color: var(--muted); min-height: 1.3em; }

.select-pill { position: relative; flex: none; }
.select-pill select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding: 9px 34px 9px 14px; border: 0; border-radius: 999px;
  background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  font-size: 15px; font-weight: 600; max-width: 46vw;
}
.select-pill::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; pointer-events: none;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: translateY(-70%) rotate(45deg);
}

.swap {
  position: relative; z-index: 2; display: grid; place-items: center;
  width: 44px; height: 44px; margin: -12px auto; padding: 0; cursor: pointer;
  border-radius: 50%; border: 4px solid var(--card); background: var(--soft); color: var(--fg);
  transition: transform .5s var(--spring), background-color .2s;
}
.swap:hover { background: color-mix(in srgb, var(--soft) 70%, var(--line)); }
.swap.spin { transform: rotate(180deg); }
.swap svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.calc-meta { margin: 18px 4px 0; display: grid; gap: 8px; font-size: 15px; }
.calc-meta div { display: flex; justify-content: space-between; gap: 16px; }
.calc-meta dt { color: var(--muted); }
.calc-meta dd { margin: 0; font-weight: 500; text-align: right; font-variant-numeric: tabular-nums; }
.calc-error { min-height: 22px; margin: 10px 4px 8px; font-size: 14px; color: var(--danger); }
.calc-note { margin-top: 14px; font-size: 12px; line-height: 1.45; color: var(--muted); text-align: center; text-wrap: balance; }

/* ---------- Sections ---------- */
.section { padding-block: clamp(72px, 11vw, 128px) 0; }
.section-title { font-size: clamp(34px, 5.6vw, 56px); line-height: 1.07; letter-spacing: -.045em; margin-bottom: clamp(28px, 4vw, 48px); text-wrap: balance; }

.features { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.feature { padding: 30px 28px 32px; transition: transform .4s var(--spring), box-shadow .4s var(--ease); }
.feature:hover { transform: translateY(-4px) scale(1.01); box-shadow: var(--shadow-lg); }
.feature svg { width: 34px; height: 34px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 22px; }
.feature h3 { font-size: 21px; letter-spacing: -.03em; margin-bottom: 8px; }
.feature p { color: var(--muted); font-size: 16px; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); counter-reset: none; }
.step { padding: 4px 4px 0; }
.step-num {
  display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 18px;
  border-radius: 50%; background: var(--fg); color: var(--bg); font-weight: 650; font-size: 18px;
}
.step h3 { font-size: 21px; letter-spacing: -.03em; margin-bottom: 6px; }
.step p { color: var(--muted); font-size: 16px; }

.faq { padding: 6px 28px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:last-child { border-bottom: 0; }
.faq summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 22px 0; font-size: 19px; font-weight: 600; letter-spacing: -.025em;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: 9px; height: 9px; margin-right: 4px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-3px) rotate(45deg); transition: transform .35s var(--spring);
}
.faq details[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.faq-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .4s var(--spring); }
.faq-body > p { overflow: hidden; color: var(--muted); font-size: 17px; }
.faq details[open] .faq-body { grid-template-rows: 1fr; }
.faq details[open] .faq-body > p { padding-bottom: 22px; }

.contacts { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.contact { display: flex; flex-direction: column; gap: 6px; padding: 26px 28px; color: var(--fg); transition: transform .4s var(--spring), box-shadow .4s var(--ease); }
a.contact:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.contact-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.contact-value { font-size: 19px; font-weight: 600; letter-spacing: -.025em; overflow-wrap: anywhere; }
a.contact .contact-value { color: var(--accent); }

.footer { margin-top: clamp(72px, 11vw, 128px); padding-block: 28px 40px; border-top: 1px solid var(--line); background: var(--bg-alt); }
.footer p { font-size: 12px; color: var(--muted); }

/* ---------- Order sheet ---------- */
.sheet {
  width: min(520px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 0;
  border-radius: var(--radius); background: var(--card); color: var(--fg); box-shadow: var(--shadow-lg);
  overflow: auto; overscroll-behavior: contain;
}
.sheet::backdrop { background: rgba(0, 0, 0, .32); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.sheet[open] { animation: sheet-in .5s var(--spring); }
.sheet[open]::backdrop { animation: fade-in .3s var(--ease); }
.sheet.closing { animation: sheet-out .25s var(--ease) forwards; }
.sheet.closing::backdrop { animation: fade-out .25s var(--ease) forwards; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(24px) scale(.97); } }
@keyframes sheet-out { to { opacity: 0; transform: translateY(16px) scale(.98); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@media (max-width: 600px) {
  .sheet { width: 100%; max-width: 100%; margin: auto 0 0; max-height: 94dvh; border-radius: 24px 24px 0 0; }
  @keyframes sheet-in { from { transform: translateY(100%); } }
  @keyframes sheet-out { to { transform: translateY(100%); } }
}
.sheet-inner { padding: 22px 24px calc(24px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.sheet-head h2 { font-size: 24px; letter-spacing: -.035em; }
.sheet-head .icon-btn { background: var(--soft); width: 32px; height: 32px; }
.sheet-head .icon-btn svg { width: 15px; height: 15px; stroke-width: 2.2; }

.summary { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-radius: 18px; background: var(--soft); }
.summary > div { flex: 1; min-width: 0; }
.summary > div:last-child { text-align: right; }
.summary svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.summary-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.summary strong { display: block; font-size: 18px; letter-spacing: -.025em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.summary-rate { margin: 8px 4px 0; font-size: 13px; color: var(--muted); }

.form-field { margin-top: 18px; }
.form-field > label, .form-field > .label { display: block; margin: 0 0 7px 4px; font-size: 14px; font-weight: 600; }
.optional { color: var(--muted); font-weight: 400; }
.form-field input:not([type="radio"]), .form-field textarea {
  display: block; width: 100%; padding: 13px 16px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--line); background: var(--card); outline: none; font-size: 17px;
  transition: border-color .2s, box-shadow .2s;
}
.form-field textarea { resize: vertical; min-height: 54px; }
.form-field input:focus, .form-field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.form-field [aria-invalid="true"] { border-color: var(--danger) !important; }
.form-field [aria-invalid="true"]:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 16%, transparent) !important; }
.form-error { margin: 6px 4px 0; font-size: 13px; color: var(--danger); }
.form-error:empty { display: none; }
.form-error-general { margin: 14px 4px 0; font-size: 14px; text-align: center; }

.segmented { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; margin-bottom: 10px; border-radius: 12px; background: var(--soft); }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 7px 10px; border-radius: 9px; text-align: center; font-size: 14px; font-weight: 500; transition: background-color .25s var(--ease), box-shadow .25s; }
.segmented input:checked + span { background: var(--card); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); font-weight: 600; }
.segmented input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); }

.check { display: flex; gap: 12px; align-items: flex-start; margin-top: 20px; font-size: 14px; color: var(--muted); cursor: pointer; }
.check input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

#order-form .btn-block { margin-top: 18px; }
.spinner { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.loading .spinner { display: inline-block; }
.loading .btn-text { opacity: .8; }
@keyframes spin { to { transform: rotate(360deg); } }

.success { text-align: center; padding: 12px 0 4px; }
.success-check { width: 72px; height: 72px; margin: 4px auto 18px; display: block; fill: none; stroke: var(--success); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.success-check circle { stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw .6s var(--ease) forwards; }
.success-check path { stroke-dasharray: 36; stroke-dashoffset: 36; animation: draw .35s .45s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.success h3 { font-size: 26px; letter-spacing: -.035em; margin-bottom: 8px; }
.success p { color: var(--muted); margin-bottom: 24px; text-wrap: balance; }

/* ---------- Reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--spring); }
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .js .reveal { opacity: 1; transform: none; }
}
