/* ============================================================
   STRYD — waitlist flow pages (/waitlist, /waitlist/check-email, /waitlist/confirm, /privacy, /terms)
   Tokens are the STRYD design-system targets from the waitlist handoff (Section 8.2). Several values are
   placeholders from the design system (grays, glass opacities, signal colors): flag, don't silently change.

   TEXT RULE (8.4): every piece of text on these pages uses --ink. No grays for text. Hierarchy comes from
   size and weight. --ink-muted is defined for completeness but must NOT be used on waitlist pages.
   ============================================================ */

:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --ink: #FFFFFF;
  --ink-muted: #A3A3A3;           /* do not use on waitlist pages */
  --gray-100: #1A1A1A;
  --gray-300: #4D4D4D;
  --glass-surface: rgba(255,255,255,0.06);
  --glass-surface-strong: rgba(255,255,255,0.10);
  --glass-border: rgba(255,255,255,0.14);
  --glass-highlight: rgba(255,255,255,0.28);
  --glow-opacity: 0.55;
  --shadow: 0 24px 64px rgba(0,0,0,0.55);
  --logo-filter: none;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #FFFFFF;
  --ink: #000000;
  --ink-muted: #6B6B6B;           /* do not use on waitlist pages */
  --gray-100: #F2F2F2;
  --gray-300: #B3B3B3;
  --glass-surface: rgba(0,0,0,0.04);
  --glass-surface-strong: rgba(0,0,0,0.07);
  --glass-border: rgba(0,0,0,0.12);
  --glass-highlight: rgba(255,255,255,0.9);
  --glow-opacity: 0.28;
  --shadow: 0 24px 64px rgba(0,40,90,0.16);
  /* The logo file is white-on-transparent; this stand-in flips white to black and keeps the blue. */
  --logo-filter: invert(1) hue-rotate(180deg);
}
:root {
  --brand: #006FBF;
  --brand-strong: #00518C;
  --signal-good: #2FB86E;
  --signal-caution: #E8A63C;
  --signal-risk: #E5484D;
  --s-1: 8px; --s-2: 16px; --s-3: 24px; --s-4: 40px;
  --r-sm: 6px; --r-md: 12px; --r-lg: 24px;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.5;
  position: relative; overflow-x: hidden;
}

/* Solid black / white page: no glow, gradient or grain. */

.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--bg); color: var(--ink); padding: 8px 16px; border: 2px solid var(--brand); border-radius: var(--r-sm); z-index: 100; }
.skip-link:focus { left: 8px; }

/* ---------- header (glass pill) ---------- */
.wl-header {
  position: sticky; top: 12px; z-index: 20; width: min(960px, calc(100% - 24px)); margin: 12px auto 0;
  height: 60px; padding: 0 12px 0 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-radius: 999px; border: 1px solid var(--glass-border);
  background: linear-gradient(135deg, var(--glass-surface-strong), var(--glass-surface));
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  box-shadow: inset 0 1px 0 var(--glass-highlight), var(--shadow);
}
.wl-logo { display: inline-flex; align-items: center; min-height: 44px; }
.wl-logo img { height: 36px; width: auto; display: block; filter: var(--logo-filter); }
.wl-header nav { display: flex; align-items: center; gap: 8px; }
.wl-header a.wl-home { color: var(--ink); font-weight: 600; font-size: 14px; text-decoration: none; padding: 10px 14px; border-radius: 999px; min-height: 44px; display: inline-flex; align-items: center; }
.wl-header a.wl-home:hover { background: var(--glass-surface-strong); }

.theme-toggle {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--glass-border); background: var(--glass-surface);
  color: var(--ink); cursor: pointer; display: grid; place-items: center; padding: 0;
}
.theme-toggle:hover { background: var(--glass-surface-strong); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .i-sun { display: none; }
.theme-toggle[data-mode="dark"] .i-sun { display: block; }   /* in dark mode show the sun (action: go light) */
.theme-toggle[data-mode="dark"] .i-moon { display: none; }

/* ---------- layout ---------- */
main { position: relative; z-index: 1; padding: var(--s-4) var(--s-2) 64px; }
.wl-wrap { width: 100%; max-width: 560px; margin: 0 auto; }
.wl-wrap.wide { max-width: 760px; }

.glass-panel {
  position: relative; border-radius: var(--r-lg); padding: var(--s-4) 32px; border: 1px solid var(--glass-border);
  background: linear-gradient(135deg, var(--glass-surface-strong), var(--glass-surface));
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  box-shadow: inset 0 1px 0 var(--glass-highlight), var(--shadow);
}
@media (max-width: 480px) { .glass-panel { padding: var(--s-3) 20px; } main { padding-top: var(--s-3); } }

/* ---------- type: one scale, every page ---------- */
h1, h2, h3 { font-family: var(--font-display); color: var(--ink); margin: 0; line-height: 1.15; letter-spacing: -0.02em; }
h1 { font-size: clamp(32px, 6vw, 44px); font-weight: 700; margin-bottom: var(--s-2); }
h2 { font-size: 22px; font-weight: 700; margin: var(--s-4) 0 var(--s-1); }
h3 { font-size: 18px; font-weight: 700; margin: var(--s-3) 0 var(--s-1); }
p, li { color: var(--ink); margin: 0 0 var(--s-2); }
.lede { font-size: 18px; font-weight: 500; margin-bottom: var(--s-3); }
.mono { font-family: var(--font-mono); font-size: 13px; }
a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
ul, ol { padding-left: 22px; margin: 0 0 var(--s-2); }

/* ---------- Field pattern ---------- */
.field { margin-bottom: var(--s-2); }
.group { margin-bottom: var(--s-3); }
.field > label, .field > .label, legend.label {
  display: block; font-size: 14px; font-weight: 600; color: var(--ink); margin: 0 0 6px; padding: 0;
}
.req { font-weight: 600; }
.help { font-size: 13px; font-weight: 400; color: var(--ink); margin: 6px 0 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

.control {
  width: 100%; height: 48px; padding: 0 var(--s-2); border-radius: var(--r-md);
  border: 1px solid var(--glass-border); background: var(--glass-surface);
  color: var(--ink); font-family: var(--font-body); font-size: 16px;
}
.control::placeholder { color: var(--ink); opacity: 0.8; }
.control:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.control[aria-invalid="true"], .seg-group[aria-invalid="true"] { border-color: var(--signal-risk); }
select.control { appearance: none; -webkit-appearance: none; padding-right: 44px; cursor: pointer; }
select.control option { background: var(--gray-100); color: var(--ink); }
.select-wrap { position: relative; }
.select-wrap::after {
  content: ''; position: absolute; right: 18px; top: 50%; width: 8px; height: 8px; margin-top: -6px;
  border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg); pointer-events: none;
}

/* segment radio cards */
.seg-group { display: grid; gap: 12px; }
.seg { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg-card {
  min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px var(--s-2);
  border-radius: var(--r-md); border: 1px solid var(--glass-border); background: var(--glass-surface);
  font-size: 16px; font-weight: 500; color: var(--ink);
}
.seg-card .check { width: 20px; height: 20px; flex: 0 0 20px; border-radius: 50%; border: 2px solid var(--glass-border); display: grid; place-items: center; }
.seg-card .check svg { width: 12px; height: 12px; opacity: 0; color: var(--ink); }
.seg input:checked + .seg-card { border: 2px solid var(--brand); background: var(--glass-surface-strong); padding: 11px 15px; }
.seg input:checked + .seg-card .check { border-color: var(--brand); background: var(--brand); }
.seg input:checked + .seg-card .check svg { opacity: 1; color: #fff; }
.seg input:focus-visible + .seg-card { outline: 2px solid var(--brand); outline-offset: 2px; }
.seg:hover .seg-card { background: var(--glass-surface-strong); }

/* checkboxes */
.check-row { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; font-size: 14px; color: var(--ink); line-height: 1.45; }
.check-row input { width: 20px; height: 20px; flex: 0 0 20px; margin: 1px 0 0; accent-color: var(--brand); cursor: pointer; }
.check-row label { cursor: pointer; font-weight: 400; margin: 0; }
.check-row.invalid input { outline: 2px solid var(--signal-risk); outline-offset: 2px; }

/* errors: --ink text with a risk icon + border (no contrast problems in light mode) */
.field-error {
  display: flex; gap: 8px; align-items: flex-start; margin: 8px 0 0; padding: 8px 12px; font-size: 14px; color: var(--ink);
  border: 1px solid var(--signal-risk); border-radius: var(--r-sm); background: var(--glass-surface);
}
.field-error[hidden] { display: none; }
.field-error svg { width: 18px; height: 18px; flex: 0 0 18px; color: var(--signal-risk); margin-top: 1px; }
.form-error { margin-bottom: var(--s-2); }

/* honeypot: off-screen, not display:none (some bots skip display:none) */
.hp { position: absolute !important; left: -10000px !important; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* buttons */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 52px; padding: 0 var(--s-3);
  border: 0; border-radius: var(--r-md); background: var(--brand); color: #fff; font-family: var(--font-body);
  font-size: 16px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn-primary:hover { background: var(--brand-strong); }
.btn-primary:disabled, .btn-primary[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-primary[aria-busy="true"]::before {
  content: ''; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.45); border-top-color: #fff;
  animation: wl-spin 0.8s linear infinite;
}
.btn-inline { width: auto; display: inline-flex; }
@keyframes wl-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn-primary[aria-busy="true"]::before { animation-duration: 3s; } }

/* status block on check-email / confirm */
.status-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin-bottom: var(--s-3); border: 2px solid var(--brand); color: var(--ink); }
.status-icon svg { width: 28px; height: 28px; }
.status-icon.ok { border-color: var(--signal-good); }
.status-icon.warn { border-color: var(--signal-caution); }

/* waitlist counter */
.counter { display: inline-flex; align-items: baseline; gap: 8px; margin-bottom: var(--s-2); padding: 6px 14px; border: 1px solid var(--glass-border); border-radius: 999px; background: var(--glass-surface); }
.counter[hidden] { display: none; }
.counter .n { font-family: var(--font-mono); font-size: 18px; font-weight: 700; }

/* legal prose */
.prose h2 { margin-top: var(--s-4); }
.prose .meta { font-size: 14px; font-weight: 600; margin-bottom: var(--s-3); }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 var(--s-2); font-size: 14px; }
.prose th, .prose td { text-align: left; padding: 8px 10px; border: 1px solid var(--glass-border); vertical-align: top; color: var(--ink); }
.prose th { font-weight: 700; background: var(--glass-surface); }
.notice { border: 1px solid var(--signal-caution); border-radius: var(--r-md); padding: 12px var(--s-2); margin-bottom: var(--s-3); font-size: 14px; font-weight: 500; background: var(--glass-surface); }

/* footer */
.wl-footer { position: relative; z-index: 1; padding: var(--s-3) var(--s-2) var(--s-4); text-align: center; font-size: 14px; }
.wl-footer .links { display: flex; gap: 8px 20px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.wl-footer a { display: inline-flex; align-items: center; min-height: 44px; }
.wl-footer .cookie-link { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 44px; }

/* tablet+ : segment cards stay stacked for readability; widen the panel a touch */
@media (min-width: 768px) { .glass-panel { padding: var(--s-4) 40px; } }

/* visually hidden, still read by screen readers */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
