/* Watake compro — tokens from the Watake Design System v2 (Stitch "Telemetry Console").
   Source: flutter-app/design-system-v2/stitch (the DESIGN.md files), matching flutter-app/design-system/lib/design/colors.dart.
   Layout: one centred column (max 1040px), mobile first; bands span the width, their inner .wrap carries the gutter.
   Theme: Light mode is the default. Dark mode is activated when :root has [data-theme="dark"]. */
:root,
:root[data-theme="light"] {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-subtle: #f1f5f9;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --track: #e2e8f0;
  --ink: #0f172a;
  --muted: #334155;
  --primary: #0d9488;
  --primary-pressed: #0f766e;
  --primary-text: #0f766e;
  --on-primary: #ffffff;
  --primary-soft: #ccfbf1;
  --accent: #b45309;
  --accent-soft: #fef3c7;
  --sky-text: #0369a1;
  --sky-soft: #e0f2fe;
  --balanced-text: #475569;
  --balanced-border: #cbd5e1;
  --skin: #facb93;
  --scale-ei: #0d9488;
  --scale-sn: #0284c7;
  --scale-tf: #d97706;
  --scale-jp: #7c3aed;
  --scrim: rgba(15, 23, 42, 0.5);
  --shadow-1: 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-2: 0 4px 12px rgba(15, 23, 42, 0.06);

  --font-display: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-text: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-code: ui-monospace, "SFMono-Regular", Menlo, monospace;

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;
  --max: 1040px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b0f17;
  --surface: #131c2e;
  --surface-subtle: #1e293b;
  --line: rgba(255, 255, 255, 0.05);
  --line-strong: rgba(45, 212, 191, 0.2);
  --track: #1e293b;
  --ink: #f8fafc;
  --muted: #94a3b8;
  --primary: #2dd4bf;
  --primary-pressed: #5eead4;
  --primary-text: #2dd4bf;
  --on-primary: #0b0f17;
  --primary-soft: rgba(45, 212, 191, 0.15);
  --accent: #f59e0b;
  --accent-soft: rgba(245, 158, 11, 0.15);
  --sky-text: #38bdf8;
  --sky-soft: rgba(56, 189, 248, 0.15);
  --balanced-text: #94a3b8;
  --balanced-border: rgba(148, 163, 184, 0.4);
  --scale-ei: #2dd4bf;
  --scale-sn: #38bdf8;
  --scale-tf: #f59e0b;
  --scale-jp: #a78bfa;
  --scrim: rgba(0, 0, 0, 0.6);
  --shadow-1: none;
  --shadow-2: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.5;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 10; background: var(--bg);
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-underline-offset: 3px; }
a:hover { color: var(--primary-pressed); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; }
h1 { font-size: clamp(32px, 7vw, 40px); line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 18px; line-height: 24px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; line-height: 20px; }
.caption { font-size: 12px; line-height: 16px; color: var(--muted); }
.mono { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.prose { max-width: 65ch; display: grid; gap: 12px; }
.prose ul, .prose ol { margin: 0; padding-left: 22px; display: grid; gap: 6px; }

/* Bands and gutter */
.wrap {
  max-width: var(--max); margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.band { padding-block: 40px; }
.band + .band { padding-top: 0; }
.stack { display: grid; gap: 16px; }
.stack-lg { display: grid; gap: 28px; }

/* Header */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 10px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand:hover { color: var(--ink); }
.brand img { width: 36px; height: 36px; border-radius: 9px; }
.brand span { font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: -0.01em; }
.nav-inline { display: none; gap: 4px; }
.nav-inline a, .menu-panel a {
  color: var(--ink); text-decoration: none; font-family: var(--font-display); font-weight: 600; font-size: 14px;
  padding: 10px 14px; border-radius: var(--radius-full);
}
.nav-inline a:hover, .menu-panel a:hover { background: var(--primary-soft); color: var(--ink); }
.nav-inline a[aria-current="page"], .menu-panel a[aria-current="page"] { color: var(--primary-text); }

/* Theme toggle button (small round icon button on top) */
.theme-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-full);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.theme-toggle:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-text);
}
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.menu { position: relative; }
.menu summary {
  list-style: none; cursor: pointer; width: 40px; height: 40px; border-radius: var(--radius-full);
  display: grid; place-items: center; color: var(--ink);
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover { background: var(--primary-soft); }
.menu-panel {
  position: absolute; right: 0; top: 48px; min-width: 200px; display: grid; padding: 8px; gap: 2px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  box-shadow: var(--shadow-2);
}
@media (min-width: 760px) {
  .site-header .wrap { gap: 12px; }
  .nav-inline { display: flex; }
  .menu { display: none; }
}

/* Buttons: full pill, 52px on mobile */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 24px; border-radius: var(--radius-full); border: 1px solid transparent;
  background: var(--primary); color: var(--on-primary);
  font: 600 16px/1 var(--font-display); text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--primary-pressed); color: var(--on-primary); }
.btn:active { transform: scale(0.98); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--surface-subtle); border-color: var(--line-strong); color: var(--ink); }
.btn-text { background: transparent; color: var(--primary-text); padding: 0 8px; }
.btn-text:hover { background: var(--primary-soft); color: var(--primary-text); }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 14px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.btn svg { flex-shrink: 0; }

/* Cards: 24px radius, 1px hairline, 20px padding */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 20px; box-shadow: var(--shadow-1);
}
.card-link { display: grid; gap: 6px; text-decoration: none; color: var(--ink); }
.card-link:hover { border-color: var(--line-strong); color: var(--ink); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: var(--radius-full);
  font-family: var(--font-display); font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.02em;
  background: var(--primary-soft); color: var(--primary-text);
}

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; padding-block: 40px 48px; }
.hero-copy { display: grid; gap: 16px; align-content: start; }
.hero-lead { font-size: 17px; line-height: 26px; color: var(--muted); max-width: 52ch; }
@media (min-width: 880px) {
  .hero { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); align-items: center; padding-block: 72px; }
}

/* Example result card */
.result { display: grid; gap: 16px; }
.result-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.result-type { font-family: var(--font-display); font-size: 40px; line-height: 48px; font-weight: 700; letter-spacing: -0.03em; }
.scales { display: grid; gap: 14px; }
.scale { display: grid; grid-template-columns: 18px minmax(0, 1fr) 18px; gap: 10px; align-items: center; }
.scale .pole { font-family: var(--font-display); font-weight: 600; font-size: 14px; text-align: center; color: var(--muted); }
.scale .pole.on { color: var(--ink); font-weight: 700; }
/* Score bar: 8px pill track, white thumb with a spectrum ring (--c, set per row) */
.track { position: relative; height: 8px; border-radius: var(--radius-full); background: var(--track); }
.track .fill { position: absolute; top: 0; bottom: 0; border-radius: var(--radius-full); }
.track .mark {
  position: absolute; top: 50%; width: 18px; height: 18px; border-radius: 50%;
  transform: translate(-50%, -50%); background: #ffffff;
  box-shadow: inset 0 0 0 3px var(--c, var(--ink)), 0 2px 4px rgba(15, 23, 42, 0.1);
}
.scale-meta { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 8px; font-size: 13px; line-height: 18px; }
/* Clarity chips: pill, 28px. Teal = Clear / Very clear, sky = Moderate, dashed = Balanced */
.chip {
  display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: var(--radius-full);
  font-family: var(--font-display); font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.02em;
  background: var(--primary-soft); color: var(--primary-text);
}
.chip.moderate { background: var(--sky-soft); color: var(--sky-text); }
.chip.balanced { background: transparent; border: 1px dashed var(--balanced-border); color: var(--balanced-text); }

/* Lists of tests */
.test-grid { display: grid; gap: 12px; }
.soon { display: flex; flex-wrap: wrap; gap: 8px; }
.soon span { padding: 0 14px; height: 32px; display: inline-flex; align-items: center; border-radius: var(--radius-full); border: 1px solid var(--line); color: var(--muted); font-family: var(--font-display); font-weight: 600; font-size: 14px; }

/* Steps */
.steps { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; align-items: start; }
.steps li::before {
  counter-increment: step; content: counter(step);
  width: 32px; height: 32px; border-radius: var(--radius-full); display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-text); font-weight: 600; font-family: var(--font-display);
}
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; } }

/* Download band */
.download { display: grid; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-1); }
.app-icon { width: 72px; height: 72px; border-radius: 18px; background: var(--skin); }
@media (min-width: 760px) { .download { grid-template-columns: auto minmax(0, 1fr) auto; padding: 28px 32px; } }

/* Page head and sections */
.page-head { display: grid; gap: 12px; padding-block: 32px 8px; }
.crumb { font-family: var(--font-display); font-weight: 600; font-size: 14px; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; }
.split { display: grid; gap: 12px; }
@media (min-width: 760px) { .split { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.scale-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.scale-list li { display: flex; gap: 12px; align-items: center; }
.dot { width: 12px; height: 12px; border-radius: var(--radius-full); flex-shrink: 0; }
.formula { overflow-x: auto; padding: 14px 16px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--line); font-family: var(--font-code); font-size: 15px; line-height: 24px; white-space: nowrap; }
.table-box { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 320px; font-size: 15px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-family: var(--font-display); font-weight: 600; }
td.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* FAQ */
.faq { display: grid; gap: 8px; max-width: 72ch; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }
.faq summary { cursor: pointer; padding: 16px 44px 16px 16px; font-family: var(--font-display); font-weight: 600; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 16px; top: 13px; font-size: 22px; color: var(--muted); }
.faq details[open] summary::after { content: "–"; }
.faq details > div { padding: 0 16px 16px; display: grid; gap: 8px; color: var(--ink); }

/* Legal */
.legal { max-width: 70ch; display: grid; gap: 24px; }
.legal section { display: grid; gap: 8px; }
.legal ul { margin: 0; padding-left: 22px; display: grid; gap: 4px; }
.draft { display: inline-block; padding: 2px 10px; border-radius: var(--radius-full); background: var(--accent-soft); color: var(--accent); font-family: var(--font-display); font-size: 12px; font-weight: 600; }

/* Sticky start bar (test page, phones only) */
.start-bar {
  position: sticky; bottom: 0; z-index: 15; background: var(--surface); border-top: 1px solid var(--line);
  padding-block: 12px calc(12px + env(safe-area-inset-bottom, 0px));
}
.start-bar .wrap { display: flex; align-items: center; gap: 12px; }
.start-bar .btn { flex: 1; }
@media (min-width: 760px) { .start-bar { display: none; } }

/* Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 24px; padding-block: 28px 36px; }
.site-footer .wrap { display: grid; gap: 16px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.footer-links a { color: var(--ink); font-family: var(--font-display); font-weight: 600; font-size: 14px; text-decoration: none; padding: 6px 0; }
.footer-links a:hover { color: var(--primary-text); }
.email-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.email-row code { font-family: var(--font-code); user-select: all; }
.copy { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: var(--radius-full); }

/* Get-the-app dialog */
dialog.get-app {
  width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
  padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--ink);
}
dialog.get-app::backdrop { background: var(--scrim); }
.get-app-body { display: grid; gap: 16px; padding: 24px; justify-items: start; }
.get-app-close {
  position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border: 0; border-radius: var(--radius-full);
  background: transparent; color: var(--ink); cursor: pointer; display: grid; place-items: center;
}
.get-app-close:hover { background: var(--primary-soft); }
.qr { display: none; gap: 8px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); }
.qr-code { width: 112px; height: 112px; background: #ffffff; padding: 6px; border-radius: var(--radius-sm); }
.qr-code img, .qr-code canvas { width: 100px !important; height: 100px !important; }
@media (min-width: 760px) and (hover: hover) { .qr.ready { display: flex; } }

/* Consent banner (only when analytics is configured) */
.consent {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line);
  padding-block: 16px calc(16px + env(safe-area-inset-bottom, 0px));
}
.consent .wrap { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }

@media (prefers-reduced-motion: no-preference) {
  .btn, .card-link, .nav-inline a, .theme-toggle { transition: background-color 150ms ease-out, border-color 150ms ease-out, color 150ms ease-out, transform 150ms ease-out; }
}
