/* ==========================================================================
   Tadbirpardaz Expo — design system (public pages + admin share it)
   Layout concept: «چهار کاشی، دو قاب» — the logo's four tiles mark progress,
   its two red corner brackets mark focus (like a QR viewfinder).
   ========================================================================== */
/* Fonts are local (no CDN): BYekan = Yekan Bakh. Fallbacks are system fonts. */
@font-face { font-family: "BYekan"; font-weight: 300; font-display: swap; src: url("../fonts/woff2/YekanBakhFaNum-Light.woff2") format("woff2"), url("../fonts/woff/YekanBakhFaNum-Light.woff") format("woff"); }
@font-face { font-family: "BYekan"; font-weight: 400; font-display: swap; src: url("../fonts/woff2/YekanBakhFaNum-Regular.woff2") format("woff2"), url("../fonts/woff/YekanBakhFaNum-Regular.woff") format("woff"); }
@font-face { font-family: "BYekan"; font-weight: 600; font-display: swap; src: url("../fonts/woff2/YekanBakhFaNum-SemiBold.woff2") format("woff2"), url("../fonts/woff/YekanBakhFaNum-SemiBold.woff") format("woff"); }
@font-face { font-family: "BYekan"; font-weight: 700; font-display: swap; src: url("../fonts/woff2/YekanBakhFaNum-Bold.woff2") format("woff2"), url("../fonts/woff/YekanBakhFaNum-Bold.woff") format("woff"); }
@font-face { font-family: "BYekan"; font-weight: 800; font-display: swap; src: url("../fonts/woff2/YekanBakhFaNum-ExtraBold.woff2") format("woff2"), url("../fonts/woff/YekanBakhFaNum-ExtraBold.woff") format("woff"); }
@font-face { font-family: "BYekan"; font-weight: 900; font-display: swap; src: url("../fonts/woff2/YekanBakhFaNum-Black.woff2") format("woff2"), url("../fonts/woff/YekanBakhFaNum-Black.woff") format("woff"); }
:root {
  /* brand (measured from the logo file — never change) */
  --brand-red: #C62C2F;
  --brand-slate: #3F4B55;

  /* light palette (slate-biased neutrals) */
  --bg: #F2F4F6;
  --bg-2: #E8EBEF;
  --surface: #FFFFFF;
  --surface-2: #F7F8FA;
  --ink: #141A20;
  --ink-2: #36414B;
  --muted: #5F6B77;
  --line: #DADFE4;
  --line-strong: #BFC6CE;
  --accent: #C62C2F;
  --accent-hover: #AE2427;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(198, 44, 47, .09);
  --slate-soft: rgba(63, 75, 85, .08);
  --ok: #17885A;
  --ok-soft: rgba(23, 136, 90, .1);
  --warn: #A86A12;
  --warn-soft: rgba(168, 106, 18, .12);
  --info: #2B6A96;
  --info-soft: rgba(43, 106, 150, .1);
  --logo-tile: #3F4B55;
  --logo-red: #C62C2F;
  --logo-edge: transparent;
  --shadow-1: 0 1px 2px rgba(20, 26, 32, .06);
  --shadow-2: 0 1px 2px rgba(20, 26, 32, .05), 0 12px 32px -14px rgba(20, 26, 32, .22);
  --shadow-3: 0 2px 6px rgba(20, 26, 32, .06), 0 28px 60px -24px rgba(20, 26, 32, .35);
  --glass: rgba(255, 255, 255, .72);
  --grid-dot: rgba(63, 75, 85, .10);

  /* type */
  --font: "BYekan", Tahoma, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --fs-xs: .75rem; --fs-sm: .875rem; --fs-md: 1rem; --fs-lg: 1.125rem;
  --fs-xl: 1.375rem; --fs-2xl: 1.75rem; --fs-3xl: clamp(1.9rem, 1.2rem + 3vw, 3rem);
  --fs-hero: clamp(2.1rem, 1.1rem + 4.6vw, 4.25rem);

  /* shape & motion */
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 28px; --r-pill: 999px;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.45, .5, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --t-fast: 160ms; --t-med: 280ms; --t-slow: 520ms;
  --tap: 48px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B0E11; --bg-2: #10151A; --surface: #13191E; --surface-2: #182027;
    --ink: #EDF1F4; --ink-2: #C7CFD6; --muted: #8D99A4; --line: #232C34; --line-strong: #34404A;
    --accent: #E2484B; --accent-hover: #EE5C5F; --accent-ink: #FFFFFF; --accent-soft: rgba(226, 72, 75, .14);
    --slate-soft: rgba(140, 158, 173, .1);
    --ok: #3CC48A; --ok-soft: rgba(60, 196, 138, .13); --warn: #E3A447; --warn-soft: rgba(227, 164, 71, .14);
    --info: #6AAEDD; --info-soft: rgba(106, 174, 221, .13);
    --logo-edge: rgba(255, 255, 255, .10);
    --shadow-1: 0 1px 0 rgba(255, 255, 255, .03);
    --shadow-2: 0 1px 0 rgba(255, 255, 255, .04), 0 14px 36px -16px rgba(0, 0, 0, .7);
    --shadow-3: 0 1px 0 rgba(255, 255, 255, .05), 0 30px 70px -26px rgba(0, 0, 0, .85);
    --glass: rgba(19, 25, 30, .72);
    --grid-dot: rgba(160, 175, 190, .07);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B0E11; --bg-2: #10151A; --surface: #13191E; --surface-2: #182027;
  --ink: #EDF1F4; --ink-2: #C7CFD6; --muted: #8D99A4; --line: #232C34; --line-strong: #34404A;
  --accent: #E2484B; --accent-hover: #EE5C5F; --accent-ink: #FFFFFF; --accent-soft: rgba(226, 72, 75, .14);
  --slate-soft: rgba(140, 158, 173, .1);
  --ok: #3CC48A; --ok-soft: rgba(60, 196, 138, .13); --warn: #E3A447; --warn-soft: rgba(227, 164, 71, .14);
  --info: #6AAEDD; --info-soft: rgba(106, 174, 221, .13);
  --logo-edge: rgba(255, 255, 255, .10);
  --shadow-1: 0 1px 0 rgba(255, 255, 255, .03);
  --shadow-2: 0 1px 0 rgba(255, 255, 255, .04), 0 14px 36px -16px rgba(0, 0, 0, .7);
  --shadow-3: 0 1px 0 rgba(255, 255, 255, .05), 0 30px 70px -26px rgba(0, 0, 0, .85);
  --glass: rgba(19, 25, 30, .72);
  --grid-dot: rgba(160, 175, 190, .07);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: var(--fs-md); line-height: 1.75;
  font-feature-settings: "ss01"; -webkit-font-smoothing: antialiased;
  min-height: 100dvh; overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; text-wrap: balance; font-weight: 800; letter-spacing: -.01em; }
p { margin: 0; text-wrap: pretty; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.mono { font-family: var(--mono); letter-spacing: 0; }
.visually-hidden { position: absolute; clip-path: inset(50%); overflow: hidden; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; white-space: nowrap; }
.muted { color: var(--muted); }
.wrap {
  width: 100%; max-width: 1180px; margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.wrap.narrow { max-width: 720px; }

/* dotted «graph paper» ground, faint */
.ground {
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1.2px);
  background-size: 22px 22px;
}

/* ---------- top bar ---------- */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 60; background: var(--bg); }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  border-bottom: 1px solid color-mix(in oklab, var(--line) 70%, transparent);
}
.topbar .wrap { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 1.05rem; }
.brand .logo { width: 34px; height: 34px; }
.brand small { display: block; font-weight: 500; font-size: .72rem; color: var(--muted); line-height: 1.2; }
.topbar .spacer { flex: 1; }
.topbar nav { display: flex; gap: 4px; }
.topbar nav a { text-decoration: none; padding: 8px 12px; border-radius: var(--r-pill); color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; }
.topbar nav a:hover { background: var(--slate-soft); }
.topbar nav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: var(--shadow-1); }
@media (max-width: 640px) { .topbar nav { display: none; } }

/* ---------- logo ---------- */
.logo { display: inline-block; width: 64px; aspect-ratio: 1; max-width: 100%; }
.logo svg { width: 100%; height: 100%; display: block; overflow: visible; }
.logo .lg-t { fill: var(--logo-tile); stroke: var(--logo-edge); stroke-width: 3; transform-box: fill-box; transform-origin: center; }
.logo .lg-b { fill: none; stroke: var(--logo-red); stroke-width: 50; stroke-linecap: butt; stroke-linejoin: miter; }
.logo .lg-sheen { fill: url(#lgSheen); opacity: 0; pointer-events: none; }
.logo.is-hoverable:hover .lg-t1 { transform: translate(-10px, -10px); }
.logo.is-hoverable:hover .lg-t2 { transform: translate(10px, -10px); }
.logo.is-hoverable:hover .lg-t3 { transform: translate(-10px, 10px); }
.logo.is-hoverable:hover .lg-t4 { transform: translate(10px, 10px); }
.logo.is-hoverable .lg-t { transition: transform var(--t-slow) var(--ease-spring); }

/* ---------- buttons ---------- */
.btn {
  --h: var(--tap);
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--h); padding: 0 22px; border-radius: var(--r-pill);
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  font-weight: 700; font-size: var(--fs-md); white-space: nowrap;
  transition: transform var(--t-fast) var(--ease-out), background-color var(--t-med), border-color var(--t-med), color var(--t-med), box-shadow var(--t-med);
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 24px -12px color-mix(in oklab, var(--accent) 80%, transparent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--slate-soft); }
.btn-soft { background: var(--slate-soft); color: var(--ink); }
.btn-soft:hover { background: color-mix(in oklab, var(--slate-soft) 100%, var(--ink) 6%); }
.btn-sm { --h: 38px; padding: 0 14px; font-size: var(--fs-sm); }
.btn-lg { --h: 56px; padding: 0 28px; font-size: var(--fs-lg); }
.btn-block { width: 100%; }
.btn-icon { width: var(--h); padding: 0; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* liquid hover swell (inspired by «Swell») — a dome rises from where the pointer entered */
.btn-swell::before {
  content: ""; position: absolute; z-index: -1; left: var(--mx, 50%); top: var(--my, 120%);
  width: 0; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%);
  background: color-mix(in oklab, var(--ink) 92%, var(--accent));
  transition: width 520ms var(--ease-out);
}
.btn-swell:hover::before { width: 260%; }
.btn-swell.btn-primary::before { background: color-mix(in oklab, var(--accent) 70%, #000); }
.btn-swell:hover { color: var(--accent-ink); }
.btn-ghost.btn-swell:hover { color: var(--bg); border-color: transparent; }

/* glyph wave label — letters ride the hover (inspired by «Glyph») */
.glyphs { display: inline-flex; }
.glyphs > span { display: inline-block; transition: transform 380ms var(--ease-spring); transition-delay: calc(var(--i) * 22ms); white-space: pre; }
.btn:hover .glyphs > span { transform: translateY(-2px); }

/* morphing submit — the button stretches into its own progress line, then floods into the done state */
.btn-morph { min-width: 220px; }
.btn-morph .bm-label, .btn-morph .bm-done { display: inline-flex; align-items: center; gap: 10px; transition: transform var(--t-med) var(--ease-out), opacity var(--t-med); }
.btn-morph .bm-done { position: absolute; inset: 0; justify-content: center; opacity: 0; transform: translateY(120%); }
.btn-morph .bm-bar { position: absolute; inset-inline: 0; bottom: 0; height: 3px; transform-origin: right; transform: scaleX(0); background: currentColor; opacity: .9; }
.btn-morph .bm-flood { position: absolute; inset: 0; z-index: -1; background: var(--ok); transform: scaleY(0); transform-origin: bottom; transition: transform 420ms var(--ease-io); }
.btn-morph.is-loading { pointer-events: none; }
.btn-morph.is-loading .bm-label { opacity: .0; transform: translateY(-120%); }
.btn-morph.is-loading .bm-bar { animation: bmBar 1.4s var(--ease-io) forwards; }
.btn-morph.is-loading::after {
  content: "در حال ارسال امن…"; position: absolute; inset: 0; display: grid; place-items: center; font-size: var(--fs-sm); font-weight: 600; opacity: .9;
}
.btn-morph.is-done { pointer-events: none; color: #fff; }
.btn-morph.is-done::after { content: none; }
.btn-morph.is-done .bm-label { opacity: 0; transform: translateY(-120%); }
.btn-morph.is-done .bm-flood { transform: scaleY(1); }
.btn-morph.is-done .bm-done { opacity: 1; transform: none; }
.btn-morph.is-done .bm-bar { opacity: 0; }
.btn-morph .check path { stroke-dasharray: 30; stroke-dashoffset: 30; }
.btn-morph.is-done .check path { animation: draw 420ms 200ms var(--ease-out) forwards; }
@keyframes bmBar { 0% { transform: scaleX(0); } 60% { transform: scaleX(.72); } 100% { transform: scaleX(1); } }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* paper-plane send (challenge) — the plane leaves through the label and its wake fills the pill */
.btn-plane .bp-plane { position: absolute; inset-inline-end: 22px; top: 50%; width: 22px; height: 22px; margin-top: -11px; transition: none; }
.btn-plane { padding-inline-end: 56px; }
.btn-plane .bp-wake { position: absolute; inset: 0; z-index: -1; background: var(--ok); transform: scaleX(0); transform-origin: right; }
.btn-plane.is-flying { pointer-events: none; }
.btn-plane.is-flying .bp-plane { animation: planeFly 1100ms var(--ease-io) forwards; }
.btn-plane.is-flying .bp-wake { animation: wake 1100ms var(--ease-io) forwards; }
.btn-plane.is-flying .bm-label { animation: fadeUp 300ms forwards; }
.btn-plane.is-done .bp-wake { transform: scaleX(1); }
.btn-plane.is-done .bm-done { opacity: 1; transform: none; }
.btn-plane.is-done { color: #fff; }
@keyframes planeFly {
  0% { transform: translate(0, 0) rotate(0); }
  18% { transform: translate(14px, 3px) rotate(10deg); }
  100% { transform: translate(-460px, -26px) rotate(-14deg); opacity: 0; }
}
@keyframes wake { 0%, 15% { transform: scaleX(0); } 100% { transform: scaleX(1); } }
@keyframes fadeUp { to { opacity: 0; transform: translateY(-100%); } }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.card-pad { padding: clamp(18px, 3vw, 28px); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .04em; color: var(--muted); }
.eyebrow::before { content: ""; width: 14px; height: 14px; border-top: 3px solid var(--accent); border-right: 3px solid var(--accent); border-top-right-radius: 5px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700; background: var(--slate-soft); color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.red { background: var(--accent-soft); color: var(--accent); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- form fields ---------- */
.field { display: grid; gap: 6px; position: relative; }
.field > label, .field .label { font-weight: 700; font-size: var(--fs-sm); color: var(--ink-2); display: flex; align-items: baseline; gap: 6px; }
.field .req { color: var(--accent); font-weight: 800; }
.field .opt { color: var(--muted); font-weight: 500; font-size: var(--fs-xs); }
.field .hint { font-size: var(--fs-xs); color: var(--muted); line-height: 1.6; }
.field .err { display: none; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--accent); font-weight: 600; }
.field .err svg { width: 14px; height: 14px; flex: none; }
.field.invalid .err { display: flex; }

.control {
  position: relative; display: flex; align-items: center;
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--r-md);
  transition: border-color var(--t-fast), box-shadow var(--t-med), background-color var(--t-med);
}
.control:hover { border-color: color-mix(in oklab, var(--line-strong) 60%, var(--ink) 25%); }
.control input, .control textarea {
  flex: 1; min-width: 0; width: 100%; border: 0; outline: 0; background: transparent;
  font-size: 1rem; min-height: 52px; padding: 12px 16px; border-radius: inherit;
}
.control textarea { min-height: 96px; resize: vertical; line-height: 1.8; }
.control .chev { position: absolute; inset-inline-start: 14px; pointer-events: none; width: 16px; height: 16px; color: var(--muted); }
.control input::placeholder, .control textarea::placeholder { color: color-mix(in oklab, var(--muted) 75%, transparent); }
.control .adorn { padding-inline: 14px 0; color: var(--muted); display: grid; place-items: center; }
.control .adorn svg { width: 20px; height: 20px; }
.control:focus-within { border-color: var(--ink); box-shadow: 0 0 0 4px var(--slate-soft); }
.control input:focus-visible, .control textarea:focus-visible { outline: none; }
/* focus = the logo's two red brackets close in on the field (top-right & bottom-left) */
.control::before, .control::after {
  content: ""; position: absolute; width: 18px; height: 18px; pointer-events: none;
  border: 0 solid var(--accent); opacity: 0;
  transition: transform 340ms var(--ease-spring), opacity 200ms;
}
.control::before { top: -6px; right: -6px; border-top-width: 3px; border-right-width: 3px; border-top-right-radius: 9px; transform: translate(6px, -6px); }
.control::after { bottom: -6px; left: -6px; border-bottom-width: 3px; border-left-width: 3px; border-bottom-left-radius: 9px; transform: translate(-6px, 6px); }
.control:focus-within::before, .control:focus-within::after { opacity: 1; transform: none; }
.field.invalid .control { border-color: var(--accent); background: var(--accent-soft); }
.field.valid .control { border-color: color-mix(in oklab, var(--ok) 55%, var(--line-strong)); }

/* the «seal» — a check that strikes itself when a field becomes valid (inspired by «Sigil») */
.seal { position: absolute; inset-inline-start: 12px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #fff; transform: scale(0) rotate(-40deg); transition: transform 420ms var(--ease-spring); pointer-events: none; }
.seal svg { width: 15px; height: 15px; }
.seal path { stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset 300ms 160ms var(--ease-out); }
.field.valid .seal { transform: scale(1) rotate(0); }
.field.valid .seal path { stroke-dashoffset: 0; }
.control.has-seal input { padding-inline-start: 46px; }
.control input.ltr { text-align: left; direction: ltr; }
.control input.ltr::placeholder { text-align: left; }

/* chips (multi) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: var(--r-pill);
  border: 1.5px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: var(--fs-sm);
  transition: background-color var(--t-med), color var(--t-med), border-color var(--t-med), transform var(--t-fast) var(--ease-out);
  user-select: none;
}
.chip span::before {
  content: ""; width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--line-strong); flex: none;
  background: var(--surface) center / 12px no-repeat;
  transition: background-color var(--t-med), border-color var(--t-med), transform 360ms var(--ease-spring);
}
.chip input[type="radio"] + span::before { border-radius: 50%; }
.chip input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.chip input:checked + span::before {
  border-color: var(--accent); background-color: var(--accent); transform: rotate(-8deg) scale(1.08);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
.chip input:active + span { transform: scale(.96); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* segmented control with a liquid indicator: leading edge leaves first, trailing edge catches up */
.seg {
  --l: 0px; --w: 0px;
  position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0;
  padding: 4px; border-radius: var(--r-pill); background: var(--bg-2); border: 1px solid var(--line);
  isolation: isolate;
}
.seg .seg-ind {
  position: absolute; z-index: -1; top: 4px; bottom: 4px; left: var(--il, 4px); right: var(--ir, 100%);
  border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--shadow-2);
  transition: left var(--dl, 300ms) var(--ease-out), right var(--dr, 300ms) var(--ease-out);
}
.seg.is-empty .seg-ind { opacity: 0; }
.seg label { position: relative; display: grid; place-items: center; min-height: 44px; padding: 6px 10px; cursor: pointer; text-align: center; font-weight: 600; font-size: var(--fs-sm); color: var(--muted); border-radius: var(--r-pill); transition: color var(--t-med); line-height: 1.35; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { color: var(--ink); font-weight: 800; }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 480px) { .seg.wrap-sm { grid-auto-flow: row; grid-template-columns: 1fr 1fr; border-radius: var(--r-lg); } .seg.wrap-sm .seg-ind { border-radius: var(--r-md); } }

/* checkbox (consent) */
.check-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; padding: 14px; border-radius: var(--r-md); border: 1.5px solid var(--line); background: var(--surface-2); transition: border-color var(--t-med), background-color var(--t-med); }
.check-row:has(input:checked) { border-color: color-mix(in oklab, var(--ok) 60%, var(--line)); background: var(--ok-soft); }
.check-row input { appearance: none; flex: none; width: 24px; height: 24px; margin: 2px 0 0; border-radius: 7px; border: 2px solid var(--line-strong); background: var(--surface) center / 16px no-repeat; cursor: pointer; transition: all var(--t-med) var(--ease-spring); }
.check-row input:checked { background-color: var(--ok); border-color: var(--ok); transform: rotate(-6deg); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
.check-row input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check-row .t { font-size: var(--fs-sm); line-height: 1.8; color: var(--ink-2); }
.field.invalid .check-row { border-color: var(--accent); background: var(--accent-soft); }

/* honeypot: present for bots, invisible and unreachable for people */
.hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none; }

/* ---------- theme toggle (circle of the new theme opens out of the button) ---------- */
.theme-btn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink); transition: transform var(--t-fast) var(--ease-out); }
.theme-btn:active { transform: scale(.92); }
.theme-btn svg { width: 20px; height: 20px; transition: transform 460ms var(--ease-spring); }
:root[data-theme="dark"] .theme-btn svg { transform: rotate(180deg); }
.theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .theme-btn .moon { display: none; } :root:not([data-theme]) .theme-btn .sun { display: block; } }
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
:root.vt-theme::view-transition-new(root) { animation: themeReveal 520ms cubic-bezier(.52, .2, .2, 1) both; }
@keyframes themeReveal { from { clip-path: circle(0 at var(--vt-x, 50%) var(--vt-y, 0)); } to { clip-path: circle(var(--vt-r, 150vmax) at var(--vt-x, 50%) var(--vt-y, 0)); } }
/* step transitions (directional) */
:root:active-view-transition-type(forward)::view-transition-old(step) { animation: stepOutFwd 320ms var(--ease-io) both; }
:root:active-view-transition-type(forward)::view-transition-new(step) { animation: stepInFwd 420ms var(--ease-out) both; }
:root:active-view-transition-type(backward)::view-transition-old(step) { animation: stepOutBack 320ms var(--ease-io) both; }
:root:active-view-transition-type(backward)::view-transition-new(step) { animation: stepInBack 420ms var(--ease-out) both; }
@keyframes stepOutFwd { to { transform: translateX(28%); opacity: 0; } }
@keyframes stepInFwd { from { transform: translateX(-28%); opacity: 0; } }
@keyframes stepOutBack { to { transform: translateX(-28%); opacity: 0; } }
@keyframes stepInBack { from { transform: translateX(28%); opacity: 0; } }

/* ---------- toast ---------- */
.toasts { position: fixed; z-index: 90; inset-inline: 0; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: grid; justify-items: center; gap: 8px; pointer-events: none; padding-inline: 16px; }
.toast { pointer-events: auto; display: inline-flex; align-items: center; gap: 10px; max-width: 520px; padding: 12px 16px; border-radius: var(--r-md); background: var(--ink); color: var(--bg); font-size: var(--fs-sm); font-weight: 600; box-shadow: var(--shadow-3); animation: toastIn 420ms var(--ease-spring); }
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.out { animation: toastOut 260ms var(--ease-io) forwards; }
@keyframes toastIn { from { transform: translateY(24px) scale(.96); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(16px); opacity: 0; } }

/* ---------- reveal on scroll (content is visible at rest; motion only adds) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .rv { animation: rvIn 700ms var(--ease-out) both; animation-timeline: view(); animation-range: entry 0% entry 45%; }
  @supports not (animation-timeline: view()) { .rv { animation: none; } }
}
@keyframes rvIn { from { opacity: .001; transform: translateY(26px); } }

/* ---------- loader (twelve beads, the last hops to the front — inspired by «Hop») ---------- */
.hop { --s: 28px; width: var(--s); height: var(--s); position: relative; display: inline-block; }
.hop i { position: absolute; inset: 0; }
.hop i::before { content: ""; position: absolute; left: 50%; top: 0; width: 18%; height: 18%; margin-left: -9%; border-radius: 50%; background: currentColor; opacity: calc(.25 + var(--k) * .065); }
.hop i { transform: rotate(calc(var(--k) * 30deg)); }
.hop { animation: hop 1.2s steps(12) infinite; }
@keyframes hop { to { transform: rotate(360deg); } }

/* ---------- footer ---------- */
.foot { padding-block: 36px 48px; color: var(--muted); font-size: var(--fs-sm); }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; }

/* ---------- motion preferences ---------- */
/* Reduced motion = calmer, not dead: no ambient loops, no slides or spins, but fades and the logo still play.
   The booth display sets <html data-motion="full"> and always runs the full set. */
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="full"]) { scroll-behavior: auto; }
  :root:not([data-motion="full"]) .hero-mark .ring, :root:not([data-motion="full"]) .hero-mark .tag { animation: none; }
  :root:not([data-motion="full"])::view-transition-old(step), :root:not([data-motion="full"])::view-transition-new(step) { animation: vtOut 220ms ease both; }
  :root:not([data-motion="full"])::view-transition-new(step) { animation: vtIn 320ms ease both; }
}
.btn-plane.is-done .bp-plane { opacity: 0; }

/* ---------- boot loader: the logo assembles, then four tiles open like curtains ---------- */
.boot { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; pointer-events: none; }
.boot .q { position: absolute; width: 50.5%; height: 50.5%; background: var(--bg); transition: transform 760ms cubic-bezier(.76, 0, .24, 1); }
.boot .q1 { top: 0; right: 0; } .boot .q2 { top: 0; left: 0; } .boot .q3 { bottom: 0; right: 0; } .boot .q4 { bottom: 0; left: 0; }
.boot .q::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(var(--grid-dot) 1px, transparent 1.2px); background-size: 22px 22px; }
.boot .logo { position: relative; z-index: 1; width: clamp(84px, 12vmin, 140px); transition: transform 620ms cubic-bezier(.76, 0, .24, 1), opacity 420ms; }
.boot.out .q1 { transform: translate(100%, -100%); } .boot.out .q2 { transform: translate(-100%, -100%); }
.boot.out .q3 { transform: translate(100%, 100%); } .boot.out .q4 { transform: translate(-100%, 100%); }
.boot.out .q { transition-delay: 80ms; }
.boot.out .logo { transform: scale(.6); opacity: 0; }
.boot { animation: bootFailSafe 0s 4s forwards; }
@keyframes bootFailSafe { to { visibility: hidden; } }
html.booting body { overflow: hidden; }
/* page entrance after the loader */
html.booting [data-in] { opacity: 0; transform: translateY(18px); }
[data-in] { transition: opacity 700ms var(--ease-out), transform 800ms var(--ease-out); transition-delay: calc(var(--in, 0) * 80ms + 120ms); }
@media (prefers-reduced-motion: reduce) { :root:not([data-motion="full"]).booting [data-in] { transform: none; } }
@keyframes vtOut { to { opacity: 0; } }
@keyframes vtIn { from { opacity: 0; } }

/* ---------- countdown: four unit cards, only the changed digit moves ---------- */
.cdown { --cd-gap: 12px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--cd-gap); direction: ltr; }
.cu { direction: rtl; --u: var(--accent); position: relative; isolation: isolate; overflow: hidden; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 22px 10px 16px;
  border-radius: 22px; border: 1px solid color-mix(in oklab, var(--u) 24%, var(--line));
  background: linear-gradient(165deg, color-mix(in oklab, var(--u) 8%, var(--surface)), var(--surface) 62%);
  box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255, 255, 255, .06);
  transition: transform 350ms var(--ease-out), border-color 350ms, box-shadow 350ms; }
.cu::before { content: ""; position: absolute; top: 0; inset-inline: 14%; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--u), transparent); box-shadow: 0 0 16px var(--u); }
.cu::after { content: ""; position: absolute; z-index: -1; inset: -45% 8% auto; height: 85%;
  background: radial-gradient(closest-side, color-mix(in oklab, var(--u) 15%, transparent), transparent); pointer-events: none; }
.cu .n { display: block; font-size: clamp(2.5rem, 1.7rem + 2.6vw, 4.4rem); font-weight: 900; line-height: 1; color: var(--ink);
  text-shadow: 0 0 26px color-mix(in oklab, var(--u) 28%, transparent); }
.cu .ln { width: 72%; display: flex; align-items: center; gap: 8px; color: var(--u); }
.cu .ln::before, .cu .ln::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: .45; }
.cu .ln svg { width: 18px; height: 18px; flex: none; }
.cu small { font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); line-height: 1.2; }
.cu.u-h { --u: var(--info); } .cu.u-m { --u: var(--ok); } .cu.u-s { --u: var(--warn); }
@media (hover: hover) { .cu:hover { transform: translateY(-4px); border-color: color-mix(in oklab, var(--u) 55%, var(--line)); box-shadow: var(--shadow-2), 0 0 26px color-mix(in oklab, var(--u) 14%, transparent); } }
@media (max-width: 560px) {
  .cdown { grid-template-columns: repeat(2, minmax(0, 1fr)); --cd-gap: 10px; }
  .cu { padding: 18px 8px 14px; border-radius: 18px; gap: 8px; }
  .cu .n { font-size: clamp(2.7rem, 14vw, 3.8rem); }
}
/* digits: fixed slots so the card never moves; the changed digit drops in softly */
.roll { display: inline-flex; justify-content: center; direction: ltr; }
.roll .dg { display: inline-block; width: .6em; text-align: center; }
.roll .dg.tick { animation: dgIn 460ms cubic-bezier(.2, .8, .2, 1); }
@keyframes dgIn { from { transform: translateY(-.2em); opacity: .3; filter: blur(1.5px); } }
@keyframes dgFade { from { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { :root:not([data-motion="full"]) .roll .dg.tick { animation-name: dgFade; } }

/* if the script never runs, the page must not stay hidden behind the loader */
html.booting [data-in] { animation: dataInFailSafe 0s 4.2s forwards; }
@keyframes dataInFailSafe { to { opacity: 1; transform: none; } }

/* browser autofill must not paint its own background over the field */
.control input:-webkit-autofill, .control input:-webkit-autofill:hover, .control input:-webkit-autofill:focus, .control textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--ink); caret-color: var(--ink); transition: background-color 600000s 0s, color 600000s 0s;
}
.control input:autofill { background-clip: text; -webkit-text-fill-color: var(--ink); }

/* Visual tests only: Playwright sets data-motion="off" on <html> to freeze every animation. No page or script sets it. */
:root[data-motion="off"] *, :root[data-motion="off"] *::before, :root[data-motion="off"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
:root[data-motion="off"] .boot { display: none !important; }
