/* ============================================================
   Corrosion Control — Base / Reset
   Minimal, opinionated. Applies the token system to bare HTML so
   specimen cards and kits inherit the look without boilerplate.
   ============================================================ */

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--surface-canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv01", "ss01";
}

h1, h2, h3, h4, h5, h6, p, figure { margin: 0; }

a { color: inherit; text-decoration: none; }

::selection {
  background: var(--accent-soft-strong);
  color: var(--text-primary);
}

/* Tabular numbers everywhere numbers matter */
.tnum { font-variant-numeric: tabular-nums; }

/* Custom scrollbars — quiet, on-brand */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-muted); background-clip: content-box; }

/* Focus-visible default */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* Reduced motion guard */
@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;
  }
}

/* ---- Skin-swap repaint guard ----
   When flipping data-game or data-theme on the root, add the .cc-skin-swap
   class for ONE frame. This suppresses transitions during the swap so every
   accent-consuming surface repaints immediately — works around a Chrome
   custom-property + transition staleness where elements that both read
   var(--accent)/var(--accent-text) AND have a color/background transition keep
   the old accent until the next reflow. See readme "Theming contract". */
.cc-skin-swap *,
.cc-skin-swap *::before,
.cc-skin-swap *::after { transition: none !important; }
