/* ============================================================
 * Base reset + element defaults.
 * ============================================================ */

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

* { margin: 0; }

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: var(--fs-16);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  background: var(--bg);
  color: var(--fg);
  min-height: 100dvh;
}

img, svg, video, canvas { display: block; max-width: 100%; }

a {
  color: var(--link);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

button { font: inherit; cursor: pointer; }

input, textarea, select {
  font: inherit;
  color: inherit;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

h1, h2, h3, h4 { line-height: var(--lh-tight); font-weight: 700; }

h1 { font-size: clamp(var(--fs-28), 4vw + 1rem, var(--fs-48)); }
h2 { font-size: clamp(var(--fs-22), 3vw + 1rem, var(--fs-36)); }
h3 { font-size: var(--fs-22); }

p { color: var(--fg-muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--fs-14);
  transition:
    background var(--dur-base) var(--easing),
    border-color var(--dur-base) var(--easing),
    transform var(--dur-fast) var(--easing);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn--lg { padding: var(--space-4) var(--space-6); font-size: var(--fs-16); }
.btn--primary {
  background: var(--primary);
  color: var(--primary-fg);
}
.btn--primary:hover { transform: translateY(-1px); }
.btn--ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--border-strong);
}
.btn--ghost:hover { background: var(--bg-elev); }

/* a11y — hide visually but keep for screen readers */
.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;
}

/* ==========================================================
   Phase 7 — global a11y + reduced-motion + focus
   ========================================================== */

/* Standardized focus ring: visible on keyboard navigation, suppressed
   on mouse-clicks (`:focus-visible` does the heavy lifting). */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 3px;
}
button:focus-visible,
.btn:focus-visible,
a:focus-visible {
  outline-offset: 3px;
}

/* Skip-to-content link is visually hidden until focused. */
.skip-to-content {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 9999;
  padding: 8px 16px;
  background: var(--primary);
  color: var(--primary-fg);
  border-radius: 4px;
  font-weight: 600;
  text-decoration: none;
}
.skip-to-content:focus,
.skip-to-content:focus-visible {
  left: 8px;
}

/* Honor user's motion preference: kill long/looping animations and
   transitions everywhere. We keep the structural transforms working
   so layout doesn't break, but the visible motion goes away. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
    scroll-behavior: auto !important;
  }
}

/* Respect `forced-colors` (Windows high-contrast). */
@media (forced-colors: active) {
  .btn--primary {
    background: ButtonFace;
    color: ButtonText;
    border: 1px solid ButtonText;
  }
  .cab-pill {
    border: 1px solid CanvasText;
  }
}
