/* ============================================================
   Living Research OS — design tokens (Section 04)
   All themes share one set of CSS variables.
   ============================================================ */
:root {
  --desk-bg: #B8AFE2;
  --desk-bg-2: #A9BCE5;
  --win-bg: #FFF9EE;
  --win-bg-2: #F6EFE2;
  --face: #EDE6F7;
  --title-active: #D4BDEB;
  --title-inactive: #DCDCE8;
  --pink: #F3C5DC;
  --blue: #A6C9EC;
  --mint: #B5E6D0;
  --cream: #F8E4A1;
  --border: #51466F;
  --text: #302D43;
  --text-2: #68647B;
  --link: #5B47A6;
  --hi: #FFFFFF;
  --shadow: #A79BCF;
  --grid-line: rgba(255, 255, 255, .22);
  --bios-bg: #080C0A;
  --bios-text: #A9D8B0;
  --splash-bg: #19172D;
  --chip-text: #302D43;
  --ok: #3F9B72;
  --warn: #B07A12;
  --bad: #C2486A;

  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --font-pixel: 'Pixelify Sans', 'Silkscreen', ui-monospace, monospace;
  --font-label: 'Silkscreen', 'Pixelify Sans', ui-monospace, monospace;
  --font-sans: 'IBM Plex Sans', Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif: 'IBM Plex Serif', Georgia, 'Times New Roman', serif;

  --menubar-h: 30px;
  --taskbar-h: 42px;
  --bevel: inset 2px 2px 0 var(--hi), inset -2px -2px 0 var(--shadow);
  --bevel-in: inset 2px 2px 0 var(--shadow), inset -2px -2px 0 var(--hi);
  --drop: 4px 4px 0 rgba(48, 45, 67, .28);
}

[data-theme="midnight"] {
  --desk-bg: #2E2A52;
  --desk-bg-2: #1E2747;
  --win-bg: #24213A;
  --win-bg-2: #2C2846;
  --face: #35304F;
  --title-active: #5D4E92;
  --title-inactive: #3A3656;
  --border: #0E0C1C;
  --text: #ECE8F7;
  --text-2: #B6B0CE;
  --link: #C7B6FF;
  --hi: #5C5585;
  --shadow: #15122A;
  --grid-line: rgba(180, 170, 255, .10);
  --drop: 4px 4px 0 rgba(0, 0, 0, .45);
  --ok: #7FD8AE;
  --warn: #F2CB6B;
  --bad: #FF9DB8;
}

[data-theme="strawberry"] {
  --desk-bg: #F3C5DC;
  --desk-bg-2: #F8DCCB;
  --title-active: #F2A7C8;
  --title-inactive: #EEDDE6;
  --face: #FBEAF1;
  --shadow: #D9A3BE;
  --border: #6A3E5C;
  --link: #A23B72;
}

[data-theme="mint"] {
  --desk-bg: #B5E6D0;
  --desk-bg-2: #A6D8E6;
  --title-active: #9BD8C0;
  --title-inactive: #DCE8E3;
  --face: #E8F6EF;
  --shadow: #8FC3AD;
  --border: #2F5A50;
  --link: #2A7A62;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--splash-bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
body.mode-academic { overflow: auto; background: var(--win-bg); }
img { image-rendering: pixelated; image-rendering: crisp-edges; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--link); }
[hidden] { display: none !important; }

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 99999;
  background: var(--cream); color: #302D43; padding: 8px 12px; border: 2px solid var(--border);
  font-family: var(--font-pixel);
}
.skip-link:focus { top: 8px; }

:focus-visible { outline: 2px dashed var(--border); outline-offset: 2px; }
[data-theme="midnight"] :focus-visible { outline-color: #F3C5DC; }

/* ---------- retro controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 30px; padding: 4px 12px;
  background: var(--face); color: var(--text);
  border: 2px solid var(--border); border-radius: 0;
  box-shadow: var(--bevel);
  font-family: var(--font-pixel); font-size: 14px; cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.03); }
.btn:active, .btn[aria-pressed="true"] { box-shadow: var(--bevel-in); }
.btn.primary { background: var(--title-active); }
.btn.small { min-height: 24px; padding: 2px 8px; font-size: 12px; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; }

.field {
  min-height: 30px; padding: 4px 8px;
  background: var(--hi); color: var(--text);
  border: 2px solid var(--border); border-radius: 0;
  box-shadow: var(--bevel-in);
  font-family: var(--font-sans); font-size: 14px;
}
[data-theme="midnight"] .field { background: #1A1830; }

.chip {
  display: inline-block; padding: 1px 7px; margin: 2px 4px 2px 0;
  font-family: var(--font-label); font-size: 10px; letter-spacing: .02em;
  color: var(--chip-text); background: var(--blue);
  border: 2px solid var(--border);
}
.chip.pink { background: var(--pink); }
.chip.mint { background: var(--mint); }
.chip.cream { background: var(--cream); }
.chip.lav { background: #D4BDEB; }
.chip.grey { background: #DCDCE8; }

.pixel-icon { width: 32px; height: 32px; image-rendering: pixelated; flex: none; }

/* ---------- toasts ---------- */
.toasts {
  position: fixed; right: 12px; bottom: calc(var(--taskbar-h) + 12px); z-index: 6000;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 220px; max-width: 320px; padding: 8px 12px;
  background: var(--win-bg); color: var(--text);
  border: 2px solid var(--border); box-shadow: var(--bevel), var(--drop);
  font-family: var(--font-pixel); font-size: 13px;
  animation: toast-in .18s steps(3) both;
}
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.noscript { padding: 32px; background: #FFF9EE; color: #302D43; font-family: Georgia, serif; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
}
