/* ==========================================================================
   CORPO RETRO WEB KIT - TOKENS.   GENERATED by towerpunk-site/build-kit.py.
   DO NOT EDIT: every value is read from the game repo (cybertower). Change
   the game, then re-run `python build-kit.py`. `--check` fails when stale.
   Source of each block is named above it. README.md has the full map.
   ========================================================================== */

/* fonts/TowerpunkMono-Regular.ttf + terminal_theme.tres FontVariation
   (variation_embolden = 0.8), baked by build-kit.py: the outline the game rasterises. */
@font-face {
  font-family: "Towerpunk Mono";
  src: url("fonts/TowerpunkMono-Embolden-a0b0235b.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --cr-font: "Towerpunk Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* -- TerminalPalette (ui/components/terminal_palette.gd) -- game-exact -- */
  --cr-amber-rgb: 212 160 23;            /* _HUE  #D4A017 */
  --cr-hero-rgb: 240 184 26;
  --cr-alert-rgb: 192 64 48;
  --cr-ok-rgb: 115 184 122;
  --cr-hero: rgb(var(--cr-hero-rgb));   /* #F0B81A */
  --cr-header: rgb(var(--cr-amber-rgb));   /* #D4A017 */
  --cr-value: rgb(var(--cr-amber-rgb));   /* #D4A017 */
  --cr-label-a: 0.58;
  --cr-label: rgb(var(--cr-amber-rgb) / var(--cr-label-a));
  --cr-lore-a: 0.42;
  --cr-lore: rgb(var(--cr-amber-rgb) / var(--cr-lore-a));
  --cr-dim-a: 0.24;
  --cr-dim: rgb(var(--cr-amber-rgb) / var(--cr-dim-a));
  --cr-rule: rgb(var(--cr-amber-rgb) / 0.42);  /* build_std_sep: a 1px LORE rule at the GAME alpha (not text, so the reading ladder never moves it) */
  --cr-alert: #C04030;
  --cr-ok: #73B87A;
  --cr-surface: #0E0E0E;
  --cr-border: #8C732E;
  --cr-ch-green: #73B87A;
  --cr-ch-mint: #99C78C;
  --cr-ch-cyan: #6BB8B8;
  --cr-ch-blue: #7A99D1;
  --cr-ch-violet: #A880C7;
  --cr-ch-pink: #C785A8;
  --cr-ch-red: #C76152;
  --cr-ch-orange: #D1853D;
  --cr-ch-ember: #DB9E57;
  --cr-ch-cream: #DECC9E;
  --cr-ch-gold: #D4B252;
  --cr-series-0: #D4A017;   /* SERIES[0] = HEADER */
  --cr-series-1: #73B87A;   /* SERIES[1] = CH_GREEN */
  --cr-series-2: #6BB8B8;   /* SERIES[2] = CH_CYAN */
  --cr-series-3: #A880C7;   /* SERIES[3] = CH_VIOLET */
  --cr-series-4: #D1853D;   /* SERIES[4] = CH_ORANGE */
  --cr-series-5: #DECC9E;   /* SERIES[5] = CH_CREAM */

  /* -- TerminalType (ui/components/terminal_type.gd) -- px at --cr-scale 1 -- */
  --cr-scale: 1;
  --cr-fs-chip: calc(12px * var(--cr-scale));
  --cr-fs-row: calc(12px * var(--cr-scale));
  --cr-fs-body: calc(13px * var(--cr-scale));
  --cr-fs-label: calc(14px * var(--cr-scale));
  --cr-fs-title: calc(16px * var(--cr-scale));
  --cr-fs-hero: calc(18px * var(--cr-scale));
  /* theme default_font_size = 13 (= BODY) */

  /* -- terminal_theme.tres Button (TerminalButton states) -- */
  --cr-btn-pad-x: 8px;
  --cr-btn-pad-y: 4px;
  --cr-btn-pressed: #D4A017B2;
  --cr-btn-disabled: #D4A01740;

  /* -- BorderOverlay (ui/overlays/border_overlay.gd): 1px core + GLOW_PASSES -- */
  --cr-border-w: 1px;
  --cr-border-glow: 0 0 0 1.5px rgb(var(--cr-amber-rgb) / 0.1), 0 0 0 2.5px rgb(var(--cr-amber-rgb) / 0.055), 0 0 0 3.5px rgb(var(--cr-amber-rgb) / 0.03);
  --cr-border-glow-inset: inset 0 0 0 1.5px rgb(var(--cr-amber-rgb) / 0.1), inset 0 0 0 2.5px rgb(var(--cr-amber-rgb) / 0.055), inset 0 0 0 3.5px rgb(var(--cr-amber-rgb) / 0.03);

  /* -- ScanlineOverlay (ui/overlays/scanline_overlay.gd) -- */
  --cr-scan-alpha: 0.18;
  --cr-scanlines: repeating-linear-gradient(to bottom, rgb(128 3 0 / 0.09) 0px 1px, rgb(128 3 0 / 0.18) 1px 2px, rgb(128 3 0 / 0.09) 2px 3px, rgb(128 3 0 / 0) 3px 4px);

  /* -- VignetteOverlay (ui/overlays/vignette_overlay.gd), menus + boot only -- */
  --cr-vignette: radial-gradient(ellipse farthest-corner at 50% 50%, transparent 55%, rgb(0 0 0 / 0.55) 100%);

  /* -- Phosphor (ui/components/phosphor.gd) -- */
  --cr-glow-alpha: 0.24;          /* GLOW_AMBER */
  --cr-glow-subtle-alpha: 0.12;   /* GLOW_AMBER_SUBTLE */
  --cr-glow-alert-alpha: 0.24;    /* GLOW_ALERT */
  --cr-glow-size: 3px;              /* GLOW_SIZE: a font OUTLINE in-game */
  --cr-glow-r: 0.30em;   /* approximation of GLOW_SIZE 3px @ 13-16px */
  --cr-glow-a: 0.34;     /* approximation of GLOW_AMBER .24 (see README) */
  --cr-glow: 0 0 var(--cr-glow-r) rgb(var(--cr-amber-rgb) / var(--cr-glow-a));
  --cr-glow-alert: 0 0 var(--cr-glow-r) rgb(var(--cr-alert-rgb) / var(--cr-glow-a));
  /* BLOOM_*: ratios 0.0455/0.1591 em, gains 2.44/1.36,
     CEIL 0.7 SPREAD 1.25 TIGHT 0.7 -> radii x2 (sigma->CSS), alphas solved */
  --cr-bloom-tight-r: 0.0795em;  --cr-bloom-tight-a: 0.5629;
  --cr-bloom-wide-r: 0.3977em;   --cr-bloom-wide-a: 0.3137;
  --cr-bloom: 0 0 var(--cr-bloom-tight-r) rgb(var(--cr-amber-rgb) / var(--cr-bloom-tight-a)), 0 0 var(--cr-bloom-wide-r) rgb(var(--cr-amber-rgb) / var(--cr-bloom-wide-a));

  /* -- GaugeBar (ui/components/gauge_bar.gd) + scrollbar grabber (theme) -- */
  --cr-gauge-glow-alpha: 0.4;
  --cr-gauge-glow-size: 2px;
  --cr-led-gap: 2px;
  --cr-led-unlit: rgb(var(--cr-amber-rgb) / 0.1);  /* Color(DIM, 0.1) */
  --cr-ghost-alpha: 0.32;
  --cr-grab-normal: #D4A017D9;
  --cr-grab-normal-glow: 0 0 3px #D4A0174C;
  --cr-grab-hover: #F0B81AF2;
  --cr-grab-hover-glow: 0 0 4px #F0B81A6B;
  --cr-grab-pressed: #F0B81A;
  --cr-grab-pressed-glow: 0 0 4px #F0B81A8C;

  /* -- InstrumentMeter (ui/components/instrument_meter.gd): THE RAIL GRID -- */
  --cr-meter-glyph-w: 22px;
  --cr-meter-sep: 10px;
  --cr-meter-value-w: 56px;
  --cr-meter-tail-w: 56px;
  --cr-meter-bar-h: 14px;

  /* -- TerminalPanel.build_std_root (ui/components/terminal_panel.gd) -- */
  --cr-pad-top: 10px; --cr-pad-right: 12px; --cr-pad-bottom: 10px; --cr-pad-left: 16px;
  --cr-row-gap: 5px;

  /* -- tooltip (theme TooltipPanel / TooltipLabel) -- */
  --cr-tip-pad: 5px 8px;
  --cr-tip-bg: #0E0E0EF7;
  --cr-tip-fs: calc(12px * var(--cr-scale));
}

/* Derived tokens, re-resolved wherever an override can land (see build-kit.py). */
.cr-root, .cr-reading, [data-cr-theme] {
  --cr-hero: rgb(var(--cr-hero-rgb));
  --cr-header: rgb(var(--cr-amber-rgb));
  --cr-value: rgb(var(--cr-amber-rgb));
  --cr-label: rgb(var(--cr-amber-rgb) / var(--cr-label-a));
  --cr-lore: rgb(var(--cr-amber-rgb) / var(--cr-lore-a));
  --cr-dim: rgb(var(--cr-amber-rgb) / var(--cr-dim-a));
  --cr-rule: rgb(var(--cr-amber-rgb) / 0.42);
  --cr-fs-chip: calc(12px * var(--cr-scale));
  --cr-fs-row: calc(12px * var(--cr-scale));
  --cr-fs-body: calc(13px * var(--cr-scale));
  --cr-fs-label: calc(14px * var(--cr-scale));
  --cr-fs-title: calc(16px * var(--cr-scale));
  --cr-fs-hero: calc(18px * var(--cr-scale));
  --cr-border-glow: 0 0 0 1.5px rgb(var(--cr-amber-rgb) / 0.1), 0 0 0 2.5px rgb(var(--cr-amber-rgb) / 0.055), 0 0 0 3.5px rgb(var(--cr-amber-rgb) / 0.03);
  --cr-border-glow-inset: inset 0 0 0 1.5px rgb(var(--cr-amber-rgb) / 0.1), inset 0 0 0 2.5px rgb(var(--cr-amber-rgb) / 0.055), inset 0 0 0 3.5px rgb(var(--cr-amber-rgb) / 0.03);
  --cr-glow: 0 0 var(--cr-glow-r) rgb(var(--cr-amber-rgb) / var(--cr-glow-a));
  --cr-glow-alert: 0 0 var(--cr-glow-r) rgb(var(--cr-alert-rgb) / var(--cr-glow-a));
  --cr-bloom: 0 0 var(--cr-bloom-tight-r) rgb(var(--cr-amber-rgb) / var(--cr-bloom-tight-a)), 0 0 var(--cr-bloom-wide-r) rgb(var(--cr-amber-rgb) / var(--cr-bloom-wide-a));
  --cr-led-unlit: rgb(var(--cr-amber-rgb) / 0.1);
  --cr-tip-fs: calc(12px * var(--cr-scale));
}

/* THE READING LADDER: same hue, descending alpha, rungs raised so long web
   prose clears WCAG AA (4.5:1) composited under the scanlines. The game's
   rungs are tuned for short readouts on a monitor you lean into. Opt in per
   page/root; the game-exact rungs above stay the default. (towerpunk.com
   WEB_SYSTEM.md 'The web alphas are not the game's alphas'.) */
.cr-reading { --cr-label-a: 0.82; --cr-lore-a: 0.75; --cr-dim-a: 0.52; }
