/* css/base.css */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400;1,500&family=Inter:wght@300;400;500;600&display=swap');

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: auto; /* Lenis handles smooth scroll — native smooth would double-smooth */
  background: var(--bg);
}

html, body { overflow-x: hidden; }

body {
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

main, section { overflow-x: clip; }

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

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: var(--lh-tight);
  color: var(--fg-strong);
  letter-spacing: var(--tracking-tight);
}

h1 { font-size: var(--fs-4xl); font-style: italic; }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-xl); }

p { max-width: 62ch; }
p + p { margin-top: var(--sp-4); }

em, .italic { font-style: italic; font-family: var(--font-display); color: var(--accent); }

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

.container--narrow { max-width: 880px; }
.container--text   { max-width: var(--max-w-text); }

.eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--accent-text); /* #7a5c2c = 5.33:1 on cream — WCAG AA pass */
}

.divider {
  display: block;
  width: 40px;
  height: 1px;
  background: var(--accent);
  border: 0;
  margin: var(--sp-6) 0;
}
.divider--center { margin-inline: auto; }

.section {
  padding-block: var(--section-y);
}

.section--alt { background: var(--bg-alt); }
.section--dark { background: var(--bg-dark); color: var(--c-cream); }
.section--dark h1, .section--dark h2, .section--dark h3, .section--dark h4 { color: var(--c-offwhite); }

/* Reveal base state — motion.js toggles .is-in */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  will-change: opacity, transform;
}
.reveal.is-in { opacity: 1; transform: translateY(0); }
.reveal[data-delay="1"].is-in { transition-delay: 0.08s; }
.reveal[data-delay="2"].is-in { transition-delay: 0.16s; }
.reveal[data-delay="3"].is-in { transition-delay: 0.24s; }
.reveal[data-delay="4"].is-in { transition-delay: 0.32s; }
.reveal[data-delay="5"].is-in { transition-delay: 0.40s; }

/* Focus */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Selection */
::selection { background: var(--c-champagne); color: var(--c-brown); }

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

.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;
}

/* ========== Split text (Splitting.js output) ========== */
.split { overflow: hidden; }
.split .word, .split .char {
  display: inline-block;
  transform: translateY(110%) rotate(4deg);
  opacity: 0;
  transition: transform 1.1s var(--ease), opacity 0.8s var(--ease);
  transition-delay: calc(var(--char-index, 0) * 22ms);
  will-change: transform, opacity;
}
.split.is-in .word, .split.is-in .char {
  transform: translateY(0) rotate(0);
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .split .word, .split .char { transform: none; opacity: 1; transition: none; }
}
