/* Onboarding foundations: public-site tokens, reset and shared controls.
   Kept separate so the immersive page does not load the homepage layout. */

:root {
  --paper: #f7f9fb;
  --paper-2: #edf2f6;
  --paper-3: #e1e8ef;
  --ink: #15202d;
  --ink-2: #223144;
  --muted: #5c6878;          /* 5.37:1 on --paper, 5.03:1 on --paper-2 */
  --line: rgba(21, 32, 45, 0.14);
  --line-strong: rgba(21, 32, 45, 0.3);
  --accent: #c9e1f5;         /* the light blue tint, used as a ground */
  --accent-dark: #48769e;    /* 4.56:1 on --paper: links and marks */
  --accent-ink: #386080;     /* text ON --accent: 4.94:1 */
  --on-dark-muted: #9aa7b4;
  --white: #ffffff;
  --invert-bg: #15202d;      /* surfaces that invert against the page */
  --invert-fg: #ffffff;
  --invert-muted: #c8d3de;
  --invert-accent: #a8cbea;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --danger: #9f3f35;
  --ok: #2e7d5b;

  /* The stage: a ground that stays dark in both themes, for the two places
     the page wants a change of light (the comparison and the ending). */
  --stage: #0f1924;
  --stage-2: #172433;
  --stage-3: #1f2e40;
  --stage-ink: #eef3f8;
  --stage-ink-2: #c9d6e2;
  --stage-muted: #a3b4c5;    /* 8.0:1 on --stage */
  --stage-line: rgba(238, 243, 248, 0.14);
  --stage-line-strong: rgba(238, 243, 248, 0.32);
  --stage-accent: #9cc8ec;   /* 9.4:1 on --stage */
  --stage-tint: #1c3650;

  --shadow: rgba(45, 75, 103, 0.14);
  --shadow-1: 0 1px 2px rgba(21, 32, 45, 0.06);
  --shadow-2: 0 1px 2px rgba(21, 32, 45, 0.05), 0 12px 30px -12px rgba(21, 45, 70, 0.18);
  --shadow-3: 0 2px 6px rgba(21, 32, 45, 0.05), 0 40px 80px -32px rgba(21, 45, 70, 0.34);

  --font-sans: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-mono: "DM Mono", ui-monospace, Consolas, monospace;

  --fs-display: clamp(3rem, 7.6vw, 7.6rem);
  --fs-h2: clamp(2.2rem, 4.3vw, 4.25rem);
  --fs-h3: clamp(1.3rem, 1.9vw, 1.65rem);
  --fs-lead: clamp(1.06rem, 1.3vw, 1.2rem);
  --fs-small: 0.875rem;
  --fs-micro: 0.72rem;

  --container: 88rem;
  --gutter: clamp(1rem, 3.4vw, 3.5rem);
  --section-y: clamp(4.5rem, 9vw, 8.5rem);
  --radius-xs: 0.25rem;
  --radius-sm: 0.4rem;
  --radius-md: 0.75rem;
  --radius-lg: 1.25rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
}

/* ── dark ────────────────────────────────────────────────────────────
   Declared twice: under the media query (guarded so an explicit LIGHT
   choice still wins over a dark system) and under the explicit stamp. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0c131b;
    --paper-2: #131d28;
    --paper-3: #1a2633;
    --ink: #e9eff5;
    --ink-2: #c3d0dd;
    --muted: #9aabbc;          /* 7.9:1 on --paper */
    --line: rgba(233, 239, 245, 0.14);
    --line-strong: rgba(233, 239, 245, 0.32);
    --accent: #1b344a;
    --accent-dark: #8fbde4;    /* 7.2:1 on --paper */
    --accent-ink: #dbe9f6;
    --on-dark-muted: #5c6a77;
    --invert-bg: #e9eff5;
    --invert-fg: #0c131b;
    --invert-muted: #3b4956;
    --invert-accent: #2c5a86;
    --surface: #131d28;
    --surface-2: #1a2632;
    --white: #131d28;
    --danger: #f0a49a;
    --ok: #7fd1a8;
    --stage: #070c12;
    --stage-2: #101923;
    --stage-3: #17222e;
    --stage-line: rgba(238, 243, 248, 0.12);
    --stage-tint: #16304a;
    --shadow: rgba(0, 0, 0, 0.55);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 1px 2px rgba(0, 0, 0, 0.4), 0 14px 32px -12px rgba(0, 0, 0, 0.7);
    --shadow-3: 0 2px 6px rgba(0, 0, 0, 0.4), 0 40px 80px -30px rgba(0, 0, 0, 0.85);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0c131b;
  --paper-2: #131d28;
  --paper-3: #1a2633;
  --ink: #e9eff5;
  --ink-2: #c3d0dd;
  --muted: #9aabbc;
  --line: rgba(233, 239, 245, 0.14);
  --line-strong: rgba(233, 239, 245, 0.32);
  --accent: #1b344a;
  --accent-dark: #8fbde4;
  --accent-ink: #dbe9f6;
  --on-dark-muted: #5c6a77;
  --invert-bg: #e9eff5;
  --invert-fg: #0c131b;
  --invert-muted: #3b4956;
  --invert-accent: #2c5a86;
  --surface: #131d28;
  --surface-2: #1a2632;
  --white: #131d28;
  --danger: #f0a49a;
  --ok: #7fd1a8;
  --stage: #070c12;
  --stage-2: #101923;
  --stage-3: #17222e;
  --stage-line: rgba(238, 243, 248, 0.12);
  --stage-tint: #16304a;
  --shadow: rgba(0, 0, 0, 0.55);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, 0.4), 0 14px 32px -12px rgba(0, 0, 0, 0.7);
  --shadow-3: 0 2px 6px rgba(0, 0, 0, 0.4), 0 40px 80px -30px rgba(0, 0, 0, 0.85);
}


/* ══ base ════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
section[id], [id].band { scroll-margin-top: 4.25rem; }

body {
  margin: 0;
  overflow-x: clip;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Any display value beats the user agent's [hidden] { display: none }, so a
   hidden panel kept its height and stayed in the accessibility tree. */
[hidden] { display: none !important; }

::selection { color: var(--ink); background: var(--accent); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }

/* One visible focus treatment everywhere. Two pixels in the link blue,
   which holds 4.5:1 or better on every ground the page uses. */
:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 3px; }
:where(a, button, summary, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent-dark);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  color: var(--invert-fg);
  background: var(--invert-bg);
  border-radius: var(--radius-sm);
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.page-progress { position: fixed; top: 0; right: 0; left: 0; z-index: 60; height: 2px; pointer-events: none; }
.page-progress span { display: block; width: 100%; height: 100%; background: var(--accent-dark); transform: scaleX(0); transform-origin: left; will-change: transform; }


.brand { display: inline-flex; align-items: center; gap: 0.65rem; font-size: 1.12rem; font-weight: 700; letter-spacing: -0.04em; }
.brand-word { display: inline-flex; align-items: baseline; }
.brand-muted { margin-left: 0.35rem; color: var(--muted); font-family: var(--font-mono); font-size: 0.68rem; font-weight: 400; letter-spacing: 0.05em; }
.brand-mark { display: inline-flex; align-items: stretch; gap: 0.17rem; width: 1.2rem; height: 1.3rem; }
.brand-mark i { display: block; flex: 1; background: currentColor; border-radius: 1px; transition: transform 320ms var(--ease); transform-origin: bottom; }
.brand-mark i:first-child { background: var(--accent-dark); }
.brand:hover .brand-mark i:nth-child(2) { transform: scaleY(0.78); }
.brand:hover .brand-mark i:nth-child(3) { transform: scaleY(0.56); }


.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  transition: border-color 180ms var(--ease), background-color 180ms var(--ease), transform 300ms var(--ease);
}
.theme-toggle:hover { border-color: var(--line-strong); background: var(--paper-2); transform: rotate(18deg); }
.theme-toggle svg { width: 1.05rem; height: 1.05rem; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
}
/* With no script there is nothing to run the button, so it is not shown. */
html:not(.js) .theme-toggle { display: none; }

.ticks { display: grid; gap: 0.55rem; margin: 0; padding: 0; list-style: none; }
.ticks li { position: relative; padding-left: 1.45rem; font-size: 0.9rem; line-height: 1.4; text-wrap: pretty; }
.ticks li::before {
  position: absolute;
  top: 0.3em;
  left: 0.1rem;
  width: 0.62rem;
  height: 0.34rem;
  content: "";
  border-bottom: 1.7px solid var(--accent-dark);
  border-left: 1.7px solid var(--accent-dark);
  transform: rotate(-45deg);
}

.source-link {
  display: inline-flex;
  gap: 0.4rem;
  width: fit-content;
  padding-bottom: 0.15rem;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.02em;
  transition: color 180ms ease, border-color 180ms ease;
}
.source-link:hover { color: var(--accent-dark); border-color: currentColor; }


.chip { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; cursor: pointer; }
