/* ==========================================================================
   Base — reset, typography, layout primitives
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
  overflow-x: hidden;
}

body.is-locked { overflow: hidden; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-variation-settings: 'SOFT' 0, 'WONK' 0, 'opsz' 96;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

p { margin: 0; text-wrap: pretty; }

ul, ol { margin: 0; padding: 0; }
li { list-style: none; }

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

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

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

::selection { background: var(--indigo); color: var(--paper); }

/* --- Layout primitives ---------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap--narrow { max-width: 64rem; }

.section {
  padding-block: var(--space-3xl);
  background: var(--bg);
  color: var(--fg);
}

.section--tight { padding-block: clamp(3.5rem, 2rem + 7vw, 7rem); }

.measure        { max-width: var(--measure); }
.measure-narrow { max-width: var(--measure-narrow); }

/* Editorial 12-column grid for the asymmetric section layouts. */
.grid12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--space-m) var(--gutter);
}
@media (max-width: 60rem) {
  .grid12 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* --- Type roles ----------------------------------------------------------- */

/* Small, tracked-out label — the connective tissue of the whole layout. */
.label {
  display: block;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--fg-muted);
  line-height: 1.4;
}

.label--accent { color: var(--accent); }

.display {
  font-size: var(--text-2xl);
  font-variation-settings: 'SOFT' 0, 'WONK' 0, 'opsz' 144;
}

.headline { font-size: var(--text-xl); }

.lede {
  font-size: var(--text-md);
  line-height: 1.5;
  color: var(--fg);
  font-weight: 300;
}

.body-muted { color: var(--fg-muted); }

.serif-italic {
  font-family: var(--font-display);
  font-style: italic;
  font-variation-settings: 'SOFT' 0, 'WONK' 1, 'opsz' 96;
}

.rule {
  height: var(--hairline);
  background: var(--rule);
  border: 0;
  margin: 0;
}

/* --- Links ---------------------------------------------------------------- */

.link {
  display: inline-block;
  position: relative;
  padding-bottom: 2px;
  color: var(--fg);
}
.link::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: var(--hairline);
  background: currentColor;
  transform-origin: left;
  transition: transform var(--dur) var(--ease-out);
}
.link:hover::after { transform: scaleX(0); transform-origin: right; }

/* Standalone call-to-action, set as a small tracked label with a rule. */
.cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  padding-block: var(--space-2xs);
  color: var(--fg);
}
.cta__line {
  display: block;
  width: 2.5rem;
  height: var(--hairline);
  background: currentColor;
  transition: width var(--dur) var(--ease-out);
}
.cta:hover .cta__line { width: 4rem; }

/* Filled button — used sparingly, only where an action is genuinely primary. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  padding: 0.9rem 1.75rem;
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  background: var(--fg);
  color: var(--bg);
  border-radius: var(--radius);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.btn:hover { background: var(--indigo); color: var(--paper); }

.btn--ghost {
  background: transparent;
  color: var(--fg);
  box-shadow: inset 0 0 0 var(--hairline) var(--rule);
}
.btn--ghost:hover { background: var(--fg); color: var(--bg); box-shadow: none; }

/* --- Accessibility -------------------------------------------------------- */

.skip-link {
  position: absolute;
  top: 0;
  left: var(--gutter);
  z-index: 200;
  transform: translateY(-120%);
  background: var(--ink);
  color: var(--paper);
  padding: var(--space-2xs) var(--space-s);
  font-size: var(--text-sm);
  border-radius: 0 0 var(--radius) var(--radius);
  transition: transform var(--dur-fast) var(--ease);
}
.skip-link:focus { transform: translateY(0); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- Scroll reveal -------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  [data-reveal] {
    opacity: 0;
    transform: translateY(1.75rem);
    transition:
      opacity var(--dur-slow) var(--ease-out),
      transform var(--dur-slow) var(--ease-out);
    transition-delay: var(--reveal-delay, 0ms);
  }
  [data-reveal].is-revealed { opacity: 1; transform: none; }
}

/* No-JS safety net: never leave content hidden if the observer never runs. */
.no-js [data-reveal] { opacity: 1; transform: none; }
