/* =============================================================
   BASE — reset + typography defaults + utilities
   Loaded after tokens.css. Edit tokens.css for design changes;
   only edit this file for structural CSS changes.
   ============================================================= */

/* -------------------- modern reset -------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html, body { height: 100%; }
html {
  font-size: var(--fs-base);
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  /* Anchor links (#section) land below the fixed header, not under it. */
  scroll-padding-top: calc(var(--header-height) + var(--space-3));
}
body {
  font-family: var(--font-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  /* Reserve space for the position:fixed header. The header overlays
     this padded area at the top of the page (with a translucent blur),
     and the actual content begins below it — preventing layout shift
     when the partial loads. */
  padding-top: var(--header-height-tall);
}
img, picture, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }

/* -------------------- typography -------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
  text-wrap: balance;
}
h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }
h5 { font-size: var(--fs-lg); font-family: var(--font-body); font-weight: var(--fw-semibold); letter-spacing: 0; }
h6 { font-size: var(--fs-md); font-family: var(--font-body); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: var(--tracking-wide); }

p { color: var(--color-text-soft); }
p + p { margin-top: 0.9em; }

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--color-link-hover); }

::selection { background: var(--color-accent); color: var(--color-accent-contrast); }

/* -------------------- accessibility -------------------- */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}
.skip-link {
  position: absolute;
  left: -9999px;
  top: var(--space-3);
  background: var(--color-text);
  color: var(--color-text-inverse);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  z-index: var(--z-modal);
}
.skip-link:focus { left: var(--space-3); }

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

/* -------------------- layout helpers -------------------- */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin-inline: auto;
  padding-inline: var(--container-gutter);
}
.container--narrow { max-width: var(--container-narrow); }

main { flex: 1 0 auto; }

.section { padding-block: var(--section-pad-y); }
.section--lg { padding-block: var(--section-pad-y-lg); }
.section--alt { background: var(--color-bg-alt); }
.section--cream { background: var(--color-bg-cream); }

.section__header {
  text-align: center;
  max-width: 720px;
  margin: 0 auto var(--space-7);
}
.section__eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}
.section__title { margin-bottom: var(--space-4); }
.section__lede {
  font-size: var(--fs-lg);
  color: var(--color-text-muted);
  max-width: 60ch;
  margin-inline: auto;
}

/* -------------------- utility classes -------------------- */
.u-text-center { text-align: center; }
.u-text-left   { text-align: left; }
.u-text-right  { text-align: right; }
.u-mx-auto     { margin-inline: auto; }
.u-visually-hidden {
  position: absolute !important;
  clip: rect(0 0 0 0); width: 1px; height: 1px;
  overflow: hidden; white-space: nowrap;
}

/* Fluid grid helpers */
.grid { display: grid; gap: var(--space-6); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }

/* Aspect ratio boxes for swappable images */
.aspect-book   { aspect-ratio: 2 / 3; }     /* book covers */
.aspect-portrait { aspect-ratio: 4 / 5; }   /* author portrait */
.aspect-square { aspect-ratio: 1 / 1; }
.aspect-wide   { aspect-ratio: 16 / 9; }
.aspect-hero   { aspect-ratio: 21 / 9; }
