/* Design tokens — 1:1 from Figma variables (file O2YnRjvTtomRNOgAbAD4qK, Section 1) */
:root {
  /* fonts */
  --font-body: "Nunito", system-ui, sans-serif;
  --font-display: "Russo One", "Nunito", system-ui, sans-serif;

  /* type scale: size / line-height */
  --type-caption-size: 13px;   --type-caption-lh: 16px;    /* SemiBold 600 */
  --type-label-size: 16px;     --type-label-lh: 18px;      /* Bold 700 */
  --type-body-size: 16px;      --type-body-lh: 24px;       /* Regular 400 */
  --type-lead-size: 20px;      --type-lead-lh: 28px;       /* Regular 400 */
  --type-display-sm-size: 20px; --type-display-sm-lh: 24px; /* Russo One */
  --type-title-size: 28px;     --type-title-lh: 36px;
  --type-display-size: 40px;   --type-display-lh: 48px;
  --type-display-xl-size: 56px; --type-display-xl-lh: 64px;

  /* text */
  --text-primary: #3b2a33;
  --text-secondary: #4a3446;
  --text-muted: #7a6474;
  --text-placeholder: #7a6474;
  --text-on-dark: #fff4d6;

  /* surfaces */
  --surface-base: #fdf6e7;
  --surface-raised: #fff4d6;
  --surface-sunken: #fce2ab;
  --surface-accent: #ff7a59;
  --surface-negative-subtle: #ffd3c2;
  --surface-positive-subtle: #cdeec3;

  /* borders */
  --border-strong: #2a1e2e;
  --border-subtle: #f7e3bf;

  /* icons */
  --icon-primary: #3b2a33;
  --icon-muted: #7a6474;
  --icon-disabled: #efd3a5;
  --icon-on-danger: #fdf6e7;

  /* controls */
  --control-ghost-hover: #f7e3bf;
  --control-ghost-pressed: #efd3a5;
  --control-ghost-selected: #f7e3bf;
  --control-selected: #cdeff3;
  --control-focus-ring: #3ec4d6;
  --control-danger-hover: #c94430;
  --control-danger-pressed: #a33626;
  --control-on-accent-hover: #ffab8f;
  --control-on-accent-pressed: #d65a3c;
  --control-glass-hover: #fff4d629;
  --control-glass-hover-border: #fff4d673;
  --control-glass-pressed: #2a1e2e47;
  --control-glass-pressed-border: #2a1e2e99;
  --control-glass-selected: #3ec4d64d;
  --control-field-bg: #fdf6e7;
  --control-field-bg-disabled: #fff4d6;
  --control-field-border: #efd3a5;
  --control-field-border-hover: #7a6474;
  --indicator-active: #ff7a59;
  --label-bg: #2a1e2e8c;

  /* app colours (title bars of active windows) */
  --app-notepad: #ff7a59;
  --app-explorer: #ffb547;
  --app-case: #7cc47a;

  /* sky */
  --bg-sky-top: #2c3e6b;
  --bg-sky-middle: #5e5a9e;
  --bg-sky-bottom: #c77fa6;

  /* game · deep space (Asteroids.exe) */
  --game-space: #161635;

  /* illustration palette */
  --ill-outline: #2a1e2e;
  --ill-ink: #4a3446;
  --ill-paper: #fdf6e7;
  --ill-paper-light: #fff4d6;
  --ill-paper-shade: #f7e3bf;
  --ill-gold-base: #ffb547; --ill-gold-light: #ffe7a3; --ill-gold-dark: #e89a3c; --ill-gold-shade: #e2a66b; --ill-gold-deep: #c27a34;
  --ill-coral-base: #ff7a59; --ill-coral-light: #ffab8f; --ill-coral-dark: #d65a3c;
  --ill-red-base: #e8553e; --ill-red-dark: #c94430;
  --ill-teal-base: #3ec4d6; --ill-teal-light: #8fe0ea; --ill-teal-dark: #2a9bb0;
  --ill-green-base: #7cc47a; --ill-green-light: #a8dca5; --ill-green-dark: #4f9a5a;
  --ill-violet-base: #5e5a9e; --ill-violet-light: #7f78c0; --ill-violet-pale: #dcd6f5;
  --ill-steel-base: #a79fb0; --ill-steel-light: #d9d2dd; --ill-steel-dark: #756c80;

  /* motion — "Пиксельный" press (from Figma component description) */
  --press-down: 60ms;
  --press-pop: 160ms;
}

/* ---------- Pixel primitives shared by every component ---------- */

/* Plate with 4px cut corners (Figma "Tile · vertical" + "Tile · horizontal") */
.px-plate {
  clip-path: polygon(4px 0, calc(100% - 4px) 0, calc(100% - 4px) 0, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 0 calc(100% - 4px), 0 4px);
}

/* 2px ring with stepped corners (Figma "Focus ring" / "Border": 4 bars + 4 corner pixels).
   Set --ring to the colour. Drawn by ::after so it never shifts layout. */
.px-ring { position: relative; --ring: transparent; } /* reset so nested rings never inherit a parent's colour */
.px-ring::after {
  content: "";
  position: absolute; inset: 0; pointer-events: none;
  --c: var(--ring, transparent);
  background:
    linear-gradient(var(--c), var(--c)) 4px 0 / calc(100% - 8px) 2px no-repeat,
    linear-gradient(var(--c), var(--c)) 4px 100% / calc(100% - 8px) 2px no-repeat,
    linear-gradient(var(--c), var(--c)) 0 4px / 2px calc(100% - 8px) no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 4px / 2px calc(100% - 8px) no-repeat,
    linear-gradient(var(--c), var(--c)) 2px 2px / 2px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) calc(100% - 2px) 2px / 2px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) 2px calc(100% - 2px) / 2px 2px no-repeat,
    linear-gradient(var(--c), var(--c)) calc(100% - 2px) calc(100% - 2px) / 2px 2px no-repeat;
}

/* 4px hard outline with notched corners (windows, start menu: "Outline top/bottom/left/right") */
.px-outline { position: relative; }
.px-outline::before {
  content: "";
  position: absolute; inset: 0; pointer-events: none; z-index: 3;
  --c: var(--outline, var(--border-strong));
  background:
    linear-gradient(var(--c), var(--c)) 4px 0 / calc(100% - 8px) 4px no-repeat,
    linear-gradient(var(--c), var(--c)) 4px 100% / calc(100% - 8px) 4px no-repeat,
    linear-gradient(var(--c), var(--c)) 0 4px / 4px calc(100% - 8px) no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 4px / 4px calc(100% - 8px) no-repeat;
}

/* Monochrome 16px interface glyph (inline SVG from js/glyphs.js), tinted by `color`.
   CSS masks are not used: Chrome blocks mask images on file:// pages. */
.glyph { display: block; width: 16px; height: 16px; flex: none; }

/* Pixel art is never smoothed */
img.px { image-rendering: pixelated; display: block; }
