/* ============================================================
   tokens.css — LAYER 0 (DESIGN_SYSTEM.md §2 names, Parchment values)
   Created at UI rollout 0.1 (UI_ROLLOUT_PLAN.md row 0.1; palette D-880;
   "tokens.css is CREATED at 0.1" D-885).

   The site-wide layer order is declared HERE, once. Every shared and
   page stylesheet puts its rules in one of these layers:
     tokens      — this file only (custom properties)
     base        — reset, element defaults (ps.css)
     components  — ps-* shared components (ps.css)
     page        — per-page rules (a page's own <style> / css file)
   Un-layered rules still beat every layer (CSS cascade spec), so legacy
   page CSS keeps working unchanged through the migration window.

   NO DARK SET here: the Copperplate value file is post-Phase-0
   (UI_ROLLOUT_PLAN §Palette note / Phase 3; D-885 ruling 1(a)).
   ============================================================ */
@layer tokens, base, components, page;

@layer tokens {
  :root {
    /* ── §2 colour tokens — the 18 names, Parchment (v9) values ── */
    --surface:#FDF3E4;  --surface-deep:#F5E6CC;  --surface-row:#FBEDD2;
    --ink:#2A1B0E;  --ink-soft:#4A3520;  --ink-mute:#806A4E;  --ink-faint:#A89070;
    --rule:#D9B779;  --rule-soft:#E8D2A8;  --rule-strong:#B68845;
    --accent:#BA7517;  --accent-deep:#854F0B;  --accent-darker:#5C3604;
    --gold:#C8932A;  --gold-light:#E8B84D;
    --shubh:#1F6B3A;  --kaal:#9B3322;  --neutral:#A07A36;

    /* ── §3 typography ── */
    --font-head:'Poppins',system-ui,sans-serif;
    --font-body:'Inter',system-ui,sans-serif;
    --font-deva:'Noto Serif Devanagari',serif;
    --font-guj:'Noto Serif Gujarati','Noto Sans Gujarati',serif;
    --fs-base:15px;
    --lh-base:1.55;

    /* ── layout ── */
    --page-max:1120px;
    --gutter:20px;
  }

  /* ── LEGACY ALIAS BRIDGE ────────────────────────────────────────
     The 62 names of static/css/panchang-base.css :root (:18–:101),
     redeclared so a page moved onto base2.html + ps.css resolves any
     leftover legacy reference against Layer 0. A name whose ROLE exists
     in §2 aliases var(--§2-name); the rest keep their literal value,
     marked LITERAL. Nothing new may consume these names.
     This bridge RETIRES PER MIGRATED PAGE and is DELETED AT ROLLOUT 0.8.
     (--section-gap / --card-padding, the +2 that make the doc's "64",
     are class-scoped on .layout-data/.layout-content, not :root, and are
     consumed with fallbacks — nothing to alias.)
     ─────────────────────────────────────────────────────────────── */
  :root {
    /* brand */
    --bg-page:            var(--surface);
    --bg-card:            var(--surface-row);      /* role (CLI judgment): card / hero field, the mockup hero idiom */
    --bg-card-hover:      var(--surface-deep);     /* role (CLI judgment) */
    --bg-nav:             var(--accent-deep);
    --bg-nav-active:      rgba(255,255,255,0.2);   /* LITERAL — an overlay, no §2 role */

    /* text */
    --text-heading:       var(--ink);
    --text-body:          var(--ink-soft);
    --text-muted:         var(--ink-mute);
    --text-link:          var(--accent-deep);
    --text-link-hover:    var(--accent-darker);    /* role (CLI judgment): mockup a:hover */
    --text-on-dark:       var(--surface);          /* role (CLI judgment): light-on-dark = --surface, §6 item 5 */
    --text-on-dark-muted: var(--rule-soft);        /* role (CLI judgment): mockup brand subtitle / utils on tier 1 */

    /* borders */
    --border-subtle:      var(--rule-soft);
    --border-strong:      var(--rule-strong);
    --border-card:        var(--rule-soft);        /* role (CLI judgment): same legacy value as --border-subtle */

    /* semantic — colours carry auspiciousness meaning only (§2) */
    --color-good:         var(--shubh);
    --color-good-bg:      color-mix(in srgb, var(--shubh) 12%, var(--surface));
    --color-neutral:      var(--neutral);
    --color-neutral-bg:   color-mix(in srgb, var(--neutral) 12%, var(--surface));
    --color-avoid:        var(--kaal);
    --color-avoid-bg:     color-mix(in srgb, var(--kaal) 12%, var(--surface));
    --color-accent:       var(--accent);
    --color-accent-bg:    color-mix(in srgb, var(--accent) 12%, var(--surface));

    /* category hero gradients — LITERAL (die with the card heroes) */
    --hero-ekadashi-start:    #854F0B;  --hero-ekadashi-end:    #C8932A;
    --hero-pradosh-start:     #1D4E7C;  --hero-pradosh-end:     #2A6FA8;
    --hero-navratri-start:    #7A1B2D;  --hero-navratri-end:    #B32E4A;
    --hero-sankashti-start:   #085041;  --hero-sankashti-end:   #0F6E56;
    --hero-purnima-start:     #633806;  --hero-purnima-end:     #EF9F27;
    --hero-amavasya-start:    #26215C;  --hero-amavasya-end:    #534AB7;
    --hero-festival-start:    #8B2500;  --hero-festival-end:    #D85A30;
    --hero-muhurat-start:     #6B1B2E;  --hero-muhurat-end:     #A52842;

    /* fluid type scale — LITERAL (§3 is a fixed 15px/1.55 base) */
    --text-xs:    clamp(0.7rem,  1.5vw, 0.8rem);
    --text-sm:    clamp(0.8rem,  1.8vw, 0.875rem);
    --text-base:  clamp(0.875rem, 2vw, 1rem);
    --text-lg:    clamp(1rem,    2.5vw, 1.125rem);
    --text-xl:    clamp(1.125rem, 3vw, 1.375rem);
    --text-2xl:   clamp(1.375rem, 4vw, 1.75rem);
    --text-3xl:   clamp(1.75rem, 5vw, 2.25rem);
    --text-devanagari: clamp(1rem, 2.5vw, 1.15rem);

    /* spacing — LITERAL */
    --space-xs:  0.25rem;
    --space-sm:  0.5rem;
    --space-md:  1rem;
    --space-lg:  1.5rem;
    --space-xl:  2rem;
    --space-2xl: 3rem;

    /* layout */
    --content-max-width:  var(--page-max);
    --content-padding:    var(--gutter);           /* role (CLI judgment): the frame gutter */
    --card-radius:        8px;                     /* LITERAL */
    --card-radius-lg:     12px;                    /* LITERAL */

    /* fonts */
    --font-heading:       var(--font-head);
    /* --font-body — the legacy name IS the Layer-0 name; declared once above, no alias possible */
    --font-devanagari:    var(--font-deva);

    /* transitions — LITERAL */
    --transition-fast:    150ms ease;
    --transition-normal:  250ms ease;
  }
}
