/* ============================================================
   BASE — reset, elements, utilities
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--text-on-light);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip; /* NOT hidden — hidden on body kills position:sticky descendants */
}

/* ---- Preloader ---- */
#preloader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--cream);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-md);
  transition: opacity 0.6s var(--ease-out), visibility 0.6s var(--ease-out);
}
#preloader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.preloader__mark img {
  height: 56px; width: auto;
  opacity: 0;
  transform: scale(0.92) translateY(6px);
  animation: preloader-in 0.7s var(--ease-out) 0.15s forwards;
}
.preloader__bar {
  position: relative;
  width: 140px; height: 2px;
  background: rgba(20, 30, 12, 0.1);
  border-radius: 2px;
  overflow: hidden;
  opacity: 0;
  animation: preloader-in 0.5s var(--ease-out) 0.4s forwards;
}
.preloader__bar span {
  position: absolute; top: 0; left: -40px;
  height: 100%; width: 40px;
  background: var(--accent-bright);
  border-radius: 2px;
  animation: preloader-sweep 1.1s ease-in-out infinite;
}
@keyframes preloader-in { to { opacity: 1; transform: none; } }
@keyframes preloader-sweep { 0% { left: -40px; } 100% { left: 140px; } }
@media (prefers-reduced-motion: reduce) {
  #preloader { transition: opacity 0.2s linear; }
  .preloader__mark img, .preloader__bar { animation: none; opacity: 1; transform: none; }
  .preloader__bar span { animation: none; width: 100%; left: 0; }
}

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

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p, figure { margin: 0; }

[hidden] { display: none !important; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: inherit;
  overflow-wrap: break-word;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-deep);
}
.eyebrow::before {
  content: '';
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}
.on-dark .eyebrow { color: var(--accent-bright); }

.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.container--narrow { max-width: 860px; }
.container--mid { max-width: 1080px; }

section { position: relative; }

.section-pad { padding-block: var(--space-2xl); }
.section-pad--sm { padding-block: var(--space-xl); }

.on-dark { background: var(--ink); color: var(--text-on-dark); }
.on-dark p { color: var(--text-on-dark-dim); }
.on-ink-soft { background: var(--ink-soft); color: var(--text-on-dark); }
.on-ink-soft p { color: var(--text-on-dark-dim); }
.on-cream-dim { background: var(--cream-dim); }

.text-center { text-align: center; }

.visually-hidden {
  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; top: -100px; left: 1rem; z-index: 2000;
  background: var(--accent-bright); color: var(--ink); padding: 0.75em 1.25em;
  border-radius: var(--radius-sm); font-weight: 600;
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: 1rem; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---- Buttons ---- */
.btn {
  --btn-fg: var(--ink);
  --btn-bg: var(--accent-bright);
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.95em 1.9em;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
  font-size: var(--step--1);
  letter-spacing: 0.02em;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.btn::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--accent);
  transform: translateY(101%);
  transition: transform var(--dur-med) var(--ease-brand);
  z-index: -1;
}
.btn:hover { color: var(--text-on-dark); }
.btn:hover::before, .btn:focus-visible::before { transform: translateY(0); }
.btn:hover, .btn:focus-visible { box-shadow: var(--shadow-sm); }
.btn:active { transform: scale(0.97); }

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--text-on-light);
  border: 1px solid currentColor;
}
.btn--ghost::before { background: var(--ink); }
.btn--ghost:hover { --btn-fg-hover: var(--cream); color: var(--cream); }

/* Any dark background context needs the same dark-mode ghost button
   treatment — page-hero/hero-scrub paint their own video/photo + scrim
   instead of using .on-dark's background, so they're listed explicitly. */
.on-dark .btn--ghost, .on-ink-soft .btn--ghost, .page-hero__content .btn--ghost, .hero-scrub__content .btn--ghost, .hero-kb__content .btn--ghost, .chapters__content .btn--ghost { --btn-fg: var(--text-on-dark); }
.on-dark .btn--ghost::before, .on-ink-soft .btn--ghost::before, .page-hero__content .btn--ghost::before, .hero-scrub__content .btn--ghost::before, .hero-kb__content .btn--ghost::before, .chapters__content .btn--ghost::before { background: var(--accent-bright); }
.on-dark .btn--ghost:hover, .on-ink-soft .btn--ghost:hover, .page-hero__content .btn--ghost:hover, .hero-scrub__content .btn--ghost:hover, .hero-kb__content .btn--ghost:hover, .chapters__content .btn--ghost:hover { color: var(--ink); }

.btn--sm { padding: 0.7em 1.4em; font-size: var(--step--1); }

.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-sm); align-items: center; }

/* ---- Pill / badge ---- */
.pill {
  display: inline-flex; align-items: center; gap: 0.5em;
  padding: 0.4em 0.9em;
  border-radius: 999px;
  background: rgba(119, 142, 29, 0.12);
  color: var(--accent-deep);
  font-size: var(--step--1);
  font-weight: 600;
}
.on-dark .pill { background: rgba(193, 215, 46, 0.16); color: var(--accent-bright); }

/* ---- Kicker rule ---- */
.rule {
  width: 100%;
  height: 1px;
  background: currentColor;
  opacity: 0.14;
}
