/* Wayfarer — design tokens.
 *
 * WHY one token file: every screen, component and illustration reads from the same small palette so
 * the app feels like one object, not a pile of widgets. The look is "a modern audiobook app crossed
 * with an RPG": deep night backgrounds, warm off-white text, a single mode accent that switches
 * between EMBER (fantasy) and GOLD (christian). The accent is scoped by `[data-mode]`, usually on
 * <html> (set by the router once a type is chosen) but any element may carry it — the Welcome
 * "Continue" card colours itself after the adventure it points to.
 *
 * Fluid type (clamp) keeps the display sizes dramatic on a phone without overflowing at 320 px.
 * Motion tokens are zeroed under prefers-reduced-motion so every animation in app.css inherits that.
 */

:root {
  color-scheme: dark;

  /* ---- colour: surfaces & text ---- */
  --bg-0: #07090F;
  --bg-1: #0D1220;
  /* Surfaces are tinted glass over the full-colour backdrop (see .vignette in app.css), so each
     screen's colour shows through cards and rows. --surface-solid is for things that cover content
     (sheets, toasts). */
  --surface: rgba(22, 22, 48, 0.52);
  --surface-2: rgba(34, 34, 68, 0.58);
  --surface-3: rgba(48, 48, 88, 0.66);
  --surface-solid: #16162E;
  --glass-blur: blur(18px) saturate(1.35);
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #F3F0E8;
  --text-muted: #9AA3B8;
  --text-faint: #6B7490;
  --on-accent: #0A0C14;
  --danger: #FF7B7B;
  --success: #7FD6A6;

  /* ---- colour: accents. Neutral by default; modes override below. ---- */
  --accent: #9DB2FF;
  --accent-2: #E2C6FF;
  --accent-ink: #0A0C14;
  --accent-soft: rgba(143, 179, 255, 0.14);
  --accent-glow: rgba(143, 179, 255, 0.35);
  --accent-gradient: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);

  /* Fixed per-mode values, for places that show BOTH modes at once (the Type cards, library pills). */
  --ember: #F08A4B;
  --ember-2: #FFC46B;
  --gold: #D9B36A;
  --gold-2: #F2DFAE;

  /* ---- type ---- */
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-card: "Libre Caslon Text", "Iowan Old Style", "Palatino Linotype", Georgia, serif;   /* the achievement cards */

  /* Scale 13/15/17/20/24/32/44/56, fluid between 320 and 480 px. */
  --fs-xs: 13px;
  --fs-sm: 15px;
  --fs-md: 17px;
  --fs-lg: clamp(18px, 4.6vw, 20px);
  --fs-xl: clamp(21px, 5.6vw, 24px);
  --fs-2xl: clamp(27px, 7.4vw, 32px);
  --fs-3xl: clamp(36px, 10vw, 44px);
  --fs-4xl: clamp(42px, 12.5vw, 56px);

  --lh-tight: 1.08;
  --lh-snug: 1.25;
  --lh-body: 1.5;
  --tracking-caps: 0.14em;

  /* ---- spacing (4-pt grid) ---- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 40px;
  --sp-9: 56px;
  --sp-10: 72px;

  --gutter: clamp(20px, 6vw, 28px);
  --column: 480px;

  /* ---- radii ---- */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* ---- elevation ---- */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.4), 0 18px 48px rgba(0, 0, 0, 0.5);
  --shadow-accent: 0 10px 30px -8px var(--accent-glow);

  /* ---- motion ---- */
  --dur-fast: 180ms;
  --dur-base: 240ms;
  --dur-slow: 320ms;
  --dur-ambient: 1;             /* multiplier for decorative loops (1 = on, 0 = off) */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* ---- touch targets ---- */
  --tap: 56px;
  --tap-choice: 72px;

  /* ---- safe areas ---- */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* ---- backdrops: one full-colour scene per mode, painted by .vignette behind every screen ----
 * Colour sits in the top two thirds; every backdrop settles into its --bd-floor colour at the
 * bottom, which sticky footers fade into, so they never show a band. --bd-top tints the phone's
 * status bar (meta theme-color, set in main.js setMode). */
:root {
  --bd-top: #251D5E;
  --bd-shade-top: rgba(10, 11, 29, 0.5);
  --bd-shade-mid: rgba(10, 11, 29, 0.5);
  --bd-shade-low: rgba(10, 11, 29, 0.74);
  --bd-floor: #0A0B1D;
  --bd-orb-1: rgba(255, 112, 166, 0.34);
  --bd-orb-2: rgba(64, 210, 220, 0.20);
  --backdrop:
    radial-gradient(75% 42% at 100% 0%, rgba(255, 118, 158, 0.55) 0%, transparent 72%),
    radial-gradient(85% 48% at 0% 6%, rgba(110, 96, 255, 0.62) 0%, transparent 72%),
    radial-gradient(95% 40% at 55% 46%, rgba(40, 196, 214, 0.20) 0%, transparent 72%),
    linear-gradient(180deg, #2B2068 0%, #1D1A52 28%, #13143A 56%, #0A0B1D 84%);
}

[data-mode="fantasy"] {
  --bd-top: #3A1838;
  --bd-shade-top: rgba(13, 9, 19, 0.5);
  --bd-shade-mid: rgba(13, 9, 19, 0.5);
  --bd-shade-low: rgba(13, 9, 19, 0.74);
  --bd-floor: #0D0913;
  --bd-orb-1: rgba(255, 150, 64, 0.34);
  --bd-orb-2: rgba(196, 64, 220, 0.18);
  --backdrop:
    radial-gradient(75% 42% at 100% 0%, rgba(255, 150, 70, 0.6) 0%, transparent 72%),
    radial-gradient(85% 48% at 0% 6%, rgba(214, 50, 104, 0.52) 0%, transparent 72%),
    radial-gradient(95% 40% at 40% 48%, rgba(140, 58, 206, 0.24) 0%, transparent 72%),
    linear-gradient(180deg, #3E1A3B 0%, #2B1436 28%, #1A0F27 56%, #0D0913 84%);
}

[data-mode="christian"] {
  --bd-top: #2E3F64;
  --bd-shade-top: rgba(10, 16, 32, 0.5);
  --bd-shade-mid: rgba(10, 16, 32, 0.5);
  --bd-shade-low: rgba(10, 16, 32, 0.74);
  --bd-floor: #0A1020;
  --bd-orb-1: rgba(255, 214, 140, 0.32);
  --bd-orb-2: rgba(84, 186, 214, 0.22);
  --backdrop:
    radial-gradient(80% 44% at 50% -6%, rgba(255, 212, 140, 0.62) 0%, transparent 72%),
    radial-gradient(75% 50% at 0% 16%, rgba(80, 182, 212, 0.44) 0%, transparent 72%),
    radial-gradient(80% 42% at 100% 40%, rgba(234, 140, 112, 0.26) 0%, transparent 72%),
    linear-gradient(180deg, #2E4066 0%, #23314F 28%, #172238 56%, #0A1020 84%);
}

[data-mode="dungeon"] {
  --bd-top: #2E1C13;
  --bd-shade-top: rgba(10, 7, 6, 0.5);
  --bd-shade-mid: rgba(10, 7, 6, 0.5);
  --bd-shade-low: rgba(10, 7, 6, 0.74);
  --bd-floor: #0A0706;
  --bd-orb-1: rgba(245, 150, 60, 0.30);
  --bd-orb-2: rgba(190, 52, 36, 0.20);
  --backdrop:
    radial-gradient(70% 40% at 50% 16%, rgba(245, 152, 62, 0.42) 0%, transparent 72%),
    radial-gradient(70% 45% at 100% 0%, rgba(150, 72, 34, 0.5) 0%, transparent 72%),
    radial-gradient(70% 40% at 0% 58%, rgba(176, 44, 32, 0.28) 0%, transparent 72%),
    linear-gradient(180deg, #301D14 0%, #21150F 30%, #150E0A 58%, #0A0706 84%);
}

/* ---- mode accents ---- */
[data-mode="fantasy"] {
  --accent: #F08A4B;
  --accent-2: #FFC46B;
  --accent-soft: rgba(240, 138, 75, 0.16);
  --accent-glow: rgba(240, 138, 75, 0.45);
}

[data-mode="christian"] {
  --accent: #D9B36A;
  --accent-2: #F2DFAE;
  --accent-soft: rgba(217, 179, 106, 0.16);
  --accent-glow: rgba(217, 179, 106, 0.4);
}

/* ---- reduced motion: collapse durations, stop ambient loops ---- */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 1ms;
    --dur-base: 1ms;
    --dur-slow: 1ms;
    --dur-ambient: 0;
  }
}
