/* ==========================================================================
   base.css — reset, typography, layout primitives, section anatomy, utilities
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
/* With JS the scroll engine (Lenis) does the smoothing. Native smooth
   behaviour must be off or ScrollTrigger measures mid-animation. */
html.js, html.lenis { scroll-behavior: auto !important; }
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;
  font-family: var(--f-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--fg);
  background: var(--c-night);
  transition: background-color var(--d-theme) var(--ease-out), color var(--d-theme) var(--ease-out);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  font-feature-settings: "ss01", "cv11";
}
html[data-scene="light"] body { background: var(--c-mist); }

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 6px;
}

.skip-link {
  position: fixed;
  inset-block-start: var(--sp-3);
  inset-inline-start: var(--sp-3);
  z-index: calc(var(--z-splash) + 1);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-pill);
  background: var(--c-violet);
  color: #fff;
  transform: translateY(-200%);
  transition: transform var(--d-fast) var(--ease-out);
}
.skip-link:focus { transform: none; }

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

/* Typography ----------------------------------------------------------- */
.t-h1, .t-h2, .t-h3 {
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
}
.t-h1 { font-size: var(--fs-h1); }
.t-h2 { font-size: var(--fs-h2); }
.t-h3 { font-size: var(--fs-h3); line-height: var(--lh-snug); }
.t-h4 { font-size: var(--fs-h4); font-weight: 600; letter-spacing: -0.02em; line-height: var(--lh-snug); }
.t-lead { font-size: var(--fs-lead); line-height: 1.45; color: var(--fg-2); letter-spacing: -0.01em; }
.t-small { font-size: var(--fs-small); color: var(--fg-2); }
.t-mono {
  font-family: var(--f-mono);
  font-size: var(--fs-mono);
  letter-spacing: var(--tracking-mono);
  text-transform: uppercase;
}
/* Serif italic accent — echoes the handwritten mark */
.t-serif {
  font-family: var(--f-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.t-grad {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

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

/* anything that declares its own theme also re-inks its text, so nested
   pinned surfaces (e.g. dark service cards) don't inherit the section colour */
[data-theme] { color: var(--fg); }

/* Section anatomy ------------------------------------------------------- */
.s {
  position: relative;
  padding-block: var(--sp-10);
  color: var(--fg);
  background: var(--bg);
  transition: color var(--d-theme) var(--ease-out);
}
/* When the scene engine runs, the body paints the background so themes blend */
html.has-scene .s { background: transparent; }

.s__head {
  display: grid;
  gap: var(--sp-5);
  margin-block-end: var(--sp-8);
}
.s__meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  color: var(--fg-3);
}
.s__index {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--fg);
}
/* Viewfinder "REC" dot used as the section index marker */
.s__index::before {
  content: "";
  inline-size: 7px;
  block-size: 7px;
  border-radius: 50%;
  background: var(--c-pink);
  box-shadow: 0 0 12px var(--c-pink);
}
.s__rule { flex: 1; height: 1px; background: var(--line); }
/* a section title is one sentence: keep it on one line where it fits */
.s__title { max-width: none; text-wrap: balance; }

/* Section enter / exit (values scrubbed by motion.js) ------------------- */
html.has-section-motion main section > .container,
html.has-section-motion main section > .marquee {
  transform:
    translate3d(0, calc((1 - var(--enter, 1)) * 14vh - var(--exit, 0) * 9vh), 0)
    scale(calc(1 - (1 - var(--enter, 1)) * 0.07 - var(--exit, 0) * 0.06));
  opacity: calc(1 - (1 - var(--enter, 1)) * 0.85 - var(--exit, 0) * 0.8);
  transform-origin: 50% 0;
}
html.has-section-motion main section > .aurora {
  opacity: calc(1 - (1 - var(--enter, 1)) - var(--exit, 0) * 0.6);
}

/* Split-text primitives ------------------------------------------------- */
.split-line { display: block; overflow: clip; padding-block-end: 0.08em; margin-block-end: -0.08em; }
.split-word {
  display: inline-block;
  white-space: nowrap;
  overflow: clip;
  vertical-align: top;
  padding-block-end: 0.12em;
  margin-block-end: -0.12em;
  padding-inline-end: 0.06em;
  margin-inline-end: -0.06em;
}
[data-scrub-words] .split-word { overflow: visible; }
/* gradient text survives word splitting */
.t-grad .split-inner { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; padding-inline-end: 0.05em; }
.split-inner { display: inline-block; will-change: transform; }

/* Pre-hide revealed content only when JS is confirmed running */
html.js [data-reveal] { opacity: 0; }
html.js.no-motion [data-reveal] { opacity: 1; }

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