/* ═══════════════════════════════════════════════════════════════════════
   CardToDeal v2 — global.css
   Resets + base element styling. Consumes tokens.css. No colors or font
   names are hardcoded here; everything resolves to a token.
   Load order: tokens.css → global.css → components.css
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Reset ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 70px;            /* sticky nav offset for #anchors */
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-md);
  font-weight: var(--fw-regular);
  line-height: var(--lh-base);
  color: var(--tx);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100svh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background var(--dur-base) var(--ease-out-quart),
              color var(--dur-base) var(--ease-out-quart);
}

/* Light type on dark surfaces reads thinner: give it more air */
[data-theme="dark"] body { line-height: 1.66; }

/* ── Headings (Bricolage Grotesque display) ─────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-snug);
  color: var(--tx);
  text-wrap: balance;
}
h1 { font-size: var(--fs-3xl); line-height: var(--lh-tight); letter-spacing: var(--ls-tight); }
h2 { font-size: var(--fs-2xl); letter-spacing: var(--ls-tight); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
h5, h6 { font-size: var(--fs-md); }

p { text-wrap: pretty; }

/* ── Links ──────────────────────────────────────────────────────────── */
a {
  color: var(--acc);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out-quart);
}
a:hover { color: var(--a2); }
[data-theme="dark"] a:hover { color: var(--tx); }

/* ── Media ──────────────────────────────────────────────────────────── */
img, svg, video, canvas { max-width: 100%; height: auto; display: block; }
svg { fill: currentColor; }

/* ── Form elements ──────────────────────────────────────────────────── */
button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  letter-spacing: inherit;
}
button { background: none; border: none; cursor: pointer; }
:disabled { cursor: not-allowed; }

ul, ol { list-style: none; }

/* ── Focus + selection (a11y) ───────────────────────────────────────── */
:focus-visible {
  outline: var(--bw3) solid var(--acc);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
::selection { background: var(--fade); color: var(--tx); }

/* ── Reduced-motion safety net ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══ Layout utilities ═══════════════════════════════════════════════ */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}
.container--wide { max-width: var(--container-wide); }
.section { padding-block: var(--sp-section); }
.measure { max-width: var(--measure); }
.u-hide { display: none !important; }
.u-mobile-only { display: none; }
.u-mt-6 { margin-top: var(--sp-6); }
@media (max-width: 860px) {
  .u-desktop-only { display: none !important; }
  .u-mobile-only { display: block; }
}

/* Kicker / eyebrow label (single deliberate use, not per-section scaffolding) */
.kicker {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--acc);
}

/* Accessible visually-hidden (skip links, sr-only labels) */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: var(--sp-2); top: -100px;
  z-index: var(--z-toast);
  padding: var(--sp-2) var(--sp-4);
  background: var(--acc);
  color: var(--on-acc);
  border-radius: var(--r-sm);
  font-weight: var(--fw-semibold);
  transition: top var(--dur-fast) var(--ease-out-quart);
}
.skip-link:focus { top: var(--sp-2); color: var(--on-acc); }

/* ── Entrance animation (subtle, opt-in via .reveal) ────────────────── */
@keyframes ctd-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.reveal { animation: ctd-rise var(--dur-slow) var(--ease-out-expo) both; }

/* Scroll-reveal (anim.js adds .is-in when in view) */
.reveal-on-scroll { opacity: 0; transform: translateY(18px); transition: opacity var(--dur-slow) var(--ease-out-expo), transform var(--dur-slow) var(--ease-out-expo); }
.reveal-on-scroll.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal-on-scroll { opacity: 1; transform: none; transition: none; } }
.reveal[data-delay="1"] { animation-delay: 60ms; }
.reveal[data-delay="2"] { animation-delay: 120ms; }
.reveal[data-delay="3"] { animation-delay: 180ms; }
.reveal[data-delay="4"] { animation-delay: 240ms; }
