/* =====================================================================
   SEASON LAYER (docs/design-system.md §1.6)

   theme-init.js puts today's season or event on <html data-season="…">,
   season.js dresses the title row from it. This file holds the two looks
   that are CSS: the banner's shadow strokes in the season's hue, and the
   inks of the pixel sprites. Every colour here is derived from the preset's
   own tokens (--attention, --good, --stable, --cat-N, --text, --bg …), so a
   sprite reads as part of whichever theme it lands on and this file never
   names a preset. TOP LEVEL ONLY: nothing here may style anything below the
   title row. LCARS does not load this file.
   ===================================================================== */

/* ---- season hue: what the banner's shadow strokes wear ------------------
   The letters keep the accent; only the shadow (.sh, the box-drawing
   strokes) takes the hue. The cool seasons stay off the accent's own blue
   on purpose: on the blue-title presets an icy-blue shadow would melt into
   the letters it is the shadow of. */
:root { --season-hue: var(--accent); }
:root[data-season="newyear"]   { --season-hue: var(--stable); }
:root[data-season="cny"]       { --season-hue: var(--attention); }
:root[data-season="valentine"] { --season-hue: var(--attention); }
:root[data-season="winter"]    { --season-hue: light-dark(color-mix(in srgb, var(--cat-6) 45%, var(--text-faint)),
                                                          color-mix(in srgb, var(--text) 80%, var(--cat-6))); }
:root[data-season="spring"]    { --season-hue: color-mix(in srgb, var(--cat-9) 60%, var(--cat-5)); }
:root[data-season="easter"]    { --season-hue: var(--good); }
:root[data-season="summer"]    { --season-hue: var(--stable); }
:root[data-season="roses"]     { --season-hue: var(--px-v); }
:root[data-season="vacation"]  { --season-hue: var(--cat-6); }
:root[data-season="autumn"]    { --season-hue: var(--cat-4); }
:root[data-season="halloween"] { --season-hue: var(--cat-2); }
:root[data-season="christmas"] { --season-hue: var(--attention); }

:root[data-season] .ascii-banner .sh,
:root[data-season] pre.banner .sh {
  color: color-mix(in srgb, var(--season-hue) 78%, var(--bg));
}

/* ---- sprite inks: one letter per ink (season.js), each a preset token ---
   A shade is the token mixed toward black, a tint toward white. Snow is
   the exception that must stay pale on every preset: it is white-ish on the
   dark ones and gets a thin outline (.px-edge) on the light ones. */
:root {
  --px-r: var(--attention);
  --px-q: color-mix(in srgb, var(--attention) 62%, #000);
  --px-g: var(--good);
  --px-d: color-mix(in srgb, var(--good) 60%, #000);
  --px-l: color-mix(in srgb, var(--good) 55%, var(--stable));
  --px-y: var(--stable);
  --px-j: var(--cat-8);
  --px-w: light-dark(color-mix(in srgb, #fff 82%, var(--accent)), color-mix(in srgb, var(--text) 90%, var(--accent)));
  --px-ww: light-dark(#fff, color-mix(in srgb, var(--text) 70%, #fff));
  --px-i: color-mix(in srgb, var(--px-w) 55%, var(--accent));
  --px-edge: light-dark(color-mix(in srgb, var(--text) 70%, var(--bg)), transparent);
  --px-e: var(--text-faint);
  --px-b: color-mix(in srgb, var(--cat-4) 68%, #3b2412);
  --px-bb: color-mix(in srgb, var(--cat-4) 42%, #3b2412);
  --px-o: var(--cat-4);
  --px-p: var(--cat-2);
  --px-pp: color-mix(in srgb, var(--cat-2) 58%, #000);
  --px-k: color-mix(in srgb, var(--cat-9) 50%, var(--cat-5));
  --px-kk: color-mix(in srgb, var(--px-k) 45%, #fff);
  --px-u: color-mix(in srgb, var(--cat-1) 50%, var(--cat-10));
  --px-c: var(--cat-6);
  --px-n: color-mix(in srgb, var(--stable) 60%, var(--text-muted));
  --px-x: color-mix(in srgb, var(--text-faint) 25%, #000);
  /* valentine pink: the rose category hue, lifted toward white on dark,
     a little toward the text on light; Z its highlight */
  --px-z: light-dark(color-mix(in srgb, var(--cat-5) 90%, var(--text)), color-mix(in srgb, var(--cat-5) 82%, #fff));
  --px-zz: color-mix(in srgb, var(--px-z) 45%, #fff);
  /* wine: the attention red taken deeper and richer; V its shade */
  --px-v: light-dark(oklch(from var(--attention) calc(l * 0.92) calc(c * 1.25) h),
                     oklch(from var(--attention) calc(l * 0.86) calc(c * 1.7) h));
  --px-vv: color-mix(in srgb, var(--px-v) 62%, #000);
  /* champagne: the gold token pulled toward the text on dark; on light the
     same pale champagne, set in oklch from the gold's own hue (light-only
     look, below 3:1 on purpose, see the coloured letters); H its shade */
  --px-h: light-dark(oklch(from var(--stable) 0.825 0.07 h), color-mix(in srgb, var(--stable) 72%, var(--text)));
  --px-hh: color-mix(in srgb, var(--stable) 70%, #000);
}
.pxs { display: inline-block; line-height: 0; pointer-events: none; }
.pxs svg { display: block; image-rendering: pixelated; overflow: visible; }
.px-r { fill: var(--px-r); } .px-q { fill: var(--px-q); } .px-g { fill: var(--px-g); } .px-d { fill: var(--px-d); }
.px-l { fill: var(--px-l); } .px-y { fill: var(--px-y); } .px-j { fill: var(--px-j); } .px-w { fill: var(--px-w); }
.px-ww { fill: var(--px-ww); } .px-e { fill: var(--px-e); } .px-b { fill: var(--px-b); } .px-bb { fill: var(--px-bb); }
.px-o { fill: var(--px-o); } .px-p { fill: var(--px-p); } .px-pp { fill: var(--px-pp); } .px-k { fill: var(--px-k); }
.px-kk { fill: var(--px-kk); } .px-u { fill: var(--px-u); } .px-c { fill: var(--px-c); } .px-n { fill: var(--px-n); }
.px-i { fill: var(--px-i); } .px-x { fill: var(--px-x); }
.px-z { fill: var(--px-z); } .px-zz { fill: var(--px-zz); } .px-v { fill: var(--px-v); } .px-vv { fill: var(--px-vv); }
.px-h { fill: var(--px-h); } .px-hh { fill: var(--px-hh); }
.px-t { fill: var(--text); } .px-f { fill: var(--text-faint); } .px-a { fill: var(--accent); }
.px-m { fill: var(--text-muted); } .px-s { fill: var(--season-hue); }
.px-edge { fill: none; stroke: var(--px-edge); stroke-width: 1; }

/* ---- dressed title: sprites worn by the banner, in its own cells -------- */
.ascii-banner .word, pre.banner .word { position: relative; }
.ascii-banner, pre.banner { overflow: visible; }
.pxs.worn { position: absolute; z-index: 1; }

/* ---- coloured letters: a few of the banner's own blocks (season.js; for
   every visitor). Ink 1 and ink 2 per
   season, from the sprite inks above, so they are preset tokens too. The
   sea is the blue ink taken deeper, so it parts from the blue letters most
   presets wear. On a light preset every cell ink is pulled a quarter of
   the way to --text (--cell-N-light): some presets' gold and orange sit
   near 2:1 on their page, and the letters need at least 3:1 wherever they
   are coloured. Three looks are exempt and wear their dark-preset glow on
   light too: summer's gold, vacation's sand and roses' champagne (a gold
   pulled toward the text reads as mud, not sun). ---- */
:root { --cell-1: var(--season-hue); --cell-2: var(--cell-1);
        --cell-1-light: color-mix(in srgb, var(--cell-1) 75%, var(--text));
        --cell-2-light: color-mix(in srgb, var(--cell-2) 75%, var(--text)); }
/* sunlit gold: summer and vacation take the gold token's hue at full sun on
   the light presets, for the sprites (y, j: sun, sunflower) and the cells */
:root { --px-sun: oklch(from var(--stable) 0.80 0.165 h); }
:root[data-season="summer"], :root[data-season="vacation"] {
  --px-y: light-dark(var(--px-sun), var(--stable));
  --px-j: light-dark(var(--px-sun), var(--cat-8)); }
:root[data-season="newyear"]   { --cell-1: var(--px-y); }
:root[data-season="cny"]       { --cell-1: var(--px-r); --cell-2: var(--px-y); }
/* valentine: the red pushed richer on the dark presets, with the pink */
:root[data-season="valentine"] { --px-r: light-dark(var(--attention), oklch(from var(--attention) calc(l * 0.92) calc(c * 1.8) h));
                                 --cell-1: var(--px-r); --cell-2: var(--px-z); }
:root[data-season="winter"]    { --cell-1: light-dark(color-mix(in srgb, var(--text-muted) 80%, var(--cat-6)), var(--px-w)); }
:root[data-season="spring"]    { --cell-1: var(--px-k); }
:root[data-season="easter"]    { --cell-1: var(--px-g); --cell-2: var(--px-y); }
:root[data-season="summer"]    { --cell-1: var(--px-y); --cell-1-light: var(--px-y); }
:root[data-season="roses"]     { --cell-1: var(--px-h); --cell-1-light: var(--px-h); }
:root[data-season="vacation"]  { --cell-1: light-dark(oklch(from var(--px-u) calc(l * 0.74) calc(c * 1.5) h),
                                            oklch(from var(--px-u) calc(l * 0.86) calc(c * 1.9) h));
                                 --cell-2: var(--px-y); --cell-2-light: var(--px-y); }
:root[data-season="autumn"]    { --cell-1: var(--px-o); }
:root[data-season="halloween"] { --cell-1: var(--cat-9); --cell-2: var(--px-o); }
:root[data-season="christmas"] { --cell-1: var(--px-r); --cell-2: var(--px-g); }
:root[data-season] .ascii-banner .sc-1, :root[data-season] pre.banner .sc-1 {
  color: light-dark(var(--cell-1-light), var(--cell-1));
}
:root[data-season] .ascii-banner .sc-2, :root[data-season] pre.banner .sc-2 {
  color: light-dark(var(--cell-2-light), var(--cell-2));
}

/* ---- corner ornament: top right of the page, scrolls away with it, under
   the scanline overlay (z 10) ------------------------------------------- */
.pxs.corner { position: absolute; top: 0; right: 0; z-index: 5; }
