/*
 * 21 Young Hearts — Base Styles
 * Reset, base HTML elements, global typography, layout primitives,
 * and utility classes. Consumes tokens from tokens.css.
 * ─────────────────────────────────────────────────────────────────
 */

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip; /* clip not hidden — hidden breaks position:sticky */
  /* Disable the double-tap-to-zoom gesture (and its 300ms delay) while still
   * allowing pinch-to-zoom for accessibility. Stops accidental zoom on tap. */
  touch-action: manipulation;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  line-height: var(--leading-normal);
  color: var(--color-warm-black);
  background: white;
  overflow-x: clip; /* clip not hidden — hidden breaks position:sticky */
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── Base typographic elements ─────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: var(--leading-tight);
  font-weight: var(--weight-black);
  letter-spacing: -0.02em;
}

a {
  color: var(--color-blue);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
  transition: color var(--duration-fast) var(--ease-out);
}
a:hover { color: var(--color-blue-mid); }
a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* ── Layout primitives ─────────────────────────────────────────── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--container-gutter);
}
/* Edge gutter: 12px mobile (<600), a single 16px across the whole tablet band
 * (600–1099), then roomy 64px on desktop (≥1100). Tablet deliberately uses one
 * consistent tight gutter like mobile. */
@media (min-width: 600px)   { :root { --container-gutter: var(--space-md); } }
@media (min-width: 1100px)  { :root { --container-gutter: var(--space-3xl); } }

/* Outlined content boxes: tight 16px internal padding on mobile AND tablet,
 * roomier 24/32 only on desktop (≥1100) so tablet card padding matches mobile. */
@media (min-width: 1100px)  { :root { --box-pad: var(--space-lg) var(--space-xl); } }

.container--narrow {
  max-width: var(--max-width-narrow);
  margin: 0 auto;
  padding: 0 var(--container-gutter);
}

.section {
  padding: var(--space-2xl) 0;
}
@media (min-width: 600px) { .section { padding: var(--space-3xl) 0; } }
@media (min-width: 1100px) { .section { padding: var(--space-4xl) 0; } }

/* ── Typography helpers ────────────────────────────────────────── */
.eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-sm);
}

.section-heading {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-lg);
}
@media (min-width: 1100px) { .section-heading { font-size: var(--text-4xl); } }
@media (max-width: 600px)  { .section-heading { font-size: var(--text-2xl); } }

/* ── Accessibility utilities ───────────────────────────────────── */
.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;
}

/* Visually hidden until focused — used by the skip-to-content link.
 * Hidden at rest (no visual change), revealed on keyboard focus. */
.sr-only-focusable:not(:focus):not(:focus-within) {
  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 — appears top-left when focused, above all chrome. */
.skip-link:focus {
  position: fixed;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: 1000;
  display: inline-block;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-blue);
  color: white;
  font-weight: var(--weight-bold);
  text-decoration: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
}

/* Anchor target (page-builder Anchor Link component) — invisible, occupies
 * no space, but offsets the scroll position so the destination isn't hidden
 * behind the 76px sticky nav when jumped to via a hash link. */
.yh-anchor {
  display: block;
  height: 0;
  scroll-margin-top: 76px;
}

/* ── Shared panel style — comic-book aesthetic ─────────────────── */
.comic-panel {
  border: 4px solid var(--color-warm-black);
  border-radius: var(--radius-lg);
  box-shadow: 5px 5px 0 var(--color-warm-black);
}
