/* Diapason design tokens. Dark default; light via [data-theme="light"] or prefers-color-scheme when no explicit choice.
   Fonts (free, Google Fonts):
   <link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link href="https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap" rel="stylesheet"> */
:root {
  color-scheme: dark;
  /* --- Type --- */
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --fs-2xs: 0.6875rem;  /* 11 */
  --fs-xs: 0.75rem;     /* 12 */
  --fs-sm: 0.8125rem;   /* 13 */
  --fs-md: 0.9375rem;   /* 15 base UI (compact, ~10% under 16-17) */
  --fs-lg: 1.0625rem;   /* 17 */
  --fs-xl: 1.25rem;     /* 20 */
  --fs-2xl: 1.5625rem;  /* 25 */
  --fs-3xl: 1.9375rem;  /* 31 */
  --fs-4xl: clamp(2.25rem, 1.6rem + 2.6vw, 3.5rem);   /* h1 */
  --fs-hero: clamp(2.75rem, 1.7rem + 4.6vw, 5.25rem); /* hero only */
  --lh-tight: 1.1; --lh-snug: 1.3; --lh-body: 1.55;
  --ls-caps: 0.12em; --ls-display: -0.01em;

  /* --- Space (4px base, compact) --- */
  --sp-1: 2px; --sp-2: 4px; --sp-3: 6px; --sp-4: 8px; --sp-5: 12px; --sp-6: 16px;
  --sp-7: 24px; --sp-8: 32px; --sp-9: 48px; --sp-10: 72px; --sp-11: 112px;
  --container: 1180px; --container-narrow: 720px; --gutter: clamp(16px, 4vw, 40px);

  /* --- Radius --- */
  --r-xs: 4px; --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-xl: 28px; --r-pill: 999px;

  /* --- Motion --- */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 120ms; --dur-base: 220ms; --dur-slow: 420ms; --dur-orbit: 90s;

  /* --- Control sizing --- */
  --ctl-h: 36px; --ctl-h-sm: 30px; --ctl-h-lg: 44px; --hit-min: 44px;

  /* --- Z --- */
  --z-nav: 50; --z-drawer: 80; --z-modal: 100; --z-toast: 120;

  /* --- Planets & zodiac elements (graphics, >=3:1 on dark bg; same hues work on light via --body-*-ink) --- */
  --body-sun: #FFC94D;  --body-moon: #D9DEEE; --body-mercury: #B9B3A8; --body-venus: #F2D9A0;
  --body-earth: #5AA9FF; --body-mars: #FF7A5C; --body-jupiter: #E0B07C; --body-saturn: #E8D49A;
  --body-uranus: #7FE3E8; --body-neptune: #6F8BFF; --body-pluto: #C7A2E8;
  --el-fire: #FF8A5C; --el-earth: #8FD18B; --el-air: #7FD4FF; --el-water: #8F9BFF;
  --aspect-support: #62D8CA; --aspect-tension: #FF8FA6; --aspect-neutral: #A99CFF;

  /* --- Dark theme semantic colours --- */
  --bg: #060813; --bg-2: #0A0E1F;
  --surface: #0F1530; --surface-2: #161D3F; --raised: #1D2650;
  --glass: rgba(15, 21, 48, 0.62); --glass-strong: rgba(15, 21, 48, 0.82);
  --scrim: rgba(3, 5, 12, 0.72);
  --text: #EEF1FA; --text-muted: #A9B2CF; --text-faint: #8790B0;
  --border: rgba(169, 178, 207, 0.16);    /* decorative hairline */
  --border-ui: #6470A3;                    /* control boundary, >=3:1 */
  --accent: #E8C36A;      /* gold: primary, premium */
  --accent-hi: #F5D88C;
  --accent-fill: #E8C36A; --on-accent: #171204;
  --accent-ink: #E8C36A;  /* gold as text */
  --violet: #A99CFF; --teal: #62D8CA; --rose: #FF8FA6;
  --danger: #FF8A80; --ok: #6FE0A0;
  --focus: #FFE29A;
  --glow-accent: 0 0 24px rgba(232, 195, 106, 0.28);
  --shadow-1: 0 1px 2px rgba(0,0,0,.5), 0 0 0 1px rgba(169,178,207,.08);
  --shadow-2: 0 8px 24px rgba(0,0,0,.45), 0 0 0 1px rgba(169,178,207,.10);
  --shadow-3: 0 24px 64px rgba(0,0,0,.6), 0 0 0 1px rgba(169,178,207,.12);
  --inner-hi: inset 0 1px 0 rgba(255,255,255,.06);
  --nebula-a: rgba(111, 90, 220, 0.18); --nebula-b: rgba(40, 160, 190, 0.10); --nebula-c: rgba(232, 195, 106, 0.07);
  --star-opacity: 1;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #F7F5EF; --bg-2: #EFECE3;
  --surface: #FFFFFF; --surface-2: #F3F1EA; --raised: #E9E6DB;
  --glass: rgba(255, 255, 255, 0.72); --glass-strong: rgba(255, 255, 255, 0.9);
  --scrim: rgba(18, 22, 43, 0.45);
  --text: #12162B; --text-muted: #444C6B; --text-faint: #5E6685;
  --border: rgba(18, 22, 43, 0.12);
  --border-ui: #7A83A3;
  --accent: #7A5700;               /* gold as text/icons on light */
  --accent-hi: #5E4300;
  --accent-fill: #D9AE45; --on-accent: #171204;
  --accent-ink: #7A5700;
  --violet: #4B3FC4; --teal: #0B6F66; --rose: #B4234A;
  --danger: #B3261E; --ok: #116A3C;
  --focus: #3A2FB0;
  --glow-accent: 0 0 0 transparent;
  --shadow-1: 0 1px 2px rgba(18,22,43,.10), 0 0 0 1px rgba(18,22,43,.06);
  --shadow-2: 0 8px 24px rgba(18,22,43,.12), 0 0 0 1px rgba(18,22,43,.07);
  --shadow-3: 0 24px 64px rgba(18,22,43,.18), 0 0 0 1px rgba(18,22,43,.08);
  --inner-hi: inset 0 1px 0 rgba(255,255,255,.9);
  --nebula-a: rgba(111, 90, 220, 0.10); --nebula-b: rgba(40, 160, 190, 0.08); --nebula-c: rgba(217, 174, 69, 0.14);
  --star-opacity: 0;  /* stars hidden in light; use paper-grain + faint orbit lines instead */
  /* on light surfaces, planet hues are darkened for ink use (graphics >=3:1 on #F7F5EF) */
  --body-sun: #B77A00; --body-moon: #5C6485; --body-mercury: #6F695E; --body-venus: #A9791A;
  --body-earth: #1F6FD1; --body-mars: #C8402A; --body-jupiter: #94602B; --body-saturn: #8A7120;
  --body-uranus: #0E8089; --body-neptune: #3F55D8; --body-pluto: #8548B8;
  --el-fire: #C4491F; --el-earth: #2F7A3A; --el-air: #1B77A8; --el-water: #4A55C9;
  --aspect-support: #0B6F66; --aspect-tension: #B4234A; --aspect-neutral: #4B3FC4;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #F7F5EF; --bg-2: #EFECE3; --surface: #FFFFFF; --surface-2: #F3F1EA; --raised: #E9E6DB;
    --glass: rgba(255,255,255,.72); --glass-strong: rgba(255,255,255,.9); --scrim: rgba(18,22,43,.45);
    --text: #12162B; --text-muted: #444C6B; --text-faint: #5E6685;
    --border: rgba(18,22,43,.12); --border-ui: #7A83A3;
    --accent: #7A5700; --accent-hi: #5E4300; --accent-fill: #D9AE45; --on-accent: #171204; --accent-ink: #7A5700;
    --violet: #4B3FC4; --teal: #0B6F66; --rose: #B4234A; --danger: #B3261E; --ok: #116A3C; --focus: #3A2FB0;
    --glow-accent: 0 0 0 transparent;
    --shadow-1: 0 1px 2px rgba(18,22,43,.10), 0 0 0 1px rgba(18,22,43,.06);
    --shadow-2: 0 8px 24px rgba(18,22,43,.12), 0 0 0 1px rgba(18,22,43,.07);
    --shadow-3: 0 24px 64px rgba(18,22,43,.18), 0 0 0 1px rgba(18,22,43,.08);
    --inner-hi: inset 0 1px 0 rgba(255,255,255,.9);
    --nebula-a: rgba(111,90,220,.10); --nebula-b: rgba(40,160,190,.08); --nebula-c: rgba(217,174,69,.14);
    --star-opacity: 0;
    --body-sun: #B77A00; --body-moon: #5C6485; --body-mercury: #6F695E; --body-venus: #A9791A;
    --body-earth: #1F6FD1; --body-mars: #C8402A; --body-jupiter: #94602B; --body-saturn: #8A7120;
    --body-uranus: #0E8089; --body-neptune: #3F55D8; --body-pluto: #8548B8;
    --el-fire: #C4491F; --el-earth: #2F7A3A; --el-air: #1B77A8; --el-water: #4A55C9;
    --aspect-support: #0B6F66; --aspect-tension: #B4234A; --aspect-neutral: #4B3FC4;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 1ms; --dur-base: 1ms; --dur-slow: 1ms; --dur-orbit: 0s; }
}
