/* Word Lineage — services that evolve into each other instead of swapping */

:root {
  --bg: #f1eee6;
  --ink: #1b1a17;
  --word: 18vw; /* fitted to the widest service in script.js */

  --hair: color-mix(in oklab, var(--ink) 24%, transparent);
  --soft: color-mix(in oklab, var(--ink) 66%, transparent);

  --serif: "Fraunces", Georgia, serif;
  --sans: "Geist", system-ui, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --gutter: clamp(16px, 3vw, 44px);
  --step: 90svh; /* scroll distance between two stops */
}

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

html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

/* Visually hidden, still read aloud */
.source {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ─────────── Pinned stage ─────────── */

.track {
  position: relative;
  height: calc(100svh + var(--step) * 5);
}

.stage {
  position: sticky;
  top: 0;
  height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  padding: 0 var(--gutter) 14px;
  overflow: hidden;
}

.bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-block: 20px;
  font-size: 13px;
}
.logo {
  font-family: var(--serif);
  font-size: 22px;
  font-style: italic;
  letter-spacing: -0.02em;
}
.count {
  margin: 0;
  color: var(--soft);
  font-variant-numeric: tabular-nums;
}
.count span { color: var(--ink); }

/* One cut for every stop: sturdier optical size and no swash forms, for reading */
.display {
  align-self: center;
  min-width: 0;
  font-family: var(--serif);
  font-weight: 420;
  font-variation-settings: "opsz" 72, "SOFT" 0, "WONK" 0;
}

.lead {
  margin: 0 0 0.12em;
  font-size: clamp(26px, 4vw, 68px);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

/* ─────────── Layers: absolute tiles over hidden measuring rows ─────────── */

.layer { position: relative; }

.row {
  position: absolute;
  inset: 0 0 auto;
  visibility: hidden;
  pointer-events: none;
}

.tile {
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  will-change: transform, opacity;
  backface-visibility: hidden;
}

/* The line is a window: words roll through it and are clipped at its edges */
.layer--word {
  overflow: hidden;
  font-size: var(--word);
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.layer--word .row { width: max-content; white-space: nowrap; }

.layer--lede {
  font-size: clamp(18px, 1.75vw, 27px);
  line-height: 1.28;
  letter-spacing: -0.012em;
}
.layer--lede .row { text-wrap: pretty; }

.layer--tags { margin-top: clamp(14px, 1.6vw, 22px); font-size: 13px; }
.layer--tags .row { display: flex; flex-wrap: wrap; gap: 8px; }

.pill {
  display: inline-block;
  padding: 0.5em 0.95em;
  border-radius: 100px;
  border: 1px solid var(--hair);
  line-height: 1.2;
}
.pill.tile { background: var(--bg); }

/* ─────────── Body ─────────── */

.body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: var(--gutter);
  align-items: start;
  padding-bottom: clamp(16px, 3vh, 36px);
}
.note {
  margin: 0;
  padding-top: 0.35em;
  font-size: 13px;
  color: var(--soft);
}
.copy { max-width: 38em; min-width: 0; }

/* ─────────── Ruler ─────────── */

.ruler {
  position: relative;
  height: 44px;
  border-top: 1px solid var(--hair);
}
.ruler-fill {
  position: absolute;
  top: -1px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.stop {
  position: absolute;
  top: 0;
  left: calc(var(--at) * 100%);
  translate: -50% 0;
  height: 44px;
  min-width: 44px;
  padding: 11px 6px 0;
  border: 0;
  background: none;
  color: var(--soft);
  font: 400 13px/1 var(--sans);
  cursor: pointer;
  transition: color 0.4s var(--ease);
}
.stop:first-of-type { translate: 0 0; padding-left: 0; text-align: left; }
.stop:last-of-type { translate: -100% 0; padding-right: 0; text-align: right; }
.stop:hover,
.stop.is-active { color: var(--ink); }
.stop:focus-visible { outline: 1px solid var(--ink); outline-offset: -4px; border-radius: 4px; }

.stop::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  width: 7px;
  height: 7px;
  margin-left: -3.5px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--ink);
  transition: background 0.4s var(--ease);
}
.stop:first-of-type::before { left: 3.5px; }
.stop:last-of-type::before { left: auto; right: 0; }
.stop.is-active::before { background: var(--ink); }

/* ─────────── Outro ─────────── */

.outro {
  min-height: 70svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 24px;
  padding: 80px var(--gutter) 28px;
}
.outro-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3rem, 9vw, 9rem);
  line-height: 0.96;
  letter-spacing: -0.035em;
}
.outro-link {
  align-self: flex-start;
  padding-bottom: 3px;
  border-bottom: 1px solid currentColor;
  font-size: 15px;
}

/* ─────────── Small screens ─────────── */

@media (max-width: 767px) {
  :root { --step: 70svh; }

  .display { align-self: end; padding-bottom: 24px; }
  .body { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .note { order: 2; padding-top: 0; }
  .layer--tags { font-size: 12px; }

  /* Dots only — labels would collide */
  .stop { font-size: 0; }
}
