/*
  brand desk tokens. outside the family system on purpose; the palette, type pair, density,
  surface strategy and radius come from the desk-brand catalog record, not from a family.

  record palette (canonical, dark is the primary theme):
    bg #16132E, surface #211D42, ink #F3F1FF, muted #A9A4D1, accent #C6F135, accent-ink #14112B
  the light theme is derived from it and keeps the accent. lime cannot carry text on a light
  ground, so light adds one derived token, --accent-text #4A5C00, for links and accent text.
  --accent stays #C6F135 in both themes and is only ever a fill under --accent-ink.

  measured with src/lib/contrast.js (wcag 2.x, rounded down). scripts/lib/tokens.test.mjs
  re-measures every pair below from this file and fails under 4.5:1.

  dark
    ink on bg            16.14:1
    ink on surface       14.28:1
    muted on bg           7.64:1
    muted on surface      6.76:1
    accent-text on bg    13.74:1
    accent-text on surface 12.15:1
    accent-ink on accent 14.00:1

  light
    ink on bg            16.75:1
    ink on surface       15.27:1
    muted on bg           6.75:1
    muted on surface      6.16:1
    accent-text on bg     6.92:1
    accent-text on surface 6.31:1
    accent-ink on accent 14.00:1
*/

:root {
  color-scheme: dark;
  --bg: #16132E;
  --surface: #211D42;
  --ink: #F3F1FF;
  --muted: #A9A4D1;
  --hairline: #3A3566;
  --accent: #C6F135;
  --accent-ink: #14112B;
  --accent-text: #C6F135;

  --radius: 16px;
  --font-display: 'Syne', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Albert Sans', 'Helvetica Neue', 'Segoe UI', system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --tap: 44px;

  /* airy density: one generous step scale, used everywhere */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 40px;
  --space-5: 64px;
  --space-6: 104px;
}

/* system preference, unless the visitor has explicitly chosen dark */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #F7F6FC;
    --surface: #EDEBF7;
    --ink: #16132E;
    --muted: #57527A;
    --hairline: #D6D2EA;
    --accent: #C6F135;
    --accent-ink: #14112B;
    --accent-text: #4A5C00;
  }
}

/* explicit choices win over the system preference */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F7F6FC;
  --surface: #EDEBF7;
  --ink: #16132E;
  --muted: #57527A;
  --hairline: #D6D2EA;
  --accent: #C6F135;
  --accent-ink: #14112B;
  --accent-text: #4A5C00;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #16132E;
  --surface: #211D42;
  --ink: #F3F1FF;
  --muted: #A9A4D1;
  --hairline: #3A3566;
  --accent: #C6F135;
  --accent-ink: #14112B;
  --accent-text: #C6F135;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* one visible focus ring everywhere, never removed */
:focus-visible {
  outline: 3px solid var(--accent-text);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: var(--accent); color: var(--accent-ink); }

/* every interactive target clears 44px on touch, per the house mobile rule */
button, [role="button"], a.tap, summary {
  min-height: var(--tap);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
