/* ════════════════════════════════════════════════════════
   Pixl Realm design tokens — the Pixel Glass System
   TEST PALETTE (Brian, 2026-10-12)

   RULES: PixlRealm/_foundation/brand/DESIGN-RULES.md.
   The system is the PIXEL GLASS SYSTEM (named by Brian, 2026-10-13). The
   token set and role names began as Icons Performance's Carbon Glass set;
   the material itself is Pixl Realm's own and lives in pixel-glass.css.

   HOW TO TWEAK: change the six --brand-* values in the first group. Every
   role below is built from them, from black and from white, so the whole
   system follows. No component writes a color of its own.

   Why some roles are a mix and not the raw color: a color that carries
   words has to hold 4.5:1 against what is behind it. Where the raw color
   does not, the role that is read as text uses a lightened tone of it.
   Fills, lines and glows use the raw color.

   Names such as --color-gold and --color-blue-glow are inherited role names:
     accent  = the default accent        (blue)
     error   = error and destructive     (red)
     gold    = highlight                 (gold)

   THEME: dark only for now (Brian, 2026-10-11). A light theme is added later
   as a second block of overrides under :root[data-theme="light"].

   THE PAGE IS BLACK (Brian, 2026-10-13). The Dark Grey page was tried and
   dropped. Dark Grey is the surface color: cards are Dark Grey seen through
   glass, and the raised surface is Dark Grey itself.

   TWO LOOKS, ON TRIAL (2026-10-13), for Brian to choose or keep both:
     default                  black page, with the brand colors
     <html data-look="bw">    black and white: black, white and the two
                              greys only, to sit with black and white content
   The second block in this file is the whole of the black and white look.
   It changes roles only; the six --brand-* values are shared. It keeps Red
   for errors (Brian, 2026-10-13).

   PIXEL MODE, ON TRIAL (2026-10-13): <html data-mode="pixel">, with either
   look. A classic game feel: square corners, chunky notched lines, hard
   block shadows, a pixel face (Press Start 2P) for headlines. The last block in this file
   holds its tokens; the shapes are redrawn at the end of components.css.

   FONTS: the same system as Icons Performance (Brian, 2026-10-13). The faces
   are loaded by fonts.css and a Google Fonts link. The logo was supplied on
   2026-11-08; it is drawn by pixl-logo.css in the two --logo-* colors below.
   ════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;

  /* ── The brand palette, as supplied ─────────────────────── */
  --brand-dark-blue: #2243bc;    /* primary */
  --brand-light-blue: #2196bf;   /* primary */
  --brand-dark-grey: #464646;    /* background */
  --brand-light-grey: #919191;   /* background */
  --brand-red: #ec1c24;          /* accent */
  --brand-gold: #fcbe11;         /* accent */
  --brand-black: #000000;
  --brand-white: #ffffff;

  /* ── The logo's own colors, from the supplied logo files (2026-11-08) ──
     Not the same as the two test blues above. Whether the palette moves to
     these is Brian's decision; until then they are used by the logo only.
     The greys are the Greyscale version: each blue at its own lightness. */
  --brand-logo-blue: #1444c3;         /* PMS 7455 C */
  --brand-logo-light-blue: #0094c6;   /* PMS 639 C */
  --brand-logo-grey-dark: #515151;
  --brand-logo-grey-light: #8a8a8a;

  /* The logo's two inks. a: the R's frame and "PIXL"; b: the R's pixel and
     leg, and "REALM". Full color in the color look. */
  --logo-a: var(--brand-logo-blue);
  --logo-b: var(--brand-logo-light-blue);

  /* ── Roles, built from the palette ──────────────────────── */

  /* Surfaces. The page is black; surfaces step up toward Dark Grey. */
  --color-bg: var(--brand-black);
  --color-surface: color-mix(in srgb, var(--brand-dark-grey) 45%, var(--brand-black));
  --color-surface-hover: color-mix(in srgb, var(--brand-dark-grey) 60%, var(--brand-black));
  --color-surface-elevated: var(--brand-dark-grey);

  /* Light Grey as a surface of its own, with the ink that sits on it. */
  --color-bg-alt: var(--brand-light-grey);
  --color-on-bg-alt: var(--brand-black);

  /* Accent. On black, Light Blue holds 4.5:1 as it is, so accent (links,
     icons, focus rings) is the raw color. accent-light is the same color,
     for lines and corners. accent-deep is Dark Blue, for solid fills;
     on-accent is the ink on that fill. */
  --color-accent: var(--brand-light-blue);
  --color-accent-hover: color-mix(in srgb, var(--brand-light-blue) 62%, var(--brand-white));
  --color-accent-light: var(--brand-light-blue);
  --color-accent-deep: var(--brand-dark-blue);
  --color-accent-deep-hover: color-mix(in srgb, var(--brand-dark-blue) 84%, var(--brand-white));
  --color-on-accent: var(--brand-white);

  /* Error and destructive. error is the raw Red, for fills and lines.
     error-light is the tone that can be read as text on a card. */
  --color-error: var(--brand-red);
  --color-error-light: color-mix(in srgb, var(--brand-red) 72%, var(--brand-white));
  --color-error-soft: color-mix(in srgb, var(--brand-red) 72%, var(--brand-white));
  --color-on-error: var(--brand-white);

  /* Highlight. Gold reads as text as it is. */
  --color-gold: var(--brand-gold);
  --color-gold-hover: color-mix(in srgb, var(--brand-gold) 70%, var(--brand-white));
  --color-gold-text: var(--brand-gold);

  /* Glows */
  --color-blue-glow: color-mix(in srgb, var(--brand-dark-blue) 45%, transparent);
  --color-red-glow: color-mix(in srgb, var(--brand-red) 35%, transparent);
  --color-gold-glow: color-mix(in srgb, var(--brand-gold) 35%, transparent);

  /* Glass: Dark Grey seen through, over the black page */
  --color-glass: color-mix(in srgb, var(--brand-dark-grey) 40%, transparent);
  --color-glass-hover: color-mix(in srgb, var(--brand-dark-grey) 54%, transparent);
  --color-glass-border: color-mix(in srgb, var(--brand-white) 16%, transparent);
  --color-glass-border-hover: color-mix(in srgb, var(--brand-white) 30%, transparent);

  /* Ink: white, stepped down for the quieter voices */
  --color-text-primary: var(--brand-white);
  --color-text-secondary: color-mix(in srgb, var(--brand-white) 74%, transparent);
  --color-text-muted: color-mix(in srgb, var(--brand-white) 60%, transparent);

  /* Hairlines */
  --color-border: color-mix(in srgb, var(--brand-white) 13%, transparent);
  --color-border-light: color-mix(in srgb, var(--brand-light-grey) 70%, transparent);

  /* Status. Info is the accent. No green and no warning color were
     supplied, so success and warning stay neutral for now. */
  --color-success: color-mix(in srgb, var(--brand-white) 80%, transparent);
  --color-warning: color-mix(in srgb, var(--brand-white) 80%, transparent);
  --color-info: var(--color-accent);

  /* Selection */
  --color-selection-bg: var(--brand-dark-blue);
  --color-selection-ink: var(--brand-white);

  /* Radius: three steps only */
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;

  /* The type scale: six sizes, and no others (Brian, 2026-10-13: "Trim").
     One screen uses at most these six. Nothing a person must read is below --size-small. */
  --size-label: 0.6875rem;    /* 11px  badges, small buttons, tags. Never a sentence */
  --size-small: 0.75rem;      /* 12px  secondary text, captions, button labels, values, eyebrows */
  --size-body: 0.875rem;      /* 14px  body text in a tool, field labels */
  --size-large: 1rem;         /* 16px  body text on a website, card titles, text typed into a field */
  --size-heading: 1.5rem;     /* 24px  section and page headings */
  --size-display: 2.25rem;    /* 36px  the one page title. A website cover may scale up from here */

  /* The spacing scale: every padding, margin and gap is one of these. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --space-16: 64px;

  /* Type: the Icons Performance font system. Area Normal for everything
     read as text, Futura PT for headlines and button labels, Martian Mono
     for the technical layer only. Do not add a fourth family. */
  --font-sans: 'Area Normal', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Futura PT', 'Area Normal', system-ui, -apple-system, sans-serif;
  --font-mono: 'Martian Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Motion */
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  /* Pixel mode (used only under data-mode="pixel"): the size of one pixel,
     the line every box is drawn with, and the hard block shadow. */
  --pixel: 4px;
  --display-scale: 1;   /* headline sizes are multiplied by this; pixel mode shrinks them */
  --pixel-line: var(--brand-white);
  --pixel-shadow: var(--brand-dark-blue);

  /* Neutral overlay bases, used as rgba(var(--wash-rgb), a).
     wash = the light that falls on a surface. shade = the shadow under it. */
  --wash-rgb: 255, 255, 255;
  --shade-rgb: 0, 0, 0;

  /* .glass-card / .glass-panel */
  --glass-blur: blur(20px);
  --glass-backdrop: blur(34px) saturate(140%) brightness(0.8);
  --glass-shadow:
    inset 0 1px 1px rgba(var(--wash-rgb), 0.34),
    inset 1px 2px 4px rgba(var(--wash-rgb), 0.10),
    inset -1px -2px 4px rgba(var(--shade-rgb), 0.40),
    inset 0 -12px 26px rgba(var(--shade-rgb), 0.44),
    0 8px 24px rgba(var(--shade-rgb), 0.38);
  --glass-shadow-hover:
    inset 0 1px 1px rgba(var(--wash-rgb), 0.46),
    inset 1px 2px 6px rgba(var(--wash-rgb), 0.14),
    inset -1px -2px 6px rgba(var(--shade-rgb), 0.44),
    inset 0 -12px 26px rgba(var(--shade-rgb), 0.40),
    0 12px 30px rgba(var(--shade-rgb), 0.45);
  --glass-sheen:
    radial-gradient(125% 62% at 50% -20%, rgba(var(--wash-rgb), 0.17) 0%, rgba(var(--wash-rgb), 0) 62%),
    linear-gradient(135deg, rgba(var(--wash-rgb), 0.055) 0%, transparent 52%);

  /* .glass-pill (pills, segmented controls, active states) */
  --pill-fill: linear-gradient(135deg, rgba(var(--wash-rgb), 0.10) 0%, rgba(var(--wash-rgb), 0.03) 42%, rgba(var(--shade-rgb), 0.05) 58%, rgba(var(--shade-rgb), 0.24) 100%);
  --pill-border: rgba(var(--wash-rgb), 0.22);
  --pill-border-hover: rgba(var(--wash-rgb), 0.42);
  --pill-sheen: linear-gradient(180deg, rgba(var(--wash-rgb), 0.26) 0%, rgba(var(--wash-rgb), 0) 100%);
  --pill-shadow:
    inset 0 1px 1px rgba(var(--wash-rgb), 0.65),
    inset 1px 2px 4px rgba(var(--wash-rgb), 0.30),
    inset -1px -2px 4px rgba(var(--shade-rgb), 0.40),
    inset 0 -10px 20px rgba(var(--shade-rgb), 0.40),
    0 2px 6px rgba(var(--shade-rgb), 0.35);
  --pill-shadow-hover:
    inset 0 1px 2px rgba(var(--wash-rgb), 0.8),
    inset 2px 4px 8px rgba(var(--wash-rgb), 0.35),
    inset -2px -4px 8px rgba(var(--shade-rgb), 0.5),
    0 0 16px rgba(var(--wash-rgb), 0.08),
    0 6px 16px rgba(var(--shade-rgb), 0.45);
  --pill-shadow-active:
    inset 0 1px 1px rgba(var(--wash-rgb), 0.15),
    inset 0 8px 16px rgba(var(--shade-rgb), 0.7),
    0 2px 6px rgba(var(--shade-rgb), 0.4);

  /* .btn-perf.outline */
  --btn-outline-bg: rgba(var(--wash-rgb), 0.04);
  --btn-outline-border: rgba(var(--wash-rgb), 0.30);
  --btn-outline-bg-hover: rgba(var(--wash-rgb), 0.10);
  --btn-outline-border-hover: rgba(var(--wash-rgb), 0.50);

  /* Form fields (.field-perf). Not in Icons' shared set; added for the website. */
  --field-bg: rgba(var(--wash-rgb), 0.05);
  --field-border: rgba(var(--wash-rgb), 0.40);   /* 3:1 against the page, so the box is findable */
  --field-border-hover: rgba(var(--wash-rgb), 0.60);
}

/* ── The black and white look ───────────────────────────────
   Black, white, Dark Grey and Light Grey, plus Red for errors and nothing
   else (Brian, 2026-10-13: "Keep red for errors in the black and white
   look."). No blue and no gold: those roles take a white or a grey, and a
   link is told by its underline. The error roles are not listed here, so
   they keep the Red they have in the color look. Put data-look="bw" on
   <html>. */
:root[data-look="bw"] {
  --color-accent: var(--brand-white);
  --color-accent-hover: color-mix(in srgb, var(--brand-light-grey) 45%, var(--brand-white));
  --color-accent-light: var(--brand-white);
  --color-accent-deep: var(--brand-white);
  --color-accent-deep-hover: color-mix(in srgb, var(--brand-light-grey) 35%, var(--brand-white));
  --color-on-accent: var(--brand-black);

  --color-gold: var(--brand-white);
  --color-gold-hover: color-mix(in srgb, var(--brand-light-grey) 45%, var(--brand-white));
  --color-gold-text: var(--brand-white);

  --color-blue-glow: color-mix(in srgb, var(--brand-white) 20%, transparent);
  --color-gold-glow: color-mix(in srgb, var(--brand-white) 14%, transparent);

  --color-info: var(--color-text-secondary);

  --color-selection-bg: var(--brand-white);
  --color-selection-ink: var(--brand-black);

  /* The glass takes no tint from what is behind it. */
  --glass-backdrop: blur(34px) saturate(0%) brightness(0.8);

  --pixel-shadow: var(--brand-dark-grey);

  /* The logo is the supplied White version. */
  --logo-a: var(--brand-white);
  --logo-b: var(--brand-white);
}

/* ── Pixel mode ─────────────────────────────────────────────
   Works with either look. Corners go square, glass goes flat and solid, and
   headlines take the pixel face. Body text stays Area Normal so long text
   stays easy to read. The shapes are in components.css. */
:root[data-mode="pixel"] {
  --radius-lg: 0px;
  --radius-md: 0px;
  --radius-sm: 0px;

  /* The pixel face, Press Start 2P (specified 2026-10-13). The face has one
     weight and every letter is as wide as it is tall, so headlines are set
     at two thirds of their size (--display-scale). */
  --font-display: 'Press Start 2P', 'Futura PT', 'Area Normal', system-ui, sans-serif;
  --display-scale: 0.667;

  --color-glass: var(--color-surface);
  --color-glass-hover: var(--color-surface-hover);
  --glass-backdrop: none;
  --glass-blur: none;
  --glass-sheen: none;
}
