/* ============================================================
   Base — typography, layout primitives, global behaviours.
   Components and pages compose on top of these.
   ============================================================ */

html {
  font-size: 16px;
  background: var(--abyssal);
  color: var(--pearl);
  /* Hide native scrollbar visually — scroll still works fully.
     Lenis (loaded by js/main.js) handles smooth scrolling. */
  -ms-overflow-style: none;
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
  width: 0;
  background: transparent;
}

body {
  font-family: var(--font-sans);
  font-size: var(--type-body);
  font-weight: 400;
  line-height: var(--lh-body);
  background: var(--abyssal);
  color: var(--pearl);
  /* General Sans stylistic alternates that read more refined. */
  font-feature-settings: "ss01", "ss02", "cv01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  hanging-punctuation: first allow-end last;
  overflow-x: hidden;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Lock scroll while hero animation runs */
body.is-locked {
  overflow: hidden;
  height: 100vh;
}

/* ---------- Display & headings ---------- */

.display,
h1.display, h2.display, h3.display {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: var(--lh-display);
  letter-spacing: var(--tr-display);
  color: var(--pearl);
  text-wrap: balance;
}

h1, .h1 {
  font-family: var(--font-display);
  font-size: var(--type-display-xl);
  font-weight: 500;
  line-height: var(--lh-display);
  letter-spacing: var(--tr-tight);
  color: var(--pearl);
}

h2, .h2 {
  font-family: var(--font-display);
  font-size: var(--type-display-l);
  font-weight: 500;
  line-height: var(--lh-display);
  letter-spacing: var(--tr-display);
  color: var(--pearl);
}

h3, .h3 {
  font-family: var(--font-display);
  font-size: var(--type-display-m);
  font-weight: 500;
  line-height: var(--lh-tight);
  letter-spacing: var(--tr-display);
  color: var(--pearl);
}

/* ---------- Body text ---------- */

p {
  max-width: var(--reading-max);
  line-height: var(--lh-body);
  color: var(--pearl);
}

p + p { margin-top: var(--space-3); }

.lead {
  font-size: var(--type-body-l);
  line-height: 1.6;
  max-width: 56ch;
}

.muted    { color: var(--pearl-muted); }
.subtle   { color: var(--pearl-quiet); }
.brand    { color: var(--navy); }

/* ---------- Eyebrow / overline labels (brief §3.2) ----------
   General Sans, uppercase, weight 500, letter-spacing 0.18em,
   colour --pearl-muted. No red rule prefix — that was a Matrix
   pattern, gone. Use a separate `.hairline` element when a rule
   is wanted. */

.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--type-eyebrow);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tr-eyebrow);
  color: var(--pearl-muted);
  display: inline-block;
  line-height: 1;
}

.label {
  font-family: var(--font-sans);
  font-size: var(--type-caption);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tr-label);
  color: var(--pearl);
}

/* ---------- Numeric face ---------- */

.numeric,
.tabular {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum", "lnum";
}

.numeric {
  font-family: var(--font-numeric);
  letter-spacing: -0.015em;
}

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

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

.section {
  padding-block: var(--section-pad-y);
}

.section-tight {
  padding-block: clamp(4rem, 8vw, 7rem);
}

.divider {
  height: var(--hairline);
  background: var(--color-divider);
  border: none;
  width: 100%;
}

.rule {
  display: block;
  width: 64px;
  height: 1px;
  background: color-mix(in srgb, var(--pearl) 40%, transparent);
  border: none;
  margin-block: var(--space-3);
}
.rule--short { width: 24px; }

/* Legacy aliases for the old red rule — now a quiet pearl hairline. */
.rule-red,
.rule-red--thin {
  display: block;
  height: 1px;
  background: color-mix(in srgb, var(--pearl) 35%, transparent);
  border: none;
  margin-block: var(--space-3);
}
.rule-red       { width: 64px; }
.rule-red--thin { width: 24px; }

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

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--dur-micro) var(--ease-out-expo);
}

a:hover { color: var(--pearl); }

/* Inline body links — underline draws from left on hover (brief §7.3).
   Scoped to text-flow contexts only (not nav, not cards, not utility
   links that already manage their own underline). */
.story__body a:not(.link-arrow),
.about-excerpt__body a:not(.link-arrow),
.office__body dd a {
  position: relative;
  display: inline;
  background:
    linear-gradient(currentColor, currentColor) left bottom / 0 1px no-repeat,
    linear-gradient(color-mix(in srgb, var(--pearl) 28%, transparent),
                    color-mix(in srgb, var(--pearl) 28%, transparent)) left bottom / 100% 1px no-repeat;
  background-position: 0 100%, 0 100%;
  padding-bottom: 2px;
  transition: background-size var(--dur-short) var(--ease-out-expo);
}
.story__body a:not(.link-arrow):hover,
.about-excerpt__body a:not(.link-arrow):hover,
.office__body dd a:hover {
  background-size: 100% 1px, 100% 1px;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-sans);
  font-size: var(--type-caption);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tr-eyebrow);
  color: var(--pearl);
  padding-bottom: 2px;
  transition: gap var(--dur-short) var(--ease-out-expo), color var(--dur-micro) var(--ease-out-expo);
}

.link-arrow > span:not(.arrow) {
  border-bottom: 1px solid color-mix(in srgb, var(--pearl) 30%, transparent);
  padding-bottom: 4px;
  transition: border-color var(--dur-short) var(--ease-out-expo);
}

.link-arrow .arrow {
  display: inline-block;
  transition: transform var(--dur-short) var(--ease-out-expo);
}

.link-arrow:hover {
  color: var(--pearl);
  gap: 0.85em;
}
.link-arrow:hover > span:not(.arrow) {
  border-color: var(--pearl);
}
.link-arrow:hover .arrow { transform: translateX(4px); }

/* ---------- Reveal helpers (set by reveals.js / GSAP) ---------- */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(24px);
}

/* ---------- Skip link ---------- */

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-2);
  background: var(--surface);
  color: var(--pearl);
  padding: var(--space-2) var(--space-3);
  z-index: var(--z-modal);
  border: 1px solid var(--pearl);
  font-size: var(--type-caption);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  transition: top var(--dur-micro) var(--ease-out-expo);
}

.skip-link:focus { top: var(--space-2); }

/* ---------- Reduced-motion overrides for JS-driven choreography ---------- */

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
  }
  body.is-locked {
    overflow: auto;
    height: auto;
  }
}

/* ---------- Utilities ---------- */

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

.no-scroll { overflow: hidden !important; }

/* ---------- Focus states (brief §8 a11y) ----------
   Designed, never browser-default. */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--pearl);
  outline-offset: 3px;
  border-radius: 1px;
}
.lang-toggle__btn:focus-visible,
.menu-toggle:focus-visible,
.menu-list a:focus-visible,
.link-arrow:focus-visible {
  outline-offset: 6px;
}
