/* ============================================================
   Sangamesh Girish Dandin — portfolio
   Built from three references, adapted to one system:
   · Dev in the Hood  → warm paper & ink, wide heavy caps, red accent,
                         story-led case studies with a "next project" hand-off.
   · Christen Dijoux  → dot-matrix / halftone motif, thin condensed display
                         type, mono metadata, pinned horizontal project rail
                         with halftone → colour circle reveals.
   · Sebastien Graf   → bold colour hero, a narrating guide with speech
                         bubbles, full-screen featured chapters with sticky
                         stages, window mockups, scroll-filled text, 12-col
                         hairline grid.
   ============================================================ */

/* ── TOKENS ───────────────────────────────────────────────── */
:root {
  --paper: #f4f1ea;
  --paper-2: #fbf9f4;
  --ink: #16130f;
  --ink-2: #4d4840;
  --ink-3: #6b665c;
  --rule: rgba(22, 19, 15, 0.14);
  --red: #d81c0e;
  --blue: #2261e9;

  --sans: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --cond: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', monospace;

  --wrap: 1360px;
  --pad: clamp(20px, 3.4vw, 48px);
  --gap: clamp(16px, 2vw, 28px);
  --hdr-h: 64px;
  --section-y: clamp(80px, 9vw, 136px);
  --section-y-sm: clamp(48px, 6vw, 88px);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t: 240ms;

  --hdr-bg: var(--blue);
  --hdr-fg: var(--paper);
}

/* ── BASE ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { scroll-padding-top: calc(var(--hdr-h) + 12px); -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul, ol { list-style: none; }
em { font-style: normal; }
::selection { background: var(--ink); color: var(--paper); }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

.mono { font-family: var(--mono); }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.accent { color: var(--red); }
.wrap { width: 100%; max-width: calc(var(--wrap) + var(--pad) * 2); margin-inline: auto; padding-inline: var(--pad); }

.skip-link {
  position: absolute; left: var(--pad); top: -80px; z-index: 100;
  min-height: 44px; display: inline-flex; align-items: center;
  padding: 0 16px; background: var(--ink); color: var(--paper);
  font-family: var(--mono); font-size: 0.75rem; text-decoration: none;
}
.skip-link:focus { top: 10px; }

/* Seb-style 12-column hairline grid */
.grid-lines {
  background-image: repeating-linear-gradient(to right, rgba(22, 19, 15, 0.07) 0 1px, transparent 1px calc(100% / 12));
  background-size: calc(100% - var(--pad) * 2) 100%;
  background-position: center top;
  background-repeat: no-repeat;
}

/* Shared labels */
.eyebrow {
  display: flex; align-items: center; gap: 12px;
  font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3);
}
.eyebrow > span:first-child { color: var(--red); }
/* The brand red is too dark for small text on ink; the RedTeam coral reads at 4.7:1 */
[data-tone="ink"] .eyebrow > span:first-child { color: #e8462a; }
.display {
  margin-top: 20px;
  font-size: clamp(2.6rem, 6vw, 5.5rem);
  font-weight: 800;
  font-stretch: 125%;
  line-height: 0.95;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  text-wrap: balance;
}
.link { text-decoration: underline; text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
.link:hover { color: var(--red); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.6875rem; letter-spacing: 0.06em; text-transform: uppercase; }
.tags li { padding: 6px 10px; border: 1px solid currentColor; opacity: 0.8; }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 46px; padding: 0 20px;
  font-family: var(--mono); font-size: 0.75rem; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none; white-space: nowrap;
  border: 1px solid transparent;
  transition: background-color var(--t) ease, color var(--t) ease, border-color var(--t) ease, transform 120ms ease;
}
.btn:active { transform: translateY(1px); }
.btn-sm { min-height: 44px; padding: 0 14px; }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover { background: var(--paper); color: var(--ink); }
.btn-paper { background: var(--paper); color: var(--ink); }
.btn-paper:hover { background: var(--ink); color: var(--paper); }
.btn-solid { background: var(--paper); color: var(--ink); }
.btn-solid:hover { background: var(--red); color: var(--paper); }
.btn-ghost { border-color: color-mix(in srgb, currentColor 30%, transparent); background: color-mix(in srgb, currentColor 6%, transparent); }
.btn-ghost:hover { border-color: currentColor; }
.hdr .btn-ghost { background: transparent; }
.btn-line { border-color: currentColor; }
.btn-line:hover { background: color-mix(in srgb, currentColor 14%, transparent); }
.btn-chapter { background: var(--c-fg); color: var(--c-bg); border-color: var(--c-fg); }
.btn-chapter:hover { background: transparent; color: var(--c-fg); }
.btn-chapter:focus-visible { outline-color: var(--c-fg); }

/* ── HEADER (takes the colour of the section under it) ────── */
.hdr {
  position: sticky; top: 0; z-index: 50;
  /* Opaque: at the top of the page a see-through bar lightened the hero blue below 4.5:1 */
  background: var(--hdr-bg);
  color: var(--hdr-fg);
  border-bottom: 1px solid color-mix(in srgb, var(--hdr-fg) 14%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: background-color 400ms ease, color 400ms ease;
}
.hdr-inner { height: var(--hdr-h); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; }
.hdr-mark { font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; justify-self: start; }
.hdr-mark span { opacity: 0.5; }
.hdr-nav { display: flex; align-items: center; gap: 4px; }
.hdr-nav a {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px;
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; text-decoration: none;
}
.hdr-nav a span { font-size: 0.625rem; opacity: 0.55; }
.hdr-nav a::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: 6px; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform var(--t) var(--ease-out); }
.hdr-nav a:not(.hdr-logo):hover::after, .hdr-nav a[aria-current="true"]::after { transform: scaleX(1); }
.hdr-logo { width: 44px; justify-content: center; padding: 0 !important; margin: 0 10px; border: 1px solid currentColor; font-weight: 500; letter-spacing: 0 !important; }
.hdr-tools { display: flex; gap: 8px; justify-self: end; }
.menu-btn { display: none; }
.menu {
  position: absolute; inset: 100% 0 auto 0;
  background: var(--ink); color: var(--paper);
  border-bottom: 1px solid rgba(244, 241, 234, 0.14);
  max-height: calc(100dvh - var(--hdr-h)); overflow-y: auto;
}
.menu nav { display: flex; flex-direction: column; padding-bottom: 24px; }
.menu nav a:not(.btn) {
  display: flex; align-items: baseline; gap: 14px; min-height: 64px; padding-top: 14px;
  border-bottom: 1px solid rgba(244, 241, 234, 0.14);
  font-family: var(--cond); font-size: 2.5rem; font-weight: 300; text-transform: uppercase; text-decoration: none;
}
.menu nav a span { font-family: var(--mono); font-size: 0.75rem; opacity: 0.6; }
.menu nav a[aria-current="true"] { color: var(--red); }
.menu .btn { margin-top: 24px; }

/* ── SPEECH BUBBLE (Seb) ──────────────────────────────────── */
.bubble {
  position: relative;
  max-width: 320px;
  padding: 14px 18px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 18px;
  box-shadow: 0 5px 0 rgba(22, 19, 15, 0.22);
  font-size: 1.0625rem; font-weight: 600; line-height: 1.3;
}
.bubble::after {
  content: ''; position: absolute; left: 50%; bottom: -8px;
  width: 16px; height: 16px; background: inherit;
  transform: translateX(-50%) rotate(45deg); border-radius: 2px;
}
.bubble b { color: var(--blue); font-weight: 700; }

/* ── HERO (Seb): blue field, speech bubble, dithered pixel portrait ── */
/* Checkerboard shadow shared by the bubble and the sound button */
.say, .sound { --checker: conic-gradient(var(--ck, #0b0b0c) 25%, transparent 0 50%, var(--ck, #0b0b0c) 0 75%, transparent 0) 0 0 / 4px 4px; }

.hero {
  --hero-run: 12svh; /* how far the portrait continues below the first screen */
  --pw: min(44vw, calc(80svh - 20px), 700px); /* portrait width */
  position: relative;
  min-height: calc(100svh - var(--hdr-h) + var(--hero-run));
  background-color: var(--blue); color: var(--paper);
  background-image: repeating-linear-gradient(to right, rgba(251, 251, 248, 0.09) 0 1px, transparent 1px calc(100% / 12));
  background-size: calc(100% - var(--pad) * 2) 100%; background-position: center; background-repeat: no-repeat;
  overflow: hidden;
}
.hero-main {
  position: relative; z-index: 2;
  min-height: calc(100svh - var(--hdr-h));
  display: flex; align-items: flex-end;
  padding-top: clamp(24px, 4vh, 48px); padding-bottom: clamp(28px, 5.5vh, 64px);
}
.hero-copy { max-width: calc(100% - var(--pw) * 0.62); }
.hero-tag { display: inline-flex; align-items: center; gap: 10px; font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; }
.pulse { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--paper); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

.hero-title {
  margin-top: clamp(12px, 2vh, 20px);
  font-size: clamp(3rem, min(6.6vw, 12svh), 7.5rem);
  font-weight: 700; line-height: 0.94; letter-spacing: -0.04em;
}
.hero-title .line { display: block; animation: line-in 900ms var(--ease-out) both; }
.hero-title .line:nth-child(2) { animation-delay: 90ms; }
.hero-title .line:nth-child(3) { animation-delay: 180ms; }
.hero-title .thin { font-weight: 300; }
@keyframes line-in { from { opacity: 0; transform: translateY(0.35em); clip-path: inset(0 0 100% 0); } to { opacity: 1; transform: none; clip-path: inset(0 0 -10% 0); } }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: clamp(18px, 3vh, 32px); }
.hero-links { display: flex; flex-wrap: wrap; gap: 0 24px; margin-top: 6px; font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase; }
.hero-links a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.hero-links a:hover { text-decoration: underline; text-underline-offset: 0.3em; }

/* The speech bubble: paper body, 24px radius, checkerboard drop shadow */
.say {
  position: relative; isolation: isolate;
  padding: 18px 22px 20px;
  color: var(--ink);
  font-weight: 650; line-height: 1.12; letter-spacing: -0.02em;
}
.say::before, .say::after { content: ''; position: absolute; inset: 0; border-radius: 24px; }
.say::after { background: #fbfbf8; z-index: -1; }
.say::before { background: var(--checker); transform: translate(6px, 6px); z-index: -2; }
.say b { color: var(--blue); font-weight: inherit; }
.say-tail {
  position: absolute; bottom: -14px; left: var(--tail-x, 22px);
  width: 24px; height: 16px; transform: translateX(-50%);
  background: #fbfbf8; clip-path: polygon(0 0, 100% 0, 50% 100%); z-index: -1;
}
.say-tail-shadow { background: var(--checker); transform: translate(calc(-50% + 6px), 6px); z-index: -2; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.94); } to { opacity: 1; transform: none; } }
/* Words fill in one by one, like the reference's narration */
.js .say .w { opacity: 0.22; transition: opacity 160ms linear; }
.js .say .w.on { opacity: 1; }

/* Sound toggle: 44px paper disc with the same checker shadow. Off by default. */
.sound {
  position: fixed; right: 16px; bottom: 16px; z-index: 45;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; isolation: isolate;
  color: var(--ink);
}
.sound[hidden] { display: none; }
.sound::before, .sound::after { content: ''; position: absolute; inset: 0; border-radius: 50%; }
.sound::after { background: #fbfbf8; z-index: -1; transition: transform var(--t) var(--ease-out); }
.sound::before { background: var(--checker); transform: translate(4px, 4px); z-index: -2; }
.sound:hover::after { transform: translate(1px, 1px); }
.sound:active::after { transform: translate(3px, 3px); }
.sound .sound-on, .sound[aria-pressed="true"] .sound-off { display: none; }
.sound[aria-pressed="true"] .sound-on { display: inline; }
@media (min-width: 768px) { .sound { right: 24px; bottom: 24px; } }

/* ── INTRO: scroll-filled statement (Seb) ─────────────────── */
.intro { height: 170vh; }
.intro-stage { position: sticky; top: var(--hdr-h); height: calc(100svh - var(--hdr-h)); display: flex; align-items: center; }
.intro-text {
  max-width: min(22.5em, calc(100% - clamp(0px, 27vw, 380px))); margin-left: auto;
  font-size: clamp(1.75rem, 3.4vw, 3.1rem);
  font-weight: 600; line-height: 1.08; letter-spacing: -0.015em;
}
.intro-text em { color: var(--blue); }
.js .intro-text .w { opacity: 0.16; transition: opacity 260ms linear; }
.js .intro-text .w.on { opacity: 1; }

/* ── WORK: heading ────────────────────────────────────────── */
.work-head { padding-top: var(--section-y-sm); padding-bottom: var(--section-y-sm); }
.work-lede { margin-top: 20px; max-width: 40ch; font-size: 1.125rem; color: var(--ink-2); }

/* ── FEATURED CHAPTERS (Seb tour) ─────────────────────────── */
.chapter { height: 200vh; background: var(--c-bg); color: var(--c-fg); --enter: 1; }
.chapter-stage {
  position: sticky; top: var(--hdr-h);
  height: calc(100svh - var(--hdr-h));
  overflow: hidden;
  display: flex; align-items: stretch;
  background-image: repeating-linear-gradient(to right, color-mix(in srgb, var(--c-fg) 10%, transparent) 0 1px, transparent 1px calc(100% / 12));
  background-size: calc(100% - var(--pad) * 2) 100%; background-position: center; background-repeat: no-repeat;
}
.chapter-grid {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: auto minmax(0, 1fr);
  column-gap: var(--gap); row-gap: clamp(16px, 2.6vh, 32px);
  padding-top: clamp(20px, 3.6vh, 44px); padding-bottom: clamp(20px, 3.6vh, 44px);
}
.chapter-head { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--gap); row-gap: 10px; align-items: end; }
.chapter-bar { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 8px; border-bottom: 1px solid color-mix(in srgb, var(--c-fg) 22%, transparent); }
.chapter-count { display: flex; gap: 18px; font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; }
.chapter-dots { display: flex; gap: 2px; }
.chapter-dots a {
  display: grid; place-items: center; min-width: 44px; min-height: 44px;
  font-size: 0.6875rem; letter-spacing: 0.08em; text-decoration: none;
  border: 1px solid transparent;
}
.chapter-dots a:hover { border-color: color-mix(in srgb, var(--c-fg) 40%, transparent); }
.chapter-dots a[aria-current="true"] { border-color: currentColor; }
.chapter-title { grid-column: 1; font-size: clamp(2.4rem, 4.6vw, 4.5rem); font-weight: 700; line-height: 1; letter-spacing: -0.025em; }
.chapter-tagline { grid-column: 1; max-width: 44ch; font-size: 1.125rem; }
.chapter-actions { grid-column: 2; grid-row: 2 / span 2; align-self: end; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.chapter-next { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none; }
.chapter-next:hover { text-decoration: underline; text-underline-offset: 0.3em; }

.window {
  border-radius: 12px; overflow: hidden;
  background: #0c0c0d;
  box-shadow: 0 30px 70px -28px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.window-bar { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; background: #1b1b1d; color: rgba(244, 241, 234, 0.75); }
.window-bar i { flex: none; width: 10px; height: 10px; border-radius: 50%; background: rgba(244, 241, 234, 0.25); }
.window-bar span { margin-left: 10px; font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.window img { width: 100%; }

/* The window shrinks to the screenshot so no letterbox bars appear */
.chapter-window {
  grid-column: 4 / -1; grid-row: 2; align-self: center; justify-self: end;
  width: fit-content; max-width: 100%; min-height: 0;
  transform: translateY(calc((1 - var(--enter)) * 90px)) scale(calc(0.94 + 0.06 * var(--enter)));
  transform-origin: 50% 100%;
}
.chapter-window img { width: auto; max-width: 100%; max-height: calc(100svh - var(--hdr-h) - 270px); }
.spec {
  grid-column: 1 / span 3; grid-row: 2; align-self: end;
  position: relative; z-index: 2;
  padding: 18px; border-radius: 14px;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.2);
  transform: translateY(calc((1 - var(--enter)) * 140px));
}
.spec dl div { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.spec dt { font-family: var(--mono); font-size: 0.625rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.spec dd { font-size: 0.9375rem; font-weight: 600; line-height: 1.3; }
.spec-stack { display: flex; flex-wrap: wrap; margin-top: 12px; font-size: 0.6875rem; color: var(--ink-2); }
.spec-stack li:not(:last-child)::after { content: '/'; margin: 0 7px; opacity: 0.4; }
.spec-links { display: flex; flex-wrap: wrap; gap: 0 18px; margin-top: 6px; }
.spec-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; font-size: 0.9375rem; text-underline-offset: 0.22em; }
.spec-link:hover { color: var(--red); }

/* Very wide diagrams (e.g. a pipeline) get the full width; facts run beneath */
.chapter[data-shape="wide"] .chapter-grid { grid-template-rows: auto minmax(0, 1fr) auto; }
.chapter[data-shape="wide"] .chapter-window { grid-column: 1 / -1; justify-self: center; }
.chapter[data-shape="wide"] .chapter-window img { max-height: calc(100svh - var(--hdr-h) - 420px); }
.chapter[data-shape="wide"] .spec { grid-column: 1 / -1; grid-row: 3; display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); column-gap: var(--gap); align-items: center; padding: 12px 18px; }
.chapter[data-shape="wide"] .spec dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: 18px; }
.chapter[data-shape="wide"] .spec dl div { border-bottom: 0; }
.chapter[data-shape="wide"] .spec-stack { margin-top: 0; }

/* Seb's tour on desktop: the mascot stands on one side (data-side) and
   presents the project, which takes the other eight columns. The facts
   become a compact strip under the screenshot. */
@media (min-width: 861px) {
  .chapter-grid, .chapter[data-shape="wide"] .chapter-grid { grid-template-rows: auto minmax(0, 1fr) auto; }
  .chapter-head, .chapter-window, .spec,
  .chapter[data-shape="wide"] .chapter-window, .chapter[data-shape="wide"] .spec { grid-column: 5 / -1; }
  .chapter[data-side="right"] :is(.chapter-head, .chapter-window, .spec) { grid-column: 1 / span 8; }
  .chapter-window, .chapter[data-shape="wide"] .chapter-window { justify-self: center; }
  .chapter-window img, .chapter[data-shape="wide"] .chapter-window img { max-height: calc(100svh - var(--hdr-h) - 430px); }
  .chapter-tagline { max-width: none; }
  .spec, .chapter[data-shape="wide"] .spec {
    grid-row: 3; align-self: stretch;
    display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); column-gap: var(--gap); align-items: center;
    padding: 10px 18px;
  }
  .spec dl { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); column-gap: 18px; }
  .spec dl div { border-bottom: 0; padding: 4px 0; }
  .spec dd { font-size: 0.875rem; }
  .spec-stack { margin-top: 0; }
  .spec-links { margin-top: 0; }
  /* "View case study" as Seb's paper pill with the checker shadow */
  .btn-chapter {
    position: relative; isolation: isolate; border: 0; border-radius: 999px;
    background: transparent; color: var(--ink);
  }
  .btn-chapter::before, .btn-chapter::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
  .btn-chapter::after { background: #fbfbf8; z-index: -1; transition: transform var(--t) var(--ease-out); }
  .btn-chapter::before {
    background: conic-gradient(#0b0b0c 25%, transparent 0 50%, #0b0b0c 0 75%, transparent 0) 0 0 / 4px 4px;
    transform: translate(5px, 5px); z-index: -2;
  }
  .btn-chapter:hover { background: transparent; color: var(--ink); }
  .btn-chapter:hover::after { transform: translate(2px, 2px); }
}

/* ── ALL PROJECTS: pinned rail (Christen) ─────────────────── */
.rail { background: var(--ink); color: var(--paper); position: relative; }
.rail-pin { display: flex; }
.js .rail.is-pinned .rail-pin { position: sticky; top: var(--hdr-h); height: calc(100svh - var(--hdr-h)); overflow: hidden; }
.rail-panel {
  flex: 0 0 clamp(320px, 29vw, 420px);
  display: flex; flex-direction: column; gap: 18px;
  padding: clamp(24px, 4vh, 44px) var(--pad);
  border-right: 1px solid rgba(244, 241, 234, 0.14);
}
.rail-panel .eyebrow { color: rgba(244, 241, 234, 0.75); }
.rail-title { font-family: var(--cond); font-size: clamp(3.6rem, min(7vw, 11vh), 7rem); font-weight: 300; line-height: 0.86; text-transform: uppercase; }
.rail-lede { color: rgba(244, 241, 234, 0.8); max-width: 30ch; font-size: 0.9375rem; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 1px solid rgba(244, 241, 234, 0.3); border-radius: 999px;
  font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase;
  transition: background-color var(--t) ease, border-color var(--t) ease;
}
.chip span { opacity: 0.7; }
.chip:hover { border-color: var(--paper); }
.chip[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: var(--paper); }
.rail-nav { margin-top: auto; display: grid; gap: 12px; }
.rail-progress { height: 2px; background: rgba(244, 241, 234, 0.18); }
.rail-progress i { display: block; height: 100%; width: 0; background: var(--red); transition: width 200ms linear; }
.rail-nav-row { display: flex; justify-content: space-between; align-items: center; }
.rail-count { font-size: 0.75rem; letter-spacing: 0.12em; }
.rail-arrows { display: flex; gap: 8px; }
.rail-arrow {
  width: 44px; height: 44px; display: grid; place-items: center;
  border: 1px solid rgba(244, 241, 234, 0.35); font-family: var(--mono);
  transition: background-color var(--t) ease, color var(--t) ease;
}
.rail-arrow:hover:not(:disabled) { background: var(--paper); color: var(--ink); }
.rail-arrow:disabled { opacity: 0.3; cursor: default; }

.rail-viewport { flex: 1; min-width: 0; overflow: hidden; }
.rail-track { display: flex; height: 100%; will-change: transform; }
.rail-card { position: relative; flex: 0 0 clamp(340px, 31vw, 500px); border-right: 1px solid rgba(244, 241, 234, 0.12); }
.rail-card.is-featured { flex-basis: clamp(420px, 42vw, 640px); }
.rail-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--red); transform: scaleX(0); transform-origin: left; transition: transform 400ms var(--ease-out); }
.rail-card.is-active::before { transform: scaleX(1); }
.rail-card article { height: 100%; display: flex; flex-direction: column; gap: 12px; padding: clamp(22px, 3.2vh, 36px) clamp(20px, 2vw, 32px); }
.rail-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(244, 241, 234, 0.8); }
.rail-meta > span:first-child { white-space: nowrap; }
.rail-flag { display: inline-block; margin-right: 10px; padding: 2px 7px; background: var(--red); color: var(--paper); }
.rail-name { font-family: var(--cond); font-size: clamp(1.9rem, 2.4vw, 2.4rem); font-weight: 400; line-height: 0.95; text-transform: uppercase; }
.is-featured .rail-name { font-size: clamp(2.2rem, 3vw, 3rem); }
.rail-desc { color: rgba(244, 241, 234, 0.82); font-size: 0.9375rem; max-width: 52ch; }
.rail-card .tags { color: rgba(244, 241, 234, 0.85); }
.rail-note { font-size: 0.6875rem; letter-spacing: 0.06em; color: rgba(244, 241, 234, 0.72); }
/* "Code not public yet": a plain label in place of the source button, not a link */
.rail-private {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  border: 1px dashed rgba(244, 241, 234, 0.35);
  font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(244, 241, 234, 0.72);
}
.rail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.rail-divider {
  flex: 0 0 clamp(150px, 12vw, 190px);
  display: flex; flex-direction: column; justify-content: flex-end; gap: 10px;
  padding: clamp(22px, 3.2vh, 36px) 24px;
  border-right: 1px solid rgba(244, 241, 234, 0.12);
  background: repeating-linear-gradient(135deg, rgba(244, 241, 234, 0.05) 0 1px, transparent 1px 10px);
  color: rgba(244, 241, 234, 0.8);
  font-size: 0.6875rem; letter-spacing: 0.1em;
}
.rail-divider-t { font-family: var(--cond); font-size: 2.6rem; font-weight: 300; line-height: 0.9; letter-spacing: 0; text-transform: uppercase; color: var(--paper); }

/* Framed preview: the real screenshot, uncropped, on a consistent 16:10 plate */
.rail-media {
  position: relative; display: block; flex: 0 1 auto; min-height: 0;
  border-radius: 10px; overflow: hidden;
  background: #0f0e0c;
  box-shadow: 0 0 0 1px rgba(244, 241, 234, 0.14);
  text-decoration: none;
}
.rail-shot {
  position: relative; display: block; aspect-ratio: 16 / 10;
  background: #0b0a09 radial-gradient(rgba(244, 241, 234, 0.09) 1px, transparent 1.4px) 0 0 / 12px 12px;
}
.rail-shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: transform 600ms var(--ease-out); }
.rail-media:hover .rail-shot img, .rail-card:focus-within .rail-shot img { transform: scale(1.025); }
/* Entry effect only: the halftone resolves, then dissolves to reveal the screenshot */
.halftone canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; transition: opacity 700ms ease; }
.halftone.is-resolved canvas { opacity: 0; }
.rail-view {
  position: absolute; z-index: 3; left: var(--mx, 50%); top: var(--my, 50%);
  width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--paper); color: var(--ink);
  font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.14em; text-transform: uppercase;
  transform: scale(0); transition: transform 400ms var(--ease-out);
  pointer-events: none;
}
.rail-media:hover .rail-view { transform: scale(1); }
@media (hover: none) { .rail-view { display: none; } }

/* ── TOOLKIT: capability rows with generative dot art (Christen) ── */
.toolkit { padding-top: var(--section-y); padding-bottom: var(--section-y-sm); }
.cap {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 28px;
  align-items: center;
  margin-top: clamp(48px, 6vw, 88px); padding-top: clamp(32px, 4vw, 56px);
  border-top: 1px solid var(--rule);
}
.cap-art { grid-column: 1 / span 5; width: 100%; aspect-ratio: 4 / 3; color: var(--ink); }
.cap-body { grid-column: 7 / -1; }
.cap-flip .cap-art { grid-column: 8 / -1; grid-row: 1; }
.cap-flip .cap-body { grid-column: 1 / span 6; grid-row: 1; }
.cap-k { font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--red); }
.cap-title { margin: 10px 0 16px; font-family: var(--cond); font-size: clamp(2.6rem, 4.6vw, 4.4rem); font-weight: 400; line-height: 0.92; text-transform: uppercase; }
.cap-body > p:not(.cap-k) { color: var(--ink-2); max-width: 52ch; }
.cap .tags { margin-top: 20px; color: var(--ink); }
.cap .tags li { border-color: var(--rule); opacity: 1; }

/* ── ABOUT ────────────────────────────────────────────────── */
.about { padding-top: var(--section-y); padding-bottom: var(--section-y); border-top: 1px solid var(--rule); }
.about-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 48px; margin-top: clamp(40px, 5vw, 72px); align-items: start; }
.journey { grid-column: 1 / span 6; position: relative; }
.journey-globe { width: min(100%, 460px); aspect-ratio: 1; color: var(--ink); }
.journey-k { margin-top: 16px; font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.journey-km { font-family: var(--cond); font-size: clamp(4.4rem, 9vw, 8.5rem); font-weight: 200; line-height: 0.9; text-transform: uppercase; }
.journey-km span { color: transparent; -webkit-text-stroke: 1.5px var(--ink); font-weight: 400; }
.journey-ends { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rule); font-size: 0.75rem; letter-spacing: 0.04em; }
.journey-ends dt { color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.6875rem; }
.journey-ends dd { margin-top: 4px; }
.journey-note { margin-top: 18px; max-width: 46ch; color: var(--ink-2); }

.profile {
  grid-column: 7 / -1;
  position: relative; overflow: hidden;
  padding: 34px 28px 28px;
  background: var(--paper-2);
  border: 1px solid var(--rule); border-radius: 16px;
  box-shadow: 0 8px 0 rgba(22, 19, 15, 0.08);
}
.profile::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 10px;
  background: repeating-linear-gradient(-45deg, var(--red) 0 10px, transparent 10px 20px);
}
.profile-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.avail { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.avail i { width: 7px; height: 7px; border-radius: 50%; background: #1f8a4c; }
.profile-name { margin-top: 18px; font-size: clamp(2rem, 3.2vw, 3rem); font-weight: 800; font-stretch: 125%; line-height: 0.95; text-transform: uppercase; }
.profile-role { margin-top: 10px; font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--red); }
.profile-lead { margin-top: 18px; font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
.profile > p:not(.profile-lead):not(.profile-role) { margin-top: 12px; color: var(--ink-2); }
.stats { display: grid; grid-template-columns: 1fr 1fr; margin-top: 22px; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.stats div { padding: 14px 16px; }
.stats div:nth-child(odd) { border-right: 1px solid var(--rule); }
.stats div:nth-child(-n+2) { border-bottom: 1px solid var(--rule); }
.stats dt { font-family: var(--mono); font-size: 0.625rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.stats dd { margin-top: 4px; font-size: 1.5rem; font-weight: 800; font-stretch: 112%; }

.block-title { display: flex; align-items: center; gap: 14px; font-family: var(--mono); font-size: 0.75rem; font-weight: 400; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.block-title::after { content: ''; flex: 1; height: 1px; background: var(--rule); }
.exp { margin-top: clamp(72px, 9vw, 128px); }
.exp-list { margin-top: 12px; }
.exp-row { display: grid; grid-template-columns: 220px minmax(0, 1fr) minmax(0, 1.1fr); gap: 12px var(--gap); padding: 26px 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.exp-when { font-size: 0.75rem; letter-spacing: 0.06em; color: var(--ink-3); }
.exp-role { font-family: var(--cond); font-size: clamp(1.9rem, 2.8vw, 2.6rem); font-weight: 400; line-height: 0.95; text-transform: uppercase; }
.exp-org { margin-top: 6px; font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.exp-points { display: grid; gap: 6px; color: var(--ink-2); font-size: 0.9375rem; }
.creds { display: grid; grid-template-columns: 1fr 1fr; gap: 48px var(--gap); margin-top: clamp(64px, 8vw, 112px); }
.cred-list li { padding: 16px 0; border-bottom: 1px solid var(--rule); }
.cred-name { font-weight: 650; }
.cred-meta { margin-top: 4px; font-size: 0.6875rem; letter-spacing: 0.04em; color: var(--ink-3); }
.wip { color: var(--red); }
.writing { margin-top: clamp(64px, 8vw, 112px); }
.writing-row { display: grid; grid-template-columns: 140px minmax(0, 1fr) auto; gap: 8px var(--gap); align-items: baseline; padding: 22px 0; border-bottom: 1px solid var(--rule); text-decoration: none; }
.w-k { font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--red); }
.w-t { font-size: clamp(1.125rem, 1.7vw, 1.4rem); font-weight: 650; line-height: 1.25; transition: color var(--t) ease; }
.w-v { font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.writing-row:hover .w-t { color: var(--red); }

/* ── CONTACT ──────────────────────────────────────────────── */
.contact { background: var(--ink); color: var(--paper); padding-top: var(--section-y); padding-bottom: var(--section-y-sm); }
.contact .eyebrow { color: rgba(244, 241, 234, 0.7); }
.contact-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 56px; align-items: end; }
.contact-main { grid-column: 1 / span 7; }
.contact-title { margin-top: 20px; font-family: var(--cond); font-size: clamp(4rem, 10vw, 10rem); font-weight: 300; line-height: 0.84; text-transform: uppercase; }
.contact-email {
  display: inline-flex; align-items: center; gap: 14px; margin-top: 32px; padding-bottom: 6px;
  font-family: var(--cond); font-size: clamp(1.8rem, 3.6vw, 3.2rem); font-weight: 300;
  text-decoration: none; border-bottom: 1px solid rgba(244, 241, 234, 0.35);
  overflow-wrap: anywhere;
}
.contact-email:hover { border-bottom-color: var(--paper); }
.contact-actions { display: flex; align-items: center; gap: 16px; margin-top: 20px; min-height: 44px; }
.copy-status { font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(244, 241, 234, 0.75); }
.contact-rows { grid-column: 9 / -1; }
.contact-rows a {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  min-height: 60px; border-bottom: 1px solid rgba(244, 241, 234, 0.14);
  text-decoration: none; font-size: 0.9375rem;
}
.contact-rows li:first-child a { border-top: 1px solid rgba(244, 241, 234, 0.14); }
.contact-rows .mono { font-size: 0.6875rem; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(244, 241, 234, 0.65); }
.contact-rows a > span:nth-child(2) { overflow-wrap: anywhere; }
.contact-rows a:hover > span:nth-child(2) { text-decoration: underline; text-underline-offset: 0.2em; }

.site-foot { background: var(--ink); color: rgba(244, 241, 234, 0.7); }
.site-foot-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 24px; padding-top: 16px; padding-bottom: 20px; border-top: 1px solid rgba(244, 241, 234, 0.14); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; }
.site-foot a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.site-foot a:hover { color: var(--paper); }

/* ── MASCOT: fixed layer that follows the whole page (Seb) ── */
.mascot-layer { position: fixed; inset: 0; z-index: 30; pointer-events: none; overflow: hidden; }
.mascot { position: absolute; left: 0; top: 0; width: 0; height: 0; aspect-ratio: auto; image-rendering: pixelated; will-change: transform; }
.mascot.is-badge { border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 3px #fbfbf8, 5px 5px 0 3px #0b0b0c; }
/* Grab handle: the only part of the mascot layer that takes the pointer */
.mascot-handle {
  position: absolute; left: 0; top: 0; pointer-events: auto;
  cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.mascot-handle.is-held { cursor: grabbing; }
.mascot-handle[hidden] { display: none; }
.is-holding-mascot, .is-holding-mascot * { user-select: none; cursor: grabbing !important; }
.mascot { transform-origin: 54% 62%; }
.mascot-say {
  position: absolute; left: 0; top: 0;
  width: max-content; max-width: min(15em, calc(100vw - 32px));
  font-size: clamp(1.25rem, 1.8vw, 1.875rem);
  transition: opacity 200ms ease;
}
.mascot-say.is-small { font-size: 1rem; max-width: min(300px, calc(100vw - 32px)); padding: 14px 18px 16px; }
.mascot-say.is-hidden { opacity: 0; }
.mascot-say b { color: var(--say-accent, var(--blue)); }
@media (max-width: 860px) { .mascot-say { font-size: clamp(1.0625rem, 4.4vw, 1.375rem); } }

/* ── CASE STUDY PAGES (Dev in the Hood) ───────────────────── */
.page-case { --hdr-bg: var(--paper); --hdr-fg: var(--ink); }
.case-hero { padding-top: clamp(48px, 7vw, 96px); padding-bottom: clamp(56px, 7vw, 96px); }
.back { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; text-decoration: none; }
.back:hover { color: var(--red); }
.case-kicker { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 28px; font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.status[data-status="wip"] { color: var(--red); }
.case-title { margin-top: 18px; font-size: clamp(2.8rem, 8vw, 7.5rem); font-weight: 800; font-stretch: 125%; line-height: 0.92; letter-spacing: -0.01em; text-transform: uppercase; text-wrap: balance; }
.case-hero-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 32px; margin-top: clamp(32px, 4vw, 56px); }
.case-intro { grid-column: 1 / span 7; display: grid; gap: 16px; color: var(--ink-2); }
.case-intro > p:not(.case-tagline) { max-width: 62ch; }
/* "What I built": my contribution, as a short scannable list */
.case-sub { margin-top: 8px; font-size: 0.6875rem; font-weight: 400; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.case-work { display: grid; gap: 10px; max-width: 62ch; }
.case-work li { position: relative; padding-left: 22px; }
.case-work li::before { content: ''; position: absolute; left: 0; top: 0.62em; width: 10px; height: 2px; background: var(--red); }
.case-tagline { font-size: clamp(1.3rem, 2vw, 1.75rem); font-weight: 650; line-height: 1.25; color: var(--ink); }
.case-meta { grid-column: 9 / -1; align-self: start; border: 1px solid var(--ink); border-radius: 14px; overflow: hidden; background: var(--paper-2); }
.case-meta div { display: grid; grid-template-columns: 104px 1fr; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--rule); }
.case-meta div:last-child { border-bottom: 0; }
.case-meta dt { font-family: var(--mono); font-size: 0.625rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); padding-top: 3px; }
.case-meta dd { font-weight: 600; }
.case-links { display: flex; flex-direction: column; }
.case-link { display: inline-flex; align-items: center; min-height: 36px; text-underline-offset: 0.2em; }
.case-link:hover { color: var(--red); }
.case-link-note { font-family: var(--mono); font-size: 0.6875rem; font-weight: 400; color: var(--ink-3); }
.tags-lg { margin-top: 32px; }
.tags-lg li { border-radius: 999px; padding: 7px 14px; border-color: var(--rule); opacity: 1; }

.case-front { padding-bottom: clamp(80px, 10vw, 144px); }
.case-h2 { margin-top: 18px; font-size: clamp(2.6rem, 6vw, 5.4rem); font-weight: 800; font-stretch: 125%; line-height: 0.95; text-transform: uppercase; }
.window-lg { margin-top: clamp(32px, 4vw, 56px); }
.case-back { background: #0f1217; color: var(--paper); padding-top: clamp(80px, 10vw, 144px); padding-bottom: clamp(80px, 10vw, 144px); }
.case-back .eyebrow { color: rgba(244, 241, 234, 0.7); }
.case-back .accent { color: #ff5a3c; }
.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-top: clamp(36px, 5vw, 64px); }
.step { position: relative; padding: 22px; border: 1px solid rgba(244, 241, 234, 0.16); border-top: 3px solid #ff5a3c; border-radius: 12px; background: rgba(244, 241, 234, 0.03); }
.step-n { font-size: 0.75rem; letter-spacing: 0.1em; color: #ff8a73; }
.step-t { margin-top: 10px; font-size: 1.25rem; font-weight: 800; font-stretch: 112%; text-transform: uppercase; }
.step p { margin-top: 8px; color: rgba(244, 241, 234, 0.75); font-size: 0.9375rem; }
.pipeline-note { margin-top: 18px; font-size: 0.6875rem; letter-spacing: 0.06em; color: rgba(244, 241, 234, 0.6); }
.case-next { padding-top: clamp(80px, 10vw, 144px); padding-bottom: clamp(80px, 10vw, 144px); }
.case-next-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: 32px; align-items: center; }
.case-next-grid > div { grid-column: 1 / span 6; }
.next-h2 a { text-decoration: none; }
.next-h2 a:hover .accent { text-decoration: underline; text-decoration-thickness: 4px; text-underline-offset: 0.1em; }
.next-name { margin-top: 16px; font-size: 1.125rem; color: var(--ink-2); max-width: 44ch; }
.case-next-grid .back { margin-top: 20px; }
.next-media { grid-column: 7 / -1; border-radius: 12px; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 1180px) {
  .exp-row { grid-template-columns: 180px minmax(0, 1fr); }
  .exp-points { grid-column: 2; }
  .chapter-window { grid-column: 5 / -1; }
  .spec { grid-column: 1 / span 4; }
}

@media (max-width: 1024px) {
  .hdr-nav { display: none; }
  .menu-btn { display: inline-flex; }
  .hdr-inner { grid-template-columns: 1fr auto; }
  .hdr-tools { grid-column: 2; }


  .rail-card { flex-basis: clamp(320px, 44vw, 460px); }
  .rail-card.is-featured { flex-basis: clamp(380px, 54vw, 560px); }

  .about-grid > * { grid-column: 1 / -1 !important; }
  .journey { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--gap); align-items: center; }
  .journey-globe { grid-row: 1 / span 4; }
  .contact-main, .contact-rows { grid-column: 1 / -1; }
  .case-intro, .case-meta { grid-column: 1 / -1; }
  .case-next-grid > div, .next-media { grid-column: 1 / -1; }
}

/* Tablet & phone: pinned effects become a normal, stacked document */
@media (max-width: 860px) {
  /* Stacked like the reference on phones: headline, then bubble, then portrait */
  .hero { min-height: calc(100svh - var(--hdr-h)); }
  .hero-main { min-height: 0; padding-top: clamp(28px, 6vh, 56px); padding-bottom: 0; }
  .hero-copy { max-width: none; }
  .hero-title { font-size: clamp(2.9rem, 11.5vw, 5.6rem); }

  .intro { height: 150vh; }

  .chapter { height: auto; }
  .chapter-stage { position: relative; top: 0; height: auto; overflow: visible; padding: var(--section-y-sm) 0; }
  .chapter-grid { grid-template-rows: none !important; height: auto; padding: 0 var(--pad); row-gap: 24px; }
  .chapter-head { grid-template-columns: 1fr; }
  .chapter-actions { grid-column: 1; grid-row: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
  .chapter-window, .spec { grid-column: 1 / -1 !important; grid-row: auto !important; transform: none; }
  .chapter-window { justify-self: stretch; width: auto; }
  .chapter-window img { width: 100%; max-height: none !important; }
  .chapter[data-shape="wide"] .spec { display: block; padding: 18px; }
  .chapter[data-shape="wide"] .spec dl { grid-template-columns: 1fr 1fr; }
  .chapter[data-shape="wide"] .spec-stack { margin-top: 12px; }

  .js .rail.is-pinned .rail-pin { position: static; height: auto; }
  .rail-pin { flex-direction: column; }
  .rail-panel { flex: none; border-right: 0; border-bottom: 1px solid rgba(244, 241, 234, 0.14); padding-top: var(--section-y-sm); }
  .rail-nav { display: none; }
  .rail-track { flex-direction: column; transform: none !important; }
  .rail-card, .rail-card.is-featured { flex: none; border-right: 0; border-bottom: 1px solid rgba(244, 241, 234, 0.12); }
  .rail-card::before { display: none; }
  .rail-card article { padding: 32px var(--pad); }
  .rail-divider { flex: none; flex-direction: row; justify-content: space-between; align-items: baseline; padding: 28px var(--pad) 20px; border-right: 0; border-bottom: 1px solid rgba(244, 241, 234, 0.12); }
  .rail-divider-t br { display: none; }
  .rail-divider-t { font-size: 2.2rem; order: -1; }

  .cap { align-items: start; }
  .cap-art, .cap-body, .cap-flip .cap-art, .cap-flip .cap-body { grid-column: 1 / -1; grid-row: auto; }
  .cap-art { max-width: 440px; }
  .exp-row { grid-template-columns: 1fr; }
  .exp-points { grid-column: 1; }
  .creds { grid-template-columns: 1fr; }
  .writing-row { grid-template-columns: 1fr auto; }
  .w-k { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  :root { --hdr-h: 58px; }
  .hdr-tools .btn:not(.menu-btn) { display: none; }
  .hero-actions .btn { flex: 1 1 0; padding: 0 10px; }
  .hero-links { gap: 0 16px; }
  .chapter-dots { display: none; }
  .journey { display: block; }
  .journey-ends { grid-template-columns: 1fr; }
  .profile { padding: 30px 20px 22px; }
  .stats dd { font-size: 1.25rem; }
  .contact-rows a { grid-template-columns: 1fr auto; }
  .contact-rows a > span:first-child { grid-column: 1 / -1; padding-top: 10px; }
  .case-meta div { grid-template-columns: 88px 1fr; }
  .case-title { font-size: min(10.2vw, calc((100vw - var(--pad) * 2) / (var(--longest, 10) * 0.9))); }
  .display, .case-h2 { font-size: 10.2vw; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
  .intro { height: auto; }
  .intro-stage { position: static; height: auto; padding: var(--section-y) 0; }
  .js .intro-text .w { opacity: 1; }
  .chapter { height: auto; }
  .chapter-stage { position: relative; top: 0; min-height: calc(100svh - var(--hdr-h)); height: auto; }
  .chapter-window, .spec { transform: none !important; }
  .rail-viewport { overflow-x: auto; scroll-snap-type: x mandatory; }
  .rail-card, .rail-divider { scroll-snap-align: start; }
}

/* Seb's ending: everything on the left, the mascot stands large on the right */
@media (min-width: 861px) {
  .contact-main, .contact-rows { grid-column: 1 / span 7; }
  .contact-grid { row-gap: 40px; }
  .site-foot-inner { justify-content: flex-start; column-gap: 40px; padding-right: calc(var(--pad) + 38vw); }
}

/* ── TEXT WRAPPING ───────────────────────────────────────────
   Headings balance across their lines; running text avoids leaving a
   single word stranded on the last line. Both are progressive: browsers
   without support simply wrap as before. */
h1, h2, h3, h4, .chapter-title, .cap-title, .rail-name, .exp-role, .profile-lead, .case-tagline, .next-name, .w-t { text-wrap: balance; }
p, li, dd, .say { text-wrap: pretty; }

/* ── PLAY: footer controls for the mascot (Seb's "Do a trick") ── */
.play { order: 10; flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 0 24px; }
.play-btn, .trick-list button {
  display: inline-flex; align-items: center; min-height: 44px;
  font: inherit; letter-spacing: inherit; text-transform: inherit;
  color: rgba(244, 241, 234, 0.6); transition: color var(--t) ease;
}
.play-btn:hover, .trick-list button:hover, .play-btn[aria-expanded="true"] { color: var(--paper); }
.trick-list { flex-basis: 100%; display: grid; grid-template-columns: repeat(3, max-content); gap: 0 24px; }
.trick-list[hidden] { display: none; }
/* Tricks are pure motion, so they're offered only to people who want motion */
@media (prefers-reduced-motion: reduce) { #trick-btn, .trick-list { display: none; } }
/* Phones: the mascot badge lives in the bottom-left corner, so the footer
   ends above it and its buttons stay tappable */
@media (max-width: 860px) { .site-foot-inner { padding-bottom: 112px; } }

/* ── ERROR PAGES: 404 (website issue) and offline (internet issue) ── */
.error-hero .hero-copy { padding-bottom: clamp(8px, 2vh, 24px); }
.error-title { margin-top: clamp(12px, 2vh, 20px); font-size: clamp(2rem, 3.4vw, 3.25rem); font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.error-code {
  margin-top: 4px;
  font-size: clamp(5.5rem, min(20vw, 30svh), 17rem); font-weight: 800;
  line-height: 0.84; letter-spacing: -0.06em;
}
.page-offline .error-code { font-size: clamp(4rem, min(13vw, 22svh), 11rem); }
.error-lede { margin-top: clamp(12px, 2vh, 22px); max-width: 44ch; font-size: clamp(1.0625rem, 1.3vw, 1.25rem); line-height: 1.45; }
.error-note { margin-top: 10px; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(244, 241, 234, 0.8); }
.error-note a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: underline; text-underline-offset: 0.3em; }
.page-error .hero { min-height: calc(100svh - var(--hdr-h)); }

/* ── PROJECT COVERS: drawn from each project's data, no invented UI ── */
.cover { display: block; width: 100%; height: auto; border-radius: 14px; }
.cv-name { font-family: var(--sans); font-weight: 800; letter-spacing: -0.03em; }
.cv-step { font-family: var(--sans); font-weight: 700; letter-spacing: -0.01em; }
.cv-mono { font-family: var(--mono); }
/* Framed like the bubbles and buttons: an offset checkerboard shadow */
.cover-frame { position: relative; isolation: isolate; margin: 0; --ck: #0b0b0c; }
.cover-frame::before {
  content: ''; position: absolute; inset: 0; z-index: -1; border-radius: 14px;
  background: conic-gradient(var(--ck) 25%, transparent 0 50%, var(--ck) 0 75%, transparent 0) 0 0 / 4px 4px;
  transform: translate(7px, 7px);
}
.chapter .cover-frame { --ck: var(--c-fg); }
@media (min-width: 861px) {
  .chapter-window.cover-frame { width: auto; }
  .chapter-window .cover { width: auto; max-width: 100%; height: calc(100svh - var(--hdr-h) - 430px); aspect-ratio: 8 / 5; }
}
.cover-lg { max-width: 1040px; margin-inline: auto; }
/* Index cards and the next-project card: the cover fills the 16:10 plate */
.rail-shot .cover { position: absolute; inset: 0; height: 100%; border-radius: 0; transition: transform 600ms var(--ease-out); }
.rail-media:hover .rail-shot .cover, .rail-card:focus-within .rail-shot .cover { transform: scale(1.025); }

/* ── ARCHITECTURE DIAGRAMS (case studies) ───────────────────── */
.diagram-lede { margin-top: 16px; max-width: 60ch; font-size: 1.125rem; color: var(--ink-2); }
.diagram { margin-top: clamp(28px, 4vw, 48px); }
.diagram-scroll {
  overflow-x: auto; overscroll-behavior-x: contain;
  border: 1px solid var(--rule); border-radius: 14px;
  background: #f4efe4;
}
.diagram-scroll:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
/* Sharp at any width; on narrow screens it keeps a readable size and scrolls sideways */
.diagram-scroll svg { display: block; width: 100%; height: auto; min-width: 860px; }
.diagram-meta { margin-top: 18px; font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.diagram-meta a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); text-underline-offset: 0.3em; }
.diagram-meta a:hover { color: var(--red); }

/* ── DEMO VIDEOS ────────────────────────────────────────────── */
.chapter-video video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 14px; background: #0a0a0f; }
@media (min-width: 861px) {
  .chapter-video video { width: auto; max-width: 100%; height: calc(100svh - var(--hdr-h) - 430px); }
}
.demo-tag {
  position: absolute; left: 12px; bottom: 12px;
  padding: 4px 9px; border-radius: 999px;
  background: rgba(10, 10, 15, 0.78); color: #f4f1ea;
  font-size: 0.625rem; letter-spacing: 0.12em; text-transform: uppercase;
  pointer-events: none;
}
.case-demo { padding-top: var(--section-y-sm); padding-bottom: clamp(24px, 4vw, 48px); }
.demo-lg { max-width: 1040px; margin: clamp(28px, 4vw, 48px) auto 0; }
.demo-lg video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 14px; background: #0a0a0f; }
.demo-note { max-width: 62ch; margin: 18px auto 0; font-size: 0.9375rem; color: var(--ink-2); text-align: center; }

/* ── SHOWCASE CHAPTER (ZeroInject for now) ──────────────────────
   The visual takes the room the facts card used; the facts collapse into one
   metadata line and the links sit with "View case study". */
.chapter-meta {
  grid-column: 1; display: flex; flex-wrap: wrap; row-gap: 4px;
  font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: color-mix(in srgb, var(--c-fg) 82%, transparent);
}
.chapter-meta span:not(:last-child)::after { content: '·'; margin: 0 10px; opacity: 0.6; }
.chapter-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0 18px; }
.chapter-links .spec-link:hover { color: var(--c-fg); text-decoration-thickness: 2px; }
@media (min-width: 861px) {
  .chapter[data-layout="showcase"] .chapter-grid { grid-template-rows: auto minmax(0, 1fr); }
  .chapter[data-layout="showcase"] .chapter-actions { grid-row: 2 / span 3; }
  /* As wide as the columns allow, but never taller than the room left on screen.
     The cap sits on the frame, so the checker shadow always hugs the video. */
  .chapter[data-layout="showcase"] .chapter-window {
    grid-row: 2; align-self: center; justify-self: center;
    width: min(100%, calc((100svh - var(--hdr-h) - 300px) * 16 / 9));
  }
  .chapter[data-layout="showcase"] .chapter-video video { width: 100%; height: auto; max-width: none; }
}
@media (max-width: 860px) {
  .chapter-links { justify-content: flex-start; }
}
