/* Base: reset, type, layout, buttons, tags, header, footer. Colours come from tokens.css only. */

:root {
  /* One family everywhere; highlighted words change colour, not font. */
  --font-sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: var(--font-sans);

  --text-xs: 0.78rem;
  --text-sm: 0.9rem;
  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.08rem);
  --text-lg: clamp(1.15rem, 1.05rem + 0.4vw, 1.35rem);
  --text-xl: clamp(1.45rem, 1.2rem + 1vw, 2rem);
  --text-2xl: clamp(2rem, 1.5rem + 2.2vw, 3.2rem);
  --text-3xl: clamp(2.6rem, 1.4rem + 4.2vw, 5.4rem);
  --text-hero: clamp(2.8rem, 1.2rem + 4.8vw, 5.6rem);

  --space-section: clamp(5rem, 3.5rem + 6vw, 10rem);
  --gutter: clamp(1rem, 0.4rem + 1.6vw, 2rem);
  --max: 1440px;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 160ms;
  --dur: 320ms;
  --dur-slow: 900ms;

  --header-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 24px); }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 400; letter-spacing: -0.025em; line-height: 1.05; text-wrap: balance; }
h1 em, h2 em, h3 em, .hl { font-style: normal; color: var(--accent); -webkit-text-fill-color: var(--accent); }
/* the blue words in each page heading are italic; a little room so the slant is not clipped */
h1 em { font-style: italic; padding-right: 0.08em; }
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }
figure, blockquote { margin: 0; }

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

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 1000;
  padding: 0.6rem 1rem; background: var(--ink); color: var(--white); border-radius: var(--radius-xs);
}
.skip-link:focus { top: 1rem; }
.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;
}

/* ---------- Layout ---------- */
.container { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
.section { padding-block: var(--space-section); position: relative; }
.section--tight { padding-block: calc(var(--space-section) * 0.6); }
.section--alt { background: var(--bg-alt); }
.dark {
  --text: var(--dark-text); --text-muted: var(--dark-muted); --line: var(--dark-line);
  --line-strong: var(--dark-line-strong); --accent: var(--dark-accent); --surface: var(--dark-surface);
  background: var(--dark-bg); color: var(--text);
}

/* ---------- Type helpers ---------- */
/* Grey-to-ink gradient headline */
.heading {
  font-weight: 400; letter-spacing: -0.03em;
  background-image: linear-gradient(180deg, var(--slate), var(--black));
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
.h-section { font-size: var(--text-3xl); }
.lead { font-size: var(--text-lg); color: var(--text-muted); max-width: 46ch; font-weight: 300; }
.muted { color: var(--text-muted); }
.mono { font-variant-numeric: tabular-nums; }

.section-head { display: grid; gap: 1.5rem 4rem; align-items: end; margin-bottom: clamp(2.5rem, 2rem + 3vw, 5rem); }
.section-head > div { display: grid; gap: 1.25rem; justify-items: start; }
@media (min-width: 900px) { .section-head { grid-template-columns: 1.4fr 1fr; } }

.index-tag { font-size: var(--text-xs); color: var(--text-muted); letter-spacing: 0.04em; text-transform: uppercase; }
.chip {
  font-size: 0.72rem; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 0.3rem 0.65rem; border-radius: var(--radius-xs); border: 1px solid var(--line-strong); color: var(--text-muted);
}

/* ---------- Buttons: dark block with a navy arrow square ---------- */
.btn {
  --btn-bg: linear-gradient(180deg, var(--ink-700), var(--black));
  --btn-fg: var(--white);
  --btn-border: transparent;
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; gap: 1.25rem;
  min-height: 46px; padding: 0.3rem 0.3rem 0.3rem 1.1rem;
  border: 1px solid var(--btn-border); border-radius: var(--radius-xs);
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 500; font-size: var(--text-sm); cursor: pointer; white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease-out), color var(--dur) var(--ease-out);
}
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--navy); transform: scaleX(0); transform-origin: right;
  transition: transform 500ms var(--ease-out);
}
.btn:hover::before { transform: scaleX(1); transform-origin: left; }
.btn:active { transform: scale(0.98); }
.btn__icon {
  display: grid; place-items: center; align-self: stretch; min-width: 40px; padding-inline: 0.6rem;
  border-radius: 4px; background: var(--navy); color: var(--white); overflow: hidden;
  transition: background var(--dur);
}
.btn:hover .btn__icon { background: color-mix(in oklab, var(--white) 16%, transparent); }
.btn__icon svg { width: 16px; height: 16px; transition: transform 500ms var(--ease-out); }
.btn:hover .btn__icon svg { animation: nudge 420ms; }
/* the arrow accelerates out to the right, then glides back in from the left */
@keyframes nudge {
  0% { transform: none; animation-timing-function: cubic-bezier(0.5, 0, 0.9, 0.4); }
  34% { transform: translateX(140%); }
  35% { transform: translateX(-140%); animation-timing-function: var(--ease-out); }
  100% { transform: none; }
}

.btn--light { --btn-bg: var(--white); --btn-fg: var(--ink); --btn-border: var(--line-strong); }
.btn--light:hover { color: var(--white); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--text); --btn-border: var(--line-strong); padding-inline: 1.1rem; }
.btn--ghost:hover { color: var(--white); }
.btn--sm { min-height: 38px; font-size: var(--text-xs); padding-inline: 0.9rem; }

.link-arrow {
  justify-self: start; display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: var(--text-sm); font-weight: 500; color: inherit;
  border-bottom: 1px solid var(--line-strong); padding-bottom: 2px;
  transition: border-color var(--dur) var(--ease-out), gap var(--dur) var(--ease-out);
}
.link-arrow:hover { border-color: var(--accent); gap: 0.8rem; }
.link-arrow svg { width: 14px; height: 14px; }

/* ---------- Logo: image wordmark + navy dot ---------- */
.logo { display: inline-flex; align-items: flex-end; gap: 0.2em; font-size: 1.3rem; line-height: 0; }
.logo img { height: 1em; width: auto; }
.logo__dot { width: 0.28em; height: 0.28em; border-radius: 50%; background: var(--navy); }
/* wordmark used inline in running text: sized to the cap height, sat on the baseline */
.brand-word { display: inline-block; height: 0.73em; width: auto; vertical-align: baseline; }

/* ---------- Header ---------- */
.site-header {
  position: fixed; inset: 0 0 auto; z-index: 100; height: var(--header-h);
  display: flex; align-items: center; color: var(--ink);
  background: color-mix(in oklab, var(--white) 82%, transparent);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  transition: transform var(--dur) var(--ease-out);
}
.site-header.is-hidden { transform: translateY(-100%); }
.header-inner { width: 100%; padding-inline: var(--gutter); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; }
.nav { display: none; }
.nav__pill { display: flex; gap: 0.4rem; }
.nav__link {
  position: relative; display: inline-block; padding: 0.45rem 0.9rem;
  font-size: var(--text-sm); color: var(--slate); transition: color var(--dur-fast);
}
.nav__link:hover, .nav__link[aria-current="page"] { color: var(--ink); }

/* Marker under a menu item: a dot on hover; on the current page the dot
   appears, then stretches into a line under the label. */
.nav__link::after {
  content: ""; position: absolute; left: 0.9rem; right: 0.9rem; bottom: 0; height: 4px;
  border-radius: 999px; background: var(--navy);
  clip-path: inset(0 calc(50% - 2px) round 999px);
  opacity: 0; transform: translateY(4px);
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
}
.nav__link:hover::after { opacity: 1; transform: none; }
.nav__link[aria-current="page"]::after { animation: dot-to-line 900ms var(--ease-out) 150ms forwards; }
@keyframes dot-to-line {
  0% { opacity: 0; transform: translateY(4px); clip-path: inset(0 calc(50% - 2px) round 999px); }
  35% { opacity: 1; transform: none; clip-path: inset(0 calc(50% - 2px) round 999px); }
  100% { opacity: 1; transform: none; clip-path: inset(0 0 round 999px); }
}
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; grid-column: 3; }

.menu-toggle {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: var(--radius-xs);
  background: var(--bg-alt); border: 1px solid var(--line); cursor: pointer;
}
/* three evenly spaced lines (the middle one is the span, the outer two its pseudo-elements);
   open, the middle line fades and the outer two turn into an X */
.menu-toggle > span:not(.sr-only) {
  position: relative; display: block; width: 18px; height: 1.5px; background: currentColor;
  transition: background-color 0s linear calc(var(--dur) / 2);
}
.menu-toggle > span:not(.sr-only)::before, .menu-toggle > span:not(.sr-only)::after {
  content: ""; position: absolute; left: 0; width: 100%; height: 100%; background: currentColor;
  transition: transform var(--dur) var(--ease-out);
}
.menu-toggle > span:not(.sr-only)::before { transform: translateY(-6px); }
.menu-toggle > span:not(.sr-only)::after { transform: translateY(6px); }
.menu-toggle[aria-expanded="true"] > span:not(.sr-only) { background-color: transparent; }
.menu-toggle[aria-expanded="true"] > span:not(.sr-only)::before { transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] > span:not(.sr-only)::after { transform: rotate(-45deg); }
/* while the menu button shows, the logo sits in the middle of the header */
@media (max-width: 999px) {
  .header-inner > .logo { grid-column: 2; grid-row: 1; }
  .header-actions { grid-row: 1; }
}

.mobile-nav {
  position: fixed; inset: var(--header-h) 0 auto; z-index: 99;
  background: var(--white); color: var(--ink); box-shadow: var(--shadow-md);
  padding: 1rem var(--gutter) 1.75rem; border-bottom: 1px solid var(--line);
  clip-path: inset(0 0 100% 0); visibility: hidden;
  transition: clip-path var(--dur) var(--ease-out), visibility 0s linear var(--dur);
}
.mobile-nav.is-open { clip-path: inset(0 0 0 0); visibility: visible; transition-delay: 0s; }
.mobile-nav a:not(.btn) { display: block; padding: 0.8rem 0; font-size: var(--text-xl); border-bottom: 1px solid var(--line); }
.mobile-nav .btn { margin-top: 1.25rem; }

@media (min-width: 1000px) {
  .nav { display: block; }
  .menu-toggle, .mobile-nav { display: none; }
}

/* ---------- Footer: wordmark + stepped bars ---------- */
.site-footer { background: var(--bg); border-top: 1px solid var(--line); overflow: hidden; }
.footer-top { display: grid; gap: 2.5rem; padding-block: clamp(3rem, 2rem + 3vw, 5rem) clamp(3rem, 2rem + 4vw, 6rem); }
.footer-logo { display: inline-flex; align-items: flex-end; gap: 0.08em; font-size: clamp(2.25rem, 1.5rem + 2.2vw, 3.4rem); line-height: 0; }
.footer-logo img { height: 1em; width: auto; }
.footer-logo .logo__dot { width: 0.2em; height: 0.2em; }
.footer-tagline { margin-top: 1.75rem; font-weight: 500; }
.footer-desc { margin-top: 0.75rem; max-width: 40ch; color: var(--text-muted); font-size: var(--text-sm); font-weight: 300; }
.footer-col h3 { font-size: var(--text-sm); font-weight: 500; margin-bottom: 1.1rem; letter-spacing: 0; }
.footer-col li + li { margin-top: 0.5rem; }
.footer-col a { color: var(--text-muted); font-size: var(--text-sm); transition: color var(--dur-fast); }
.footer-col a:hover { color: var(--ink); }
.footer-meta { display: grid; gap: 0.5rem; align-content: start; font-size: var(--text-xs); color: var(--text-muted); }
.footer-meta a:hover { color: var(--ink); }
@media (min-width: 900px) {
  .footer-top { grid-template-columns: 2.2fr 0.8fr 1fr 1.4fr; }
  .footer-meta { justify-items: end; text-align: right; }
}
/* touch screens: small text links get a finger-sized hit area; padding is cancelled by margin
   wherever the line should not move */
@media (pointer: coarse) {
  .footer-col li + li { margin-top: 0; }
  .footer-col a, .footer-meta a { display: inline-block; padding-block: 0.6rem; }
  .footer-meta { gap: 0; }
  .footer-meta > * { padding-block: 0.25rem; }
  .logo, .crumbs a { padding-block: 0.75rem; margin-block: -0.75rem; }
}
/* Stepped bars over one live halftone (halftone.js, started by main.js). Each column is a window:
   a white cap covers the part above its bar. On reveal the bars wipe up into view.
   Without WebGL the container gradient shows through. */
.footer-bars {
  position: relative; display: flex; height: clamp(9rem, 5rem + 12vw, 16rem);
  background: linear-gradient(180deg,
    color-mix(in oklab, var(--navy) 40%, var(--white)) 0%,
    color-mix(in oklab, var(--navy) 18%, var(--white)) 45%,
    var(--white) 100%);
}
.footer-halftone { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* soft fade into the page at the bottom */
.footer-bars::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 35%, color-mix(in oklab, var(--bg) 70%, transparent) 75%, var(--bg) 100%);
}
.footer-bars i { position: relative; flex: 1; box-shadow: 1px 0 0 var(--bg); }
.footer-bars i::before {
  content: ""; position: absolute; inset: -1px 0 auto; background: var(--bg);
  height: calc((1 - var(--h)) * 100% + 1px);
}
.footer-bars i:nth-child(2), .footer-bars i:nth-child(12) { --h: 0.12; }
.footer-bars i:nth-child(3), .footer-bars i:nth-child(11) { --h: 0.28; }
.footer-bars i:nth-child(4), .footer-bars i:nth-child(10) { --h: 0.46; }
.footer-bars i:nth-child(5), .footer-bars i:nth-child(9) { --h: 0.64; }
.footer-bars i:nth-child(6), .footer-bars i:nth-child(8) { --h: 0.82; }
.footer-bars i:nth-child(7) { --h: 1; }
/* wipe up: a cover over each bar shrinks towards the top once the footer scrolls in (.is-in) */
@media (prefers-reduced-motion: no-preference) {
  .js .footer-bars i::after {
    content: ""; position: absolute; inset: auto 0 -1px; height: calc(var(--h, 0) * 100% + 3px);
    background: var(--bg); transform-origin: top; transition: transform 1s var(--ease-in-out);
  }
  .js .footer-bars.is-in i::after { transform: scaleY(0); }
}

/* ---------- Reveal motion ---------- */
.js [data-reveal] {
  opacity: 0; transform: translateY(28px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
  transition-delay: calc(var(--stagger, 0) * 90ms);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }
.js [data-reveal-group] > :nth-child(2) { --stagger: 1; }
.js [data-reveal-group] > :nth-child(3) { --stagger: 2; }
.js [data-reveal-group] > :nth-child(4) { --stagger: 3; }
.js [data-reveal-group] > :nth-child(5) { --stagger: 4; }
.js [data-reveal-group] > :nth-child(6) { --stagger: 5; }

/* Split headline: each line rises out of a mask */
.split-line { display: block; overflow: hidden; padding-bottom: 0.14em; margin-bottom: -0.14em; }
.split-line > span { display: inline-block; }
.js .split-line > span { transform: translateY(105%); transition: transform 1.1s var(--ease-out); }
.js .split-line:nth-child(2) > span { transition-delay: 120ms; }
.js .split-line:nth-child(3) > span { transition-delay: 240ms; }
.js .is-in .split-line > span, .js .split-line.is-in > span { transform: none; }

/* ---------- Page hero (inner pages) ---------- */
.page-hero { padding-block: calc(var(--header-h) + clamp(4rem, 3rem + 6vw, 9rem)) clamp(3.5rem, 3rem + 3vw, 6rem); position: relative; overflow: hidden; }
.page-hero h1 { font-size: var(--text-3xl); max-width: 16ch; margin-top: 1.5rem; }
.page-hero .lead { margin-top: 1.75rem; }
.crumbs { display: flex; gap: 0.5rem; font-size: var(--text-xs); color: var(--text-muted); margin-bottom: 1.25rem; }
.crumbs a:hover { color: var(--text); }

/* ---------- Shared CTA: light, centred ---------- */
.cta-band { background: linear-gradient(180deg, var(--white) 75%, color-mix(in oklab, var(--navy) 15%, var(--white))); text-align: center; }
.cta-band__inner { display: grid; gap: 2rem; justify-items: center; }
.cta-band__inner > div { display: grid; justify-items: center; }
.cta-band h2 { font-size: var(--text-3xl); margin-top: 1.25rem; }
.cta-band p { color: var(--text-muted); max-width: 46ch; margin-top: 1.25rem; font-weight: 300; }
.cta-band__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
  .js [data-reveal], .js .split-line > span { opacity: 1; transform: none; }
}
