/* =============================================================================
   BLACK SIGNAL — css/tokens.css
   Every color, face, size, duration and easing the interface uses, as custom
   properties. Loaded first. Nothing here draws anything.

   Cascade layers (the order below is the priority order, lowest first):
     legacy      the older stylesheets (css/01…15, command_center, c_labs,
                 python_labs, levelup, bs_tour, BSEditor), each wrapped in its
                 own sub-layer in load order — so a later file still wins over
                 an earlier one, without a single !important
     tokens      this file
     components  css/components/*.css — the primitives (sweep, topbar, band,
                 grid-tile, row, rail, modal, toast, form, chip, tabs)
     screens     css/screens/*.css — layout only
     a11y        css/13-a11y.css — focus rings and contrast floors, last word
   A rule in a higher layer beats any rule in a lower one whatever its
   specificity, which is what lets the components stay small and flat.
   ============================================================================= */
@layer legacy, tokens, components, screens, a11y;
/* Sub-layer order inside `legacy`: the course sheets (editor, C, Python,
   Analytics, tour) sit between 12 and 14, because 14-premium and 15-signature
   were written to override them. */
@layer legacy.l01, legacy.l02, legacy.l03, legacy.l04, legacy.l05, legacy.l06,
       legacy.l07, legacy.l08, legacy.l09, legacy.l10, legacy.l11, legacy.l12,
       legacy.editor, legacy.clabs, legacy.levelup, legacy.pylabs, legacy.cc,
       legacy.tour, legacy.l14, legacy.l15;

@layer tokens {
:root {
  /* ── Faces ───────────────────────────────────────────────────────────── */
  --font-display: 'Barlow Condensed', 'Barlow Condensed Fallback', sans-serif;   /* titles, labels, numerals */
  --font-body:    'Barlow', 'Barlow Fallback', sans-serif;             /* reading prose */
  --sig-mono:     'JetBrains Mono', ui-monospace, 'Fira Code', Menlo, monospace; /* eyebrows, codes, counts, clock, tags */
  --font-mono:    var(--sig-mono);

  /* ── Accent (applyTheme() rewrites these five per theme) ─────────────── */
  --orange:       #ff4a00;
  --orange-dim:   #cc3b00;
  --orange-dark:  #7a2200;
  --orange-bg:    rgba(244, 77, 11, 0.5);
  --accent-on-accent: #050505;   /* ink on a solid accent fill */

  /* ── ONE BLACK ───────────────────────────────────────────────────────── */
  /* 6.5% of the live accent mixed into #0b0b0b — the menu's black. Every
     surface is this color; regions are separated by hairlines, never by a
     second shade. The legacy names below all resolve to it. */
  --sig-black:    color-mix(in srgb, var(--orange) 6.5%, #0b0b0b);
  --black:        var(--sig-black);
  --black-2:      var(--sig-black);
  --black-3:      var(--sig-black);
  --bs-panel:     var(--sig-black);
  --acc-ground:   var(--sig-black);
  --acc-surf-1:   var(--sig-black);
  --acc-surf-2:   var(--sig-black);
  --acc-surf-3:   var(--sig-black);
  --acc-screen-bg: var(--sig-black);
  --sig-ground:   var(--sig-black);
  --sig-cell:     var(--sig-black);

  /* ── Ink ─────────────────────────────────────────────────────────────── */
  --ink-rgb:      244, 243, 240;
  --white:        #f0f0f0;
  --white-dim:    rgba(240, 240, 240, 0.62);
  --white-faint:  rgba(240, 240, 240, 0.28);
  --sig-ink:      rgb(var(--ink-rgb));
  --sig-ink-dim:  rgba(var(--ink-rgb), 0.62);
  --sig-ink-mute: rgba(var(--ink-rgb), 0.52);

  /* ── Rules (hairlines) — three weights ───────────────────────────────── */
  --sig-rule:        color-mix(in srgb, var(--orange) 26%, transparent);
  --sig-rule-strong: var(--orange-dark);
  --acc-hair:        color-mix(in srgb, var(--orange) 22%, transparent);
  --acc-hair-2:      color-mix(in srgb, var(--orange) 40%, transparent);
  --acc-hair-3:      var(--orange);
  --border-color:    var(--orange);
  --border:          1px solid var(--orange);
  --border-2:        2px solid var(--orange);
  --border-dim:      1px solid var(--orange-dark);

  /* ── Tints used by states (never a resting surface) ──────────────────── */
  --sig-tint:        color-mix(in srgb, var(--orange) 10%, var(--sig-black));  /* hover on non-sweep cells */
  --sig-alert-bg:    color-mix(in srgb, #ff1a1a 14%, var(--sig-black));        /* wrong answer / error */
  --sig-alert-rule:  color-mix(in srgb, #ff1a1a 45%, var(--orange-dark));
  --sig-alert-ink:   #ff6a6a;                                                   /* wrong-answer letter, error labels */
  --sig-hatch:       repeating-linear-gradient(135deg, transparent 0 7px, color-mix(in srgb, var(--orange) 12%, transparent) 7px 8px);

  /* ── Shape: square ───────────────────────────────────────────────────── */
  --acc-r:    0;
  --acc-r-lg: 0;
  --sig-notch: 6px;   /* the single chamfer keys may carry */

  /* ── Light: none ─────────────────────────────────────────────────────── */
  --acc-glow:  transparent;
  --acc-bloom: transparent;
  --acc-el-1:  none;
  --acc-el-2:  none;
  --acc-el-3:  none;

  /* ── Type scale ──────────────────────────────────────────────────────── */
  --sig-eyebrow-size:  11.5px;
  --sig-eyebrow-track: 0.22em;
  --sig-key-size:      12px;
  --sig-key-track:     0.18em;
  --sig-meta-size:     11.5px;
  --sig-body-size:     15px;
  --sig-measure:       70ch;

  /* ── Layout ──────────────────────────────────────────────────────────── */
  --sig-col:          1200px;
  --sig-gutter:       32px;
  --bs-topbar-h:      56px;
  --bs-bottombar-h:   60px;
  --bs-band-h:        118px;   /* hero band, index screens */
  --bs-band-compact-h: 72px;   /* compact band, working screens */

  /* ── Motion ──────────────────────────────────────────────────────────── */
  --dur-fast:  120ms;
  --dur:       220ms;
  --dur-slow:  360ms;
  --acc-dur-fast: 160ms;
  --acc-dur:      240ms;
  --ease:          cubic-bezier(0.22, 1, 0.36, 1);
  --ease-sharp:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-exit:     cubic-bezier(0.7, 0, 1, 0.3);
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --sig-ease:      var(--ease-sharp);
  --thf-ease-sharp: var(--ease-sharp);
  --thf-ease-wipe:  cubic-bezier(0.76, 0, 0.24, 1);
  --thf-line-ease:  cubic-bezier(0.52, 1, 0.56, 1);
  --thf-wipe-dur:    560ms;
  --thf-overlay-dur: 480ms;
  --thf-line-dur:    500ms;

  /* ── Stacking ────────────────────────────────────────────────────────── */
  --z-chrome: 8000;   /* top bar, phone bar */
  --z-menu:   8700;
  --z-modal:  9000;
  --z-toast:  9800;
}

/* ── Re-measured for narrower screens ─────────────────────────────────── */
@media (max-width: 1023px) {
  :root { --sig-gutter: 20px; }
}
@media (max-width: 599px) {
  :root { --sig-gutter: 16px; --bs-topbar-h: 48px; }
}
}
