/* ==========================================================================
   BASE. reset, typography, layout primitives, motion
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--w-paper);
  color: var(--w-ink);
  font-family: var(--w-font);
  font-size: var(--w-t-body);
  font-weight: var(--w-w-book);
  line-height: var(--w-lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
  overflow-x: hidden;
}

h1, h2, h3, h4, p, figure, blockquote, dl, dd, fieldset { margin: 0; }
fieldset { border: 0; padding: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--w-signal); color: var(--w-paper); }

/* ---------- FOCUS ---------------------------------------------------------
   Visible on every focusable element. Never removed.
   -------------------------------------------------------------------------- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--surface-signal);
  outline-offset: 3px;
}

.w-skip {
  position: absolute;
  left: var(--w-margin);
  top: 0;
  transform: translateY(-130%);
  z-index: 400;
  background: var(--w-ink);
  color: var(--w-paper);
  padding: var(--w-s-xs) var(--w-s-md);
  font-family: var(--w-mono);
  font-size: var(--w-t-label);
  letter-spacing: var(--w-tr-label);
  text-transform: uppercase;
  transition: transform var(--w-d-base) var(--w-e-std);
}
.w-skip:focus-visible { transform: translateY(0); }

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

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

.w-display {
  font-size: var(--w-t-display);
  font-weight: var(--w-w-semi);
  line-height: var(--w-lh-display);
  letter-spacing: var(--w-tr-display);
  text-wrap: balance;
}
.w-h1 {
  font-size: var(--w-t-h1);
  font-weight: var(--w-w-semi);
  line-height: var(--w-lh-tight);
  letter-spacing: var(--w-tr-head);
  text-wrap: balance;
}
.w-h2 {
  font-size: var(--w-t-h2);
  font-weight: var(--w-w-semi);
  line-height: var(--w-lh-head);
  letter-spacing: var(--w-tr-head);
  text-wrap: balance;
}
.w-h3 {
  font-size: var(--w-t-h3);
  font-weight: var(--w-w-med);
  line-height: var(--w-lh-head);
  letter-spacing: -0.012em;
}
.w-lead {
  font-size: var(--w-t-lead);
  font-weight: var(--w-w-light);
  line-height: var(--w-lh-lead);
  letter-spacing: -0.008em;
  max-width: 58ch;
}
.w-body { font-size: var(--w-t-body); max-width: var(--w-measure); }
.w-body + .w-body { margin-top: 1.1em; }
.w-small { font-size: var(--w-t-small); line-height: 1.75; color: var(--surface-mute); }
.w-mute { color: var(--surface-mute); }

/* Mono voice. Labels, indices, stage numbers, data. */
.w-label {
  display: block;
  font-family: var(--w-mono);
  font-size: var(--w-t-label);
  font-weight: var(--w-w-med);
  letter-spacing: var(--w-tr-label);
  text-transform: uppercase;
  line-height: 1;
  color: var(--surface-mute);
}
.w-label--signal { color: var(--surface-signal); }
.w-num {
  font-family: var(--w-mono);
  font-size: var(--w-t-label);
  font-weight: var(--w-w-book);
  letter-spacing: 0.06em;
  line-height: 1;
  color: var(--surface-signal);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   LAYOUT
   ========================================================================== */

.w-section {
  background: var(--surface-bg);
  color: var(--surface-fg);
  padding-block: var(--w-section);
  position: relative;
}
.w-section--tight { padding-block: var(--w-section-tight); }
.w-section--airy  { padding-block: var(--w-section-airy); }
.w-section--ruled { border-top: var(--w-hair) solid var(--surface-line); }
/* Two sections of the same surface reading as one page. */
.w-section--flush { padding-top: 0; }

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

.w-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--w-gutter);
}

/* Asymmetric editorial split */
.w-split {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--w-gutter);
  row-gap: var(--w-s-xl);
  align-items: start;
}
.w-split__a { grid-column: 1 / span 4; }
.w-split__b { grid-column: 6 / span 7; }
.w-split--wide .w-split__a { grid-column: 1 / span 5; }
.w-split--wide .w-split__b { grid-column: 7 / span 6; }

@media (max-width: 900px) {
  .w-split__a, .w-split__b,
  .w-split--wide .w-split__a, .w-split--wide .w-split__b { grid-column: 1 / -1; }
  .w-split { row-gap: var(--w-s-lg); }
}

.w-stack > * + *     { margin-top: var(--w-s-md); }
.w-stack-lg > * + *  { margin-top: var(--w-s-xl); }
.w-stack-xl > * + *  { margin-top: clamp(40px, 5vw, 76px); }

.w-rule { height: var(--w-hair); background: var(--surface-line); border: 0; margin: 0; }

/* ==========================================================================
   MOTION
   One shared observer adds .is-in. Content is visible without JavaScript.
   ========================================================================== */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(var(--w-move));
  transition: opacity var(--w-d-slow) var(--w-e-out),
              transform var(--w-d-slow) var(--w-e-out);
  transition-delay: var(--reveal-delay, 0ms);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* Two sections sharing a surface stack their padding, which produces roughly
   350px of dead space. The previous section's bottom padding is already the
   correct gap, so the second one drops its top padding. Ruled sections keep
   theirs, because their border needs clearance before the content starts. */
.w-section[data-surface="paper"] + .w-section[data-surface="paper"]:not(.w-section--ruled):not(.w-cta),
.w-section[data-surface="ink"]   + .w-section[data-surface="ink"]:not(.w-section--ruled):not(.w-cta) {
  padding-top: 0;
}
