/* ==========================================================================
   base.css — reset, typography, layout helpers, focus styles, reduced motion.
   MEGA_PROMPT §3 + §8. All values come from tokens.css.
   ========================================================================== */

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

* { margin: 0; padding: 0; }

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

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  font-weight: 400;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, picture, video, svg { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; }
ul, ol { list-style: none; }

/* --- Typography scale (§3.2) --- */
h1, h2, h3, h4 { font-weight: 700; line-height: var(--lh-heading); letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); line-height: var(--lh-tight); }
h2 { font-size: clamp(1.75rem, 4vw, 2.75rem); }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); font-weight: 600; }
p { margin-bottom: var(--space-4); }
p:last-child { margin-bottom: 0; }

.lead { font-size: var(--fs-md); line-height: var(--lh-body); }

/* Small uppercase eyebrow label above section headings */
.eyebrow {
  display: block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-3);
}
.eyebrow--accent { color: var(--color-accent); }
.eyebrow--muted { color: var(--color-text-muted); }
.on-dark .eyebrow--muted { color: var(--color-text-inverse-muted); }

/* --- Layout helpers --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--content-pad);
}

.section { padding-block: var(--section-pad); }
.section--surface { background: var(--color-surface); }
.section--dark { background: var(--color-bg-dark); color: var(--color-text-inverse); }
.on-dark { color: var(--color-text-inverse); }
.on-dark .muted { color: var(--color-text-inverse-muted); }
.muted { color: var(--color-text-muted); }

.section-head { max-width: 720px; margin-bottom: var(--space-7); }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head h2 { margin-bottom: var(--space-3); }
.section-head p { margin-bottom: 0; }

/* --- Links --- */
a { text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* --- Focus (WCAG 2.2 AA, §8) --- */
:focus { outline: none; }
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--color-focus);
  border-radius: var(--radius-sm);
}

/* --- Skip link --- */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 200;
  background: var(--color-bg-dark);
  color: var(--color-text-inverse);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: top var(--duration-fast) var(--ease);
}
.skip-link:focus { top: var(--space-4); text-decoration: none; }

/* --- No-JS fallback note --- */
.noscript-note {
  background: var(--color-bg-dark);
  color: var(--color-text-inverse);
  text-align: center;
  padding: var(--space-3) var(--content-pad);
  margin: 0;
}

/* --- Screen-reader only --- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

/* --- Reveal-on-scroll animation (disabled under reduced motion) --- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity var(--duration-med) var(--ease), transform var(--duration-med) var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

/* --- Responsive: section padding + content padding (§3.3) --- */
@media (max-width: 768px) {
  :root { --section-pad: 64px; --content-pad: 16px; }
}

/* --- Reduced motion (§3.4, §8) --- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
  .reveal { opacity: 1; transform: none; }
}
