/* =========================================================
   PYHeavyee Case Study — Chitrangada Mishra
   ========================================================= */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("assets/fonts/BricolageGrotesque-Variable.woff2") format("woff2-variations"),
       url("assets/fonts/BricolageGrotesque-Variable.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("assets/fonts/InstrumentSerif-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("assets/fonts/InstrumentSerif-Italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}

:root {
  /* Palette */
  --cream: #F5F0E4;
  --paper: #FBF8F1;
  --forest: #1F3D2B;
  --forest-2: #2E5440;
  --charcoal: #262823;
  --ink-2: #51554C;
  --sage: #8FA585;
  --sage-soft: #E2E8D9;
  --solar: #E8B83A;
  --solar-soft: #F7E9C2;
  --orange: #C2662A;
  --line: rgba(38, 40, 35, 0.14);
  --line-strong: rgba(38, 40, 35, 0.28);

  /* Type */
  --f-sans: "Bricolage Grotesque", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  /* (fonts are self-hosted in assets/fonts — SIL Open Font License) */
  --f-serif: "Instrument Serif", "Iowan Old Style", Georgia, "Times New Roman", serif;

  /* Layout */
  --wrap: 1240px;
  --gutter: clamp(1.15rem, 4vw, 2.75rem);
  --section-y: clamp(4.5rem, 10vw, 8.5rem);
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 8px;
  --shadow: 0 1px 2px rgba(31, 61, 43, 0.06), 0 10px 30px -18px rgba(31, 61, 43, 0.35);
  --topbar-h: 64px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 16px + env(safe-area-inset-top, 0px));
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--charcoal);
  font-family: var(--f-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-optical-sizing: auto;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }

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

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute; left: 1rem; top: -100px;
  background: var(--forest); color: var(--paper);
  padding: .6rem 1rem; border-radius: var(--r-sm);
  z-index: 200; text-decoration: none;
}
.skip-link:focus { top: calc(1rem + env(safe-area-inset-top, 0px)); }

/* =========================================================
   Top bar & navigation
   ========================================================= */
.topbar {
  position: sticky; top: 0; z-index: 100;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(245, 240, 228, 0.86);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease;
}
.topbar.is-scrolled { border-bottom-color: var(--line); }

.topbar__inner {
  max-width: var(--wrap); margin: 0 auto;
  padding: 0 var(--gutter);
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}

.topbar__mark {
  display: inline-flex; align-items: center; gap: .6rem;
  text-decoration: none; color: var(--forest);
  font-weight: 650; font-size: .95rem; letter-spacing: -0.005em;
}
.topbar__dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--solar);
  box-shadow: 0 0 0 3px var(--solar-soft);
}
.topbar__sub { color: var(--ink-2); font-weight: 400; margin-left: .35rem; }

.casenav { position: relative; }
.casenav__list { display: flex; gap: .25rem; }
.casenav__list a {
  display: block;
  padding: .45rem .8rem;
  border-radius: 999px;
  font-size: .9rem;
  color: var(--ink-2);
  text-decoration: none;
  transition: background-color .2s ease, color .2s ease;
}
.casenav__list a:hover { color: var(--forest); background: var(--sage-soft); }
.casenav__list a.is-active { color: var(--paper); background: var(--forest); }

.casenav__toggle {
  display: none;
  align-items: center; gap: .55rem;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: .45rem .9rem;
  font-size: .9rem; cursor: pointer;
}
.casenav__toggle-icon {
  width: 12px; height: 8px; position: relative;
  border-top: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
}

.topbar__progress { height: 2px; background: transparent; }
.topbar__progress span {
  display: block; height: 100%; width: 0;
  background: var(--solar);
}

/* =========================================================
   Shared section patterns
   ========================================================= */
.section { padding-block: var(--section-y); }

.section__head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(1rem, 3vw, 2.25rem);
  align-items: start;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
  max-width: 62rem;
}
.section__head--stacked { grid-template-columns: 1fr; gap: .9rem; margin-bottom: 1.75rem; }

.section__index {
  font-family: var(--f-serif);
  font-style: italic;
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  line-height: 1;
  color: var(--orange);
  padding-top: .55rem;
  min-width: 2.2ch;
}
.section__index--light { color: var(--solar); }

.section__title {
  font-family: var(--f-sans);
  font-weight: 760;
  font-stretch: 78%;
  font-variation-settings: "wdth" 78;
  text-transform: uppercase;
  font-size: clamp(2.1rem, 5.6vw, 4.4rem);
  line-height: .95;
  letter-spacing: -0.01em;
  color: var(--forest);
  text-wrap: balance;
}
.section__sub {
  margin-top: 1rem;
  max-width: 38rem;
  color: var(--ink-2);
  font-size: clamp(1.02rem, 1.4vw, 1.18rem);
}

.eyebrow {
  display: flex; flex-wrap: wrap; align-items: center; gap: .55rem .9rem;
  font-size: .82rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-2);
}
.eyebrow__pill {
  background: var(--forest); color: var(--paper);
  padding: .32rem .7rem; border-radius: 6px;
}

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .8rem 1.25rem;
  border-radius: 999px;
  border: 1px solid var(--forest);
  background: var(--forest); color: var(--paper);
  font-weight: 600; font-size: .95rem; cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.btn:hover { background: transparent; color: var(--forest); }

/* Reveal (only active when JS is running) */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .2, 1);
}
.js .reveal.is-in { opacity: 1; transform: none; }

/* =========================================================
   01 — HERO
   ========================================================= */
.hero { padding-top: clamp(2.5rem, 6vw, 4.5rem); padding-bottom: clamp(3rem, 6vw, 5rem); }

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}

.hero__title {
  margin-top: 1.4rem;
  font-weight: 800;
  font-stretch: 75%;
  font-variation-settings: "wdth" 75;
  text-transform: uppercase;
  font-size: clamp(2.5rem, 9.2vw, 7.4rem);
  line-height: .88;
  letter-spacing: -0.012em;
  color: var(--charcoal);
}
.hero__title .line { display: block; }
.hero__title .line--green { color: var(--forest); }

.hero__grid { margin-top: clamp(2rem, 4vw, 3.25rem); }
.hero__meta { margin-top: 0; padding-left: 1rem; border-left: 3px solid var(--solar); }
.hero__company { font-weight: 650; font-size: 1.12rem; color: var(--forest); }
.hero__place { color: var(--ink-2); font-size: .98rem; }
.hero__place span { color: var(--sage); margin: 0 .35rem; }

.hero__statement {
  margin-top: 1.6rem;
  font-family: var(--f-serif);
  font-size: clamp(1.7rem, 3.2vw, 2.45rem);
  line-height: 1.12;
  color: var(--forest);
  max-width: 22ch;
}

.hero__lede {
  margin-top: 1.1rem;
  max-width: 36rem;
  color: var(--ink-2);
}

.hero__facts {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, max-content));
  justify-content: start;
  gap: .9rem 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.hero__facts dt { font-size: .78rem; color: var(--ink-2); }
.hero__facts dd { font-weight: 600; font-size: .95rem; color: var(--charcoal); }

/* Collage — column widths are tuned so the tall image and the
   two stacked images end at near-identical heights, uncropped. */
.hero__collage {
  display: grid;
  grid-template-columns: minmax(0, .81fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  position: relative;
}
.collage__stack { display: grid; gap: 12px; }
.collage__item {
  position: relative;
  display: block; width: 100%;
  padding: 0; border: 0; background: var(--sage-soft);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: zoom-in;
  box-shadow: var(--shadow);
}
.collage__item img { width: 100%; height: auto; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.collage__item:hover img { transform: scale(1.03); }
.collage__tag {
  position: absolute; left: 10px; bottom: 10px;
  background: rgba(251, 248, 241, 0.92);
  color: var(--forest);
  font-size: .76rem; font-weight: 600;
  padding: .28rem .6rem; border-radius: 6px;
}
.collage__caption {
  grid-column: 1 / -1;
  font-size: .82rem; color: var(--ink-2);
  font-family: var(--f-serif); font-style: italic; font-size: 1rem;
  padding-top: .3rem;
}

/* The build rail */
.buildrail {
  margin-top: clamp(3rem, 6vw, 4.5rem);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  position: relative;
  counter-reset: none;
}
.buildrail::before {
  content: ""; position: absolute; left: 0; right: 0; top: 7px;
  height: 2px; background: var(--line);
}
.buildrail::after {
  content: ""; position: absolute; left: 0; top: 7px;
  height: 2px; width: var(--rail, 100%);
  background: linear-gradient(90deg, var(--sage), var(--forest) 60%, var(--solar));
  transition: width 1.8s cubic-bezier(.4, 0, .2, 1), height 1.8s cubic-bezier(.4, 0, .2, 1);
}
.js .buildrail:not(.is-in) { --rail: 0%; }

.buildrail__step { position: relative; padding-top: 1.6rem; padding-right: .75rem; }
.buildrail__step::before {
  content: ""; position: absolute; left: 0; top: 0;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--cream); border: 2px solid var(--forest);
  z-index: 1;
}
.buildrail__step--zero::before { border-color: var(--sage); border-style: dashed; }
.buildrail__step--end::before { background: var(--solar); border-color: var(--solar); }
.buildrail__k { display: block; font-size: .8rem; color: var(--ink-2); }
.buildrail__v {
  display: block;
  font-weight: 760;
  font-variation-settings: "wdth" 80;
  font-stretch: 80%;
  text-transform: uppercase;
  font-size: clamp(1rem, 1.7vw, 1.3rem);
  line-height: 1.05;
  color: var(--forest);
}
.buildrail__step--zero .buildrail__v { color: var(--ink-2); }

.js .buildrail__step { opacity: 0; transform: translateY(8px); transition: opacity .5s ease, transform .5s ease; }
.js .buildrail.is-in .buildrail__step { opacity: 1; transform: none; }
.js .buildrail.is-in .buildrail__step:nth-child(2) { transition-delay: .35s; }
.js .buildrail.is-in .buildrail__step:nth-child(3) { transition-delay: .7s; }
.js .buildrail.is-in .buildrail__step:nth-child(4) { transition-delay: 1.05s; }
.js .buildrail.is-in .buildrail__step:nth-child(5) { transition-delay: 1.4s; }

/* =========================================================
   02 — CHALLENGE
   ========================================================= */
.challenge { background: var(--paper); border-block: 1px solid var(--line); }

.challenge__grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}
.ccard {
  border-radius: var(--r-lg);
  padding: clamp(1.4rem, 2.6vw, 2rem);
  min-height: 15rem;
  display: flex; flex-direction: column;
  border: 1px solid var(--line);
  transition: transform .3s ease, box-shadow .3s ease;
}
.ccard:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.ccard__num {
  font-family: var(--f-serif); font-style: italic;
  font-size: 2.2rem; line-height: 1;
  margin-bottom: auto;
}
.ccard__title {
  margin-top: 2.2rem;
  font-weight: 760;
  font-variation-settings: "wdth" 80;
  font-stretch: 80%;
  text-transform: uppercase;
  font-size: clamp(1.3rem, 2.1vw, 1.65rem);
  line-height: 1;
  letter-spacing: -0.005em;
}
.ccard p { margin-top: .6rem; font-size: .98rem; }

.ccard--a { grid-column: span 3; background: var(--forest); color: var(--paper); border-color: var(--forest); }
.ccard--a .ccard__num { color: var(--solar); }
.ccard--a p { color: rgba(251, 248, 241, .78); }
.ccard--b { grid-column: span 3; background: var(--sage-soft); }
.ccard--c { grid-column: span 2; background: var(--cream); }
.ccard--d { grid-column: span 2; background: var(--paper); border-style: dashed; border-color: var(--line-strong); }
.ccard--e { grid-column: span 2; background: var(--solar-soft); border-color: rgba(232, 184, 58, .5); }
.ccard--b .ccard__num, .ccard--c .ccard__num, .ccard--d .ccard__num { color: var(--forest-2); }
.ccard--e .ccard__num { color: var(--orange); }
.ccard--b p, .ccard--c p, .ccard--d p, .ccard--e p { color: var(--ink-2); }
.ccard--b .ccard__title, .ccard--c .ccard__title, .ccard--d .ccard__title, .ccard--e .ccard__title { color: var(--forest); }

/* =========================================================
   03 — RESULTS
   ========================================================= */
.results { background: var(--forest); color: var(--paper); }
.section__head--light .section__title { color: var(--paper); }
.section__head--light .section__sub { color: rgba(251, 248, 241, .72); }
.section__head--light .section__index { color: var(--solar); }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid rgba(251, 248, 241, .18);
}
.metric {
  padding: clamp(1.6rem, 3vw, 2.4rem) clamp(1rem, 2vw, 1.6rem) clamp(1.6rem, 3vw, 2.2rem) 0;
  border-bottom: 1px solid rgba(251, 248, 241, .18);
  display: flex; flex-direction: column; gap: .7rem;
}
.metric:not(:nth-child(4n+1)) { padding-left: clamp(1rem, 2vw, 1.6rem); border-left: 1px solid rgba(251, 248, 241, .18); }

.metric__value {
  font-weight: 800;
  font-variation-settings: "wdth" 75;
  font-stretch: 75%;
  font-size: clamp(3rem, 6.6vw, 5.6rem);
  line-height: .9;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--paper);
  white-space: nowrap;
}
.metric--lead .metric__value { color: var(--solar); }
.metric__label { font-size: .98rem; color: rgba(251, 248, 241, .8); max-width: 15rem; line-height: 1.35; }

/* =========================================================
   04 — PHASES
   ========================================================= */
.timeline {
  display: grid;
  grid-template-columns: 4fr 8fr 18fr; /* months, to scale */
  gap: 4px;
  margin-bottom: 1.6rem;
}
.timeline__seg {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  padding: .6rem .8rem;
  border-radius: 8px;
  font-size: .82rem; font-weight: 600;
  min-width: 0;
}
.timeline__seg span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline__seg em { font-style: normal; font-weight: 400; opacity: .8; white-space: nowrap; }
.timeline__seg--1 { background: var(--sage-soft); color: var(--forest); }
.timeline__seg--2 { background: var(--sage); color: var(--charcoal); }
.timeline__seg--3 { background: var(--forest); color: var(--paper); }

.phase-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  position: relative;
}
.phase {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(1.4rem, 2.4vw, 2rem);
  position: relative;
}
.phase:not(:last-child)::after {
  content: "";
  position: absolute; top: 2.15rem; right: -14px;
  width: 14px; height: 2px; background: var(--line-strong);
}
.phase__top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.phase__badge {
  font-size: .78rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase;
  padding: .3rem .65rem; border-radius: 6px;
}
.phase--1 .phase__badge { background: var(--sage-soft); color: var(--forest); }
.phase--2 .phase__badge { background: var(--solar-soft); color: #7a5a06; }
.phase--3 .phase__badge { background: var(--forest); color: var(--paper); }
.phase__months { font-size: .85rem; color: var(--ink-2); }
.phase__title {
  margin: 1.1rem 0 1.3rem;
  font-weight: 800;
  font-variation-settings: "wdth" 76;
  font-stretch: 76%;
  text-transform: uppercase;
  font-size: clamp(2rem, 3.4vw, 2.8rem);
  line-height: .95;
  color: var(--forest);
}
.phase--2 .phase__title { color: var(--forest-2); }
.phase__group { padding: .95rem 0; border-top: 1px solid var(--line); }
.phase__group h4 {
  font-family: var(--f-serif); font-style: italic; font-weight: 400;
  font-size: 1.15rem; color: var(--orange); margin-bottom: .35rem;
}
.phase__group ul { display: grid; gap: .25rem; }
.phase__group li {
  position: relative; padding-left: 1rem;
  font-size: .95rem; line-height: 1.45; color: var(--charcoal);
}
.phase__group li::before {
  content: ""; position: absolute; left: 0; top: .62em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--sage);
}

/* =========================================================
   05 — ENGINE
   ========================================================= */
.engine { background: var(--paper); border-block: 1px solid var(--line); }
.engine__grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  grid-template-areas: "copy hub" "detail hub";
  grid-template-rows: auto 1fr;
  column-gap: clamp(2rem, 5vw, 5rem);
  align-items: start;
}
.engine__copy { grid-area: copy; }
.hub { grid-area: hub; align-self: center; }
.engine__detail { grid-area: detail; }
.engine__statement {
  font-family: var(--f-serif);
  font-size: clamp(1.55rem, 2.7vw, 2.15rem);
  line-height: 1.15;
  color: var(--forest);
}
.engine__support { margin-top: 1rem; color: var(--ink-2); max-width: 32rem; }

.engine__detail {
  margin-top: 2rem;
  padding: 1.2rem 1.35rem;
  border-radius: var(--r-md);
  background: var(--cream);
  border: 1px solid var(--line);
  border-left: 3px solid var(--solar);
  min-height: 8.5rem;
}
.engine__detail-k {
  font-weight: 760; font-variation-settings: "wdth" 80; font-stretch: 80%;
  text-transform: uppercase; font-size: 1.15rem; color: var(--forest);
}
.engine__detail-v { margin-top: .35rem; font-size: .97rem; color: var(--ink-2); }

.hub {
  position: relative;
  width: 100%; max-width: 580px; margin-inline: auto;
  aspect-ratio: 1 / 1;
}
.hub__lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.hub__lines line {
  stroke: var(--line-strong); stroke-width: .35; stroke-dasharray: 1.2 1.2;
  transition: stroke .25s ease, stroke-width .25s ease;
}
.hub__lines line.is-on { stroke: var(--orange); stroke-width: .6; stroke-dasharray: none; }
.hub__ring { fill: none; stroke: var(--line); stroke-width: .3; }

.hub__core {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 34%; aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: var(--forest);
  color: var(--paper);
  display: grid; place-items: center; text-align: center;
  box-shadow: 0 0 0 10px rgba(31, 61, 43, .08), 0 0 0 22px rgba(31, 61, 43, .04);
}
.hub__core span {
  font-weight: 800; font-variation-settings: "wdth" 76; font-stretch: 76%;
  text-transform: uppercase; line-height: 1;
  font-size: clamp(.95rem, 1.9vw, 1.35rem);
  padding: 0 .6rem;
}

.hub__node {
  position: absolute; left: var(--x); top: var(--y);
  transform: translate(-50%, -50%);
  padding: .55rem .95rem;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  font-weight: 650; font-size: .9rem;
  color: var(--forest);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.hub__node:hover, .hub__node.is-on {
  background: var(--forest); color: var(--paper); border-color: var(--forest);
  box-shadow: 0 0 0 4px var(--solar-soft);
}

/* =========================================================
   06 — OUTCOMES TABLE
   ========================================================= */
.table-wrap {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.otable { width: 100%; border-collapse: collapse; }
.otable thead th {
  text-align: left;
  background: var(--forest); color: var(--paper);
  font-size: .8rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase;
  padding: 1rem 1.4rem;
}
.otable tbody th, .otable td {
  text-align: left; vertical-align: top;
  padding: 1.15rem 1.4rem;
  border-top: 1px solid var(--line);
}
.otable tbody tr { transition: background-color .2s ease; }
.otable tbody tr:hover { background: var(--cream); }
.otable tbody th { font-weight: 650; color: var(--charcoal); width: 30%; }
.otable__res {
  width: 22%;
  font-weight: 800; font-variation-settings: "wdth" 80; font-stretch: 80%;
  font-size: 1.3rem; line-height: 1.15; color: var(--forest);
}
.otable td:last-child { color: var(--ink-2); }

/* =========================================================
   07 — PROJECTS
   ========================================================= */
.projects { background: var(--paper); border-top: 1px solid var(--line); }
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.project {
  border-radius: var(--r-lg);
  padding: clamp(1.6rem, 3vw, 2.4rem);
  background: var(--forest); color: var(--paper);
  display: flex; flex-direction: column;
}
.project--alt { background: var(--cream); color: var(--charcoal); border: 1px solid var(--line); }
.project__num { font-family: var(--f-serif); font-style: italic; font-size: 1.2rem; color: var(--solar); }
.project--alt .project__num { color: var(--orange); }
.project__title {
  margin-top: .7rem;
  font-weight: 800; font-variation-settings: "wdth" 76; font-stretch: 76%;
  text-transform: uppercase;
  font-size: clamp(1.9rem, 3.6vw, 2.9rem); line-height: .95;
}
.project--alt .project__title { color: var(--forest); }
.project__type { margin-top: .6rem; font-size: 1.05rem; opacity: .85; }
.project__specs {
  margin-top: 1.6rem;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem;
  padding-block: 1.1rem;
  border-block: 1px solid rgba(251, 248, 241, .2);
}
.project--alt .project__specs { border-color: var(--line); }
.project__specs dt { font-size: .8rem; opacity: .72; }
.project__specs dd { font-weight: 650; font-size: 1.05rem; }
.project__role {
  margin-top: 1.5rem; margin-bottom: .6rem;
  font-family: var(--f-serif); font-style: italic; font-weight: 400; font-size: 1.25rem;
  color: var(--solar);
}
.project--alt .project__role { color: var(--orange); }
.project__list { display: grid; gap: .45rem; }
.project__list li { position: relative; padding-left: 1.6rem; }
.project__list li::before {
  content: ""; position: absolute; left: 0; top: .35em;
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid currentColor; opacity: .7;
}
.project__list li::after {
  content: ""; position: absolute; left: 4px; top: calc(.35em + 4px);
  width: 6px; height: 3px; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); opacity: .9;
}

/* =========================================================
   08 — GALLERY (justified rows: every image keeps its own
   aspect ratio; flex-grow = ratio aligns heights, no crop)
   ========================================================= */
.story { margin-bottom: clamp(3.5rem, 7vw, 5.5rem); }
.story__intro {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.5rem 3rem; align-items: end;
  margin-bottom: 1.6rem;
}
.story__kicker {
  font-family: var(--f-serif); font-style: italic; font-size: 1.2rem; color: var(--orange);
  grid-column: 1 / -1;
}
.story__title {
  font-weight: 800; font-variation-settings: "wdth" 75; font-stretch: 75%;
  text-transform: uppercase;
  font-size: clamp(2.4rem, 6vw, 4.8rem); line-height: .88;
  color: var(--forest);
}
.story__title span {
  display: block; color: var(--sage);
}
.story__text { color: var(--ink-2); max-width: 32rem; }

.jrow {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 14px;
}
.jitem { flex: var(--r) 1 0; min-width: 0; }
.jitem__btn {
  display: block; width: 100%;
  padding: 0; border: 0;
  background: var(--sage-soft);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: zoom-in;
  box-shadow: var(--shadow);
}
.jitem__btn img { width: 100%; height: auto; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.jitem__btn:hover img { transform: scale(1.025); }
.jitem figcaption {
  margin-top: .6rem;
  font-size: .78rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-2);
}

.jitem--doc .jitem__btn { background: var(--paper); padding: 10px; border: 1px solid var(--line); }
.jitem--doc .jitem__btn img { border-radius: 6px; }
.jitem--doc .jitem__btn:hover img { transform: none; }
.jitem--doc .jitem__btn:hover { border-color: var(--forest); }

.jnote {
  flex: var(--r) 1 0; min-width: 0;
  align-self: stretch;
  border-radius: var(--r-md);
  border: 1px dashed var(--line-strong);
  padding: 1.4rem;
  display: flex; flex-direction: column; justify-content: flex-end;
  color: var(--ink-2); font-size: .95rem;
}
.jnote__k { font-family: var(--f-serif); font-style: italic; font-size: 1.25rem; color: var(--forest); margin-bottom: .5rem; }

.installs { margin-bottom: clamp(3.5rem, 7vw, 5.5rem); }
.installs__title {
  font-weight: 760; font-variation-settings: "wdth" 80; font-stretch: 80%;
  text-transform: uppercase; font-size: clamp(1.5rem, 2.6vw, 2rem); color: var(--forest);
  padding-bottom: .9rem; border-bottom: 1px solid var(--line);
}

/* Snapshot */
.snapshot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  background: var(--sage-soft);
  border-radius: calc(var(--r-lg) + 6px);
  padding: clamp(1.4rem, 4vw, 3.5rem);
}
.snapshot__title {
  margin-top: .4rem;
  font-weight: 800; font-variation-settings: "wdth" 76; font-stretch: 76%;
  text-transform: uppercase;
  font-size: clamp(2rem, 4vw, 3.2rem); line-height: .93; color: var(--forest);
}
.snapshot__copy p:not(.story__kicker) { margin-top: 1rem; color: var(--ink-2); max-width: 30rem; }
.snapshot__copy .btn { margin-top: 1.6rem; }
.snapshot__frame {
  max-width: 460px; width: 100%; justify-self: center;
}
.snapshot__frame .jitem__btn {
  background: var(--paper);
  padding: 12px;
  border: 1px solid var(--line);
  box-shadow: 0 2px 4px rgba(31, 61, 43, .06), 0 30px 60px -30px rgba(31, 61, 43, .5);
}
.snapshot__frame .jitem__btn img { border-radius: 6px; }
.snapshot__frame .jitem__btn:hover img { transform: none; }

/* =========================================================
   09 — AI FLOW
   ========================================================= */
.ai { background: var(--paper); border-block: 1px solid var(--line); }
.flow {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  counter-reset: flow;
}
.flow__step {
  position: relative;
  border: 1px solid var(--line);
  background: var(--cream);
  border-radius: var(--r-md);
  padding: 1.1rem .95rem 1.2rem;
  display: flex; flex-direction: column; gap: .5rem;
  min-height: 9rem;
}
.flow__step:not(:last-child)::after {
  content: "";
  position: absolute; right: -10px; top: 50%;
  width: 10px; height: 2px; background: var(--line-strong);
}
.flow__n { font-family: var(--f-serif); font-style: italic; font-size: 1.3rem; color: var(--orange); line-height: 1; }
.flow__t {
  margin-top: auto;
  font-weight: 760; font-variation-settings: "wdth" 80; font-stretch: 80%;
  text-transform: uppercase; font-size: 1.05rem; line-height: 1.02; color: var(--forest);
}
.flow__step--ai { background: var(--forest); border-color: var(--forest); }
.flow__step--ai .flow__t { color: var(--solar); }
.flow__step--ai .flow__n { color: var(--paper); }
.flow__tools { font-size: .78rem; color: rgba(251, 248, 241, .78); line-height: 1.3; }
.ai__result {
  margin-top: 1.8rem;
  font-family: var(--f-serif); font-size: clamp(1.4rem, 2.4vw, 1.9rem); color: var(--forest);
}
.ai__result strong { font-weight: 400; background: linear-gradient(transparent 62%, var(--solar-soft) 62%); }

/* =========================================================
   10 — TOOLS (typographic index)
   ========================================================= */
.toolindex { border-top: 1px solid var(--line-strong); }
.toolrow {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 1rem 2.5rem;
  padding-block: 1.4rem;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.toolrow dt {
  font-family: var(--f-serif); font-style: italic; font-size: 1.3rem; color: var(--orange);
}
.toolrow ul { display: flex; flex-wrap: wrap; gap: .4rem 0; }
.toolrow li {
  font-weight: 700; font-variation-settings: "wdth" 82; font-stretch: 82%;
  font-size: clamp(1.45rem, 3.2vw, 2.4rem); line-height: 1.1;
  color: var(--forest);
  transition: color .2s ease;
}
.toolrow li:not(:last-child)::after {
  content: "/";
  color: var(--sage);
  font-weight: 300;
  margin: 0 .55em;
}
.toolrow:hover li { color: var(--charcoal); }

/* =========================================================
   11 — CLOSING
   ========================================================= */
.closing {
  background: var(--forest); color: var(--paper);
  padding-block: clamp(5rem, 12vw, 10rem);
  position: relative; overflow: hidden;
}
.closing::before {
  content: "";
  position: absolute; right: -10vw; top: -14vw;
  width: 42vw; height: 42vw; max-width: 560px; max-height: 560px;
  border-radius: 50%;
  border: 1px solid rgba(232, 184, 58, .25);
  box-shadow: 0 0 0 40px rgba(232, 184, 58, .04), 0 0 0 80px rgba(232, 184, 58, .03);
  pointer-events: none;
}
.closing__inner { display: grid; grid-template-columns: auto 1fr; gap: clamp(1rem, 3vw, 2.5rem); position: relative; }
.closing__quote blockquote p {
  font-family: var(--f-serif);
  font-size: clamp(1.75rem, 4.1vw, 3.5rem);
  line-height: 1.12;
  letter-spacing: -0.005em;
  max-width: 30ch;
  text-indent: -0.42em;
  text-wrap: pretty;
}
.closing__quote figcaption { margin-top: 2.4rem; display: flex; flex-direction: column; gap: .15rem; }
.closing__name { font-weight: 650; color: var(--solar); font-size: 1.1rem; }
.closing__role { color: rgba(251, 248, 241, .7); font-size: .95rem; }

/* =========================================================
   Footer
   ========================================================= */
.foot { background: var(--charcoal); color: rgba(251, 248, 241, .7); font-size: .88rem; }
.foot__inner {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding-block: 1.5rem calc(1.5rem + env(safe-area-inset-bottom, 0px));
}
.foot__top { color: var(--solar); text-decoration: none; font-weight: 600; }
.foot__top:hover { text-decoration: underline; }

/* =========================================================
   Lightbox
   ========================================================= */
.lightbox {
  border: 0; padding: 0; margin: auto;
  max-width: 100vw; max-height: 100vh;
  width: 100vw; height: 100vh; height: 100dvh;
  background: transparent;
}
.lightbox::backdrop { background: rgba(20, 28, 22, .95); }
.lightbox__inner {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  padding: calc(3.5rem + env(safe-area-inset-top, 0px)) 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
}
.lightbox__figure { display: flex; flex-direction: column; align-items: center; gap: .8rem; max-width: 100%; max-height: 100%; }
.lightbox__figure img {
  max-width: min(100%, 1100px);
  max-height: calc(100dvh - 8rem);
  width: auto; height: auto;
  object-fit: contain;
  border-radius: 8px;
  background: var(--paper);
}
.lightbox__figure figcaption { color: rgba(251, 248, 241, .85); font-size: .92rem; text-align: center; }
.lightbox__close {
  position: fixed; top: calc(.9rem + env(safe-area-inset-top, 0px)); right: 1rem;
  background: var(--paper); color: var(--forest);
  border: 0; border-radius: 999px;
  padding: .5rem 1rem; font-weight: 650; cursor: pointer;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1080px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__collage { max-width: 720px; }
  .engine__grid { grid-template-columns: 1fr; grid-template-areas: "copy" "hub" "detail"; grid-template-rows: auto; row-gap: 2rem; }
  .flow { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .flow__step:nth-child(4)::after { display: none; }
  .snapshot { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .casenav__toggle { display: inline-flex; }
  .casenav__list {
    position: absolute; right: 0; top: calc(100% + 10px);
    flex-direction: column; gap: 2px;
    min-width: 200px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: .4rem;
    box-shadow: var(--shadow);
    display: none;
  }
  .casenav.is-open .casenav__list { display: flex; }
  .casenav__list a { padding: .65rem .9rem; border-radius: 8px; }

  .challenge__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ccard--a, .ccard--b, .ccard--c, .ccard--d { grid-column: span 1; }
  .ccard--e { grid-column: 1 / -1; }

  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:not(:nth-child(4n+1)) { padding-left: 0; border-left: 0; }
  .metric:nth-child(2n) { padding-left: clamp(1rem, 3vw, 1.6rem); border-left: 1px solid rgba(251, 248, 241, .18); }

  .phase-grid { grid-template-columns: 1fr; }
  .phase:not(:last-child)::after { top: auto; bottom: -14px; right: auto; left: 2.4rem; width: 2px; height: 14px; }

  .project-grid { grid-template-columns: 1fr; }
  .story__intro { grid-template-columns: 1fr; }

  .jrow--docs { flex-wrap: wrap; }
  .jrow--docs .jnote { flex-basis: 100%; }
}

@media (max-width: 760px) {
  .buildrail { grid-template-columns: 1fr; gap: 1.1rem; }
  .buildrail::before, .buildrail::after { left: 7px; right: auto; top: 0; width: 2px; height: 100%; }
  .buildrail::after { height: var(--rail, 100%); width: 2px; background: linear-gradient(180deg, var(--sage), var(--forest) 60%, var(--solar)); }
  .buildrail__step { padding-top: 0; padding-left: 2.1rem; }
  .buildrail__step::before { top: .15rem; }

  .hero__facts { grid-template-columns: 1fr 1fr; }

  /* Outcomes table → stacked cards */
  .table-wrap { background: transparent; border: 0; box-shadow: none; border-radius: 0; overflow: visible; }
  .otable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .otable, .otable tbody, .otable tr, .otable th, .otable td { display: block; width: 100%; }
  .otable tbody { display: grid; gap: 12px; }
  .otable tbody tr {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 1.1rem 1.2rem;
  }
  .otable tbody th, .otable td { border: 0; padding: 0; width: 100%; }
  .otable tbody th { font-size: 1rem; }
  .otable__res { width: 100%; font-size: 1.7rem; margin-top: .3rem; }
  .otable td:last-child { margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--line); font-size: .95rem; }
  .otable td:last-child::before { content: "How — "; font-weight: 650; color: var(--charcoal); }

  .toolrow { grid-template-columns: 1fr; gap: .4rem; }

  .flow { grid-template-columns: 1fr; gap: 8px; }
  .flow__step { min-height: 0; flex-direction: row; align-items: center; flex-wrap: wrap; gap: .3rem .9rem; padding: .9rem 1.1rem; }
  .flow__t { margin-top: 0; }
  .flow__tools { flex-basis: 100%; padding-left: 2.1rem; }
  .flow__step:not(:last-child)::after { right: auto; left: 1.6rem; top: auto; bottom: -8px; width: 2px; height: 8px; display: block; }
  .flow__step:nth-child(4)::after { display: block; }

  .closing__inner { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  :root { --topbar-h: 58px; }
  .collage__tag { display: none; }
  body { font-size: 1rem; }
  .topbar__sub { display: none; }

  .section__head { grid-template-columns: 1fr; gap: .4rem; }
  .section__index { padding-top: 0; }

  .challenge__grid { grid-template-columns: 1fr; }
  .ccard, .ccard--e { grid-column: auto; min-height: 0; }
  .ccard__title { margin-top: 1.4rem; }

  .metrics { grid-template-columns: 1fr 1fr; }
  .metric__value { font-size: clamp(2.4rem, 12vw, 3.2rem); }
  .metric__label { font-size: .9rem; }

  .timeline { grid-template-columns: 4fr 8fr 18fr; }
  .timeline__seg { padding: .5rem .45rem; font-size: .72rem; }
  .timeline__seg span { display: none; }
  .timeline__seg em { margin: 0 auto; }

  /* Engine hub → stacked list */
  .hub { aspect-ratio: auto; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: none; }
  .hub__lines { display: none; }
  .hub__core {
    position: static; transform: none;
    width: 100%; aspect-ratio: auto;
    border-radius: var(--r-md);
    padding: 1.2rem; margin-bottom: 6px;
    box-shadow: none;
  }
  .hub__node { position: static; transform: none; }

  /* Gallery rows stack, each image at its own natural ratio */
  .jrow { flex-direction: column; align-items: stretch; }
  .jitem, .jnote { flex: none; width: 100%; }
  .jrow--docs .jitem { max-width: 460px; width: 100%; margin-inline: auto; }

  .snapshot { padding: 1.2rem; }
  .project__specs { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; transition-delay: 0s !important; }
  .js .reveal, .js .buildrail__step { opacity: 1; transform: none; }
  .js .buildrail:not(.is-in) { --rail: 100%; }
}
.nowrap { white-space: nowrap; }
