/*
 * Medusa panel — design tokens.
 *
 * Mirror of the tokens recorded in `../../../DESIGN.md`. Every panel
 * stylesheet reads the SEMANTIC aliases below — never the palette
 * literals and never inline hex values.
 *
 * Direction: Slipstream-derived terminal — editorial fintech density
 * crossed with a trading floor: flat fields, hairline grid rules,
 * condensed display caps, dense mono data, one lime accent reserved
 * for the capture.
 *   night floor — the committed dark ground (dim-room scene)
 *   day floor   — the same terminal on lit stock (derived light field)
 *
 * `data-theme` on <html> picks the palette: "night" | "day".
 * panel.js persists the operator's choice in localStorage and
 * follows prefers-color-scheme only before the first toggle.
 *
 * Fonts self-host under ./fonts — no CDN calls.
 */

@font-face {
  font-family: "Barlow Condensed";
  font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/BarlowCondensed-600.ttf") format("truetype");
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/BarlowCondensed-700.ttf") format("truetype");
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal; font-weight: 800; font-display: swap;
  src: url("fonts/BarlowCondensed-800.ttf") format("truetype");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/IBMPlexMono-400.ttf") format("truetype");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/IBMPlexMono-500.ttf") format("truetype");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/IBMPlexMono-600.ttf") format("truetype");
}
@font-face {
  font-family: "Inter";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/Inter-400.ttf") format("truetype");
}
@font-face {
  font-family: "Inter";
  font-style: normal; font-weight: 500; font-display: swap;
  src: url("fonts/Inter-500.ttf") format("truetype");
}
@font-face {
  font-family: "Inter";
  font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/Inter-600.ttf") format("truetype");
}
@font-face {
  font-family: "Inter";
  font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/Inter-700.ttf") format("truetype");
}

:root {
  /* ── palette literals (night floor — source of truth) ─────────── */
  --ground: #101211;      /* terminal ground — near-black, olive cast */
  --deck: #161916;        /* inset surfaces */
  --deck-hi: #1C201D;     /* raised surface — control fills */
  --grid: #282E28;        /* subtle rules */
  --rule: #353D35;        /* control borders */
  --ink: #F2F3E9;         /* primary text — ~15.6:1 */
  --ink-2: #B3B9AF;       /* secondary — ~8.6:1 */
  --ink-3: #929B90;       /* captions/labels — ~5.4:1 */
  --lime: #D5F64A;        /* THE accent — capture + primary action */
  --lime-hi: #E5FF77;     /* accent hover */
  --lime-ink: #11140C;    /* ink on lime fills */
  --up: #67DCA0;          /* live/ok */
  --down: #F27D80;        /* fail */
  --amber: #F4C66A;       /* warn */
  --gold: #C9A45C;        /* brand gold — the mark's metal */

  /* ── semantic aliases (components read ONLY these) ────────────── */
  --bg: var(--ground);            /* panel ground */
  --bg-2: var(--deck);            /* inset surfaces, input fills */
  --bg-3: var(--deck-hi);         /* raised surfaces — chips, control fills */
  --edge: var(--grid);            /* hairline rules, panel edges */
  --edge-strong: var(--rule);     /* control borders, section rules */
  --fg: var(--ink);               /* primary text */
  --fg-dim: var(--ink-2);         /* secondary text */
  --fg-faint: var(--ink-3);       /* captions, mini-labels */
  --live: var(--up);              /* open sessions / streaming ok */
  --warn: var(--amber);           /* degraded waits */
  --fail: var(--down);            /* locked / failed / terminated */
  --brand: var(--gold);           /* mark gold — identity, not signal */
  --capture: var(--lime);         /* capture accent — text-safe */
  --capture-fill: var(--lime);    /* lime action fill */
  --capture-fill-hi: var(--lime-hi); /* lime fill hover */
  --capture-ink: var(--lime-ink); /* text on lime fills */

  /* soft variants — row ribbons, rings, veils */
  --ribbon: rgba(242, 243, 233, 0.05);        /* selected + hover row */
  --edge-soft: rgba(40, 46, 40, 0.55);        /* row hairline at half depth */
  --live-glow: rgba(103, 220, 160, 0.55);     /* arrival ring */
  --live-ring: rgba(103, 220, 160, 0.4);      /* ok pill / chip border */
  --live-veil: rgba(103, 220, 160, 0.08);     /* green-tinted control surface */
  --live-veil-strong: rgba(103, 220, 160, 0.16);
  --live-soft: #8ee8b9;                       /* bright green text on dark */
  --fail-ring: rgba(242, 125, 128, 0.42);     /* err pill border */
  --fail-veil: rgba(242, 125, 128, 0.09);     /* red-tinted control surface */
  --fail-veil-strong: rgba(242, 125, 128, 0.15);
  --fail-soft: #f0979a;                       /* soft red text */
  --fail-soft-hi: #f7b6b8;
  --capture-veil: rgba(213, 246, 74, 0.06);   /* captured row ground */
  --capture-edge: rgba(213, 246, 74, 0.32);   /* captured row hairline */
  --capture-glow: rgba(213, 246, 74, 0.55);   /* capture ring */
  --capture-hover: var(--lime-hi);            /* legacy alias — use fill-hi */

  /* soundings chart — solid map colors, no opacity blending */
  --map-ocean: #131713;       /* water — a half-step off the ground */
  --map-land: #39423A;        /* continents — clearly solid masses */
  --map-coast: #7E8977;       /* coastline + borders — ~3:1 on ocean */

  --veil: rgba(8, 10, 8, 0.74);               /* sheet backdrop */
  --shadow: rgba(0, 0, 0, 0.4);
  --shadow-deep: rgba(0, 0, 0, 0.55);
  --sheen: rgba(255, 255, 255, 0.08);
  --fade-from: rgba(16, 18, 17, 0);
  --fade-to: var(--ground);
  --shell-outer: #080a08;                     /* page edge outside the floor */

  /* type — condensed display caps / Inter body / Plex Mono data */
  --f-display: "Barlow Condensed", "Arial Narrow", "Franklin Gothic Medium", sans-serif;
  --f-body: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "IBM Plex Mono", "Monaspace Argon", ui-monospace, Consolas, monospace;

  /* space */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 48px;
}

/*
 * day floor — the same terminal on lit stock. The dark field is the
 * world's home; this derives its light counterpart honestly: warm
 * off-white floor, deep ink, lime deepened to chartreuse for text but
 * kept vivid on action fills.
 */
:root[data-theme="day"] {
  --paper: #EFF0E1;         /* lit floor — warm, olive cast */
  --paper-2: #F6F7EB;       /* lifted insets */
  --paper-3: #FBFCF2;       /* raised surfaces */
  --grid-d: #CBCEB4;        /* subtle rules */
  --rule-d: #8E9377;        /* control borders ~3:1 */
  --ink-d: #181B0F;         /* ~15:1 */
  --ink-d2: #42473A;        /* ~8.4:1 */
  --ink-d3: #5F644F;        /* ~5.6:1 */
  --up-d: #1D7A4E;          /* ~5.4:1 */
  --down-d: #B23A3F;        /* ~5.9:1 */
  --amber-d: #7D620D;       /* ~5.4:1 */
  --lime-d: #4E680A;        /* capture text — ~5.6:1 deep chartreuse */
  --lime-fill-d: #B9DA3E;   /* vivid fill on light */
  --lime-fill-d-hi: #A6C72E;
  --lime-ink-d: #161A08;
  --gold-d: #8A6A2F;        /* mark gold on lit stock — ~5.6:1 */

  --bg: var(--paper);
  --bg-2: var(--paper-2);
  --bg-3: var(--paper-3);
  --edge: var(--grid-d);
  --edge-strong: var(--rule-d);
  --fg: var(--ink-d);
  --fg-dim: var(--ink-d2);
  --fg-faint: var(--ink-d3);
  --live: var(--up-d);
  --warn: var(--amber-d);
  --fail: var(--down-d);
  --brand: var(--gold-d);
  --capture: var(--lime-d);
  --capture-fill: var(--lime-fill-d);
  --capture-fill-hi: var(--lime-fill-d-hi);
  --capture-ink: var(--lime-ink-d);

  --ribbon: rgba(24, 27, 15, 0.05);
  --edge-soft: rgba(142, 147, 119, 0.5);
  --live-glow: rgba(29, 122, 78, 0.4);
  --live-ring: rgba(29, 122, 78, 0.42);
  --live-veil: rgba(29, 122, 78, 0.08);
  --live-veil-strong: rgba(29, 122, 78, 0.15);
  --live-soft: #1d7a4e;
  --fail-ring: rgba(178, 58, 63, 0.42);
  --fail-veil: rgba(178, 58, 63, 0.08);
  --fail-veil-strong: rgba(178, 58, 63, 0.14);
  --fail-soft: #a33527;
  --fail-soft-hi: #8a2b20;
  --capture-veil: rgba(78, 104, 10, 0.08);
  --capture-edge: rgba(78, 104, 10, 0.4);
  --capture-glow: rgba(78, 104, 10, 0.35);
  --capture-hover: var(--lime-fill-d-hi);

  /* soundings chart — lit-floor map */
  --map-ocean: #E4E6D2;       /* water — deeper than the paper */
  --map-land: #C4CAA9;        /* continents — solid against water */
  --map-coast: #6F7558;       /* coastline + borders — ~3.2:1 */

  --veil: rgba(24, 27, 15, 0.4);
  --shadow: rgba(24, 27, 15, 0.16);
  --shadow-deep: rgba(24, 27, 15, 0.26);
  --sheen: rgba(255, 255, 255, 0.3);
  --fade-from: rgba(239, 240, 225, 0);
  --fade-to: var(--paper);
  --shell-outer: #D4D7C0;   /* the mat around the framed floor */
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-arrival: none;
  }
}
