/* Cantastorie design tokens — single indigo palette × light/dusk modes.
   Source of truth: Task 453 — warm/seaglass/plum removed.
   Selection: <html data-palette="indigo" data-theme="…">.
   No-JS fallback: :root = indigo light.

   Variable set per block:
     surface, page-glow, card, field, ink, ink-soft, ink-faint,
     mono-ink, mono-faint, ghost, line-10, line-12,
     card-shadow, btn-shadow,
     primary, primary-text, primary-16, primary-ring, primary-outline,
     confirm, confirm-text, confirm-22,
     accent, accent-text, accent-22, on-accent,
     info, info-20, info-text, info-ring,
     rest, rest-text, rest-16

   Legacy aliases (player.css compat — defined once at the bottom):
     --terracotta, --sage, --honey, --sea, --sticker, --moonlight,
     --greeting-sub, --karaoke, --prompt

   Unchanged shared vars: --font-app, --font-story, --app-max,
     --fade, --fade-quick, --settle, --sticker-ring, motion, shape.
*/

/* ─── Shared / layout / motion / shape ───────────────────────────── */
:root {
  --font-app: "Baloo 2", sans-serif;
  --font-story: "Literata", serif;
  --app-max: 540px;

  --fade: 900ms ease;
  --fade-quick: 600ms ease;
  --settle: 250ms ease;

  /* The mascot moon (handoff): orchid-lit sphere, same in both modes. */
  --moon-light:  #F2EDFB;
  --moon-mid:    #D6CBF0;
  --moon-ink:    #3A2F55;
  --moon-crater: rgba(112,92,158,.3);
  --moon-shade:  rgba(74,58,112,.4);
}

/* ═══════════════════════════════════════════════════════════════════
   INDIGO — light  (also the :root no-JS fallback)
   =================================================================== */
:root,
[data-palette="indigo"] {
  --surface:  #F2F4F8;
  --card:     #FFFFFF;
  --field:    #EEF1F6;
  --ink:      #2F3646;
  --ink-soft: #7C8598;
  --ink-faint:#A3ABBC;
  /* Cover captions are 14px text: --ink-soft (3.4:1 on --surface) misses
     AA, so they get a deeper slate — 5.1:1 on --surface (AI-498). */
  --caption-ink: #5F687B;
  /* Keyboard focus ring: orchid deepened to 4.6:1 on --surface, since
     --accent is only 2.6:1 on the light ground (AI-498). */
  --focus-ring: #7A5CC0;
  --mono-ink: #6B7488;
  --mono-faint: rgba(47,54,70,.40);

  --ghost:    rgba(47,54,70,.06);
  --line-10:  rgba(47,54,70,.10);
  --line-12:  rgba(47,54,70,.12);

  --card-shadow: 0 2px 10px rgba(47,54,70,.08);
  --btn-shadow:  0 2px 8px rgba(47,54,70,.12);

  --primary:         #5566A8;
  --primary-text:    #46549C;
  --primary-16:      rgba(85,102,168,.16);
  --primary-ring:    rgba(85,102,168,.45);
  --primary-outline: rgba(85,102,168,.50);

  --confirm:      #5E8A72;
  --confirm-text: #4C7560;
  --confirm-22:   rgba(94,138,114,.22);

  --accent:      #A88BE0;
  --accent-text: #BFA8EB;
  --on-accent: #1C2130; /* ink on an orchid fill (make CTA) */
  --accent-22:   rgba(168,139,224,.22);

  --info:      #6C93B8;
  --info-20:   rgba(108,147,184,.20);
  --info-text: #4A6E93;
  --info-ring: rgba(108,147,184,.40);

  --rest:      #A85E68;
  --rest-text: #96525C;
  --rest-16:   rgba(168,94,104,.16);

  --page-glow: radial-gradient(90% 30% at 50% -8%, rgba(213,222,240,.40), transparent 70%);
}


/* INDIGO — dusk */
[data-palette="indigo"][data-theme="dusk"] {
  --surface:  #1C2130;
  --card:     #2A3044;
  --field:    #232940;
  --ink:      #E8EBF2;
  --ink-soft: #97A0B5;
  --ink-faint:#7C86A0;
  --caption-ink: var(--ink-soft);
  --focus-ring: var(--accent);
  --mono-ink: #AAB3C8;
  --mono-faint: rgba(232,235,242,.40);

  --ghost:    rgba(232,235,242,.08);
  --line-10:  rgba(232,235,242,.12);
  --line-12:  rgba(232,235,242,.16);

  --card-shadow: 0 4px 14px rgba(0,0,0,.35);
  --btn-shadow:  0 2px 8px rgba(0,0,0,.40);

  --primary:         #8B9AD6;
  --primary-text:    #A8B4E4;
  --primary-16:      rgba(139,154,214,.18);
  --primary-ring:    rgba(139,154,214,.50);
  --primary-outline: rgba(139,154,214,.55);

  --confirm:      #7FA98D;
  --confirm-text: #9FC4AC;
  --confirm-22:   rgba(127,169,141,.22);

  --accent:      #A88BE0;
  --accent-text: #BFA8EB;
  --on-accent: #1C2130; /* ink on an orchid fill (make CTA) */
  --accent-22:   rgba(168,139,224,.22);

  --info:      #7FA0C4;
  --info-20:   rgba(127,160,196,.22);
  --info-text: #A9C4DE;
  --info-ring: rgba(127,160,196,.45);

  --rest:      #C08087;
  --rest-text: #D0959C;
  --rest-16:   rgba(192,128,135,.18);

  --page-glow: radial-gradient(90% 30% at 50% -8%, rgba(168,139,224,.12), transparent 70%);
}

/* ═══════════════════════════════════════════════════════════════════
   .night — the player always lives at dusk, per palette.
   Scoped per palette so each uses its own dusk values.
   =================================================================== */

[data-palette="indigo"] .night {
  --card:     #2A3044;
  --ink:      #E8EBF2;
  --ink-soft: #97A0B5;
  --primary:  #8B9AD6;
  --confirm:  #7FA98D;
  --accent:   #A88BE0;
  --accent-text: #BFA8EB;
  --focus-ring: #A88BE0;
  --info:     #7FA0C4;
  --page-glow: radial-gradient(90% 30% at 50% -8%, rgba(168,139,224,.12), transparent 70%);
}

/* ═══════════════════════════════════════════════════════════════════
   Legacy aliases — keep player.css working without any edits.
   Defined once here; cascade picks up the active palette's values.
   =================================================================== */
:root,
[data-palette="indigo"] {
  /* Colour aliases */
  --terracotta:   var(--primary);
  --sage:         var(--confirm);
  --honey:        var(--accent);
  --sea:          var(--info);
  --sticker:      var(--card);
  --moonlight:    var(--accent-text);
  --greeting-sub: var(--ink-soft);

  /* Karaoke highlight: accent at .45 opacity.
     CSS can't do dynamic-alpha on a var(), so we keep a named stop per palette.
     In light mode the warm/indigo/seaglass/plum accent at 45% opacity; in dusk
     also uses the dusk accent value.  The pattern-matched rgba below is
     palette-specific but the alias name stays stable. */
  --karaoke: rgba(168,139,224,.45);  /* orchid default; overridden below */

  /* --prompt used in .night / player overlays */
  --prompt: var(--accent-text);

  /* Shape */
  --sticker-ring: 0 0 0 7px var(--sticker);
}

/* Per-palette karaoke (orchid accent at .45) */
[data-palette="indigo"]   { --karaoke: rgba(168,139,224,.45); }
[data-palette="indigo"][data-theme="dusk"],
[data-palette="indigo"] .night { --karaoke: rgba(168,139,224,.45); }

/* dusk sticker-ring (translucent) — mirrors the original tokens.css behaviour */
[data-theme="dusk"],
.night {
  --sticker-ring: 0 0 0 7px rgba(232,235,242,.14);
}

[data-palette="indigo"][data-theme="dusk"],
[data-palette="indigo"] .night {
  --sticker-ring: 0 0 0 7px rgba(232,235,242,.14);
}
