/* ============================================================
   MixNight, design tokens & themes (single source of truth)
   Used by: index.html (Pour), bar/index.html (The Bar), bar/party/ (Party), and every module.

   14 Oct polish pass (Linear's dark UI as the reference):
   · a theme is five inputs, bg, txt, accent, accent-ink, accent2. Every surface, hairline and text tier is mixed from them,
     so all six themes share the same contrast steps and only the hue changes.
   · one face for the interface: Onest, with tabular figures for clocks, durations and counts. Martian Mono is kept for
     one job only, the darts scoreboard and the bar code / PIN, where the numbers are the show.
   · a fixed type scale (--fs-*) and three weights (400 / 500 / 600; display 600 / 700). No all-caps labels.
   · a 2px corner on controls and tiles, 4px on the big panels (modal, home cards, the player), optically the same softness.
   · elevation = a hairline, a 1px top highlight and a soft shadow, the way Linear builds raised surfaces.

   Type
     --sans     everything that is words, and most numbers (tabular-nums)        Onest 400/500/600
     --display  wordmark, titles, the same face, tighter tracking                Onest 600 (--display-weight) / 700 (--display-heavy)
     --serif    legacy alias of --display, kept for Pour's stylesheet
     --mono     darts scores, keypads, bar code / PIN                               Martian Mono
     --fs-micro … --fs-4xl   the scale: 11 · 12 · 13 · 14 · 15 · 16 · 18 · 22 · 28 · 48 (px at a 16px root; it all grows with the rem)

   Colour  (surfaces go bg → bg2 → card → card2, each a small step of txt mixed into bg)
     --txt / --dim / --dim2        text: 100% · 62% · 42% of the way from bg to txt
     --line / --line2              hairlines: txt at 7% / txt-with-a-little-accent at 14%
     --accent / --accent-ink       the one brand colour and the text that sits on it
     --accent2                     a second colour for highlights, never for buttons
     --gold / --gold2              legacy aliases of --accent / --accent2 (Pour)
     --green / --red               semantic
   ============================================================ */

/* ---------- faces: self-hosted variable woff2 (latin), no CDN, works offline on the LAN and on the Fire Stick ---------- */
@font-face{font-family:"Onest";src:url("fonts/onest-latin.woff2") format("woff2");font-weight:100 900;font-style:normal;font-display:swap}
@font-face{font-family:"Martian Mono";src:url("fonts/martian-mono-latin.woff2") format("woff2");font-weight:100 800;font-stretch:75% 112.5%;font-style:normal;font-display:swap}

:root{
  /* ---------- NOIR (default), the five inputs ---------- */
  --bg:#0a0a0b; --txt:#f4f4f2;
  --accent:#f4f4f2; --accent-ink:#0a0a0b; --accent2:#c8c8c4;

  /* ---------- derived (every theme inherits these; override only with a reason) ---------- */
  --bg2:  color-mix(in oklab,var(--bg),var(--txt) 2.5%);
  --card: color-mix(in oklab,var(--bg),var(--txt) 4.5%);
  --card2:color-mix(in oklab,var(--bg),var(--txt) 8%);
  --dim:  color-mix(in oklab,var(--bg),var(--txt) 62%);
  --dim2: color-mix(in oklab,var(--bg),var(--txt) 42%);
  --line: color-mix(in oklab,var(--txt) 7%,transparent);
  --line2:color-mix(in oklab,color-mix(in oklab,var(--txt),var(--accent) 35%) 14%,transparent);
  --accent-soft:color-mix(in oklab,var(--accent) 14%,transparent);   /* selected rows, the "in queue" wash, accent as a tint, not a slab */
  /* surfaces without outlines (22 Sep, phone first): surface-1 raised (Dock, sheets, modal) · surface-2 tonal (buttons, chips, inputs) · surface-3 pressed / selected */
  --surface-1:color-mix(in oklab,var(--bg),var(--txt) 6%);
  --surface-2:color-mix(in oklab,var(--txt) 8%,transparent);
  --surface-3:color-mix(in oklab,var(--txt) 14%,transparent);
  --hover:color-mix(in oklab,var(--txt) 5%,transparent);           /* the one hover wash for ghost buttons, rows and icons */
  /* buttons (14 Oct): three kinds, one recipe. Secondary = a translucent raised surface; primary = a solid fill (accent for play, txt for confirm);
     both carry a 1px top light and a hairline edge; quiet = no box until hover. */
  --btn2-bg:linear-gradient(180deg,color-mix(in oklab,var(--txt) 10%,transparent),color-mix(in oklab,var(--txt) 6.5%,transparent));
  --btn2-bg-hover:linear-gradient(180deg,color-mix(in oklab,var(--txt) 14%,transparent),color-mix(in oklab,var(--txt) 10%,transparent));
  --btn2-edge:color-mix(in oklab,var(--txt) 11%,transparent);
  --btn2-edge-hover:color-mix(in oklab,var(--txt) 18%,transparent);
  --btn-shadow:inset 0 1px 0 color-mix(in oklab,var(--txt) 9%,transparent),0 1px 2px rgba(0,0,0,.45);
  --btn1-shadow:inset 0 1px 0 rgba(255,255,255,.35),inset 0 -1px 0 rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.45);
  --scrim:rgba(0,0,0,.6);

  /* ---------- elevation: hairline + 1px top light + soft shadow ---------- */
  --hl:inset 0 1px 0 0 color-mix(in oklab,var(--txt) 6%,transparent);
  --shadow-1:0 1px 2px rgba(0,0,0,.35);
  --shadow-2:0 0.5rem 1.5rem -0.5rem rgba(0,0,0,.6);
  --shadow-3:0 1.5rem 4rem -1rem rgba(0,0,0,.75),0 0 0 1px var(--line2);
  --shadow:0 1.5rem 4rem -1rem rgba(0,0,0,.75);   /* legacy name: the soft part of shadow-3, for surfaces that already draw their own border */

  /* ---------- corners (14 Oct): a touch off the square ---------- */
  --rad-1:0.625rem;   /* 10px (25 Oct, the rounded look; was 2px): buttons, chips, inputs, tiles, badges, tabs */
  --rad-2:1.25rem;    /* 20px (25 Oct; was 4px): modal, sheets, home cards, the player frame, the Dock */
  --rad:var(--rad-1); --rad-lg:var(--rad-2);
  /* ---------- spacing (26 Oct): three steps, used for everything. s1 inside a row, s2 the base (margins, a heading to its content, between cards), s3 between sections and grid rows ---------- */
  --s1:0.4375rem; --s2:0.875rem; --s3:1.75rem;
  /* ---------- grids (25 Oct): one spacing for every card grid, site-wide; on the spacing scale from 26 Oct ---------- */
  --grid-row-gap:var(--s3); --grid-col-gap:var(--s2);
  /* section and page titles (25 Oct): one size everywhere, clearly bigger than a card's 15px name; 22px on a phone, 20px beside the player */
  --sec-title:1.25rem; --sec-chev:1.25rem;
  --card-name:0.875rem;   /* every card's name, Tunes and Drinks (14px) */

  /* ---------- type ---------- */
  --sans:"Onest",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  --display:var(--sans);
  --mono:"Martian Mono",ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  --display-weight:600; --display-heavy:700; --display-track:-0.03em; --display-heavy-track:-0.04em;
  --mono-wide:112.5%;   /* font-stretch for the big darts scores */
  --icon-stroke:1.75; --icon-stroke-strong:2.25;   /* Lucide line weight (14 Oct): outline icons, and the active / on state of nav and mode icons */
  --fs-micro:0.6875rem; --fs-xs:0.75rem; --fs-sm:0.8125rem; --fs-md:0.875rem; --fs-base:0.9375rem;
  --fs-lg:1rem; --fs-xl:1.125rem; --fs-2xl:1.375rem; --fs-3xl:1.75rem; --fs-4xl:3rem;

  /* ---------- motion: enters ease out (expo), exits ease in, one spring for "added". Small distances, short times. ---------- */
  --dur-1:90ms;  --dur-2:160ms; --dur-3:240ms; --dur-4:420ms; --dur-5:900ms;
  --hover-scale:1.02; --hover-dur:600ms; --hover-bright:1.06;   /* the one card hover (25 Oct): the whole art grows a hair and brightens a touch */
  --ease-out:cubic-bezier(.16,1,.3,1); --ease-in:cubic-bezier(.4,0,1,1); --ease-spring:cubic-bezier(.34,1.3,.5,1);
  --rise:0.375rem;   /* how far things travel as they arrive */

  --pink:#ff5c8a; --green:#3ecf8e; --red:#ff5d5d;
  --grad:linear-gradient(135deg,#ffffff 0%,#d9d9d5 100%);
  --bg-ambient:none;
  --img-grade:none;
  /* legacy aliases for Pour */
  --gold:var(--accent); --gold2:var(--accent2); --serif:var(--display);
  color-scheme:dark;
}
@media (max-width:600px) and (max-aspect-ratio:1/1){:root{--sec-title:1.375rem;--sec-chev:1.375rem}}

/* ---------- NEON, near-black violet, hot pink + cyan ---------- */
html[data-theme="neon"]{
  --bg:#07060c; --txt:#f6f3ff;
  --accent:#ff3ea5; --accent-ink:#14061a; --accent2:#38e8ff;
  --pink:#ff3ea5;
  --grad:linear-gradient(135deg,#ff3ea5 0%,#38e8ff 100%);
  --bg-ambient:radial-gradient(800px 420px at 20% -10%,rgba(255,62,165,.12),transparent 60%),radial-gradient(800px 420px at 90% 110%,rgba(56,232,255,.08),transparent 60%);
  --img-grade:saturate(1.25) contrast(1.05) hue-rotate(-6deg);
}

/* ---------- GOLD, true black, bright gold, champagne second. Replaced Speakeasy 21 Sep; saved "speakeasy" lands here ---------- */
html[data-theme="gold"], html[data-theme="speakeasy"]{
  --bg:#080706; --txt:#f6f1e6;
  --accent:#e8b94a; --accent-ink:#140e02; --accent2:#f3dfae;
  --grad:linear-gradient(135deg,#f6d77a 0%,#c8922a 100%);
  --bg-ambient:radial-gradient(900px 480px at 50% -12%,rgba(232,185,74,.08),transparent 60%);
  --img-grade:saturate(.9) contrast(1.05);
}

/* ---------- LASER, black, acid lime, violet second. Replaced Pub 21 Sep; saved "pub" / "irish" land here ---------- */
html[data-theme="laser"], html[data-theme="pub"], html[data-theme="irish"]{
  --bg:#060708; --txt:#f4f7ee;
  --accent:#c6ff3d; --accent-ink:#0c1400; --accent2:#a67bff;
  --green:#c6ff3d;
  --grad:linear-gradient(135deg,#c6ff3d 0%,#a67bff 100%);
  --bg-ambient:radial-gradient(800px 420px at 15% -10%,rgba(198,255,61,.08),transparent 60%),radial-gradient(800px 420px at 95% 110%,rgba(166,123,255,.10),transparent 60%);
  --img-grade:saturate(1.15) contrast(1.05);
}

/* ---------- SUNSET, deep plum, hot orange, magenta second ---------- */
html[data-theme="sunset"]{
  --bg:#0b0610; --txt:#fff4ec;
  --accent:#ff7a2f; --accent-ink:#1a0a02; --accent2:#ff3d9a;
  --grad:linear-gradient(135deg,#ffb02f 0%,#ff3d9a 100%);
  --bg-ambient:radial-gradient(900px 460px at 85% -10%,rgba(255,122,47,.13),transparent 60%),radial-gradient(800px 420px at 5% 110%,rgba(255,61,154,.10),transparent 60%);
  --img-grade:saturate(1.2) contrast(1.04) hue-rotate(-4deg);
}

/* ---------- ELECTRIC, blue-black, electric blue, ice cyan second ---------- */
html[data-theme="electric"]{
  --bg:#05070d; --txt:#f1f5ff;
  --accent:#5b8cff; --accent-ink:#030a1f; --accent2:#5ef0ff;
  --grad:linear-gradient(135deg,#5b8cff 0%,#5ef0ff 100%);
  --bg-ambient:radial-gradient(900px 460px at 20% -10%,rgba(77,125,255,.15),transparent 60%),radial-gradient(700px 400px at 95% 110%,rgba(94,240,255,.07),transparent 60%);
  --img-grade:saturate(1.1) contrast(1.05);
}

/* ---------- theme swatches (settings pickers in every app) ---------- */
.sw-noir{--p-bg:#0a0a0b;--p-card:#1c1c1c;--p-acc:#f4f4f2;--p-txt:#9c9c98}
.sw-gold{--p-bg:#080706;--p-card:#1c1913;--p-acc:#e8b94a;--p-txt:#f3dfae}
.sw-neon{--p-bg:#07060c;--p-card:#1a162b;--p-acc:#ff3ea5;--p-txt:#38e8ff}
.sw-laser{--p-bg:#060708;--p-card:#181c1d;--p-acc:#c6ff3d;--p-txt:#a67bff}
.sw-sunset{--p-bg:#0b0610;--p-card:#22172e;--p-acc:#ff7a2f;--p-txt:#ff3d9a}
.sw-electric{--p-bg:#05070d;--p-card:#141b2d;--p-acc:#5b8cff;--p-txt:#5ef0ff}
/* theme switch cross-fades the surfaces */
html.theming, html.theming body, html.theming *{transition:background-color .4s ease,border-color .4s ease,color .4s ease!important}
.themecard .swatch{position:relative;height:56px;border-radius:var(--rad-1);background:var(--p-bg);border:1px solid rgba(255,255,255,.06);overflow:hidden}
.themecard .swatch::before{content:"";position:absolute;left:10px;top:10px;width:46%;height:10px;border-radius:2px;background:var(--p-card)}
.themecard .swatch::after{content:"";position:absolute;left:10px;bottom:10px;width:28px;height:14px;border-radius:2px;background:var(--p-acc);box-shadow:40px 0 0 -3px var(--p-txt)}

/* ---------- motion overrides: TVs get shorter, nothing overlapping; reduced motion keeps a 120ms crossfade so state changes still register ---------- */
html.tv{--dur-2:120ms;--dur-3:180ms;--dur-4:300ms;--icon-stroke:2;--icon-stroke-strong:2.5}   /* icons a touch heavier across the room */
@media (prefers-reduced-motion:reduce){:root{--dur-1:0ms;--dur-2:0ms;--dur-3:120ms;--dur-4:120ms;--dur-5:120ms;--rise:0px}}

/* ---------- reveal (14 Oct, shared/mixnight-reveal.js): listings wait until they scroll into view, then arrive in reading order ---------- */
html.mn-reveal .mn-pre{opacity:0}
html.mn-reveal .mn-pre.mn-shown{animation:mnIn 520ms var(--ease-out) var(--mn-d,0ms) both}
@keyframes mnIn{from{opacity:0;transform:translateY(0.75rem) scale(.985)}to{opacity:1;transform:none}}
html.mn-reveal img.mn-img:not(.mn-go){opacity:0}
html.mn-reveal img.mn-img{transition:opacity 420ms var(--ease-out)}
html.mn-reveal img.mn-img.mn-now{transition:none}

/* ---------- touch screens (14 Oct): nothing changes size or disappears under a scrolling thumb. Cards are always shown (the reveal
   only fades images in on touch, see mixnight-reveal.js), and the press shrink is off: a finger landing to scroll counts as a press ---------- */
@media (hover:none),(pointer:coarse){
  html:not(.tv) .tile:active,html:not(.tv) .card:active,html:not(.tv) .bcard:active,html:not(.tv) .appcard:active{transform:none}
}
@keyframes mnFade{from{opacity:0}to{opacity:1}}

/* image placeholders (14 Oct): a calm, still tone, per-card shimmers each started at their own moment and read as out of step;
   the pictures' own ordered fade-in is the motion now */
html .tile .art,html .cardmedia,html .bmedia{animation:none!important;background:var(--card2)}

/* 18 Oct, TV performance: Laser (the default since 14 Oct) colour-grades every picture with a CSS filter, and on a Fire TV
   stick in Silk every filtered image is extra GPU work on each scroll and repaint (Noir, the old default, had none).
   On a TV the pictures go ungraded. */
html.tv{--img-grade:none!important}
html.tv .tile .art img,html.tv .bmedia img,html.tv .cardmedia img,html.tv .modalhead img{filter:none!important}
