/* Canopy Neon design tokens (Direction A, see issue #22).
   Layer 1-2: primitives. Layer 3: semantic names. Templates read only layer 3.
   Contrast ratios are WCAG 2.x, computed from the hex values here. */
:root {
  color-scheme: dark;

  /* 1. Primitives: earth & vegetation (from Terrarium design-tokens.css) */
  --deep-cedar:#1B3828; --moss-shadow:#2C3E2E; --sage:#A8B89A; --moss-grey:#8C8F78;
  --grass:#7CB342; --terracotta:#C2703D; --mustard:#D9A441; --honey:#E0A85B;
  --ceramic-cream:#E8E2D5; --linen:#D6CBB8; --charcoal:#3D3C37;
  --canopy:#14291D;            /* derived: darker cedar, not true black */
  --terracotta-ink:#9A4F22;    /* derived: for light (email) backgrounds */

  /* 2. Primitives: neon threads */
  --acid-moss:#B8E04A; --orchid:#F08BDD; --ultraviolet:#B49CFF;
  --white-hot:#fff8ec;         /* centre of the event pin only */

  /* 2b. Night & ember (kept for later; see [data-theme="night"]) */
  --night-deep:#171232; --night-soft:#241d4a; --night-panel:#1d1740; --night-edge:#3a3266;
  --ember-high:#ffc76a; --ember-core:#e8a94e; --ember-deep:#b97a2e;
  --mist:#8d84c0; --star:#cfc8ef; --parchment:#e8dcc0;

  /* 3. Semantics */
  --bg:var(--canopy);
  --surface:var(--deep-cedar);
  --surface-raised:var(--moss-shadow);
  /* Text on canopy / deep-cedar / moss-shadow: */
  --text:var(--ceramic-cream);        /* 11.92 / 9.90 / 8.86 */
  --text-soft:var(--linen);           /*  9.59 / 7.97 / 7.13 */
  --text-muted:var(--sage);           /*  7.32 / 6.08 / 5.44 */
  /* moss-grey is 4.63 on canopy but 3.44 on moss-shadow: borders only, never small text */
  --border:var(--moss-grey);
  --border-quiet:color-mix(in srgb,var(--moss-grey) 45%,var(--surface));
  --action-bg:var(--honey);           /* canopy text on honey 7.27 */
  --action-text:var(--canopy);
  --action-hover:var(--mustard);      /* canopy text on mustard 6.84 */
  --link:var(--honey);                /* 7.27 / 6.04 / 5.41 */
  --focus:var(--acid-moss);           /* 10.11 / 8.40 / 7.52 (needs 3.0) */
  --role-driver:var(--honey);
  --role-rider:var(--ultraviolet);    /* 6.70 / 5.56 / 4.98 */
  --state-confirmed:var(--acid-moss);
  --state-proposed:var(--sage);
  --notice-rule:var(--terracotta);    /* a coloured rule only, never text (4.16 on canopy, 3.09 on moss-shadow) */

  /* Route threads: orchid 6.92 / 5.75 / 5.14, ultraviolet 6.70 / 5.56 / 4.98 on canopy / cedar / moss-shadow */
  --thread-1:var(--acid-moss);
  --thread-2:var(--orchid);
  --thread-3:var(--ultraviolet);
  --thread-4:var(--honey);

  /* Glow recipes: no offsets, no black shadows. Set --glow on the element to recolour. */
  --glow-sm:0 0 0 1px color-mix(in srgb,var(--glow,var(--acid-moss)) 55%,transparent),
            0 0 10px color-mix(in srgb,var(--glow,var(--acid-moss)) 30%,transparent);
  --glow-md:0 0 0 1px color-mix(in srgb,var(--glow,var(--acid-moss)) 60%,transparent),
            0 0 18px 2px color-mix(in srgb,var(--glow,var(--acid-moss)) 28%,transparent);
  --text-glow:0 0 14px color-mix(in srgb,var(--glow,var(--honey)) 45%,transparent); /* display text >= 24px only */
  --iridescent:linear-gradient(90deg,var(--acid-moss),var(--honey) 35%,var(--orchid) 68%,var(--ultraviolet));
  --aurora:radial-gradient(60rem 30rem at 85% -10%,color-mix(in srgb,var(--ultraviolet) 14%,transparent),transparent 70%),
           radial-gradient(50rem 30rem at -10% 110%,color-mix(in srgb,var(--grass) 12%,transparent),transparent 70%);

  --font-system:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  --radius-sm:6px; --radius-md:10px; --radius-lg:16px; --radius-full:999px;
  --space-1:.25rem; --space-2:.5rem; --space-3:1rem; --space-4:1.5rem; --space-5:2.5rem;
  --container:40rem; --ease:cubic-bezier(.4,0,.2,1); --dur:250ms;
}

/* Optional night scope: opt in with <html data-theme="night"> */
[data-theme="night"] {
  --bg:var(--night-deep); --surface:var(--night-panel); --surface-raised:var(--night-soft);
  --text:var(--star); --text-soft:var(--parchment); --text-muted:var(--mist); --border:var(--mist);
  --action-bg:var(--ember-high); --action-text:var(--night-deep); --action-hover:var(--ember-core);
  --link:var(--ember-high);
}

@media (prefers-reduced-motion:reduce) { :root { --dur:0ms } }
@media (forced-colors:active) { :root { --glow-sm:none; --glow-md:none; --text-glow:none } }
