/* ==========================================================================
   MODS4 — BASE: modern reset + global typography
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-color: var(--border-strong) transparent;
}

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--tracking);
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--bg-pattern);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

/* Media defaults — kill CLS, keep responsive */
img, picture, svg, video, canvas {
  display: block;
  max-width: 100%;
  height: auto;
}
img { background-color: var(--surface-2); }

/* Form controls inherit type */
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }

/* Headings */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-strong);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: 0.01em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-display); }
h2 { font-size: var(--fs-title); }
h3 { font-size: var(--fs-h2); }
h4 { font-size: var(--fs-h3); }
h5, h6 { font-size: var(--fs-body); }

p { text-wrap: pretty; }

/* Links */
a {
  color: var(--accent-hover);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--accent); }

strong, b { font-weight: var(--fw-semibold); color: var(--text-strong); }
small { font-size: var(--fs-xs); }

ul, ol { padding-left: 1.25em; }
li { margin-bottom: var(--space-1); }

code, pre, kbd { font-family: var(--font-mono); font-size: 0.9em; }

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

/* Accessible focus — only for keyboard users */
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--radius-sm);
}

/* Skip link */
.skip-link {
  position: fixed;
  left: var(--space-3);
  top: -100px;
  z-index: var(--z-toast);
  padding: var(--space-2) var(--space-4);
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: var(--radius-sm);
  font-size: var(--fs-meta);
  font-weight: var(--fw-semibold);
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: var(--space-3); color: var(--accent-contrast); }

/* Custom scrollbars (WebKit) */
::-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: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* Utility: vertical rhythm stack */
.stack { display: flex; flex-direction: column; gap: var(--space-5); }

/* Utility: visually hidden but screen-reader available */
.screen-reader-text,
.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;
}

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