/* ══════════════════════════════════════════════════════════════════════════
   Base layer (UI-Redesign Phase 2, 2026-10-22): reset, document defaults,
   fonts that aren't tokens. Tokens only — see DESIGN.md / tokens.css.
   ══════════════════════════════════════════════════════════════════════════ */

/* IBM Plex: Mono for log-structured data (timestamps, counts), Sans as one
   of the two user-selectable chat fonts. Self-hosted, SIL OFL 1.1. One
   variable file covers all Sans weights. */
@font-face { font-family: 'IBM Plex Sans'; src: url('/assets/fonts/ibm-plex-sans.woff2') format('woff2'); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/assets/fonts/ibm-plex-mono-regular.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('/assets/fonts/ibm-plex-mono-medium.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* One rule for the whole app instead of a [hidden] override per component:
   any class that sets `display` would otherwise beat the UA [hidden] rule
   (author origin wins regardless of specificity) — the bug class behind
   several earlier fixes (settings panes, dashboard skeleton, …). */
[hidden] { display: none !important; }

:root {
  color-scheme: dark;
  /* The chat font is a user setting (settings.js overrides both). */
  --chat-font-family: 'IBM Plex Sans', var(--font-ui);
  --chat-font-size: var(--fs-sm);
}

html, body { height: 100%; }

body {
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  letter-spacing: var(--ls-tight);
  color: var(--color-text-primary);
  background: var(--color-bg-canvas);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01'; /* Inter: single-storey a, open digits — calmer in dense lists */
}

button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: var(--color-accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; }
svg { flex-shrink: 0; }

h1, h2, h3, h4 { font-weight: var(--fw-semibold); line-height: var(--lh-tight); }

::selection { background: var(--color-accent-subtle); }
::placeholder { color: var(--color-text-tertiary); opacity: 1; }

:focus-visible {
  outline: var(--bw-thick) solid var(--color-focus-ring);
  outline-offset: var(--focus-offset);
}
:focus:not(:focus-visible) { outline: none; }

/* Thin, quiet scrollbars — a gray step, never the accent. */
* { scrollbar-width: thin; scrollbar-color: var(--color-border-strong) transparent; }
::-webkit-scrollbar { width: var(--s-2); height: var(--s-2); }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: var(--r-full); border: var(--s-0-5) solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--color-border-strong); }

.mono { font-family: var(--font-mono); letter-spacing: 0; }
.tnum { font-variant-numeric: tabular-nums; }
.sr-only {
  position: absolute; width: var(--s-px); height: var(--s-px);
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(var(--s-1)); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }
