/* ============================================================
 * base.css — reset, typography, focus, scrollbars
 * Loaded after tokens.css.
 * ============================================================ */

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

/* HTML hidden attribute — must beat any class-based display rule.
   Without !important, .btn[hidden] etc. stay visible because
   `.btn { display: inline-flex }` in components.css has equal
   specificity but later source order, so it wins on a tie.
   This rule is the foundation the data-cap / data-role-* gates
   in shell.js depend on — without it, hidden=true is a no-op
   on any styled element. See CLAUDE.md §14. */
[hidden] { display: none !important; }

html {
  /* Root owns the page wash. Painting html (NOT body) means CSS's
     root-background propagation rule fills the entire canvas — including
     the macOS overscroll-bounce area — with the page color. Painting
     body instead can leave the overscroll area showing the OS/system
     default, which appears as a dark strip on dark-OS-mode setups.
     DevTools sees only one paint layer this way (was duplicated across
     html + body before — same color, but two stacked layers). */
  background: var(--bg-alt);
}

html, body {
  margin: 0;
  padding: 0;
  color: var(--text);
  /* Brand all native form chrome that supports it (checkboxes, radios,
     range, progress, native select highlight on Chromium). Themes that
     swap --primary automatically rebrand these too. */
  accent-color: var(--primary);
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
  text-rendering: optimizeLegibility;
}

/* native element resets */
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-700); }

/* headings */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }

p { margin: 0; }

/* code */
code, kbd, pre {
  font-family: var(--font-mono);
  font-size: var(--fs-md);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--space-6) 0;
}

/* focus — visible only when keyboard navigating */
:focus { outline: 0; }
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* scrollbar — subtle, mac-like */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 2px solid transparent;
  background-clip: content-box;
  border-radius: var(--radius-pill);
}
*::-webkit-scrollbar-thumb:hover { background-color: var(--text-4); background-clip: content-box; }

/* selection */
::selection { background: var(--primary-100); color: var(--primary-700); }
