/* Reset, document defaults, typography. */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-app);
  color: var(--text-hi);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { color: var(--accent-text-hi); }

img, svg, video { max-width: 100%; height: auto; }

/**
 * The hidden attribute must always win.
 *
 * The UA rule is [hidden] { display: none }, which any class or id selector
 * that sets display outranks — so a component styled `display: flex` silently
 * ignores el.hidden = true and stays on screen. That bug has now shipped three
 * times here (the admin sign-in card, the avatar menu, the bell and its
 * badge), so it gets fixed once, at the root, rather than per selector.
 */
[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }

button {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Keyboard users need this; pointer users should never see it. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  border-radius: var(--r-xs);
  font-weight: 600;
}
.skip-link:focus { left: 8px; color: var(--accent-ink); }

::-webkit-scrollbar { width: 0; height: 0; }
* { scrollbar-width: none; }

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes toastUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Typography ──────────────────────────────────────────────────────────── */

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }

h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); line-height: 1.1; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.3rem, 3vw, 1.5rem); line-height: 1.2; }
h3 { font-size: 1.1rem; }
h4 { font-size: 0.95rem; }

p { margin: 0 0 1rem; color: var(--text-body); max-width: 64ch; }
p:last-child { margin-bottom: 0; }

.lede { font-size: clamp(1rem, 2.2vw, 1.15rem); color: var(--text-mute); }
.muted { color: var(--text-mute); }
.dim { color: var(--text-dim); }
.small { font-size: 13px; }

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
}

.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--accent-text); }
.neg { color: var(--danger); }

code {
  font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-size: 0.9em;
  background: var(--bg-tile);
  padding: 2px 6px;
  border-radius: 5px;
  color: var(--text-body);
}

hr { border: none; border-top: 1px solid var(--line-card); margin: 32px 0; }
