/* Design tokens, base elements and the caption type roles.
   Type follows the measured Apple spec: kicker 14/18 600 light grey, h2 40/44 600 white,
   lead 17/22 600 grey with a white <b> lead-in, note 14/20, src 12/16. Nothing is set below 11px.
   Contrast (WCAG, measured on the real backgrounds): every text under 24px reaches at least 4.5:1. */

/* Inter (variable, latin subset) is only a fallback: Apple devices render SF Pro. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #03030a;
  --ink: #eef1ff;
  --white: #f5f5f7;     /* Apple white: headlines, bold lead-ins (18:1) */
  --kicker: #a1a1a6;    /* kickers, chart titles (7.9:1) */
  --grey: #86868b;      /* Apple grey: body copy (5.6:1 on the page, 5.0:1 on the lightest glass) */
  --grey-2: #8e8e93;    /* small print: sources, axes, footer, captions (6.3:1) */
  --blue: #2997ff;      /* the one accent (6.6:1) */
  --dim: rgba(220,228,255,.6);
  --faint: rgba(220,228,255,.14);
  --grad-loop: linear-gradient(90deg,#7cc0ff,#2997ff,#6e7bff,#2997ff,#7cc0ff);
  --mono: ui-monospace,"SF Mono",Menlo,monospace;
  --display: -apple-system,BlinkMacSystemFont,"SF Pro Display","Inter","Helvetica Neue",sans-serif;
  --body: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter","Helvetica Neue",sans-serif;

  /* Spacing scale: every margin and padding in the caption system comes from here */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;

  /* Page gutters, widened where a notch or rounded corner needs it */
  --gutter: clamp(16px,4vw,48px);
  --safe-t: env(safe-area-inset-top,0px);
  --safe-r: env(safe-area-inset-right,0px);
  --safe-b: env(safe-area-inset-bottom,0px);
  --safe-l: env(safe-area-inset-left,0px);
  --pad-l: max(var(--gutter), var(--safe-l));
  --pad-r: max(var(--gutter), var(--safe-r));
  --card-px: var(--s-6);   /* glass card side padding (the ghost year lines up with it) */
}

/* ---------- Base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0 }
html { background: var(--bg); scrollbar-width: none; -webkit-text-size-adjust: 100%; text-size-adjust: 100% }
html::-webkit-scrollbar { display: none }
body {
  background: var(--bg); color: var(--ink); font-family: var(--body); font-weight: 400; letter-spacing: -.011em;
  overflow-x: hidden; -webkit-font-smoothing: antialiased; font-optical-sizing: auto;
}
body.loading { overflow: hidden }
a { color: inherit; text-decoration: none }
b, strong { font-weight: 600; color: var(--ink) }

/* Visually hidden, still read by screen readers: the one global definition */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* Wrapping: headlines balance their lines, paragraphs avoid orphans */
p { text-wrap: pretty }
h1, h2, .big, .q { text-wrap: balance }

/* Numerals: proportional in reading copy, tabular in data (HUD, charts, labels) */
p, h2, .kicker { font-variant-numeric: proportional-nums }

/* Shared gradient sweep (logo ".AI" and the hero title) */
@keyframes flow { to { background-position: -200% 0 } }

/* ---------- Type roles ---------- */
/* the kicker is an eyebrow, not small print: 14px but semibold, the lighter #a1a1a6 grey, near-neutral tracking,
   and 12px (8px on phones) above its headline */
.kicker {
  font-family: var(--body); font-weight: 600; font-size: 14px; line-height: 18px; letter-spacing: -.01em;
  color: var(--kicker); display: flex; align-items: center; gap: var(--s-2); margin: 0 0 var(--s-3);
}
h2 {
  font-family: var(--display); font-weight: 600; font-size: 40px; line-height: 44px; letter-spacing: 0;
  margin: 0 0 var(--s-4); color: var(--white);
}
/* <em> in a headline is semantic only (the words a reader would stress), never a second style: it renders exactly
   like the rest of the h2. Only the finale (.big) and the hard questions (.q), whose text is grey, turn it white. */
h2 em { font-style: normal; color: inherit }
.q em, .big em { font-style: normal; color: var(--white) }
.lead {
  font-family: var(--body); font-weight: 600; font-size: 17px; line-height: 22px; letter-spacing: -.022em;
  color: var(--grey);
}
.lead b, .note b { font-weight: 600; color: var(--white) }
.note { margin-top: var(--s-3); font-size: 14px; line-height: 20px; letter-spacing: -.016em; font-weight: 400; color: var(--grey) }
.src { margin-top: var(--s-4); font-size: 12px; line-height: 16px; letter-spacing: -.01em; color: var(--grey-2) }
/* keep small print near 60 characters a line, without orphans */
.note, .src { max-width: 30em; text-wrap: pretty }
/* the finale headline (an h2 with this class; .big outranks h2 on every shared property) */
.big {
  font-family: var(--display); font-weight: 600; font-size: clamp(40px,5vw,72px); letter-spacing: -.025em;
  line-height: 1.06; margin: var(--s-3) 0 var(--s-5); color: var(--grey);   /* 12px under its kicker, like every h2 */
}

/* Inter fallback (everything but Safari): Inter runs wider than SF, so it gets its own tracking.
   Values follow Inter's dynamic metrics: tighter as the size grows. */
@supports not (font: -apple-system-body) {
  h2 { letter-spacing: -.015em }
  .big { letter-spacing: -.032em }
  .title { letter-spacing: -.05em }
  .q-wheel { letter-spacing: -.026em }
  .lead, .tagline { letter-spacing: -.012em }
  .note { letter-spacing: -.006em }
  .src { letter-spacing: 0 }
}

/* Phones: 40+ characters a line inside a full-width card */
@media (max-width:734px) {
  :root { --card-px: var(--s-5) }
  .kicker { font-size: 13px; line-height: 16px; margin-bottom: var(--s-2) }
  h2 { font-size: 28px; line-height: 32px; letter-spacing: .007em; margin-bottom: var(--s-3) }
  .lead { font-size: 16px; line-height: 21px; letter-spacing: -.02em }
  .note { font-size: 13px; line-height: 18px }
}
@supports not (font: -apple-system-body) {
  @media (max-width:734px) { h2 { letter-spacing: -.01em } }
}
/* Phone landscape: the card sits beside the sculpture, so everything tightens */
@media (orientation:landscape) and (max-height:500px) {
  :root { --card-px: var(--s-5) }
  .kicker { font-size: 13px; line-height: 16px; margin-bottom: var(--s-2) }
  h2 { font-size: 24px; line-height: 28px; margin-bottom: var(--s-2) }
  .lead { font-size: 15px; line-height: 20px }
  .note { font-size: 13px; line-height: 18px; margin-top: var(--s-2) }
  .src { font-size: 11px; line-height: 14px; margin-top: var(--s-2) }
  .big { font-size: 32px; margin: var(--s-2) 0 var(--s-3) }
}

@media (prefers-reduced-motion:reduce) {
  * { animation: none !important; transition-duration: .01s !important }
}
