/* =====================================================================
   FBM Design System v2 — base.css
   Reset, typography, focus, selection, scrollbars, minimal utilities.
   Requires tokens.css. Uses var(--…) only — no raw colors.
   ===================================================================== */

/* ---- Reset ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
}
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-14);
  line-height: var(--lh);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img, svg, video, canvas, picture { display: block; max-width: 100%; }
svg { flex-shrink: 0; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
ul[role="list"], ol[role="list"], nav ul, nav ol { list-style: none; padding: 0; }
table { border-collapse: collapse; border-spacing: 0; }
p, h1, h2, h3, h4, h5, h6, li, dd, dt { overflow-wrap: break-word; }
hr { border: 0; border-top: 1px solid var(--border); }
[hidden] { display: none !important; }

/* ---- Headings (dashboard scale, not editorial) ---------------------- */
h1, h2, h3, h4, h5, h6 { font-weight: var(--fw-semibold); line-height: var(--lh-tight); color: var(--ink); text-wrap: balance; }
h1 { font-size: var(--fs-22); font-weight: var(--fw-bold); }
h2 { font-size: var(--fs-18); }
h3 { font-size: var(--fs-16); }
h4 { font-size: var(--fs-14); }
h5, h6 { font-size: var(--fs-12); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
p { text-wrap: pretty; }
small { font-size: var(--fs-12); }
strong, b { font-weight: var(--fw-semibold); }
code, kbd, samp, pre { font-family: var(--mono); font-size: .92em; }

/* ---- Links ---------------------------------------------------------- */
a { color: var(--info); text-decoration: none; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }

/* ---- Focus, selection ----------------------------------------------- */
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-xs); }
::selection { background: var(--brand-amber-soft); color: var(--ink); }

/* ---- Scrollbars (subtle) -------------------------------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-pill); border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--ink-3); }

/* ---- Utilities (kept minimal on purpose) ---------------------------- */
.fbm-sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.fbm-muted { color: var(--ink-2); }
.fbm-num { font-variant-numeric: tabular-nums; white-space: nowrap; }

.fbm-stack-2, .fbm-stack-3, .fbm-stack-4, .fbm-stack-6 { display: flex; flex-direction: column; }
.fbm-stack-2 { gap: var(--sp-2); }
.fbm-stack-3 { gap: var(--sp-3); }
.fbm-stack-4 { gap: var(--sp-4); }
.fbm-stack-6 { gap: var(--sp-6); }
.fbm-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }

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