/* Process case study (project pages with a `story` in js/projects.js).
   Editorial, notebook-like: an outcome headline, label/value facts, then
   sections whose images read as state sequences (01 → 02 → 03), each captioned. */

.story { padding: clamp(80px, 10vw, 160px) var(--pad) clamp(60px, 8vw, 120px); }

/* ---------- Head ---------- */
/* The header spans the page grid; only the text inside it keeps a reading measure. */
.st-outcome {
  margin-top: 18px; max-width: 24ch;
  font-size: var(--t-statement); font-weight: 500; line-height: 1.04; letter-spacing: -.035em;
}
.st-blurb { margin-top: clamp(24px, 2.6vw, 40px); max-width: 60ch; display: grid; gap: .8em; font-size: var(--t-lead); line-height: 1.4; letter-spacing: -.01em; color: var(--ink); }
.st-meta {
  margin-top: clamp(36px, 4vw, 64px); display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 18px var(--gap);
  padding-top: 18px; border-top: 1px solid var(--hair);
}
.st-meta dt { margin-bottom: 6px; }
.st-meta dd { font-size: var(--t-body); font-weight: 500; letter-spacing: -.01em; line-height: 1.35; }
.st-todo { margin-top: 10px; color: #a07a2c; letter-spacing: 0; text-transform: none; font-size: 13px; }
.st-todo::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #e3b04b; margin-right: 8px; vertical-align: 1px; }

/* ---------- Hero ---------- */
.st-hero { margin-top: clamp(48px, 6vw, 96px); display: grid; gap: var(--gap); }
.st-hero figure img { display: block; width: 100%; height: auto; border-radius: var(--radius-in); background: var(--light); }
.st-hero figcaption { margin-top: 10px; }

/* ---------- Sections ---------- */
.st-sec { margin-top: clamp(80px, 9vw, 150px); }
.st-sec.is-cont { margin-top: clamp(56px, 6vw, 96px); }
.st-h2 {
  font-size: clamp(28px, 2.6vw, 44px); font-weight: 500; letter-spacing: -.03em; line-height: 1.05;
  margin-bottom: clamp(20px, 2.4vw, 36px);
}
/* One divider per section: a hairline above the title, never one below it. */
.st-sec:has(> .st-h2) { padding-top: clamp(20px, 2vw, 28px); border-top: 1px solid var(--hair); }
/* The first section sits right under its chapter title, which already draws the line. */
.chapter + .st-body > .st-sec:first-child, .chapter + .st-body > *:first-child .st-sec:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.chapter + .st-body { padding-top: 0; }
.st-sub { margin-bottom: 14px; color: var(--ink); }
.st-copy { max-width: 64ch; display: grid; gap: .9em; font-size: var(--t-body); line-height: 1.55; color: #3b3b40; }
.st-key { font-size: var(--t-lead); font-weight: 500; line-height: 1.3; letter-spacing: -.015em; color: var(--ink); }

/* ---------- Figures: state sequences ---------- */
.st-seq, .st-data { margin-top: clamp(32px, 4vw, 56px); }
.st-seq > figcaption, .st-data > figcaption { margin-top: 14px; }
.st-steps { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: var(--gap); align-items: start; }
.st-sequence .st-steps { gap: calc(var(--gap) + 18px); }
.st-step { position: relative; min-width: 0; }
.st-arrow { position: absolute; left: calc(-1 * (var(--gap) + 18px) / 2); top: 40%; transform: translate(-50%, -50%); color: var(--muted); font-size: 18px; }
.st-media { border-radius: var(--radius-in); overflow: hidden; background: var(--light); border: 1px solid var(--hair); }
.st-media img { display: block; width: 100%; height: auto; }
.st-cap { margin-top: 10px; color: var(--ink); text-transform: none; letter-spacing: 0; font-size: 13px; line-height: 1.35; }
.st-cap b { font-weight: 600; color: var(--muted); margin-right: 4px; }
/* Six marks read better as two rows of three. */
.st-sequence[style*="--n:6"] .st-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 28px; }
.st-sequence[style*="--n:6"] .st-step:nth-child(3n + 1) .st-arrow { display: none; }
.st-pairs .st-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- Figure: file sizes ---------- */
.st-data ol { list-style: none; border-top: 1px solid var(--hair); }
.st-data li {
  display: grid; grid-template-columns: minmax(0, 15em) minmax(0, 1fr) 5.5em; gap: 6px 18px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--hair);
}
.st-d-name { font: 500 13px/1.3 ui-monospace, Menlo, monospace; overflow-wrap: anywhere; }
.st-d-bar { height: 10px; border-radius: 99px; background: var(--light); overflow: hidden; }
.st-d-bar i { display: block; width: var(--w); height: 100%; border-radius: inherit; background: var(--ink); }
.st-data li:last-child .st-d-bar i { background: #ff1b2d; }
.st-d-size { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.st-d-note { grid-column: 1 / -1; text-transform: none; letter-spacing: 0; font-size: 12px; }

@media (max-width: 820px) {
  .st-steps, .st-pairs .st-steps, .st-sequence[style*="--n:6"] .st-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .st-sequence .st-steps { gap: 22px var(--gap); }
  .st-arrow { display: none; }
  .st-data li { grid-template-columns: minmax(0, 1fr) 5em; }
  .st-d-bar { grid-column: 1 / -1; grid-row: 2; }
}

/* Mixed-aspect sequences sit in equal frames so the steps line up. */
.st-seq.is-fit .st-media { aspect-ratio: var(--fit); display: grid; place-items: center; background: #fff; }
.st-seq.is-fit .st-media img { width: 100%; height: 100%; object-fit: contain; }

/* ======================================================================
   Case study v2 (js/stories/<slug>.js): flat 2x captures, agent/people split,
   numbered decisions, feature cards and real numbers.
   ====================================================================== */
.story { --col: 68ch; }
.st-copy { max-width: var(--col); }

/* ---------- Flat captures ---------- */
.st-shots { margin-top: clamp(32px, 4vw, 56px); }
.st-shots > figcaption { margin-top: 14px; max-width: var(--col); text-transform: none; letter-spacing: 0; font-size: 13px; }
.st-shots-row { display: flex; gap: var(--gap); align-items: flex-start; }
.st-shot { flex: 1 1 0; min-width: 0; }
.st-shot.is-phone { flex: 0 0 auto; width: clamp(150px, 21vw, 300px); }
/* Desktop captures sit in the same browser window as the demos and site previews:
   grey bar, three dots. The bar is a transparent top border painted by the
   background, so absolutely placed pins still measure from the image itself. */
.st-frame {
  position: relative; overflow: hidden; border-radius: 12px;
  border-top: 38px solid transparent;
  background:
    radial-gradient(circle at 19.5px 19px, #d1d1d8 5.5px, transparent 6px) border-box no-repeat,
    radial-gradient(circle at 37.5px 19px, #d1d1d8 5.5px, transparent 6px) border-box no-repeat,
    radial-gradient(circle at 55.5px 19px, #d1d1d8 5.5px, transparent 6px) border-box no-repeat,
    linear-gradient(#ececef 37px, #dedee4 37px 38px, #fff 38px) border-box;
  box-shadow: 0 24px 60px rgba(10, 16, 60, .14), 0 0 0 1px rgba(0, 0, 0, .06);
}
.st-shot.is-phone .st-frame { border-top: 0; background: #fff; border-radius: clamp(18px, 2vw, 30px); box-shadow: 0 0 0 1px var(--hair), 0 0 0 6px #141414, 0 22px 50px -20px rgba(20, 20, 20, .35); margin: 6px; }
.st-frame img { display: block; width: 100%; height: auto; }
.st-shot .st-cap { margin-top: 12px; }
/* Every capture sits on the text grid: same left edge as the copy, full content width. */

/* Annotation pins: a numbered dot on the image, its label in a small chip. */
.st-pin { position: absolute; translate: -50% -50%; display: flex; align-items: center; gap: 6px; pointer-events: none; }
.st-pin b {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--cobalt); color: #fff; font: 600 12px/1 var(--sans); box-shadow: 0 0 0 4px rgba(47, 43, 255, .2);
}
.st-pin span { background: #141414; color: #fff; font-size: 12px; line-height: 1.2; padding: 5px 8px; border-radius: 6px; white-space: nowrap; }

/* ---------- Where the agent acts / where people decide ---------- */
.st-split { margin-top: clamp(28px, 3vw, 44px); display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.st-split > div { border-radius: var(--radius-in); padding: clamp(18px, 2vw, 28px); background: var(--light); }
.st-split > div:last-child { background: #141414; color: #fff; }
.st-split > div:last-child h3 { color: rgba(255, 255, 255, .55); }
.st-split ul { margin-top: 14px; list-style: none; display: grid; gap: 12px; }
.st-split li { position: relative; padding-left: 18px; font-size: var(--t-body); line-height: 1.45; }
.st-split li::before { content: ''; position: absolute; left: 0; top: .6em; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .5; }

/* ---------- Numbered decisions, each tied to a figure ---------- */
.st-steps-list { list-style: none; margin-top: clamp(28px, 3vw, 44px); display: grid; gap: clamp(56px, 6vw, 96px); }
.st-step-copy { max-width: var(--col); display: grid; gap: 10px; }
.st-num { color: var(--cobalt); }
.st-step-copy h3 { font-size: clamp(22px, 1.9vw, 32px); font-weight: 500; letter-spacing: -.025em; line-height: 1.1; }
.st-step-copy p { font-size: var(--t-body); line-height: 1.55; color: #3b3b40; }
.st-stepper .st-shots { margin-top: clamp(20px, 2.4vw, 32px); }

/* ---------- Feature cards ---------- */
.st-cards { list-style: none; margin-top: clamp(28px, 3vw, 44px); display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--gap); }
.st-cards li { border: 1px solid var(--hair); border-radius: var(--radius-in); padding: clamp(18px, 2vw, 26px); display: grid; gap: 10px; align-content: start; }
.st-cards h3 { font-size: var(--t-body); font-weight: 600; letter-spacing: -.01em; }
.st-cards p { font-size: 15px; line-height: 1.5; color: #4a4a50; }

/* ---------- Real numbers ---------- */
.st-facts { margin-top: clamp(28px, 3vw, 44px); display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--gap); border-top: 1px solid var(--hair); padding-top: 22px; }
.st-facts dt { font-size: clamp(36px, 4vw, 64px); font-weight: 500; letter-spacing: -.04em; line-height: 1; }
.st-facts dd { margin-top: 10px; text-transform: none; letter-spacing: 0; font-size: 13px; max-width: 26ch; }

@media (max-width: 820px) {
  .st-split { grid-template-columns: 1fr; }
  .st-shots-row { flex-wrap: wrap; }
  .st-duo .st-shot:not(.is-phone) { flex-basis: 100%; }
  .st-shot.is-phone { width: calc(50% - var(--gap) / 2 - 12px); }
  .st-pin span { display: none; }
}

.st-duo .st-shots-row { align-items: center; }

/* ======================================================================
   Page chapters: 01 The website · 02 The product · 03 How I built it
   ====================================================================== */
.st-head { padding-bottom: clamp(40px, 5vw, 80px); }
.st-body { padding-top: clamp(24px, 3vw, 48px); }
.chapter {
  display: flex; align-items: baseline; gap: clamp(12px, 1.4vw, 22px); margin: clamp(80px, 9vw, 150px) var(--pad) clamp(28px, 3.4vw, 56px);
  padding-top: clamp(16px, 1.6vw, 24px); border-top: 2px solid var(--ink); color: var(--ink);
  font-size: clamp(34px, 4.4vw, 72px); font-weight: 500; letter-spacing: -.035em; line-height: 1; text-transform: none;
}
.chapter span { flex: none; font-size: 13px; font-weight: 500; letter-spacing: .06em; line-height: 1; color: var(--cobalt); font-variant-numeric: tabular-nums; transform: translateY(-.15em); align-self: flex-start; padding-top: .5em; }
.chapter + .lp, .chapter + .demo { margin-top: 0; }

/* ---------- The product: unmistakably a live demo ---------- */
.demo-intro { display: flex; align-items: baseline; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 16px; }
.demo-badge {
  justify-self: start; display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 999px; background: #141414; color: #fff; letter-spacing: .04em;
}
.demo-badge i { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, .25); animation: demo-live 1.6s ease-in-out infinite; }
@keyframes demo-live { 50% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); } }
.demo-title { font-size: clamp(26px, 2.4vw, 40px); font-weight: 500; letter-spacing: -.03em; line-height: 1.08; }
.demo-what { font-size: var(--t-lead); line-height: 1.4; color: #3b3b40; max-width: 52ch; }
.demo-steps { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 0 0 12px; padding: 0; border-radius: var(--radius-in); background: var(--light); counter-reset: none; }
.demo-steps li { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 16px clamp(16px, 1.8vw, 24px); font-size: 15px; line-height: 1.4; color: #3b3b40; }
.demo-steps li + li::before { content: "→"; position: absolute; left: -.5em; top: 16px; color: var(--muted); }
.demo-steps b { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--cobalt); color: #fff; font-size: 12px; font-weight: 600; }
.demo-note { margin-top: 14px; max-width: 80ch; text-transform: none; letter-spacing: 0; font-size: 13px; line-height: 1.5; }
@media (max-width: 820px) {
  .demo-steps { grid-template-columns: 1fr; }
  .demo-steps li + li::before { content: none; }
  .demo-steps li + li { border-top: 1px solid var(--hair); }
}
@media (prefers-reduced-motion: reduce) { .demo-badge i { animation: none; } }


@media (max-width: 820px) {
  .st-meta { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Steps live inside the demo stage, as white cards right above the app. */
.demo-stage .demo-steps { gap: 10px; margin: 0 0 clamp(12px, 1.6vw, 20px); background: none; border-radius: 0; }
.demo-stage .demo-steps li { padding: 14px 16px; border-radius: 12px; background: #fff; box-shadow: 0 1px 2px rgba(10, 16, 60, .06), 0 0 0 1px rgba(10, 16, 60, .05); color: var(--ink); font-weight: 500; letter-spacing: -.01em; }
.demo-stage .demo-steps li + li::before { content: none; }
.demo-stage .demo-steps li + li { border-top: 0; }
.demo-stage.is-phone-stage .demo-steps { max-width: 980px; margin-inline: auto; }

/* Sections: the title sits in a narrow left column (sticky while you read),
   the content in the wide right column. Chapter > section > content now read
   as three clear levels instead of three stacked headlines. */
.st-body .st-sec { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); column-gap: clamp(24px, 4vw, 72px); margin-top: clamp(56px, 6vw, 96px); }
.st-body .st-sec > * { grid-column: 2; min-width: 0; }
.st-body .st-sec > .st-h2 { grid-column: 1; grid-row: 1 / span 40; align-self: start; position: sticky; top: 110px; margin: 0; font-size: clamp(20px, 1.6vw, 26px); letter-spacing: -.02em; line-height: 1.15; }
@media (max-width: 820px) {
  .st-body .st-sec { grid-template-columns: minmax(0, 1fr); }
  .st-body .st-sec > *, .st-body .st-sec > .st-h2 { grid-column: 1; }
  .st-body .st-sec > .st-h2 { grid-row: auto; position: static; margin-bottom: 16px; }
}

/* Process steps: a tight numbered list, one row per decision —
   number, title, then the explanation beside it — split by hairlines. */
.st-steps-list { gap: 0; margin-top: clamp(20px, 2.4vw, 32px); border-top: 1px solid var(--hair); }
.st-stepper { padding: clamp(18px, 2vw, 28px) 0; border-bottom: 1px solid var(--hair); }
.st-step-copy { max-width: none; display: grid; grid-template-columns: 2.6em minmax(0, 5fr) minmax(0, 7fr); column-gap: clamp(12px, 2vw, 32px); align-items: baseline; }
.st-step-copy h3 { font-size: clamp(18px, 1.4vw, 22px); letter-spacing: -.02em; line-height: 1.25; }
.st-step-copy p { font-size: 16px; }
.st-stepper .st-shots { margin-top: clamp(16px, 2vw, 24px); }
@media (max-width: 820px) {
  .st-step-copy { grid-template-columns: 2.2em minmax(0, 1fr); row-gap: 6px; }
  .st-step-copy p { grid-column: 2; }
}

/* Presentation mockups already carry their own frame and backdrop: no browser bar. */
.st-shot.is-mock .st-frame { border-top: 0; background: none; box-shadow: none; border-radius: clamp(10px, 1vw, 16px); }

/* Phones: three or more images in a row would shrink to thumbnails, so the row scrolls sideways instead. */
@media (max-width: 820px) {
  .st-shots-row:has(> .st-shot:nth-child(3)) { flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin-right: calc(var(--pad) * -1); padding-right: var(--pad); }
  .st-shots-row:has(> .st-shot:nth-child(3)) > .st-shot { flex: 0 0 64%; scroll-snap-align: start; }
}
