/* Princely Kitilya — first screen: 22,699 data points become a name. */
:root {
  --zone-top: 112px;
  --blue: #1f2bff;
  --lime: #d8ff3e;
  --paper: #f4f4ef;
  --ink: #0b0c10;

  --display: "Fraunces", Georgia, serif;
  --sans: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;

  --m: clamp(16px, 2.4vw, 36px);
  /* iPhone notch / Dynamic Island / home bar: each edge keeps clear of the safe area */
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --mt: max(var(--m), var(--sat));
  --mr: max(var(--m), var(--sar));
  --mb: max(var(--m), var(--sab));
  --ml: max(var(--m), var(--sal));
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  margin: 0;
  background: var(--blue);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-variant-emoji: text; /* keep arrows like the north-east arrow as text on iOS */
  overflow-x: hidden;
}
h1, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--lime); color: var(--ink); }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }

/* ---------- Custom cursor ---------- */
.has-cursor, .has-cursor a, .has-cursor button { cursor: none; }
.cursor { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; display: none; }
.has-cursor .cursor { display: block; }
.cursor-dot {
  position: absolute; left: -7px; top: -7px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--lime);
  transition: transform 0.35s var(--ease), background-color 0.3s;
}
.cursor.is-link .cursor-dot { transform: scale(3.4); background: var(--paper); mix-blend-mode: difference; }
.cursor-label {
  position: absolute; left: 18px; top: 10px;
  padding: 3px 8px;
  background: var(--ink); color: var(--lime);
  font-family: var(--mono); font-size: 12px; white-space: nowrap;
  opacity: 0; transform: translateY(4px);
  transition: opacity 0.2s, transform 0.3s var(--ease);
}
.cursor.has-label .cursor-label { opacity: 1; transform: none; }

/* ---------- HUD ---------- */
.hud-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start;
  padding: var(--mt) var(--mr) var(--m) var(--ml);
  pointer-events: none;
  color: var(--hud, var(--paper));
}
.hud-top > * { pointer-events: auto; }
.hud-top .btn { background: var(--hud-btn, var(--lime)); color: var(--hud-btn-ink, var(--ink)); }
.hud-top .btn:hover { background: var(--hud, var(--paper)); color: var(--hud-btn, var(--ink)); }
.hud-name { font-weight: 500; font-size: 16px; line-height: 1.25; justify-self: start; }
.hud-name span { display: block; opacity: 0.7; }
.hud-nav { display: flex; gap: 28px; font-size: 16px; }
.hud-nav a { position: relative; }
.hud-nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 2px;
  background: var(--lime);
  transform: scaleX(0); transform-origin: right;
  transition: transform 0.45s var(--ease);
}
.hud-nav a:hover::after { transform: scaleX(1); transform-origin: left; }
.hud-right { justify-self: end; display: flex; align-items: center; gap: 20px; font-size: 15px; }
.hud-clock { opacity: 0.8; }
.hud-clock b { font-family: var(--mono); font-weight: 400; }
.btn {
  display: inline-flex; align-items: center;
  height: 44px; padding: 0 20px;
  background: var(--lime); color: var(--ink);
  font-weight: 500; border-radius: 999px;
  transition: transform 0.4s var(--ease), background-color 0.3s;
}
.btn:hover { background: var(--paper); transform: scale(1.06); }

/* ---------- Hero stage ---------- */
.hero { position: relative; height: 560vh; }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.fallback-name {
  position: absolute; left: var(--ml); right: var(--mr); top: 50%;
  transform: translateY(-50%); text-align: center;
  font-family: var(--display); font-weight: 800;
  font-size: clamp(4rem, 15vw, 16rem);
  line-height: 0.86; letter-spacing: -0.024em; text-transform: uppercase;
}
.webgl .fallback-name {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; top: 0; left: 0; transform: none;
}

.layer { position: absolute; inset: 0; pointer-events: none; }

.lead {
  position: absolute; left: var(--ml); bottom: var(--mb);
  max-width: 24ch;
  font-size: clamp(20px, 1.7vw, 28px); line-height: 1.2;
  font-weight: 500; letter-spacing: -0.01em;
}
.now-tag {
  position: absolute; right: var(--mr); bottom: var(--mb);
  display: grid; justify-items: end; gap: 6px;
  max-width: 300px; text-align: right;
  font-size: 18px; font-weight: 500; line-height: 1.25;
}
.now-tag span { font-family: var(--mono); font-size: 13px; font-weight: 400; color: var(--lime); }

/* the story: name breaks into scattered data while these lines play */
.story-step {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(100% - var(--ml) - var(--mr), 1040px);
  display: grid; justify-items: center; gap: 22px; text-align: center;
  opacity: 0; visibility: hidden;
}
.story-kicker { font-family: var(--mono); font-size: 14px; letter-spacing: 0.04em; color: var(--lime); }
.story-big {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(40px, 5.6vw, 96px);
  line-height: 0.98; letter-spacing: -0.02em;
  text-wrap: balance;
}
.story-small { font-size: clamp(18px, 1.5vw, 24px); line-height: 1.35; max-width: 34ch; text-wrap: pretty; }
.scroll-cue {
  position: absolute; left: 50%; bottom: var(--mb);
  transform: translateX(-50%);
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.04em;
  padding-bottom: 26px;
}
.scroll-cue::after {
  content: ""; position: absolute; left: 50%; bottom: 0; width: 2px; height: 18px;
  background: var(--lime); transform-origin: top;
  animation: cue 1.8s var(--ease) infinite;
}
@keyframes cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(0); transform-origin: bottom; } }

.layer-chart { opacity: 0; }
.chart-copy {
  position: absolute; left: var(--ml); top: var(--zone-top); bottom: var(--mb);
  width: min(40vw, 540px);
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
}
.chart-big {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(64px, 7.4vw, 136px);
  line-height: 0.9; letter-spacing: -0.028em;
  color: var(--lime);
}
.chart-copy .chap-note { color: var(--lime); }
.axis { position: absolute; font-family: var(--mono); font-size: 13px; opacity: 0.85; }
.axis-x { right: var(--mr); bottom: 8vh; }
.axis-y { left: 47vw; top: 12vh; }

.layer-chart { visibility: hidden; }
.layer button, .layer a { pointer-events: auto; }
.open-btn {
  font: inherit; font-size: 16px; font-weight: 500;
  height: 48px; padding: 0 22px;
  border: 0; border-radius: 999px;
  background: var(--lime); color: var(--ink);
  cursor: pointer;
  transition: transform 0.4s var(--ease), background-color 0.3s, color 0.3s;
}
.open-btn:hover { transform: scale(1.06); background: var(--paper); }


/* ---------- Work: one pinned stage, four datasets ---------- */
.work { position: relative; height: 900vh; --zone-bottom: calc(var(--mb) + 64px); --fg: #f4f4ef; --hl: #d8ff3e; --hl-ink: #0b0c10; }
.w-stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: #0b0c10; color: var(--fg); }
.w-gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.w-labels { position: absolute; inset: 0; pointer-events: none; }
.w-label {
  position: absolute; transform: translate(-50%, -50%);
  font-family: var(--mono); font-size: 13px; white-space: nowrap;
  color: var(--fg); opacity: 0;
}
.w-label.hl { color: var(--hl); }
.w-label.left { transform: translate(-100%, -50%); }
.w-label.right { transform: translate(0, -50%); }

.chap {
  position: absolute; left: var(--ml);
  top: var(--zone-top); bottom: var(--zone-bottom);
  width: min(40vw, 540px);
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  opacity: 0; visibility: hidden;
}
.chap-intro { width: auto; right: var(--mr); gap: clamp(16px, 3vh, 32px); }
.w-intro-title {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(48px, min(8.6vw, 15vh), 156px);
  line-height: 0.92; letter-spacing: -0.024em;
}
.w-intro-sub { font-size: clamp(18px, 1.5vw, 24px); max-width: 30ch; }

/* one chapter = question, answer, story, proof, action.
   Title and number read as one group; looser steps between the rest. */
.chap-title {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(26px, min(2.6vw, 5vh), 44px);
  line-height: 1.04; letter-spacing: -0.02em; text-wrap: balance;
}
.chap-big, .chart-big {
  margin-top: clamp(10px, 2.2vh, 24px);
  font-family: var(--display); font-weight: 800;
  font-size: clamp(56px, min(7.4vw, 14vh), 136px);
  line-height: 0.88; letter-spacing: -0.028em;
  color: var(--hl);
  /* room under the number for a comma's tail (€800,200), so it never touches the line below */
  padding-bottom: 0.12em;
}
.chart-big { color: var(--lime); }
.chap-note { margin-top: 6px; font-size: clamp(16px, 2vh, 19px); font-weight: 500; }
.chap-text {
  margin-top: clamp(16px, 3.4vh, 36px);
  font-size: clamp(15px, 2vh, 18px); line-height: 1.45; max-width: 40ch; text-wrap: pretty;
}
.chap-stack {
  margin-top: clamp(12px, 2.2vh, 22px);
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px;
  font-family: var(--mono); font-size: 13px; opacity: 0.85;
}
.chap-stack span { padding: 3px 9px; border-radius: 999px; box-shadow: inset 0 0 0 1px currentColor; }
.chap-actions, .chart-copy .open-btn { margin-top: clamp(16px, 3vh, 30px); }
.chap-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.chap .open-btn { background: var(--hl); color: var(--hl-ink); }
.chap .open-btn:hover { background: var(--fg); color: var(--hl-ink); }
.chap-link { font-weight: 500; border-bottom: 2px solid currentColor; padding-bottom: 2px; transition: opacity 0.3s; }
.chap-link:hover { opacity: 0.7; }

.w-progress {
  position: absolute; left: var(--ml); bottom: var(--mb);
  display: flex; gap: 6px;
}
.w-progress button {
  font: inherit; font-size: 14px; color: var(--fg);
  background: transparent; border: 0; cursor: pointer;
  padding: 6px 12px; border-radius: 999px;
  opacity: 0.78;
  transition: opacity 0.3s, background-color 0.3s, color 0.3s;
}
.w-progress button:hover { opacity: 1; }
.w-progress button.on { opacity: 1; background: var(--fg); color: var(--hl-ink); }

/* No WebGL: the chapters simply stack */
html:not(.webgl) .hero { height: auto; }
html:not(.webgl) .stage { position: relative; height: auto; overflow: visible; }
html:not(.webgl) .fallback-name { position: static; transform: none; padding: 22vh var(--mr) 4vh var(--ml); }
html:not(.webgl) .layer-intro { position: relative; height: 40vh; }
html:not(.webgl) .story-step { position: static; transform: none; opacity: 1; visibility: visible; width: auto; margin: 0 auto; padding: 12vh var(--mr) 12vh var(--ml); }
html:not(.webgl) .layer-story, html:not(.webgl) .layer-chart { position: static; }
html:not(.webgl) .layer-chart { visibility: visible; opacity: 1; padding: 0 var(--mr) 14vh var(--ml); }
html:not(.webgl) .chart-copy { position: static; transform: none; width: auto; max-width: 560px; }
html:not(.webgl) .axis { display: none; }
html:not(.webgl) .work { height: auto; }
html:not(.webgl) .w-stage { position: static; height: auto; padding: 14vh 0; display: grid; gap: 14vh; }
html:not(.webgl) .chap { position: static; transform: none; opacity: 1; visibility: visible; width: auto; padding: 0 var(--mr) 0 var(--ml); }
html:not(.webgl) .w-progress, html:not(.webgl) .w-gl { display: none; }

/* ---------- Full-screen project view ---------- */
.detail {
  position: fixed; inset: 0; z-index: 60;
  background: var(--ink); color: var(--paper);
  overflow-y: auto; overscroll-behavior: contain;
  clip-path: circle(0% at 50% 50%);
}
.detail[hidden] { display: none; }
.detail-close {
  position: fixed; top: var(--mt); right: var(--mr); z-index: 2;
  font: inherit; font-weight: 500; font-size: 16px;
  height: 44px; padding: 0 20px; border-radius: 999px; border: 0;
  background: var(--paper); color: var(--ink); cursor: pointer;
  transition: transform 0.4s var(--ease);
}
.detail-close:hover { transform: scale(1.06); }
.detail-inner {
  min-height: 100%;
  padding: 16vh var(--mr) max(10vh, var(--sab)) var(--ml);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  grid-template-areas: "metric metric" "title body" "stack body" "links body";
  column-gap: 6vw; row-gap: 24px;
  align-content: start;
}
.detail-metric {
  grid-area: metric;
  font-family: var(--display); font-weight: 800;
  font-size: clamp(88px, 19vw, 340px);
  line-height: 0.85; letter-spacing: -0.024em;
  color: var(--lime);
  margin-bottom: 4vh;
}
.detail-title { grid-area: title; font-family: var(--display); font-weight: 700; font-size: clamp(32px, 3.6vw, 60px); line-height: 1; letter-spacing: -0.02em; }
.detail-body { grid-area: body; display: grid; gap: 28px; font-size: 18px; line-height: 1.5; max-width: 52ch; }
.detail-body h3 { font-size: 15px; font-weight: 500; color: var(--lime); margin: 0 0 6px; }
.detail-body p { margin: 0; }
.detail-stack { grid-area: stack; font-family: var(--mono); font-size: 14px; opacity: 0.8; }
.detail-links { grid-area: links; display: flex; flex-wrap: wrap; gap: 12px; align-self: start; }
.detail-links a {
  display: inline-flex; align-items: center; height: 48px; padding: 0 22px;
  border-radius: 999px; background: var(--lime); color: var(--ink); font-weight: 500;
  transition: transform 0.4s var(--ease), background-color 0.3s;
}
.detail-links a + a { background: transparent; color: var(--paper); box-shadow: inset 0 0 0 2px var(--paper); }
.detail-links a:hover { transform: scale(1.05); }
/* ---------- Now: a pinned lime scene, the job told as three verbs ---------- */
.now { --verb-size: clamp(64px, min(15vw, 26vh), 260px); position: relative; height: 420vh; background: var(--lime); color: var(--ink); }
.now-stage {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
  padding: var(--zone-top) var(--mr) var(--mb) var(--ml);
  display: grid; grid-template-rows: auto 1fr;
}
.now-head { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 24px 6vw; align-items: end; }
.now-title {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(40px, min(5.6vw, 10vh), 104px);
  line-height: 0.94; letter-spacing: -0.024em;
}
.ln { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.06em; }
.ln > span { display: inline-block; }
.now-role { font-size: clamp(16px, 1.25vw, 20px); line-height: 1.45; max-width: 38ch; padding-bottom: 0.4em; }
.now-role b { font-weight: 600; }

.verbs { list-style: none; margin: 0; padding: 0; position: relative; }
/* the isometric block sits in the open space between the headline and the verb */
.now-blocks {
  position: absolute; z-index: 0;
  left: 50%; top: 47%; transform: translate(-50%, -50%);
  width: min(30vw, 44vh, 500px); height: auto; overflow: visible;
}
.now-head, .verbs, .verb-progress { position: relative; z-index: 1; }
.verbs { pointer-events: none; }
.verb-progress { position: absolute; }
.verb {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 16px 4vw;
}
.verb-word {
  position: relative; overflow: hidden;
  font-family: var(--display); font-weight: 800;
  font-size: var(--verb-size);
  line-height: 0.86; letter-spacing: -0.024em;
  padding-bottom: 0.2em; margin-bottom: -0.2em;
  white-space: nowrap;
}
.verb-out, .verb-fill { display: block; }
.verb-out { color: transparent; -webkit-text-stroke: 2px var(--ink); }
.verb-fill { position: absolute; left: 0; top: 0; color: var(--ink); clip-path: inset(0 100% 0 0); }
.verb-text {
  max-width: 30ch; padding-bottom: 1.6vh;
  font-size: clamp(17px, 1.4vw, 22px); line-height: 1.4; font-weight: 500;
}
.verb-progress {
  position: absolute; left: var(--ml); bottom: calc(var(--mb) + var(--verb-size) * 0.92 + 22px);
  display: flex; gap: 6px;
}
.verb-progress span { width: 44px; height: 4px; border-radius: 4px; background: rgba(11, 12, 16, 0.18); overflow: hidden; position: relative; }
.verb-progress span::after { content: ""; position: absolute; inset: 0; background: var(--ink); transform: scaleX(var(--p, 0)); transform-origin: left; }

/* until the script takes over, show the scene as a plain list */
html:not(.now-live) .now { height: auto; }
html:not(.now-live) .now-stage { position: relative; height: auto; }
html:not(.now-live) .verbs { display: grid; gap: 8vh; margin-top: 10vh; }
html:not(.now-live) .verb { position: static; }
html:not(.now-live) .verb-fill { clip-path: none; }
html:not(.now-live) .verb-progress { display: none; }

/* ---------- Contact: blue, proof first, then the ask ---------- */
.contact { background: var(--blue); color: var(--paper); padding: 18vh var(--mr) var(--mb) var(--ml); }
/* ---------- Behind the work: a shelf of spines, one open at a time ---------- */
.shelf-wrap { margin: 0 0 20vh; }
.shelf-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-bottom: 28px; }
.shelf-title {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(30px, 3.4vw, 56px); line-height: 1; letter-spacing: -0.02em;
}
.shelf-hint { font-family: var(--mono); font-size: 13px; opacity: 0.8; }

.shelf {
  list-style: none; margin: 0; padding: 0;
  display: flex; gap: 8px;
  height: clamp(340px, 46vh, 460px);
}
.sleeve {
  --bg: var(--paper); --fg: var(--ink); --dot: var(--blue); --hot: var(--lime);
  flex: 0 0 auto; flex-grow: 0; flex-basis: 68px;
  display: flex; min-width: 0;
  background: var(--bg); color: var(--fg);
  border-radius: 6px; overflow: hidden;
  transition: flex-grow 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.sleeve.is-open { flex-grow: 1; }
.sleeve--top   { --bg: #d8ff3e; --fg: #0b0c10; --dot: #0b0c10; --hot: #1f2bff; }
.sleeve--tools { --bg: #0b0c10; --fg: #f4f4ef; --dot: #d8ff3e; --hot: #f4f4ef; }
.sleeve--lang  { --bg: #f4f4ef; --fg: #0b0c10; --dot: #1f2bff; --hot: #0b0c10; }
.sleeve--brain { --bg: #0d1466; --fg: #f4f4ef; --dot: #f4f4ef; --hot: #d8ff3e; }
.sleeve--certs { --bg: #c9cdff; --fg: #0b0c10; --dot: #1f2bff; --hot: #0b0c10; }

.sleeve-spine {
  flex: 0 0 68px; width: 68px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 22px 0 18px; border: 0; background: transparent; color: inherit; cursor: pointer;
  font: inherit;
}
.sleeve.is-open .sleeve-spine { box-shadow: inset -1px 0 0 color-mix(in srgb, var(--fg) 22%, transparent); }
.spine-title {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -0.01em; line-height: 1;
}
.spine-mark {
  width: 26px; height: 26px; border-radius: 3px;
  background-image: radial-gradient(var(--dot) 1.6px, transparent 2.1px);
  background-size: 6.5px 6.5px; background-position: center;
}
.sleeve-spine:focus-visible { outline: 2px solid var(--fg); outline-offset: -6px; }

.sleeve-cover { flex: 1 1 auto; min-width: 0; height: 100%; overflow: hidden; }
.cover-inner {
  width: min(1000px, 68vw); height: 100%;
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: clamp(20px, 3vw, 44px);
  padding: 22px clamp(22px, 3vw, 40px) 22px 22px;
  opacity: 0; transform: translateX(-24px);
  transition: opacity 0.35s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.sleeve.is-open .cover-inner { opacity: 1; transform: none; transition-delay: 0.18s; }
.poster {
  display: block; height: 100%; min-height: 0; aspect-ratio: 4 / 5; width: auto; max-width: 100%;
  border-radius: 4px;
  background: color-mix(in srgb, var(--fg) 6%, var(--bg));
}
.cover-text { align-self: end; display: grid; gap: 12px; max-width: 38ch; padding-bottom: 6px; }
.cover-title {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(28px, 2.8vw, 46px); line-height: 1; letter-spacing: -0.024em;
}
.cover-meta { font-family: var(--mono); font-size: 13px; opacity: 0.85; }
.cover-body { font-size: clamp(16px, 1.25vw, 19px); line-height: 1.45; }

/* tablets: covers fill what is left, poster keeps its shape */
@media (max-width: 1099px) {
  .cover-inner { width: calc(100vw - var(--ml) - var(--mr) - 5 * 68px - 32px); grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .poster { height: 100%; width: 100%; aspect-ratio: auto; min-height: 0; }
  .shelf { height: clamp(460px, 58vh, 620px); }
}

/* phones: the shelf turns into a stack of bars, one opens downward */
@media (max-width: 760px) {
  .shelf { flex-direction: column; height: auto; gap: 6px; }
  .sleeve { flex-direction: column; flex: none; }
  .sleeve-spine {
    flex: none; width: 100%; min-height: 60px;
    flex-direction: row; padding: 0 18px;
  }
  .sleeve.is-open .sleeve-spine { box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--fg) 22%, transparent); }
  .spine-title { writing-mode: horizontal-tb; transform: none; font-size: 22px; }
  .sleeve-cover { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
  .sleeve.is-open .sleeve-cover { grid-template-rows: 1fr; }
  .cover-inner { width: auto; height: auto; min-height: 0; overflow: hidden; padding: 0 16px; grid-template-rows: auto auto; transform: translateY(-12px); }
  .sleeve.is-open .cover-inner { padding: 16px; }
  .poster { height: 200px; width: 100%; }
  .cover-text { gap: 8px; }
  .cover-title { font-size: 28px; }
  .shelf-wrap { margin-bottom: 12vh; }
}

/* landscape phones: shorter shelf */
@media (max-height: 519px) and (orientation: landscape) {
  .shelf { height: 290px; }
  .sleeve { flex-basis: 54px; }
  .sleeve-spine { flex-basis: 54px; width: 54px; padding: 16px 0 14px; }
  .spine-title { font-size: 18px; }
  .cover-inner {
    width: calc(100vw - var(--ml) - var(--mr) - 5 * 54px - 32px);
    grid-template-columns: auto minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
    gap: 18px; padding: 16px;
  }
  .poster { height: 100%; width: auto; aspect-ratio: 4 / 5; }
  .cover-title { font-size: 24px; }
  .cover-meta { font-size: 12px; }
  .cover-body { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .sleeve, .cover-inner, .sleeve-cover { transition: none; }
}

.contact-title {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(32px, 4.2vw, 76px);
  line-height: 1; letter-spacing: -0.02em;
  max-width: 18ch; text-wrap: balance;
}
.close-mail {
  display: block; margin-top: 5vh;
  font-family: var(--display); font-weight: 800;
  font-size: clamp(28px, 6vw, 124px);
  line-height: 1.02; letter-spacing: -0.028em;
  color: var(--lime);
}
.close-mail .w { display: inline-block; white-space: nowrap; }
.close-mail .ch { display: inline-block; will-change: transform; }
.contact-row { margin-top: 6vh; display: flex; flex-wrap: wrap; align-items: center; gap: 16px 32px; }
.copy-btn {
  font: inherit; font-size: 16px; font-weight: 500;
  height: 52px; padding: 0 26px; border: 0; border-radius: 999px;
  background: var(--lime); color: var(--ink); cursor: pointer;
  transition: transform 0.4s var(--ease), background-color 0.3s;
}
.copy-btn:hover { transform: scale(1.05); background: var(--paper); }
.copy-btn.is-done { background: var(--paper); }
.close-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 28px; }
.close-links a {
  font-size: 18px; font-weight: 500;
  background: linear-gradient(currentColor, currentColor) left bottom / 0 2px no-repeat;
  padding-bottom: 3px; transition: background-size 0.5s var(--ease);
}
.close-links a:hover { background-size: 100% 2px; }
.foot {
  margin-top: 16vh; padding-top: 18px; border-top: 1px solid rgba(244, 244, 239, 0.4);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  font-family: var(--mono); font-size: 13px; opacity: 0.85;
}

@media (max-width: 760px) {
  .now-stage { padding-top: 92px; }
  .now-head { grid-template-columns: 1fr; gap: 14px; }
  .now-title { font-size: 38px; }
  .now-role { font-size: 15px; }
  .verb { grid-template-columns: 1fr; gap: 10px; }
  .verb-word { font-size: 17vw; order: 2; }
  .verb-text { order: 1; font-size: 16px; padding-bottom: 0; }
  .now { --verb-size: 17vw; }
  .verb-progress { display: none; }
  .close-mail { font-size: 9.6vw; }
}

/* ---------- Phone ---------- */
@media (max-width: 760px) {
  .hud-top { grid-template-columns: 1fr auto; }
  .hud-nav, .hud-clock, .scroll-cue { display: none; }
  .lead { bottom: auto; top: 104px; max-width: 20ch; font-size: 20px; }
  .now-tag { left: var(--ml); right: var(--mr); justify-items: start; text-align: left; font-size: 16px; }
  /* phone: copy owns the top of the screen, the chart the bottom */
  :root { --zone-top: 72px; }
  .chart-copy { right: var(--mr); width: auto; bottom: 53vh; }
  .chap { right: var(--mr); width: auto; bottom: 43vh; }
  .chap-title { font-size: 24px; }
  .chap-big, .chart-big { font-size: 48px; margin-top: 4px; padding-bottom: 0.1em; }
  .chap-note { font-size: 15px; margin-top: 2px; }
  .chap-text { font-size: 14px; line-height: 1.36; margin-top: 8px; }
  .chap-stack, .chart-copy .chap-text { display: none; }
  .chap-actions, .chart-copy .open-btn { margin-top: 10px; }
  .chap-actions { gap: 14px; }
  .open-btn { height: 42px; padding: 0 18px; font-size: 15px; }
  .axis-y { left: var(--ml); top: auto; bottom: 50vh; }
  .story-step { gap: 16px; }
  .chap-intro { bottom: 30vh; }
  .w-label { font-size: 11px; }
  .w-label.cap { display: none; }
  .w-progress { left: var(--ml); right: var(--mr); justify-content: space-between; bottom: max(12px, var(--sab)); }
  .w-progress button { padding: 6px 10px; font-size: 13px; }
  .detail-inner { grid-template-columns: 1fr; grid-template-areas: "metric" "title" "body" "stack" "links"; padding-top: 12vh; }
}

/* ---------- Narrower than a laptop: the verb's sentence moves above the word ---------- */
@media (max-width: 1199px) {
  .verb { grid-template-columns: 1fr; gap: 12px; }
  .verb-text { order: 1; padding-bottom: 0; }
  .verb-word { order: 2; }
  .verb-progress { display: none; }
  .now { --verb-size: clamp(56px, min(14vw, 24vh), 200px); }
}

/* ---------- Touch screens: no scroll hint needed, every target 44px ---------- */
@media (hover: none), (pointer: coarse) {
  .scroll-cue { display: none; }
  .w-progress button { min-height: 44px; min-width: 44px; }
  .chap-link, .close-links a { display: inline-flex; align-items: center; min-height: 44px; }
  .open-btn, .copy-btn { min-height: 44px; }
}
@media (max-width: 1099px) {
  .scroll-cue { display: none; }
}

/* ---------- Portrait tablets: phone-style stack, tablet-sized type ---------- */
@media (min-width: 761px) and (max-width: 1099px) and (max-aspect-ratio: 20/23) {
  .chart-copy { right: var(--mr); width: auto; max-width: 640px; bottom: 52vh; }
  .chap { right: var(--mr); width: auto; max-width: 640px; bottom: 45vh; }
  .chap-title { font-size: clamp(32px, 4.4vw, 44px); }
  .chap-big, .chart-big { font-size: clamp(72px, 10vw, 110px); }
  .chap-note { font-size: 18px; }
  .chap-text { font-size: 18px; max-width: 46ch; }
  .chart-copy .chap-text { display: none; }
  .axis-y { left: var(--ml); top: auto; bottom: 48vh; }
  .chap-intro { bottom: 30vh; }
  .w-label.cap { display: none; }
  .w-progress { left: var(--ml); right: var(--mr); justify-content: space-between; }
  .now .verbs { position: relative; }
  .verb { top: 50%; bottom: auto; transform: translateY(-50%); }
}

/* ---------- Phone portrait: centre the verb in the space under the headline ---------- */
@media (max-width: 760px) {
  .verb { top: 50%; bottom: auto; transform: translateY(-50%); }
  .open-btn { min-height: 44px; }
}

/* ---------- Landscape phones: a short, wide screen ---------- */
@media (max-height: 519px) and (orientation: landscape) {
  :root { --zone-top: 64px; }
  .hud-top { grid-template-columns: 1fr auto; padding: max(10px, var(--sat)) var(--mr) 10px var(--ml); }
  .hud-nav, .hud-clock { display: none; }
  .hud-name { font-size: 14px; }

  .lead { font-size: 17px; max-width: 30ch; }
  .now-tag { font-size: 14px; }

  .chart-copy, .chap { top: var(--zone-top); bottom: 12px; width: min(46vw, 520px); }
  .chap-title { font-size: 22px; }
  .chap-big, .chart-big { font-size: 44px; margin-top: 6px; }
  .chap-note { font-size: 14px; margin-top: 2px; }
  .chap-text { font-size: 13.5px; line-height: 1.4; margin-top: 8px; max-width: 52ch; }
  .chap-stack { display: none; }
  .chap-actions, .chart-copy .open-btn { margin-top: 10px; }
  .chart-copy .chap-stack { display: none; }
  .w-label.cap { display: none; }
  .w-label { font-size: 11px; }
  .w-progress { left: auto; right: var(--mr); top: 58px; bottom: auto; }
  .w-progress button { padding: 4px 10px; font-size: 13px; }
  .w-intro-title { font-size: 44px; }

  .story-big { font-size: clamp(30px, 5vw, 48px); }
  .story-small { font-size: 16px; }
  .story-step { gap: 12px; }

  .now-stage { padding-top: 60px; }
  .now-title { font-size: 34px; }
  .now-role { font-size: 14px; }
  .now { --verb-size: min(12vw, 28vh); }
  .verb-text { font-size: 15px; }

  .contact { padding-top: 22vh; }
  .detail-inner { padding-top: 64px; }
}

/* ---------- Phones: chapter text sits at the top so the chart labels below never reach it ---------- */
@media (max-width: 760px) {
  .chap, .chart-copy { justify-content: flex-start; }
}

/* ---------- The Now block on narrower screens ---------- */
@media (max-width: 1199px) {
  .now-blocks { width: min(46vw, 38vh, 440px); top: 50%; left: 45%; }
}
@media (max-width: 760px), (max-width: 1099px) and (max-aspect-ratio: 20/23) {
  .verb { top: auto; bottom: 0; transform: none; }
  .now-blocks { width: min(66vw, 40vh, 460px); top: 55%; left: 50%; }
}
@media (max-height: 519px) and (orientation: landscape) {
  .now-blocks { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-cue::after { animation: none; }
}

/* arriving from a case study's "All work": the page opens straight on that project's chapter (see index.html) */
.handoff-cover { display: none; }
html.handoff { background: var(--h-bg); }
html.handoff:not(.placed) body { visibility: hidden; }
/* the live particles and their labels stay hidden until they have settled on the landed chart */
html.handoff .w-gl, html.handoff .gl { visibility: hidden; }
.w-labels { transition: opacity 0.4s ease; }
html.handoff .w-labels { opacity: 0; }
html.handoff .handoff-cover { display: block; position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
html.handoff .w-stage { background: var(--h-bg); --fg: var(--h-fg); --hl: var(--h-hl); --hl-ink: var(--h-ink); }
html[data-handoff="ratios"] .chap[data-chap="1"], html[data-handoff="hospital"] .chap[data-chap="2"], html[data-handoff="flights"] .chap[data-chap="3"], html[data-handoff="eu"] .chap[data-chap="4"] { opacity: 1; visibility: visible; }
html[data-handoff="ratios"] .w-progress button[data-go="1"], html[data-handoff="hospital"] .w-progress button[data-go="2"], html[data-handoff="flights"] .w-progress button[data-go="3"], html[data-handoff="eu"] .w-progress button[data-go="4"] { opacity: 1; background: var(--fg); color: var(--hl-ink); }
html[data-handoff="taxi"] .stage { background: var(--h-bg); }
html[data-handoff="taxi"] .layer-intro { opacity: 0; }
html[data-handoff="taxi"] .layer-chart { opacity: 1; visibility: visible; }

/* short phones (iPhone SE and similar): the paragraph would run into the chart, so each chapter keeps its question, number and button */
@media (max-width: 760px) and (max-height: 640px) {
  .chap:not(.chap-intro) .chap-text { display: none; }
}

/* short phones: the chapter's button and link stay on one line, so the link never lands on the chart */
@media (max-width: 760px) and (max-height: 640px) {
  .chap-actions { flex-wrap: nowrap; gap: 12px; }
  .chap .open-btn { padding: 0 16px; font-size: 14px; white-space: nowrap; }
  .chap-link { font-size: 14px; white-space: nowrap; }
}
/* landscape phones: the verb's sentence sits beside the big word, as on laptops, instead of over the job text */
@media (max-height: 519px) and (orientation: landscape) {
  .verb { grid-template-columns: minmax(0, 1fr) minmax(0, 34ch); align-items: end; }
  .verb-word { order: 1; }
  .verb-text { order: 2; padding-bottom: 1.4vh; }
}
@media (max-height: 519px) and (orientation: landscape) {
  .now { --verb-size: min(9vw, 20vh); }
  .verb { grid-template-columns: minmax(0, 1fr) minmax(0, 28ch); }
}
/* landscape phones, final arrangement: the big verb spans the full width along the bottom, and its sentence sits
   in the empty right half above it, beside the job text instead of on top of it */
@media (max-height: 519px) and (orientation: landscape) {
  .verb { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 4vw; row-gap: 8px; }
  .verb-text { grid-column: 2; grid-row: 1; order: 0; padding-bottom: 0; max-width: 34ch; }
  .verb-word { grid-column: 1 / -1; grid-row: 2; order: 0; }
}

/* contact section: the header sits on a soft fade of the blue, so the shelf cards scroll away under it
   instead of showing through the name, links and button */
body:not(.case) .hud-top::before { content: ""; position: absolute; inset: 0 0 -24px 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity 0.3s; background: linear-gradient(to bottom, var(--blue) 0%, var(--blue) 72%, transparent 100%); }
html.hud-solid body:not(.case) .hud-top::before { opacity: 1; }

/* phones: the project panel scrolls with a finger (iOS), and its links sit right under the title,
   so "Read the case study" is on the first screen instead of below a long text */
.detail { -webkit-overflow-scrolling: touch; touch-action: pan-y; }
@media (max-width: 760px) {
  .detail-inner { grid-template-areas: "metric" "title" "links" "body" "stack"; padding-top: 88px; row-gap: 18px; }
  .detail-metric { font-size: clamp(48px, 15vw, 72px); }
}
