/* ==========================================================================
   Base: reset, surfaces, type, utilities, motion fail-safes
   ========================================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--text);
  font-family: var(--f-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
body.menu-open { overflow: hidden; }

h1, h2, h3, h4, p, ul, ol, figure, blockquote, dl, dd { margin: 0; }
ul[class], ol[class] { list-style: none; padding: 0; }
img, svg, video, canvas { display: block; max-width: 100%; }
svg { flex-shrink: 0; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
::selection { background: var(--primary); color: var(--on-primary); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 6px;
}
[data-surface="light"] :focus-visible,
[data-surface="lavender"] :focus-visible { outline-color: var(--ink); }

[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  padding: 0.75rem 1.1rem;
  border-radius: var(--r-pill);
  background: var(--soft);
  color: var(--ink);
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform 0.3s var(--ease-out);
}
.skip-link:focus { transform: none; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- Surfaces ---------- */
main { position: relative; z-index: 1; display: block; }
main > section,
.site-footer { position: relative; z-index: 1; }

[data-surface="dark"] { background: transparent; color: var(--text); }
[data-surface="ink2"] { background: var(--ink-2); color: var(--text); }
[data-surface="light"] { background: var(--paper); color: var(--text-ink); }
[data-surface="lavender"] { background: var(--lav); color: var(--text-ink); }
[data-surface="accent"] { background: var(--accent); color: var(--accent-ink); }

[data-surface="light"] .muted,
[data-surface="lavender"] .muted,
[data-surface="accent"] .muted { color: var(--muted-ink); }

.grid-paper {
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  background-position: center top;
}
/* Dashed crosshair lines like a design canvas */
.crosshair { position: relative; }
.crosshair::before,
.crosshair::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 0;
}
.crosshair::before {
  left: 0; right: 0; top: 50%;
  border-top: 2px dashed color-mix(in srgb, var(--ink) 12%, transparent);
}
.crosshair::after {
  top: 0; bottom: 0; left: 50%;
  border-left: 2px dashed color-mix(in srgb, var(--ink) 12%, transparent);
}

/* Film grain on top of everything — subtle */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 150;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: var(--section-y); }
.section--tight { padding-block: calc(var(--section-y) * 0.6); }
.stack > * + * { margin-top: var(--stack, 1.5rem); }

/* ---------- Type ---------- */
.display,
h1, h2, h3 {
  font-family: var(--f-display);
  font-weight: var(--display-weight, 600);
  font-stretch: var(--display-stretch, 100%);
  letter-spacing: var(--track-tight);
  line-height: 1.02;
}
h3 { letter-spacing: var(--track-snug); line-height: 1.12; }
.t-giga { font-size: var(--fs-giga); line-height: 0.96; }
.t-mega { font-size: var(--fs-mega); line-height: 1; }
.t-xl { font-size: var(--fs-xl); }
.t-l { font-size: var(--fs-l); }
.t-m { font-size: var(--fs-m); line-height: 1.16; letter-spacing: var(--track-snug); }
.t-upper { text-transform: uppercase; letter-spacing: -0.03em; }
.lead { font-size: var(--fs-lead); line-height: 1.5; max-width: 38ch; }
.prose { max-width: 58ch; }
.prose p + p { margin-top: 1.1em; }
.muted { color: var(--muted); }
.line { display: block; }
.nowrap { white-space: nowrap; }
.indent-1 { padding-left: 0.9em; }
.indent-2 { padding-left: 1.8em; }
.outline-word {
  color: transparent;
  -webkit-text-stroke: 1.5px currentColor;
}
[data-surface="dark"] .outline-word { -webkit-text-stroke-color: var(--text); }

.eyebrow {
  display: block;
  font-family: var(--f-body);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}
[data-surface="light"] .eyebrow,
[data-surface="lavender"] .eyebrow { color: var(--muted-ink); }

/* SplitText masks */
.split-line { padding-bottom: 0.16em; margin-bottom: -0.16em; padding-right: 0.06em; }

/* ---------- Motion fail-safes ----------
   JS hides these before animating; if JS never runs they stay visible.
   If JS stalls, the fail-safe animation reveals them after 2.6s. */
.js [data-split],
.js [data-reveal],
.js [data-hero-fade] {
  visibility: hidden;
  animation: pk-failsafe 0s linear 2.6s forwards;
}
@keyframes pk-failsafe { to { visibility: visible; } }

.reduced-motion [data-split],
.reduced-motion [data-reveal],
.reduced-motion [data-hero-fade],
.no-motion [data-split],
.no-motion [data-reveal],
.no-motion [data-hero-fade] { visibility: visible !important; animation: none; }

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