/* ==========================================================
   Mac OS 9 Platinum chrome — tokens, fonts, desktop
   Load AFTER styles/tokens.css. Brand layer (colors, logo, stickers,
   Anton, stars) comes from tokens.css and is untouched here.
   All --os-* tokens are semantic and redefined per theme.
   Light = platinum (main look). Dark = graphite: same shapes, darker grays.
   Bevels are pixel-crisp: 1px offsets, never any blur.
   ========================================================== */

/* Chicago Kare by Duane King — MIT license, see Assets/fonts/chicago-kare/LICENSE.txt
   https://github.com/KingDuane/Chicago-Kare */
@font-face {
  font-family: "Chicago Kare";
  src: url("../Assets/fonts/chicago-kare/ChicagoKare-Regular.woff2") format("woff2"),
       url("../Assets/fonts/chicago-kare/ChicagoKare-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ---------- Shared (non-color) ---------- */
:root {
  --os-font-chrome: var(--font-chrome);      /* alias: titles, menu bar, buttons, labels (styles/tokens.css) */
  --os-font-ui: var(--font-chrome-text);     /* alias: small UI text (Geneva is local-only, never bundled) */
  --os-font-prose: var(--font-body);         /* Inter, long paragraphs */
  --os-size: calc(12px * var(--chrome-scale));
  --menubar-h: 22px;
  --os-titlebar-h: 20px;
  --os-radius-btn: 4px;
  --z-os-float: 500;      /* floating widgets sit above document windows */
  --z-os-menubar: 8000;   /* under the CRT overlay (9000); the toggle tray is above it */
  --player-gloss: 100%;   /* strength of the player's highlight/glare/sheen (one knob to retune all of it) */
  --os-screen: #000000;    /* media-player screen (Work cards): black in both themes */
}

/* ---------- LIGHT: platinum (default) ---------- */
:root,
:root[data-theme="light"] {
  --os-face: #dddddd;          /* platinum base */
  --os-face-pressed: #a5a5a5;
  --os-btn-face: #e6e6e6;
  --os-hi: #ffffff;            /* highlight edge, top/left */
  --os-lo: #888888;            /* shadow edge, bottom/right */
  --os-lo-soft: #b4b4b4;
  --os-outline: #1c1c1c;       /* 1px near-black outer border */
  --os-content: #ffffff;       /* window content */
  --os-field: #ffffff;         /* checkbox, radio, text field */
  --os-field-edge: var(--os-outline);
  --os-text: #111111;          /* 13.9:1 on face, 18.9:1 on content */
  --os-text-muted: #4d4d4d;    /* 6.2:1 on face */
  --os-text-inactive: #5c5c5c; /* inactive window titles, 4.9:1 */
  --os-text-disabled: #6e6e6e;
  --os-link: var(--link);      /* blue, 8.1:1 on white */
  --os-focus: var(--fill);
  --os-select-bg: var(--fill); /* menu + selection highlight: brand blue */
  --os-select-text: var(--on-fill);
  --os-stripe-a: #f7f7f7;      /* title bar pinstripes */
  --os-stripe-b: #a9a9a9;
  --os-track: #c9c9c9;
  --os-thumb: #b9c1d3;         /* platinum thumb, faint blue-gray */
  --os-thumb-grip-a: #ffffff;
  --os-thumb-grip-b: #6b7385;
  --os-widget-bar: #111111;    /* black title bar on floating widgets */
  --os-on-widget-bar: #ffffff;
  --os-win-shadow: 2px 2px 0 rgb(0 0 0 / 0.35);
  --os-progress: var(--fill);
  --os-progress-stripe: rgb(255 255 255 / 0.35);
  --os-led: var(--accent-2);   /* pink, decoration only */

  /* Music player gloss (components/player.css). Light: medium-subtle shine */
  --player-body-top: color-mix(in srgb, var(--os-face) 72%, var(--os-hi));
  --player-body-bottom: color-mix(in srgb, var(--os-face) 82%, var(--os-lo));
  --player-highlight: rgb(255 255 255 / 0.7);  /* curved highlight, upper body */
  --player-reflect: rgb(255 255 255 / 0.5);    /* light band near the bottom edge */
  --player-edge: rgb(255 255 255 / 0.85);      /* thin bright inner edge */
  --player-glare: rgb(255 255 255 / 0.22);     /* diagonal glare on the screen glass */
  --player-sheen: rgb(255 255 255 / 0.6);      /* click wheel + center button */
  --player-bezel-a: #8e8e94;                   /* screen bezel, lit corner */
  --player-bezel-b: #5a5a60;                   /* screen bezel, shadowed corner */
  --player-focus: var(--os-focus);             /* focus ring on the glossy body */
  --player-sticker-border: #ffffff;            /* white sticker border on the body stickers */
  --player-sticker-shadow: rgb(0 0 0 / 0.22);  /* tight, faint, hard shadow: sits flat */

  /* Desktop: the wallpaper (components/wallpaper.css); this solid color shows under it while it loads */
  --os-wallpaper-fallback: var(--blue);
  /* Desktop-colored bits (labels on the desktop, the old blue desktop's shades) */
  --os-desk: var(--blue);
  --os-desk-hi: #1a5db8;
  --os-desk-lo: #003c8f;
  --os-desk-label: #ffffff;     /* 8.1:1 on blue, >= 5.3:1 on the lightest swirl */
  --os-desk-label-shadow: rgb(0 0 0 / 0.5);
  --os-desk-sel-bg: #ffffff;    /* selected icon = inverted label */
  --os-desk-sel-text: #111111;

  --os-arrow-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4'%3E%3Cpath d='M3.5 0 7 4H0z' fill='%23111'/%3E%3C/svg%3E");
  --os-arrow-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4'%3E%3Cpath d='M0 0h7L3.5 4z' fill='%23111'/%3E%3C/svg%3E");
  --os-arrow-updown: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='11'%3E%3Cpath d='M3.5 0 7 4H0zM0 7h7l-3.5 4z' fill='%23111'/%3E%3C/svg%3E");

  /* CRT retune for platinum: lighter scanlines + stripes so grays stay clean */
  --crt-scan: rgba(0, 0, 0, 0.06);
  --crt-flicker: rgba(18, 16, 16, 0.03);
  --crt-stripes: linear-gradient(90deg, rgba(255, 0, 0, 0.025), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.025));
  --crt-split-a: rgb(0 74 173 / 0.25);
  --crt-split-b: rgb(255 64 129 / 0.2);
}

/* ---------- DARK: graphite ---------- */
:root[data-theme="dark"] {
  --os-face: #4b4b50;
  --os-face-pressed: #2e2e32;
  --os-btn-face: #55555a;
  --os-hi: #727278;
  --os-lo: #2a2a2e;
  --os-lo-soft: #3a3a3e;
  --os-outline: #0b0b0c;
  --os-content: var(--charcoal);
  --os-field: #46464b;          /* lifted off charcoal so fields stay visible; paper text 8.3:1 */
  --os-field-edge: #8a8a90;     /* control boundary 4.2:1 against charcoal */
  --os-text: var(--paper);      /* 7.7:1 on face, 12.2:1 on content */
  --os-text-muted: #d0d2d5;     /* 5.7:1 on face */
  --os-text-inactive: #bdbfc3;  /* 4.7:1 */
  --os-text-disabled: #a4a6aa;
  --os-link: var(--link);       /* blue-light, 5.7:1 on charcoal */
  --os-focus: var(--blue-light);
  --os-select-bg: var(--fill);
  --os-select-text: var(--on-fill);
  --os-stripe-a: #606066;
  --os-stripe-b: #38383c;
  --os-track: #3a3a3e;
  --os-thumb: #6a6f7a;
  --os-thumb-grip-a: #9a9fa9;
  --os-thumb-grip-b: #2a2a2e;
  --os-widget-bar: #0b0b0c;
  --os-on-widget-bar: #ffffff;
  --os-win-shadow: 2px 2px 0 rgb(0 0 0 / 0.6);
  --os-progress: var(--fill);
  --os-progress-stripe: rgb(255 255 255 / 0.25);
  --os-led: var(--accent-2);

  /* Music player gloss: toned down so graphite doesn't look washed out */
  --player-body-top: color-mix(in srgb, var(--os-face) 78%, var(--os-hi));
  --player-body-bottom: color-mix(in srgb, var(--os-face) 80%, var(--os-lo));
  --player-highlight: rgb(255 255 255 / 0.16);
  --player-reflect: rgb(255 255 255 / 0.08);
  --player-edge: rgb(255 255 255 / 0.22);
  --player-glare: rgb(255 255 255 / 0.07);
  --player-sheen: rgb(255 255 255 / 0.14);
  --player-bezel-a: #3c3c40;
  --player-bezel-b: #1d1d20;
  --player-focus: var(--os-text);              /* blue-light is too faint on graphite gloss (2:1); paper is >= 4.6:1 */
  --player-sticker-border: #ffffff;
  --player-sticker-shadow: rgb(0 0 0 / 0.45);

  --os-wallpaper-fallback: #1c1446; /* deep indigo, under the night wallpaper */
  --os-desk: #003c8f;
  --os-desk-hi: var(--blue);
  --os-desk-lo: #00214f;
  --os-desk-label: #ffffff;
  --os-desk-label-shadow: rgb(0 0 0 / 0.6);
  --os-desk-sel-bg: #ffffff;
  --os-desk-sel-text: #111111;

  --os-arrow-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4'%3E%3Cpath d='M3.5 0 7 4H0z' fill='%23f0f1f1'/%3E%3C/svg%3E");
  --os-arrow-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='4'%3E%3Cpath d='M0 0h7L3.5 4z' fill='%23f0f1f1'/%3E%3C/svg%3E");
  --os-arrow-updown: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='11'%3E%3Cpath d='M3.5 0 7 4H0zM0 7h7l-3.5 4z' fill='%23f0f1f1'/%3E%3C/svg%3E");

  --crt-scan: rgba(0, 0, 0, 0.2);
  --crt-flicker: rgba(18, 16, 16, 0.08);
  --crt-stripes: linear-gradient(90deg, rgba(255, 0, 0, 0.05), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.05));
}

/* ---------- Desktop page ---------- */
body.os-desktop {
  min-height: 100vh;
  font-family: var(--font-chrome-text);
  font-size: var(--os-size);
  color: var(--os-text);
  background: transparent; /* the desktop is the wallpaper (components/wallpaper.css), with its fallback color on <html> */
}

/* Interface text follows the font mode's letter spacing (--chrome-tracking, styles/tokens.css).
   Components with their own letter-spacing add it in their own rule. */
:is(.os-menubar, .os-win__bar, .os-browser__toolbar, .os-btn, .os-dock__item, .os-label, .os-choice, .os-alert, .qt-bar, .qt-controls) {
  letter-spacing: var(--chrome-tracking);
}

/* Long paragraphs inside chrome stay readable: Inter 16px */
.os-prose {
  font-family: var(--os-font-prose);
  font-size: var(--text-base);
  line-height: var(--leading-body);
}

/* CRT color split on OS 9 chrome labels (crt.css already covers h1–h4/.display) */
body.crt-on :is(.os-menu__item, .os-btn, .os-widget__title) {
  animation: crt-split 3s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  body.crt-on :is(.os-menu__item, .os-btn, .os-widget__title) {
    animation: none;
    text-shadow: none;
  }
}
