/* ==========================================================================
   Ezekeil Third Cruz portfolio
   Direction: type first. Anton for display, Work Sans for text.
   White and black fields change by chapter; one blue accent for actions.
   ========================================================================== */

:root {
  /* Colour roles */
  --bg: #ffffff;
  --surface: #f4f4f4;
  --surface-2: #e9e9e9;
  --ink: #111111;
  --muted: #4d4d4d;
  --accent: #1a4be0;
  --accent-hover: #1238b0;
  --accent-ink: #ffffff;
  --dark: #111111;
  --dark-2: #1c1c1c;
  --dark-3: #262626;
  --dark-ink: #ffffff;
  --dark-muted: #a8a8a8;
  --blue-2: #1641c4;

  /* Type */
  --display: "Anton", "Impact", "Arial Narrow", sans-serif;
  --text: "Work Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --code: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; /* taste-skill-ignore: real code blocks only */
  --step-small: clamp(0.9375rem, 0.9rem + 0.1vw, 1rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-head: clamp(2.5rem, 1.2rem + 5vw, 5.5rem);
  --step-poster: clamp(3.5rem, 1rem + 9.5vw, 9.5rem);

  /* Space */
  --margin: clamp(16px, 2.2vw, 32px);
  --section: clamp(96px, 12vw, 192px);
  --gap: 24px;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);
  --t-press: 140ms;
  --t-hover: 180ms;
  --t-ui: 240ms;
  --t-chapter: 300ms;
  --t-reveal: 800ms;

  /* Chapter colours, switched by script for the header */
  --chapter-bg: var(--bg);
  --chapter-ink: var(--ink);
  --chapter-muted: var(--muted);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text);
  font-size: var(--step-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; cursor: pointer; }
pre, code { font-family: var(--code); }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: var(--margin); top: -80px; z-index: 200; padding: 12px 20px; background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none; transition: top var(--t-ui) var(--ease-out); }
.skip-link:focus { top: 12px; }

/* ---------- Controls ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: var(--step-small);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--t-hover) ease, transform var(--t-press) var(--ease-out);
}
.button:hover { background: var(--accent-hover); }
.button:active { transform: scale(0.97); }

.link {
  display: inline-block;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
  text-decoration-color: currentColor;
  transition: color var(--t-hover) ease, text-underline-offset var(--t-hover) var(--ease-out);
}
.link:hover { color: var(--accent); text-underline-offset: 9px; }

/* ---------- Header: takes the colour of the chapter beneath ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 32px;
  height: 72px;
  padding: 0 var(--margin);
  background: var(--chapter-bg);
  color: var(--chapter-ink);
  transition: background-color var(--t-chapter) ease, color var(--t-chapter) ease, transform 420ms var(--ease-out);
}
.site-header.is-hidden { transform: translateY(-100%); }
.wordmark { margin-right: auto; font-size: 1.25rem; font-weight: 600; text-decoration: none; letter-spacing: -0.01em; }
.nav { display: flex; gap: 28px; }
.nav a, .menu-panel a {
  position: relative;
  font-size: var(--step-small);
  font-weight: 600;
  text-decoration: none;
}
.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--t-ui) var(--ease-out);
}
.nav a:hover::after, .nav a[aria-current="true"]::after { transform: scaleX(1); transform-origin: left; }
.menu-button { display: none; min-height: 44px; padding: 0 4px; border: 0; background: none; font-size: var(--step-small); font-weight: 600; }
.menu-panel { display: none; }

/* ---------- Hero ---------- */
.hero {
  --hf: clamp(88px, min(15vw, 27svh), 240px);
  position: relative;
  isolation: isolate;
}
.hero-top { height: 50svh; background: var(--bg); }
.hero-bottom {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 80svh;
  padding: calc(var(--hf) * 0.64 + 56px) var(--margin) 56px;
  background: var(--dark);
  color: var(--dark-ink);
}
.hero-canvas { position: absolute; inset: calc(var(--hf) * 0.62) 0 0; width: 100%; height: calc(100% - var(--hf) * 0.62); z-index: 0; }
.hero-title {
  position: absolute;
  top: calc(50svh - var(--hf) * 1.14);
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
  font-family: var(--display);
  font-size: var(--hf);
  font-weight: 400;
  line-height: 0.86;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  white-space: nowrap;
  text-align: center;
  pointer-events: none;
}
.ht { display: block; }
.ht-top { color: var(--ink); clip-path: inset(0 0 0.58em 0); }
.ht-bottom { position: absolute; inset: 0; color: var(--dark-ink); clip-path: inset(1.14em 0 0 0); }
.ht .line { display: block; overflow: hidden; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.ht [data-line] { display: block; }

.runner { position: relative; z-index: 1; width: min(1180px, 100%); }
.runner-intro { color: var(--dark-muted); font-size: var(--step-small); text-align: center; }
.runner-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.runner-tab {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  background: var(--dark-3);
  color: var(--dark-ink);
  font-size: var(--step-small);
  font-weight: 600;
  transition: background-color var(--t-hover) ease, color var(--t-hover) ease, transform var(--t-press) var(--ease-out);
}
.runner-tab:hover { background: #333333; }
.runner-tab:active { transform: scale(0.97); }
.runner-tab.is-active { background: var(--dark-ink); color: var(--dark); }
.runner-steps {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 6px;
  margin-top: 28px;
  counter-reset: none;
}
.runner-steps li {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 84px;
  padding: 12px 14px;
  overflow: hidden;
  background: var(--dark-2);
  color: var(--dark-muted);
  font-size: var(--step-small);
  font-weight: 600;
  line-height: 1.25;
  transition: color var(--t-ui) ease, background-color var(--t-ui) ease;
}
.runner-steps li::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 520ms var(--ease-in-out);
  z-index: 0;
}
.runner-steps li span { position: relative; z-index: 1; }
.runner-steps li.is-running { color: var(--dark-ink); }
.runner-steps li.is-running::before { transform: scaleX(1); }
.runner-steps li.is-done { background: var(--dark-3); color: var(--dark-ink); }
.runner-steps li.is-done::before { transform: scaleX(0); transform-origin: right; }
.runner-log { min-height: 3em; margin-top: 20px; font-size: var(--step-lead); text-align: center; }
.hero-sentence {
  position: relative;
  z-index: 1;
  max-width: 40ch;
  margin-top: auto;
  padding-top: 56px;
  font-size: var(--step-lead);
  line-height: 1.35;
  text-align: center;
}

/* ---------- Section heads ---------- */
.section-head, .stepped, .method-title, .run-side h3 {
  font-family: var(--display);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.section-head { font-size: var(--step-head); }

/* ---------- Work: frame runs ---------- */
.work { padding: var(--section) var(--margin); background: var(--bg); }
.work .section-head { margin-bottom: 96px; }
.run { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: var(--gap); }
.run + .run { margin-top: 144px; }
.run-side { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding-right: 16px; }
.run-side h3 { font-size: var(--step-head); }
.run-side p { max-width: 32ch; }
.run-note { margin-top: auto; padding-top: 32px; max-width: 34ch; }
.run-frames {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  grid-auto-rows: auto;
  gap: 24px 8px;
  align-items: start;
}
.frame { display: flex; flex-direction: column; min-width: 0; }
.frame.is-lifted { grid-row: span 2; align-self: stretch; }
.frame-media { position: relative; overflow: hidden; background: var(--surface); aspect-ratio: 16 / 10; }
.frame.is-lifted .frame-media { flex: 1; aspect-ratio: auto; min-height: 280px; }
.frame img, .frame video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
  transition: transform 700ms var(--ease-soft);
}
.frame.is-lifted video { object-position: center; }
.frame:hover img, .frame:hover video { transform: scale(1.035); }
.frame figcaption { display: flex; flex-direction: column; margin-top: 10px; font-size: var(--step-small); line-height: 1.35; }
.frame figcaption span:last-child { color: var(--muted); }
.frame.is-lifted figcaption { flex-direction: row; justify-content: space-between; gap: 12px; }
.frame img[src$=".svg"] { object-fit: contain; background: var(--dark); }

/* ---------- All work: names ---------- */
.index { padding: var(--section) var(--margin); background: var(--surface); }
.names {
  font-family: var(--display);
  font-size: var(--step-head);
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.names li { display: inline; white-space: nowrap; }
.names li:not(.names-lead):not(:last-child)::after { content: ","; color: var(--muted); margin-right: 0.22em; }
.names li:last-child::after { content: "."; color: var(--muted); }
.names-lead { margin-right: 0.22em; }
.names a { color: var(--muted); text-decoration: none; transition: color var(--t-hover) ease; }
.names a:hover, .names a:focus-visible { color: var(--ink); }
.thumb {
  display: inline-block;
  width: 1.2em;
  height: 0.72em;
  margin-left: 0.14em;
  overflow: hidden;
  vertical-align: 0.06em;
  background: var(--dark);
  transform-origin: left center;
  transition: transform var(--t-ui) var(--ease-out);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.names a:hover .thumb, .names a:focus-visible .thumb { transform: scale(1.6); }
.names-count { margin-top: 48px; }

/* ---------- Evidence table ---------- */
.evidence { padding: var(--section) var(--margin); background: var(--bg); }
.stepped { display: flex; flex-direction: column; font-size: var(--step-head); }
.stepped span:last-child { padding-left: calc(100% / 12 * 2); }
.proof { width: 100%; margin-top: 72px; border-collapse: collapse; font-size: var(--step-body); }
.proof thead th { padding: 0 16px 14px; color: var(--muted); font-size: var(--step-small); font-weight: 600; text-align: left; }
.proof th, .proof td { padding: 14px 16px; text-align: left; vertical-align: top; }
.proof tbody th { width: 22%; font-weight: 600; }
.proof td:nth-child(2) { width: 34%; }
.proof td:last-child, .proof thead th:last-child { text-align: right; }
.proof td:last-child { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.proof tbody tr:not(.gap):nth-child(odd) { background: var(--surface); }
.proof tr.gap td { padding: 12px; }
.table-note { margin-top: 32px; }

/* ---------- Method: call and response ---------- */
.method { padding: var(--section) var(--margin); background: var(--surface); }
.method-col { width: min(560px, 100%); margin-left: calc(100% / 12 * 3); }
.method-title { margin-bottom: 64px; font-size: var(--step-head); }
.exchange + .exchange { margin-top: 88px; }
.exchange-lead { font-size: var(--step-lead); font-weight: 600; line-height: 1.3; }
.call { margin-top: 16px; padding: 20px; background: var(--bg); }
.call pre { margin: 0; overflow-x: auto; font-size: 14px; line-height: 1.6; }
.mail-subject { font-weight: 600; }
.call p + p { margin-top: 8px; }
.response { margin: 24px 0 0 56px; }
.response pre { margin: 0; padding: 20px; overflow-x: auto; background: var(--dark); color: var(--dark-ink); font-size: 14px; line-height: 1.6; }
.response img { width: 100%; background: var(--bg); }
.response.is-wide { width: min(760px, calc(100vw - var(--margin) * 2)); }
.response-note { margin-top: 12px; color: var(--muted); font-size: var(--step-small); }

/* ---------- Poster list ---------- */
.poster { padding: 80px var(--margin); background: var(--dark); color: var(--dark-ink); overflow: hidden; }
.poster-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; }
.poster-word {
  font-family: var(--display);
  font-size: var(--step-poster);
  line-height: 0.96;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: color var(--t-hover) ease;
}
.poster-list li:hover .poster-word { color: #8aa6ff; }
.poster-fact { color: var(--dark-muted); font-size: var(--step-body); text-align: right; }

/* ---------- About ---------- */
.about { padding: var(--section) var(--margin); background: var(--bg); }
.about-row { display: grid; grid-template-columns: calc(34vw - var(--margin)) minmax(0, 1fr); gap: 0; }
.about-row + .about-row { margin-top: 120px; }
.facts { display: grid; gap: 20px; align-content: start; width: 200px; font-size: var(--step-small); }
.facts dt { color: var(--muted); }
.facts dd { font-weight: 600; }
.about-text { max-width: 36ch; font-size: var(--step-lead); font-weight: 600; line-height: 1.35; }
.about-more { max-width: 58ch; margin-top: 24px; }
.record-label { font-size: var(--step-small); font-weight: 600; }
.records { display: grid; grid-template-columns: repeat(2, minmax(0, 380px)); gap: 64px; }
.records li { display: flex; justify-content: space-between; gap: 16px; padding: 5px 0; }
.records li span:last-child { color: var(--muted); text-align: right; }

/* ---------- Contact rows ---------- */
.contact { background: var(--accent); color: var(--accent-ink); }
.contact-rows li {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  min-height: clamp(84px, 10vw, 150px);
  padding: 0 var(--margin) 0.35em;
  font-family: var(--display);
  font-size: clamp(2.25rem, 1rem + 5.2vw, 5.5rem);
  line-height: 1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.contact-rows li:nth-child(even) { background: var(--blue-2); }
.contact-rows a { text-decoration: none; transition: opacity var(--t-hover) ease; }
.contact-rows a:not(.arrow-button):hover { opacity: 0.75; }
.contact-rows li:nth-child(2) { text-transform: none; }
.arrow-button {
  display: grid;
  place-items: center;
  width: 0.9em;
  height: 0.9em;
  margin-bottom: 0.05em;
  background: var(--accent-ink);
  color: var(--accent);
  transition: transform var(--t-press) var(--ease-out);
}
.arrow-button svg { width: 50%; height: 50%; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: square; }
.arrow-button:hover { transform: translateX(6px); }
.arrow-button:active { transform: scale(0.94); }

/* ---------- Footer ---------- */
.footer { position: relative; display: flex; flex-direction: column; min-height: 100svh; padding: 120px var(--margin) 0; overflow: hidden; background: var(--dark); color: var(--dark-ink); }
.footer-top { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 2fr) minmax(0, 3fr); gap: var(--gap); }
.footer-top > div { grid-column: 1; }
.invite { display: flex; flex-direction: column; margin-bottom: 32px; font-weight: 400; letter-spacing: -0.01em; font-family: var(--display); font-size: var(--step-head); line-height: 0.95; text-transform: uppercase; }
.footer-links { grid-column: 3; display: grid; gap: 10px; align-content: start; }
.footer-links a { text-decoration: none; font-weight: 600; transition: color var(--t-hover) ease; }
.footer-links a:hover { color: #8aa6ff; }
.footer-legal { display: flex; justify-content: space-between; gap: 16px; margin-top: auto; padding-top: 64px; color: var(--dark-muted); font-size: var(--step-small); }
.footer-name {
  margin: 0.1em calc(var(--margin) * -1) 0;
  font-family: var(--display);
  font-size: 30vw;
  line-height: 0.8;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  transform: translateY(2%);
}

/* ==========================================================================
   Case-study pages
   ========================================================================== */
.project-page main { padding: 120px var(--margin) var(--section); overflow-x: clip; }
.project-hero { display: flex; flex-direction: column; align-items: flex-start; max-width: 1100px; padding-bottom: 64px; }
.project-hero .project-back { order: 10; margin-top: 24px; }
.project-hero .project-facts, .project-hero .project-intro { align-self: stretch; }
.project-back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; font-size: var(--step-small); text-decoration: none; }
.project-back .icon { transition: transform var(--t-hover) var(--ease-out); }
.project-back:hover .icon { transform: translateX(-4px); }
.project-kicker { display: none; }
.project-hero h1 {
  margin-top: 0;
  font-family: var(--display);
  font-size: var(--step-head);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  text-wrap: balance;
}
.project-intro { max-width: 52ch; margin-top: 32px; font-size: var(--step-lead); line-height: 1.4; }
.project-tags { display: flex; flex-wrap: wrap; gap: 4px 0; margin-top: 32px; color: var(--muted); font-size: var(--step-small); }
.project-tag { font-weight: 600; }
.project-tag:not(:last-child)::after { content: ","; margin-right: 0.4em; }
.project-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; margin-top: 32px; }
.btn { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 24px; border: 0; font-size: var(--step-small); font-weight: 600; text-decoration: none; transition: background-color var(--t-hover) ease, transform var(--t-press) var(--ease-out); }
.btn:active { transform: scale(0.97); }
.btn-solid, .btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-solid:hover, .btn-primary:hover { background: var(--accent-hover); }
.btn-outline, .btn-ghost { padding: 0; min-height: 44px; background: none; color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.btn-outline:hover, .btn-ghost:hover { color: var(--accent); }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: square; stroke-linejoin: miter; }
.icon-lg { width: 22px; height: 22px; }
.project-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; margin-top: 56px; }
.project-facts div { padding: 20px; background: var(--surface); }
.project-facts dt { color: var(--muted); font-size: var(--step-small); }
.project-facts dd { margin-top: 4px; font-weight: 600; }
.project-cover { margin: 0 calc(var(--margin) * -1); background: var(--dark); }
.project-cover img { width: 100%; max-height: 88svh; object-fit: cover; object-position: top center; }

.project-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); gap: var(--gap); padding-top: 120px; }
.project-toc { position: sticky; top: 104px; align-self: start; display: flex; flex-direction: column; gap: 4px; }
.project-toc-title { margin-bottom: 8px; font-weight: 600; font-size: var(--step-small); }
.project-toc a { padding: 4px 0; color: var(--muted); font-size: var(--step-small); text-decoration: none; transition: color var(--t-hover) ease, transform var(--t-hover) var(--ease-out); }
.project-toc a:hover, .project-toc a.is-active { color: var(--ink); }
.project-toc a.is-active { transform: translateX(8px); }
.project-layout > article { min-width: 0; max-width: 860px; }
.case-section + .case-section { margin-top: 120px; }
.case-section h2 { font-family: var(--display); font-size: clamp(2rem, 1.2rem + 2.6vw, 3.5rem); font-weight: 400; line-height: 0.95; letter-spacing: -0.01em; text-transform: uppercase; text-wrap: balance; }
.case-section > p, .case-section article > p { max-width: 66ch; margin-top: 24px; }
.case-section h3 { font-size: var(--step-body); font-weight: 600; line-height: 1.3; }
.case-section ul:not(.tag-list) { max-width: 66ch; margin-top: 24px; padding-left: 1.2em; list-style: square; }
.case-section ul li + li { margin-top: 10px; }
.case-section code { padding: 1px 6px; background: var(--surface); font-size: 0.88em; }
.case-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.case-meta span { padding: 6px 12px; background: var(--surface); font-size: var(--step-small); font-weight: 600; }
.case-grid, .challenge-grid, .result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 32px; }
.case-box, .challenge-card, .result-grid > div { padding: 24px; background: var(--surface); transition: background-color var(--t-hover) ease; }
.case-box:hover, .challenge-card:hover, .result-grid > div:hover { background: var(--surface-2); }
.case-box p, .challenge-card p { margin-top: 8px; color: var(--muted); font-size: var(--step-small); }
.challenge-card .mono { display: none; }
.result-grid > div { display: flex; flex-direction: column; gap: 8px; }
.result-grid strong { font-family: var(--display); font-size: clamp(1.75rem, 1.2rem + 1.4vw, 2.5rem); font-weight: 400; line-height: 1; text-transform: uppercase; }
.result-grid span { color: var(--muted); font-size: var(--step-small); }
.case-steps { max-width: 66ch; margin-top: 24px; padding-left: 1.6em; list-style: decimal; }
.case-steps li { padding-left: 8px; }
.case-steps li + li { margin-top: 14px; }
.case-steps li::marker { color: var(--muted); font-weight: 600; }
.architecture { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; margin-top: 32px; }
.arch-step { display: flex; flex-direction: column; justify-content: flex-end; min-height: 120px; padding: 16px; background: var(--dark); color: var(--dark-ink); font-size: var(--step-small); font-weight: 600; line-height: 1.3; }
.arch-step strong { display: none; }
.arch-step small { display: block; margin-top: 6px; color: var(--dark-muted); font-size: var(--step-small); font-weight: 400; }
.why-built, .lessons, .evidence-callout, .evidence-note { max-width: 66ch; margin-top: 32px; padding: 24px; background: var(--surface); }
.why-built .mono { display: block; margin-bottom: 8px; font-family: var(--text); font-weight: 600; font-size: var(--step-small); }
.lessons p + p { margin-top: 12px; }
.evidence-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 32px; }
.evidence-item { background: var(--surface); }
.evidence-item.wide { grid-column: 1 / -1; }
.evidence-item img { width: 100%; cursor: zoom-in; background: var(--dark); transition: opacity var(--t-hover) ease; }
.evidence-item img:hover { opacity: 0.88; }
.evidence-item figcaption { padding: 14px 16px 18px; color: var(--muted); font-size: var(--step-small); }
.evidence-item figcaption strong { color: var(--ink); }
.next-project { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-top: 160px; padding: 40px; background: var(--dark); color: var(--dark-ink); text-decoration: none; transition: background-color var(--t-hover) ease; }
.next-project:hover { background: var(--accent); }
.next-project > div { display: flex; flex-direction: column-reverse; }
.next-project span { display: block; margin-top: 8px; color: var(--dark-muted); font-size: var(--step-small); }
.next-project:hover span { color: var(--accent-ink); }
.next-project strong { display: block; font-family: var(--display); font-size: clamp(2rem, 1.2rem + 2.6vw, 3.5rem); font-weight: 400; line-height: 0.95; text-transform: uppercase; }
.next-project .icon { width: 40px; height: 40px; transition: transform var(--t-ui) var(--ease-out); }
.next-project:hover .icon { transform: translateX(8px); }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 300; display: none; align-items: center; justify-content: center; padding: 72px 96px; background: rgba(10, 10, 10, 0.94); }
.lightbox.open { display: flex; animation: fade var(--t-ui) var(--ease-out); }
.lightbox img { max-width: 100%; max-height: calc(100vh - 180px); animation: settle 400ms var(--ease-out); }
.lightbox-close, .lightbox-prev, .lightbox-next { position: absolute; display: grid; place-items: center; width: 52px; height: 52px; border: 0; background: #ffffff; color: #111111; transition: transform var(--t-press) var(--ease-out); }
.lightbox-close:active, .lightbox-prev:active, .lightbox-next:active { transform: scale(0.94); }
.lightbox-close { top: 20px; right: 20px; }
.lightbox-prev { left: 20px; top: 50%; margin-top: -26px; }
.lightbox-next { right: 20px; top: 50%; margin-top: -26px; }
.lightbox-count { position: absolute; top: 34px; left: 24px; color: #bdbdbd; font-size: var(--step-small); }
.lightbox-caption { position: absolute; bottom: 24px; left: 50%; width: min(720px, calc(100% - 48px)); transform: translateX(-50%); color: #e6e6e6; font-size: var(--step-small); text-align: center; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes settle { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }

/* Case-study footer reuses the home footer at a shorter height */
.project-page .footer { min-height: 72svh; }

/* ==========================================================================
   Motion (content stays visible without script or with reduced motion)
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  .js .ht [data-line] { transform: translateY(105%); animation: lineUp 1000ms var(--ease-out) forwards; animation-delay: calc(var(--i, 0) * 120ms + 150ms); }
  .js .runner, .js .hero-sentence { opacity: 0; transform: translateY(20px); animation: rise var(--t-reveal) var(--ease-out) forwards; }
  .js .runner { animation-delay: 520ms; }
  .js .hero-sentence { animation-delay: 680ms; }

  .js [data-reveal] { opacity: 0; transform: translateY(28px); transition: opacity var(--t-reveal) var(--ease-out), transform var(--t-reveal) var(--ease-out); transition-delay: var(--d, 0ms); }
  .js [data-reveal].is-in { opacity: 1; transform: none; }

  .js .frame { opacity: 0; transform: translateY(24px); transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out); transition-delay: calc(var(--fi, 0) * 80ms + 200ms); }
  .js .run.is-in .frame { opacity: 1; transform: none; }
  .js .frame-media { clip-path: inset(0 0 100% 0); transition: clip-path 900ms var(--ease-in-out); transition-delay: calc(var(--fi, 0) * 80ms + 200ms); }
  .js .run.is-in .frame-media { clip-path: inset(0 0 0 0); }

  .js .poster-list li { clip-path: inset(0 0 100% 0); transition: clip-path 900ms var(--ease-in-out); transition-delay: calc(var(--pi, 0) * 110ms); }
  .js .poster-list.is-in li { clip-path: inset(-0.2em -1em -0.2em -1em); }

  .js .proof tbody tr { opacity: 0; transform: translateY(12px); transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out); transition-delay: calc(var(--ri, 0) * 60ms + 150ms); }
  .js .proof.is-in tbody tr { opacity: 1; transform: none; }

  .js .footer-name { transform: translateY(34%); transition: transform 1200ms var(--ease-out); }
  .js .footer-name.is-in { transform: translateY(2%); }

  .js .case-section { opacity: 0; transform: translateY(24px); transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out); }
  .js .case-section.is-in { opacity: 1; transform: none; }
  .js .project-hero > * { opacity: 0; transform: translateY(20px); animation: rise 800ms var(--ease-out) forwards; animation-delay: calc(var(--i, 0) * 80ms + 80ms); }
  .project-cover img { animation: slowZoom 18s var(--ease-soft) both; }
}
@keyframes lineUp { to { transform: none; } }
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes slowZoom { from { transform: scale(1.06); } to { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ==========================================================================
   Tablet and phone: their own compositions
   ========================================================================== */
@media (max-width: 1080px) {
  .run { grid-template-columns: 1fr; }
  .run-side { padding-right: 0; }
  .run-note { margin-top: 0; padding-top: 8px; }
  .method-col { margin-left: 0; }
  .response.is-wide { width: auto; }
  .poster-list li { flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 40px; }
  .poster-fact { text-align: left; }
  .run-side h3 { font-size: clamp(2.5rem, 1.2rem + 5vw, 4rem); }
  .about-row { grid-template-columns: 1fr; gap: 32px; }
  .project-layout { grid-template-columns: 1fr; padding-top: 80px; }
  .project-toc { display: none; }
  .project-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
}

@media (max-width: 860px) {
  .nav, .site-header > .button { display: none; }
  .menu-button { display: block; }
  .menu-panel {
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    flex-direction: column;
    padding: 8px var(--margin) 24px;
    background: var(--chapter-bg);
    transform-origin: top right;
  }
  .menu-panel.open { display: flex; animation: menuIn var(--t-ui) var(--ease-out); }
  .menu-panel a { display: flex; align-items: center; min-height: 52px; font-family: var(--display); font-size: 2.25rem; font-weight: 400; text-transform: uppercase; }
  .runner-steps { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .runner-steps li { min-height: 56px; }
  .footer-top { grid-template-columns: 1fr; gap: 48px; }
  .footer-links { grid-column: 1; display: flex; flex-wrap: wrap; gap: 12px 24px; }
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-8px) scale(0.98); } to { opacity: 1; transform: none; } }

@media (max-width: 640px) {
  .hero { --hf: 18vw; }
  .hero-top { height: 40svh; }
  .hero-title { top: calc(40svh - var(--hf) * 1.14); }
  .hero-bottom { min-height: 74svh; padding-bottom: 40px; }
  .runner-log { font-size: var(--step-body); }
  .hero-sentence { max-width: 28ch; font-size: var(--step-body); padding-top: 40px; }
  .work .section-head { margin-bottom: 56px; }
  .run + .run { margin-top: 96px; }
  .run-frames { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 6px; }
  .frame.is-lifted { grid-column: 1 / -1; grid-row: auto; }
  .frame.is-lifted .frame-media { aspect-ratio: 16 / 10; min-height: 0; }
  .frame figcaption { flex-direction: column; gap: 0; }
  .frame figcaption span:last-child { text-align: left; }
  .names { font-size: 9vw; line-height: 1.18; }
  .names li { white-space: normal; }
  .names a { color: var(--ink); }
  .names li:nth-child(n + 5) .thumb { display: none; }
  .stepped span:last-child { padding-left: 0; }
  .proof thead { display: none; }
  .proof, .proof tbody, .proof tr, .proof th, .proof td { display: block; width: auto !important; }
  .proof tr { padding: 14px 16px; }
  .proof th, .proof td { padding: 0; text-align: left !important; }
  .proof tbody th:empty { display: none; }
  .proof tbody th { margin-bottom: 4px; font-size: var(--step-lead); }
  .proof td:nth-child(3) { color: var(--muted); font-size: var(--step-small); }
  .proof td:last-child { margin-top: 4px; }
  .proof tr.gap { padding: 8px; }
  .response { margin-left: 0; }
  .response.is-wide { width: auto; }
  .poster { padding: 64px var(--margin); }
  .poster-word { font-size: 11vw; }
  .poster-fact { font-size: var(--step-small); }
  .facts { width: auto; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .records { grid-template-columns: 1fr; gap: 40px; }
  .contact-rows li { min-height: 84px; font-size: 9vw; }
  .contact-rows li:nth-child(2) { font-size: 6.4vw; }
  .greeting { justify-content: space-between; }
  .arrow-button { width: 56px; height: 56px; }
  .footer { padding-top: 96px; min-height: 86svh; }
  .invite { font-size: 11vw; }
  .footer-top .button { width: 100%; }
  .footer-legal { flex-direction: column; gap: 4px; }
  .footer-name { font-size: 34vw; }
  .project-page main { padding-top: 104px; }
  .project-facts { grid-template-columns: 1fr; }
  .case-grid, .challenge-grid, .result-grid, .evidence-gallery { grid-template-columns: 1fr; }
  .next-project { padding: 24px; }
  .next-project strong, .case-section h2 { font-size: 1.625rem; }
  .lightbox { padding: 72px 16px; }
  .lightbox-prev, .lightbox-next { top: auto; bottom: 16px; margin-top: 0; }
  .lightbox-caption { bottom: 84px; }
}

/* ---------- 404 ---------- */
.nf { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; min-height: 100svh; padding: var(--margin); background: var(--dark); color: var(--dark-ink); }
.nf-mark { position: absolute; top: 24px; left: var(--margin); }
.nf-title { font-family: var(--display); font-size: clamp(9rem, 4rem + 30vw, 30rem); font-weight: 400; line-height: 0.82; letter-spacing: -0.02em; }
.nf-text { max-width: 32ch; margin: 32px 0; font-size: var(--step-lead); line-height: 1.35; }
