/* ============================================================================
   CS2STAT — base.css
   Reset, document defaults, links, focus-visible, scrollbars, motion prefs,
   and a few generic helpers. Loaded after tokens.css, before legacy.css.

   NOTE: Tailwind CDN also ships a preflight reset. This file stays intentionally
   light and additive (focus-visible, scrollbars, reduced-motion, app frame)
   so it coexists with both Tailwind and the extracted legacy styles.
   ========================================================================== */

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

html {
  max-width: 100%;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  /* Layered frame: cool depth + faint grain. Avoids flat “AI black void”. */
  background:
    radial-gradient(1200px 700px at 12% -8%, rgba(48, 92, 140, 0.18), transparent 55%),
    radial-gradient(900px 520px at 92% 8%, rgba(255, 106, 18, 0.07), transparent 50%),
    radial-gradient(700px 480px at 70% 100%, rgba(40, 120, 130, 0.08), transparent 55%),
    var(--color-bg);
  background-attachment: fixed;
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.45;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

img, svg, video { max-width: 100%; }
input, select, textarea, button { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* Alpine.js: hide elements until Alpine initialises them. */
[x-cloak] { display: none !important; }

/* Keyboard focus only — never on mouse click. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 3px;
}
:where(a, button, input, select, textarea, summary, [tabindex]):focus:not(:focus-visible) {
  outline: none;
}

/* Thin, cool scrollbars to match the tactical frame. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-strong) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-track { background: transparent; }

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

/* ---- generic helpers ------------------------------------------------------ */
.u-visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.u-skip-link {
  position: absolute; left: 8px; top: -48px; z-index: var(--z-tooltip);
  padding: 8px 14px; border-radius: var(--radius-md);
  background: var(--color-primary); color: #fff; font-weight: var(--font-weight-bold);
  transition: top 0.16s ease;
}
.u-skip-link:focus { top: 8px; }
