/* ==========================================================================
   lennx — base.css
   Design tokens · reset · typography · themes · utilities
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  /* Palette */
  --ink: #0c0c0b;
  --ink-2: #151513;
  --ink-3: #20201d;
  --bone: #edeae3;
  --bone-2: #e4e0d7;
  --bone-3: #d6d1c6;
  --signal: #3a3aff;      /* primary accent — electric ultramarine */
  --signal-deep: #2a2ae0;
  --signal-soft: #a9a9ff; /* accent for text on dark */
  --white: #ffffff;

  /* Type */
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Instrument Serif", "Iowan Old Style", "Times New Roman", serif;
  --font-mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --fs-xs: 0.6875rem;
  --fs-sm: 0.8125rem;
  --fs-base: clamp(1rem, 0.96rem + 0.18vw, 1.125rem);
  --fs-lg: clamp(1.125rem, 1rem + 0.55vw, 1.5rem);
  --fs-h3: clamp(1.375rem, 1.1rem + 1.2vw, 2.25rem);
  --fs-h2: clamp(2.6rem, 1.3rem + 5.6vw, 7.5rem);
  --fs-display: clamp(3.7rem, 0.6rem + 13.6vw, 16rem);

  /* Space & shape */
  --gutter: clamp(16px, 3.4vw, 56px);
  --section-y: clamp(96px, 14vw, 220px);
  --radius-sm: 10px;
  --radius: clamp(18px, 2vw, 32px);
  --header-h: 84px;
  --maxw: 1680px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur: 0.6s;
}

/* ---------- Themes (sections set their own palette) ---------- */
[data-theme="dark"] {
  --bg: var(--ink);
  --fg: var(--bone);
  --muted: #8f8c84;
  --line: rgba(237, 234, 227, 0.14);
  --accent: var(--signal-soft);
  --accent-fill: var(--signal);
  --on-accent: var(--white);
  --surface: var(--ink-2);
}
[data-theme="light"] {
  --bg: var(--bone);
  --fg: var(--ink);
  --muted: #67645c;
  --line: rgba(12, 12, 11, 0.14);
  --accent: var(--signal);
  --accent-fill: var(--signal);
  --on-accent: var(--white);
  --surface: var(--bone-2);
}
[data-theme="signal"] {
  --bg: var(--signal);
  --fg: var(--white);
  --muted: rgba(255, 255, 255, 0.72);
  --line: rgba(255, 255, 255, 0.24);
  --accent: var(--bone);
  --accent-fill: var(--ink);
  --on-accent: var(--white);
  --surface: var(--signal-deep);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--ink);
  color-scheme: light;
}
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: clip; }
body {
  min-height: 100vh;
  background: var(--bone);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.55;
  letter-spacing: -0.011em;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, video, canvas { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; cursor: pointer; text-align: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
em { font-style: normal; }
::selection { background: var(--signal); color: var(--white); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-weight: 500; line-height: 0.95; letter-spacing: -0.045em; }
h1 em, h2 em, h3 em, .serif, [class*="__title"] em, p em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
}
p em { letter-spacing: -0.005em; }
.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.4;
}

/* ---------- Layout primitives ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
main [data-theme], .footer {
  position: relative;
  background: var(--bg);
  color: var(--fg);
}

/* ---------- Section head ---------- */
.section-label {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-bottom: 14px;
  margin-bottom: clamp(32px, 5vw, 72px);
  color: var(--muted);
}
.section-label::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--line);
  transform-origin: left center;
  transform: scaleX(var(--line-scale, 1));
}
.section-title {
  font-size: var(--fs-h2);
  max-width: 14ch;
}
.section-title em { color: var(--accent); }
.section-intro {
  max-width: 36ch;
  font-size: var(--fs-lg);
  line-height: 1.4;
  color: var(--muted);
  letter-spacing: -0.02em;
}
.section-head { margin-bottom: clamp(48px, 7vw, 120px); }
.section-head .section-title { margin-bottom: clamp(20px, 2.5vw, 40px); }
.section-head--row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: end;
}
@media (min-width: 900px) {
  .section-head--row { grid-template-columns: 1fr auto; }
  .section-head--row .section-title { margin-bottom: 0; }
}

/* ---------- SplitText helpers ---------- */
.w-mask, .c-mask {
  padding-bottom: 0.12em;
  margin-bottom: -0.12em;
  padding-right: 0.06em;
  margin-right: -0.06em;
}

/* ---------- Utilities ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  top: 12px; left: 12px;
  z-index: 1000;
  padding: 12px 18px;
  background: var(--signal);
  color: var(--white);
  border-radius: 999px;
  transform: translateY(-160%);
  transition: transform 0.4s var(--ease-out);
}
.skip-link:focus-visible { transform: none; }

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
  border-radius: 4px;
}
[data-theme="signal"] :focus-visible { outline-color: var(--white); }

/* ---------- Progressive enhancement initial states ----------
   Only hide things when JS runs and motion is allowed. */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] { opacity: 0; transform: translateY(32px); }
  .js [data-split] { visibility: hidden; }
  .js [data-reveal-line] { --line-scale: 0; }
}
