/**
 * HipNumber Brand v1.1 tokens - the one place colour is decided.
 *
 * Every console page used to carry its own identical `:root` block. Twelve
 * copies of the same values is twelve chances for them to drift, and it made a
 * light mode impossible without editing all of them. This is that block,
 * extracted, with the light scheme filled in.
 *
 * THREE STATES, and the order matters:
 *
 *   :root                                    the LIGHT palette, always defined
 *   :root:not([data-theme="light"]) @media   the system preference
 *   :root[data-theme="dark"]                 an explicit choice, which wins
 *
 * Defining light on bare `:root` is what makes the system-preference block
 * safe: a colour whose ONLY definition lives inside a media query is undefined
 * for anybody whose browser reports the other preference.
 *
 * The legacy alias names (--night, --panel, --cream, --sticker …) are kept and
 * mapped onto the semantic set, so existing page CSS keeps working unchanged.
 * They are aliases now, not definitions - do not add colours outside --hn-*.
 */

:root {
  /* ---- brand constants: identical in both schemes ---------------------- */
  --hn-orange: #F97316;
  --hn-orange-deep: #EA580C;
  --hn-navy: #0F2347;
  --hn-off-white: #F7F5F2;
  --hn-cool-gray: #D9DEE7;
  --hn-charcoal: #1F2937;

  /* ---- light: the corporate default (brand skill §8) ------------------- */
  --hn-bg: #F7F5F2;
  --hn-bg-subtle: #FFFFFF;
  --hn-bg-raised: #FFFFFF;
  --hn-bg-hi: #EDF0F5;
  --hn-heading: #0F2347;
  --hn-text: #1F2937;
  --hn-muted: #5B6675;
  /* 4.5:1 on the light page: small uppercase labels, and they are read. */
  --hn-faint: #626D80;
  --hn-border: #D9DEE7;
  --hn-border-hi: #C2CBD9;

  /* Orange is a FILL colour, not an ink colour. #F97316 as TEXT on the light
     page measures 2.58:1 - the hip number and the asking price were the two
     most important figures on the screen and the two least readable. This is
     the same hue carried down until it can be read; the fill stays canonical. */
  --hn-orange-ink: #C2410C;

  /* A success fill carries its own label colour, because what reads on
     #15803D is not what reads on #4ADE80. "Going once" was navy on dark green
     at 3.10:1. */
  --hn-ok-fill: #15803D;
  --hn-ok-on: #FFFFFF;

  /* Semantic status. Darkened from the canonical values where they sit on a
     light surface as TEXT: #16A34A is 3.30:1 on white, short of AA, and a
     status word is read. Accessibility outranks brand exactness (§20). */
  --hn-ok: #15803D;
  --hn-warn: #B45309;
  --hn-bad: #B42318;
  --hn-danger: #DC2626;

  /* A surface that deliberately contrasts with the page in BOTH schemes:
     toasts, printed cards, anything that must read as "on top". */
  --hn-invert-bg: #0F2347;
  --hn-invert-fg: #FFFFFF;

  --hn-shadow: 0 14px 40px rgba(15, 35, 71, .16);

  /* ---- radii ----------------------------------------------------------- */
  --r: 12px;
  --r-sm: 8px;

  /* ---- type ------------------------------------------------------------ */
  --display: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: var(--display);
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Courier New', monospace;

  /* ---- legacy aliases -------------------------------------------------- */
  --night: var(--hn-bg);
  --night-deep: var(--hn-bg-hi);
  --panel: var(--hn-bg-subtle);
  --panel-up: var(--hn-bg-raised);
  --panel2: var(--hn-bg-hi);
  --paper: var(--hn-bg-subtle);
  --sticker: var(--hn-orange);
  --sticker-deep: var(--hn-orange-deep);
  --ink: var(--hn-navy);
  --cream: var(--hn-text);
  --cream-dim: var(--hn-muted);
  --cream-faint: var(--hn-faint);
  --line: var(--hn-border);
  --hammer: var(--hn-danger);
  --ok: var(--hn-ok);
  --warn: var(--hn-warn);
  --bad: var(--hn-bad);
  --annie: var(--hn-orange);
}

/* ---- dark, as the system asks for it. Never the only definition. -------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --hn-bg: #0B1220;
    --hn-bg-subtle: #101B2D;
    --hn-bg-raised: #16243A;
    --hn-bg-hi: #1C2A40;
    --hn-heading: #FFFFFF;
    --hn-text: #E8EDF5;
    --hn-muted: rgba(232, 237, 245, .62);
    --hn-faint: rgba(232, 237, 245, .42);
    --hn-border: rgba(232, 237, 245, .11);
    --hn-border-hi: rgba(232, 237, 245, .20);

    /* Lifted off the light-mode values: the darker greens and ambers do not
       clear AA against a navy surface. */
    --hn-orange-ink: var(--hn-orange);
    --hn-ok-fill: #4ADE80;
    --hn-ok-on: #0F2347;
    --hn-ok: #4ADE80;
    --hn-warn: #FBBF24;
    --hn-bad: #F87171;

    --hn-invert-bg: #F7F5F2;
    --hn-invert-fg: #0F2347;
    --hn-shadow: 0 16px 44px rgba(0, 0, 0, .5);

    --night-deep: #070D18;
    --paper: var(--hn-off-white);
  }
}

/* ---- dark, chosen. Wins over the system preference in both directions. --- */
:root[data-theme="dark"] {
  --hn-bg: #0B1220;
  --hn-bg-subtle: #101B2D;
  --hn-bg-raised: #16243A;
  --hn-bg-hi: #1C2A40;
  --hn-heading: #FFFFFF;
  --hn-text: #E8EDF5;
  --hn-muted: rgba(232, 237, 245, .62);
  --hn-faint: rgba(232, 237, 245, .42);
  --hn-border: rgba(232, 237, 245, .11);
  --hn-border-hi: rgba(232, 237, 245, .20);

  --hn-orange-ink: var(--hn-orange);
  --hn-ok-fill: #4ADE80;
  --hn-ok-on: #0F2347;
  --hn-ok: #4ADE80;
  --hn-warn: #FBBF24;
  --hn-bad: #F87171;

  --hn-invert-bg: #F7F5F2;
  --hn-invert-fg: #0F2347;
  --hn-shadow: 0 16px 44px rgba(0, 0, 0, .5);

  --night-deep: #070D18;
  --paper: var(--hn-off-white);
}

/* ---- the toggle -------------------------------------------------------- */
/* One control, three states, on every page that has somebody looking at it.
   Icon plus a label, because a sun/moon glyph alone is a state communicated by
   picture only, and the reading of it flips depending on whether you think it
   shows the current mode or the one you would get. */
.hn-theme {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--hn-border-hi);
  background: var(--hn-bg-raised);
  color: var(--hn-text);
  border-radius: 8px;
  padding: 8px 12px;
  font: 600 13px/1 var(--display);
  cursor: pointer;
  white-space: nowrap;
}
.hn-theme:hover { border-color: var(--hn-orange); }
.hn-theme:focus-visible { outline: 2px solid var(--hn-orange); outline-offset: 2px; }
.hn-theme .ico { font-size: 14px; line-height: 1; }
@media (max-width: 620px) {
  .hn-theme .txt { display: none; }
  .hn-theme { padding: 8px 10px; }
}

/* ---- scrollbars -------------------------------------------------------- */
/* The default OS scrollbar is a wide grey slab that belongs to no theme and
   reads as a seam down the side of a panel. These are the same surfaces and
   borders as everything else, and they thin out until you are pointing at
   them.

   `scrollbar-width`/`scrollbar-color` is the standard property (Firefox, and
   Chrome 121+); the ::-webkit- rules cover the WebKit engines that do not
   honour it yet. Both are stated because neither covers everything.

   Deliberately NOT `scrollbar-width: none`: a scrollbar is how somebody knows
   there is more catalog below the fold, and hiding it to look tidy costs them
   that. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--hn-border-hi) transparent;
}
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--hn-border-hi);
  border-radius: 999px;
  /* Inset with a transparent border so the thumb reads as a slim pill rather
     than a full-width bar. */
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--hn-muted); background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* ---- station switcher ("Matt · Ring Clerk ▾") ----------------------------
   Lives HERE, once, because it is chrome every station shares. It used to be
   pasted inline into each page's <style>, which produced four copies that had
   already drifted into two different visual treatments - and a fifth page
   (paper.html) that had no copy at all, so its dropdown rendered as unstyled
   markup falling out of the header. A shared control needs a shared rule.

   The popup anchors to whatever element the switcher is mounted into;
   mode-switcher.ts sets position:relative on that container so this works on
   any page without the page needing to know. */
.ms-wrap{position:relative}
.ms-chip{border:1px solid var(--hn-border-hi);background:var(--hn-bg-raised);color:var(--hn-text);border-radius:var(--r-sm);padding:9px 13px;font:600 13px/1 var(--display);cursor:pointer;white-space:nowrap}
.ms-chip:hover{border-color:var(--hn-orange)}
.ms-chip.ms-static{cursor:default}
.ms-chip.ms-static:hover{border-color:var(--hn-border-hi)}
.ms-pop{position:absolute;right:0;top:46px;z-index:60;background:var(--hn-bg-raised);border:1px solid var(--hn-border-hi);border-radius:var(--r);min-width:250px;padding:6px;box-shadow:var(--hn-shadow)}
.ms-title{font:600 10px/1 var(--mono);letter-spacing:.14em;color:var(--hn-faint);text-transform:uppercase;padding:8px 11px 6px}
.ms-item{display:flex;gap:10px;width:100%;text-align:left;background:none;border:0;border-radius:var(--r-sm);padding:9px 11px;color:var(--hn-text);cursor:pointer;font-family:var(--display)}
.ms-item:hover{background:var(--hn-bg-hi)}
.ms-item.on .ms-name{color:var(--hn-orange-ink)}
.ms-dot{color:var(--hn-orange-ink)}
.ms-name{display:block;font:600 14px/1.3 var(--display)}
.ms-desc{display:block;font:12px/1.3 var(--display);color:var(--hn-faint)}

/* The UA sheet gives [hidden] display:none, and ANY explicit display in a
   class or id rule silently beats it. That has now bitten twice: state-driven
   buttons in the ring console, and the paper clerk's results panel, which is
   display:flex and therefore ignored its own hidden attribute. Global, so a
   new page cannot inherit the trap. */
[hidden]{display:none !important}
