/* =====================================================================
   CASE STUDY PAGES: same tokens, cards and frame as the homepage
   (melfi.css loads first). Hero, numbered sections with a sticky
   heading column, framed screens, decision cards, next-project link.
   ===================================================================== */

/* hero */
.c-hero { padding: var(--space-16) 0 var(--section-y); }
.back { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; color: var(--muted); font-size: .9375rem; text-decoration: none; margin-bottom: var(--space-6); }
.back svg { width: 18px; height: 18px; }
.back:hover { color: #fff; }
.c-hero .badge { margin-bottom: var(--space-4); }
.c-hero h1 { font-size: clamp(2rem, 2.6vw + 1.2rem, 3.5rem); line-height: 1.08; letter-spacing: -.02em; max-width: 22ch; margin: 0; }
.c-hero .lede { color: var(--muted); font-size: var(--fs-lede); line-height: 1.5; max-width: 62ch; margin-top: var(--space-6); }
.meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: var(--space-12) 0 0; background: #1a2030; border: 1px solid #1a2030; border-radius: var(--r-card); overflow: hidden; }
.meta > div { background: var(--card); padding: var(--space-5, 20px) var(--space-6); }
.meta dt { color: var(--muted); font-size: .8125rem; letter-spacing: .02em; }
.meta dd { margin: var(--space-1) 0 0; font-size: 1rem; line-height: 1.4; color: #fff; }

/* framed screens and videos */
.shot { margin: 0; }
.shot img, .shot video { display: block; width: 100%; height: auto; border-radius: var(--r-inner); border: 1px solid #1c2232; background: #0a0d16; }
.shot figcaption { margin-top: var(--space-3); color: var(--muted); font-size: .875rem; line-height: 1.45; }
.hero-shot { margin-top: var(--space-12); padding: var(--space-3); background: var(--card); border: 1px solid #161b28; border-radius: var(--r-card); }
.hero-shot img { border-radius: var(--r-inner); }

/* TL;DR */
.tldr { margin-top: var(--space-8); display: grid; grid-template-columns: auto 1fr; gap: var(--space-6); align-items: start; padding: var(--space-6) var(--space-8); background: var(--card); border: 1px solid #161b28; border-left: 3px solid var(--blue); border-radius: var(--r-card); }
.tldr-k { font: 700 .875rem/1.6 var(--display); color: var(--blue-hi, #4a8ff8); letter-spacing: .04em; }
.tldr p { margin: 0; font-size: var(--fs-lede); line-height: 1.55; color: #e6ebf5; }

/* numbered sections */
.c-sec { padding: var(--section-y) 0; }
.c-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: var(--space-12); align-items: start; }
.c-head { position: sticky; top: var(--space-8); }
.c-head .num { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 30px; padding: 0 12px; border-radius: 999px; background: rgba(39,118,239,.14); color: #8fb2ff; font: 600 .8125rem/1 var(--display); }
.c-head h2 { font-size: clamp(1.5rem, 1.4vw + 1rem, 2.25rem); line-height: 1.15; margin: var(--space-4) 0 0; max-width: 14ch; }
.c-body > p { color: #c9d0dd; font-size: var(--fs-body); line-height: 1.65; margin: 0 0 var(--space-4); max-width: 66ch; }
.c-body > p.big { font: 600 clamp(1.25rem, .8vw + 1rem, 1.625rem)/1.45 var(--display); color: #fff; letter-spacing: -.01em; }
.c-body > .shot, .c-body > .pair, .c-body > .flow, .c-body > .products, .c-body > .decisions, .c-body > .chips { margin-top: var(--space-8); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); }

/* stakeholder chips */
.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chips li { display: inline-flex; align-items: center; height: 36px; padding: 0 16px; border-radius: 999px; background: var(--card); border: 1px solid #1f2637; color: #e6ebf5; font-size: .9375rem; }

/* discover > connect > act */
.flow { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); counter-reset: none; }
.flow li { position: relative; padding: var(--space-6); background: var(--card); border: 1px solid #161b28; border-radius: var(--r-card); }
.flow li + li::before { content: ""; position: absolute; left: calc(-1 * var(--space-4)); top: 50%; width: var(--space-4); height: 1px; background: #2a3a5c; }
.flow .step-n { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--blue); color: #fff; font: 700 .875rem/1 var(--display); }
.flow h3 { font-size: var(--fs-h3); margin: var(--space-4) 0 var(--space-2); }
.flow p { margin: 0; color: var(--muted); font-size: .9375rem; line-height: 1.55; }

/* two products */
.products { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.product { padding: var(--space-8); background: var(--card); border: 1px solid #161b28; border-radius: var(--r-card); }
.kicker { display: block; color: #8fb2ff; font: 600 .8125rem/1.4 var(--display); letter-spacing: .04em; text-transform: uppercase; }
.product h3 { font-size: var(--fs-h3-lg); margin: var(--space-2) 0 var(--space-3); }
.product > p { color: var(--muted); font-size: .9375rem; line-height: 1.55; margin: 0 0 var(--space-4); }
.product ul { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); }
.product li { position: relative; padding-left: var(--space-6); color: #e6ebf5; font-size: .9375rem; line-height: 1.5; }
.product li::before { content: ""; position: absolute; left: 4px; top: .55em; width: 8px; height: 8px; border-radius: 2px; background: var(--blue); }

/* design decisions */
/* editorial rows, not a grid of boxes: number + headline on the left, the reasoning on the right,
   the same split as the section heads above them; space separates rows, no fills, outlines or rules */
.decisions { display: grid; gap: var(--space-12); max-width: 1040px; margin-left: auto; margin-right: auto; }
.decision { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); grid-template-rows: auto 1fr; column-gap: var(--space-12); align-items: start; }
.decision.wide { grid-column: auto; }
.d-n { grid-column: 1; grid-row: 1; font: 600 var(--fs-h3)/var(--lh-h3) var(--display); color: #3b4356; }
.decision h3 { grid-column: 1; grid-row: 2; margin: var(--space-1) 0 0; font-size: var(--fs-h3); line-height: var(--lh-h3); max-width: 18em; }
.decision p { grid-column: 2; grid-row: 1 / span 2; margin: 0; color: #b4b9c4; font-size: var(--fs-body); line-height: var(--lh-body); }
/* onboarding before / after */
.onb { margin-top: var(--space-6); display: grid; gap: var(--space-4); }
.onb-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding: var(--space-4); border-radius: var(--r-inner); background: #0b0f1a; border: 1px solid #1a2030; }
.onb-k { width: 64px; flex: none; color: var(--muted); font: 600 .8125rem/1 var(--display); text-transform: uppercase; letter-spacing: .04em; }
.onb .pill { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid #2a3248; color: #c9d0dd; font-size: .8125rem; white-space: nowrap; }
.onb .pill.dim { opacity: .5; }
.onb .pill.on { border-color: var(--blue); color: #fff; background: rgba(39,118,239,.16); }
.onb .pill.go { border-color: var(--blue); background: var(--blue); color: #fff; }
.onb i { width: 14px; height: 1px; background: #2a3248; flex: none; }
.onb small { flex-basis: 100%; padding-left: calc(64px + var(--space-2)); color: var(--muted); font-size: .8125rem; }
.onb .before .pill:not(.dim) { border-style: dashed; }

/* next project */
.c-next { padding: var(--section-y) 0; }
.next-card { display: flex; align-items: center; justify-content: space-between; gap: var(--space-8); padding: var(--space-10, 40px) var(--space-12); background: var(--card); border: 1px solid #161b28; border-radius: var(--r-card); color: inherit; text-decoration: none; transition: border-color .25s ease, transform .35s cubic-bezier(.2,.7,.2,1); }
.next-card:hover { border-color: #2a3a5c; transform: translateY(-2px); }
.next-card h2 { font-size: var(--fs-h2); line-height: 1.1; margin: var(--space-2) 0 var(--space-2); }
.next-card p { margin: 0; color: var(--muted); font-size: var(--fs-lede); }
.next-card .btn { flex: none; }

/* responsive */
@media (max-width: 1024px) {
  .c-grid { grid-template-columns: 1fr; gap: var(--space-6); }
  .c-head { position: static; }
  .c-head h2 { max-width: none; }
  .meta { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .c-hero { padding-top: var(--space-8); }
  .pair, .products, .decisions, .flow { grid-template-columns: 1fr; }
  .flow li + li::before { display: none; }
  .tldr { grid-template-columns: 1fr; gap: var(--space-2); padding: var(--space-6); }
  .product { padding: var(--space-6); }
  .decisions { gap: var(--space-10); }
  .decision { grid-template-columns: 1fr; }
  .decision p { grid-column: 1; grid-row: auto; margin-top: var(--space-3); }
  .next-card { flex-direction: column; align-items: flex-start; padding: var(--space-8) var(--space-6); }
  .onb-k { width: 100%; }
  .onb small { padding-left: 0; }
}
@media (max-width: 480px) { .meta { grid-template-columns: 1fr; } }
.onb-fig { margin: var(--space-4) 0 0; padding: var(--space-6); background: var(--card); border: 1px solid #161b28; border-radius: var(--r-card); }
.onb-fig .onb { margin-top: 0; }
.onb-fig figcaption { margin-top: var(--space-4); color: var(--muted); font-size: .875rem; }
.c-body > .onb-fig + .pair { margin-top: var(--space-8); }
/* hero image keeps its own transparent rounded corners: no border or backdrop behind it */
.hero-shot img { border: 0; background: none; border-radius: 0; }
/* back link on its own line above the badge */
.back { display: flex; width: fit-content; }

/* TL;DR: no side stripe. Same even border as every card, label as a pill above the text */
.tldr { display: block; border-left: 1px solid #161b28; padding: var(--space-8); }
.tldr-k { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 999px; background: rgba(39,118,239,.14); color: #8fb2ff; font: 600 .8125rem/1 var(--display); letter-spacing: .02em; }
.tldr p { margin-top: var(--space-4); max-width: 72ch; }
@media (max-width: 760px) { .tldr { padding: var(--space-6); } }

/* summary card: tilts toward the cursor, with a light that follows it and a lit border edge */
.tldr { position: relative; transform-style: preserve-3d; will-change: transform; transition: border-color .3s ease, box-shadow .4s ease; isolation: isolate; }
.tldr::before, .tldr::after { content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .35s ease; }
/* soft spotlight under the cursor */
.tldr::before { z-index: -1; background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(74,143,248,.16), transparent 60%); }
/* border highlight nearest the cursor */
.tldr::after { padding: 1px; background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), rgba(143,178,255,.9), rgba(143,178,255,0) 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); }
.tldr.hot::before, .tldr.hot::after { opacity: 1; }
.tldr.hot { box-shadow: 0 30px 60px -30px rgba(39,118,239,.45); }
.tldr > * { transform: translateZ(24px); }
.tldr::before { background: radial-gradient(460px circle at var(--mx, 50%) var(--my, 50%), rgba(74,143,248,.24), transparent 62%); }

/* =====================================================================
   Pieces blended in from the TMS deck: split hero with floating phones,
   problem/goal side by side, role/tools/responsibilities columns,
   phone trios on a glow, and the "other relevant screens" row
   ===================================================================== */
.split-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: var(--space-12); align-items: center; }
.split .c-hero h1, .split h1 { max-width: 18ch; }
.split .meta { margin-top: var(--space-16); }

/* phone frames, drawn in CSS so they stay crisp */
.phone { position: relative; border-radius: 40px; padding: 9px; background: linear-gradient(160deg, #2a2d36, #0d0e12 40%, #1c1e25); box-shadow: 0 0 0 1px #2f3340, 0 40px 80px -30px rgba(0,0,0,.9); }
.phone img { display: block; width: 100%; height: auto; border-radius: 32px; }
.phones { position: relative; }
/* soft purple-blue glow behind phones (the deck's gradient, in the dark theme) */
.phones::before { content: ""; position: absolute; inset: 8% -6% 4%; z-index: -1; border-radius: 50%; background: radial-gradient(closest-side, rgba(139,92,246,.35), rgba(39,118,239,.18) 55%, transparent 100%); filter: blur(30px); }

.hero-phones { display: flex; justify-content: center; align-items: flex-start; isolation: isolate; min-height: 520px; }
.hero-phones .phone { width: min(230px, 44%); }
.hero-phones .back-phone { transform: translate(18%, 0) rotate(-4deg); animation: float-a 7s ease-in-out infinite; }
.hero-phones .front-phone { transform: translate(-10%, 70px) rotate(3deg); z-index: 2; animation: float-b 8s ease-in-out infinite; }
@keyframes float-a { 0%,100% { transform: translate(18%, 0) rotate(-4deg); } 50% { transform: translate(18%, -12px) rotate(-3deg); } }
@keyframes float-b { 0%,100% { transform: translate(-10%, 70px) rotate(3deg); } 50% { transform: translate(-10%, 56px) rotate(2deg); } }

.trio, .duo { display: flex; justify-content: center; align-items: flex-end; gap: var(--space-6); margin-top: var(--space-12); padding: var(--space-8) 0 0; isolation: isolate; }
.trio .phone { width: min(220px, 30%); }
.trio .phone.lift { transform: translateY(-28px); }
.duo .phone { width: min(240px, 42%); }

/* problem / goal */
.pg { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.pg-card { padding: var(--space-8); background: var(--card); border: 1px solid #161b28; border-radius: var(--r-card); }
.pg-card p { margin: var(--space-3) 0 0; color: #e6ebf5; font-size: var(--fs-lede); line-height: 1.55; }
.pg-card.goal .kicker { color: #b9a3ff; }

/* role / tools / responsibilities */
.roles { margin-top: var(--space-8); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: #1a2030; border: 1px solid #1a2030; border-radius: var(--r-card); overflow: hidden; }
.role-col { background: var(--card); padding: var(--space-6); }
.role-v { margin: var(--space-3) 0 0; color: #fff; font-size: 1rem; }
.tool-list, .resp { list-style: none; padding: 0; margin: var(--space-3) 0 0; display: grid; gap: var(--space-2); }
.tool-list li { display: flex; align-items: center; gap: var(--space-2); color: #e6ebf5; font-size: .9375rem; }
.tool-list img { width: 16px; height: 16px; }
.tool-list img[src$="photoshop.svg"] { filter: brightness(0) invert(1); }
.resp li { position: relative; padding-left: var(--space-5, 20px); color: #e6ebf5; font-size: .9375rem; }
.resp li::before { content: ""; position: absolute; left: 2px; top: .5em; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }

/* other relevant screens: a row of outlined phones */
.screens { margin-top: var(--space-10, 40px); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-4); align-items: start; }
.screens img { display: block; width: 100%; height: auto; border-radius: 26px; box-shadow: 0 0 0 1px #2f3340, 0 24px 48px -28px rgba(0,0,0,.9); transition: transform .35s cubic-bezier(.2,.7,.2,1); }
.screens img:hover { transform: translateY(-6px); }

@media (prefers-reduced-motion: reduce) { .hero-phones .back-phone, .hero-phones .front-phone { animation: none; } }
@media (max-width: 1024px) {
  .split-grid { grid-template-columns: 1fr; }
  .hero-phones { min-height: 0; margin-top: var(--space-8); padding-bottom: 70px; }
  .screens { grid-template-columns: repeat(5, 200px); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: var(--space-3); }
  .screens img { scroll-snap-align: start; }
}
@media (max-width: 760px) {
  .pg, .roles { grid-template-columns: 1fr; }
  .trio .phone { width: 31%; } .trio .phone.lift { transform: translateY(-14px); }
  .phone { border-radius: 28px; padding: 6px; } .phone img { border-radius: 22px; }
  .screens { grid-template-columns: repeat(5, 170px); }
}
/* keep the phone glow from widening the page (clip, not hidden, so sticky headings still work) */
.c-hero, .c-sec { overflow-x: clip; }

/* TMS: screens shown in the deck's own iPhone mockups (frame is part of the image) */
.case-tms .phone { padding: 0; background: none; box-shadow: none; border-radius: 0; }
.case-tms .phone img { border-radius: 0; filter: drop-shadow(0 36px 40px rgba(0,0,0,.65)); }
.case-tms .hero-phones .phone { width: min(250px, 46%); }
.case-tms .trio .phone { width: min(230px, 31%); }
.case-tms .duo .phone { width: min(250px, 44%); }
@media (max-width: 760px) { .case-tms .phone { padding: 0; } .case-tms .phone img { border-radius: 0; } }

/* TMS: Benjamin's own phone groups from the deck, placed exactly as exported */
.group-hero, .group-trio { isolation: isolate; }
.group-hero { display: flex; justify-content: center; }
.group-hero img { display: block; width: min(453px, 100%); height: auto; }
.group-trio { margin-top: var(--space-12); }
.group-trio img { display: block; width: 100%; max-width: 765px; height: auto; margin: 0 auto; }
@media (max-width: 1024px) { .group-hero { margin-top: var(--space-8); } }

/* TMS: Blender renders of the screens (UI composited pixel-sharp) */
.render { position: relative; isolation: isolate; }
.render img { display: block; width: 100%; height: auto; }
.render::before { content: ""; position: absolute; inset: 12% 8% 6%; z-index: -1; border-radius: 50%; background: radial-gradient(closest-side, rgba(139,92,246,.28), rgba(39,118,239,.14) 55%, transparent 100%); filter: blur(34px); pointer-events: none; }
.render-hero { width: min(560px, 100%); margin: 0 auto; }
.render-trio { margin-top: var(--space-12); }
.render-duo { margin: var(--space-12) auto 0; width: min(560px, 100%); }
.render-lineup { margin-top: var(--space-10, 40px); }
@media (max-width: 1024px) { .render-hero { margin-top: var(--space-8); } }
@media (max-width: 760px) {
  /* the five-phone line-up scrolls sideways rather than shrinking its UI too far */
  .render-lineup { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: var(--space-3); }
  .render-lineup img { width: 900px; max-width: none; }
}

/* the onboarding before/after diagram spans the full page width (heading column + body column) */
@media (min-width: 1025px) {
  .c-body > .onb-fig { margin-left: calc(-50% - var(--space-12)); width: calc(150% + var(--space-12)); }
}

/* =====================================================================
   TMS information architecture: entry chain + five dashboard branches,
   in the same pill-and-connector language as the onboarding diagram
   ===================================================================== */
.ia-notes { list-style: none; padding: 0; margin: var(--space-6) 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2) var(--space-6); }
.ia-notes li { position: relative; padding-left: var(--space-5, 20px); color: #c9d0dd; font-size: .9375rem; line-height: 1.5; }
.ia-notes li::before { content: ""; position: absolute; left: 2px; top: .55em; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.ia-fig { margin: var(--space-10, 40px) 0 0; padding: var(--space-6); background: var(--card); border: 1px solid #161b28; border-radius: var(--r-card); }
@media (min-width: 1025px) { .c-body > .ia-fig { margin-left: calc(-50% - var(--space-12)); width: calc(150% + var(--space-12)); } }
.ia-k { display: block; color: var(--muted); font: 600 .75rem/1 var(--display); text-transform: uppercase; letter-spacing: .05em; }
.ia-chain { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.ia-fig .pill { display: inline-flex; align-items: center; min-height: 30px; padding: 4px 12px; border-radius: 999px; border: 1px solid #2a3248; color: #dfe5f0; font-size: .8125rem; line-height: 1.3; }
.ia-fig .pill.go { background: var(--blue); border-color: var(--blue); color: #fff; }
.ia-fig .ia-chain i, .ia-branch li i { width: 14px; height: 1px; background: #3a4560; flex: none; position: relative; }
.ia-fig .ia-chain i::after, .ia-branch li i::after { content: ""; position: absolute; right: -1px; top: -3px; border: 3.5px solid transparent; border-left-color: #3a4560; }
.ia-entry { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: var(--space-4); padding: var(--space-4); border-radius: var(--r-inner); background: #0b0f1a; border: 1px solid #1a2030; }
.ia-branches { position: relative; margin-top: var(--space-6); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-3); }
/* a connector from the dashboard down into the branches */
.ia-branches::before { content: ""; position: absolute; left: 10%; right: 10%; top: -12px; height: 1px; background: #3a4560; }
.ia-branch { position: relative; padding: var(--space-4); border-radius: var(--r-inner); background: #0b0f1a; border: 1px solid #1a2030; }
.ia-branch::before { content: ""; position: absolute; left: 50%; top: -13px; width: 1px; height: 12px; background: #3a4560; }
.ia-branch h3 { display: inline-flex; align-items: center; min-height: 30px; margin: 0 0 var(--space-3); padding: 0 12px; border-radius: 999px; font-size: .875rem; }
.ia-branch.blue h3 { background: rgba(56,189,248,.14); color: #7dd3fc; }
.ia-branch.purple h3 { background: rgba(139,92,246,.18); color: #c4b5fd; }
.ia-branch.green h3 { background: rgba(74,222,128,.14); color: #86efac; }
.ia-branch ul { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-3); }
.ia-branch li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: var(--space-3); border-top: 1px dashed #1f2637; }
.ia-branch li:first-child { padding-top: 0; border-top: 0; }
.ia-nav { margin-top: var(--space-6); display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.ia-nav > div { padding: var(--space-4); border-radius: var(--r-inner); background: #0b0f1a; border: 1px solid #1a2030; }
.ia-nav p { margin: var(--space-2) 0 0; color: #dfe5f0; font-size: .875rem; line-height: 1.6; }
@media (max-width: 1200px) and (min-width: 1025px) { .ia-branches { grid-template-columns: repeat(3, minmax(0, 1fr)); } .ia-branches::before, .ia-branch::before { display: none; } }
@media (max-width: 1024px) { .ia-branches { grid-template-columns: 1fr 1fr; } .ia-branches::before, .ia-branch::before { display: none; } }
@media (max-width: 640px) {
  .ia-notes, .ia-nav, .ia-branches { grid-template-columns: 1fr; }
  .ia-entry { grid-template-columns: 1fr; }
  .ia-fig { padding: var(--space-4); }
}
/* full-width diagrams sit above the pinned section heading */
.c-body > .ia-fig, .c-body > .onb-fig { position: relative; z-index: 2; }
/* branch paths read top to bottom: steps stacked, arrows pointing down */
.ia-branch li { flex-direction: column; align-items: flex-start; gap: 4px; }
.ia-branch li i { width: 1px; height: 12px; margin-left: 18px; }
.ia-branch li i::after { right: auto; left: -3px; top: auto; bottom: -2px; border: 3.5px solid transparent; border-top-color: #3a4560; border-left-color: transparent; }

/* =====================================================================
   Generated case studies (Eli & Lulu, 360 MaaaS, Slate): lifecycle,
   swim-lanes, branch column counts, three-up cards, stats
   ===================================================================== */
.ia-branches.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ia-branches.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.ia-fig > .ia-branches:first-child { margin-top: 0; }
.ia-fig > .ia-branches:first-child::before, .ia-fig > .ia-branches:first-child .ia-branch::before { display: none; }
.decisions.three { grid-template-columns: none; }
.meta a.u { color: #8fb2ff; text-decoration: underline; text-underline-offset: 3px; }

/* order lifecycle: numbered steps joined by arrows */
.cycle { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-4); }
.cycle li { position: relative; padding: var(--space-4); border-radius: var(--r-inner); background: #0b0f1a; border: 1px solid #1a2030; }
.cycle li + li::before { content: ""; position: absolute; left: calc(-1 * var(--space-4)); top: 32px; width: var(--space-4); height: 1px; background: #3a4560; }
.cycle li + li::after { content: ""; position: absolute; left: -5px; top: 29px; border: 3.5px solid transparent; border-left-color: #3a4560; }
.cycle .c-n { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--blue); color: #fff; font: 700 .8125rem/1 var(--display); }
.cycle h3 { margin: var(--space-3) 0 var(--space-1); font-size: 1rem; line-height: 1.25; }
.cycle .c-role { display: inline-flex; align-items: center; min-height: 24px; padding: 0 10px; border-radius: 999px; background: rgba(139,92,246,.18); color: #c4b5fd; font-size: .75rem; }
.cycle p { margin: var(--space-2) 0 0; color: var(--muted); font-size: .8125rem; line-height: 1.5; }

/* swim-lanes (e.g. E-Vote: officers / students) */
.ia-entry.lane { grid-template-columns: 150px 1fr; }
.ia-entry.lane + .ia-entry.lane { margin-top: var(--space-3); }
.ia-entry.lane.blue .ia-k { color: #7dd3fc; }
.ia-entry.lane.purple .ia-k { color: #c4b5fd; }

/* stats row */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: var(--space-6) 0 var(--space-6); background: #1a2030; border: 1px solid #1a2030; border-radius: var(--r-card); overflow: hidden; }
.stats > div { background: var(--card); padding: var(--space-6); }
.stats b { display: block; font: 700 clamp(1.75rem, 2vw + 1rem, 2.5rem)/1 var(--display); color: #fff; }
.stats span { display: block; margin-top: var(--space-2); color: var(--muted); font-size: .875rem; }
.c-body > .stats { margin-top: 0; }

@media (max-width: 1200px) { .cycle { grid-template-columns: repeat(3, minmax(0, 1fr)); } .cycle li:nth-child(4)::before, .cycle li:nth-child(4)::after { display: none; } }
@media (max-width: 1024px) { .ia-branches.cols-4, .ia-branches.cols-5 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) {
  .cycle { grid-template-columns: 1fr; } .cycle li::before, .cycle li::after { display: none; }
  .ia-branches.cols-4, .ia-branches.cols-5, .decisions.three, .stats { grid-template-columns: 1fr; }
  .ia-entry.lane { grid-template-columns: 1fr; }
}
/* generated pages: diagram rows and the text that continues after them */
.full-row { margin-top: var(--space-10, 40px); }
.full-row > .ia-fig { margin: 0; }
.c-grid.cont { margin-top: var(--space-10, 40px); }
@media (max-width: 1024px) { .c-grid.cont > .c-head { display: none; } }
/* pull quote (no side stripe: large type, quote mark above) */
.pullquote { margin: var(--space-8) 0 var(--space-6); padding: 0; }
.pullquote::before { content: "\201C"; display: block; height: .55em; font: 700 3.5rem/1 var(--display); color: var(--blue); }
.pullquote p { margin: 0; font: 600 clamp(1.25rem, .9vw + 1rem, 1.75rem)/1.35 var(--display); color: #fff; letter-spacing: -.01em; max-width: 30ch; }
.pullquote .q-who { display: block; margin-top: var(--space-3); color: var(--muted); font-size: .9375rem; }
/* tall artefacts (flow maps) shown in a scrollable window */
.shot.tall { max-height: 720px; overflow: auto; border-radius: var(--r-inner); }
.shot.tall img { border-radius: 0; }
/* a three-step cycle (e.g. MeetSession core loop) */
.cycle:has(> li:nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* "Live at ..." links in the fact strip: full-size tap target */
.meta a.u { display: inline-flex; align-items: center; min-height: 44px; margin: -12px 0; }
.c-hero-render { margin-top: var(--space-12); width: min(560px, 100%); margin-left: auto; margin-right: auto; }
/* portrait videos never taller than the screen (phones, the Duo's short inner display) */
.shot video { max-height: 80vh; max-height: 80svh; width: auto; max-width: 100%; margin: 0 auto; }
.shot:has(video) { text-align: center; }

/* decisions, wide screens (decisions.js): only the selected decision is lit, the rest are ghosted.
   The block pins while the page scrolls through .dx-track, one stretch per decision.
   The plain rows above remain for phones and when the script does not run. */
.dx-track { display: none; }
@media (min-width: 861px) {
  .decisions.dx > .decision { display: none; }
  .decisions.dx { gap: 0; margin-top: var(--space-16) !important; }        /* head-to-content 64 (sizing system) */
  .dx-track { display: block; position: relative; }
  .dx-stage { position: sticky; top: 96px; }
  .dx-ui { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); column-gap: var(--space-12); align-items: start; }
  /* heading pinned with the list: it sits in the stage, so the block starts where the heading used to */
  .dx-host .k-block:has(> .decisions.dx) { margin-top: 0; }
  .dx-host .decisions.dx { margin-top: 0 !important; }
  .dx-stage > .k-text { width: auto; margin: 0 0 var(--space-16); }
  /* whatever follows inside the same section starts a head-to-content step below */
  .k-block:has(> .decisions.dx) + * { margin-top: var(--space-16); }
}
.dx-list { display: grid; }
.dx-tab { display: flex; align-items: baseline; gap: var(--space-4); width: 100%; min-height: var(--hit-min); padding: var(--space-4) 0;
  border: 0; background: none; text-align: left; cursor: pointer; color: #394052;
  font: 600 clamp(1.25rem, 1.2vw + .85rem, 1.75rem)/1.2 var(--display); letter-spacing: -.01em; transition: color .3s var(--ease); }
.dx-tab:first-child { padding-top: 0; }
.dx-n { flex: 0 0 2.25em; font-size: .875rem; font-variant-numeric: tabular-nums; }
.dx-tab:hover { color: #7d8597; }
.dx-tab[aria-selected="true"] { color: var(--ink); }
.dx-tab[aria-selected="true"] .dx-n { color: var(--blue-hi); }
.dx-tab:focus-visible { outline: 2px solid var(--blue-hi); outline-offset: 4px; border-radius: 8px; }
/* every panel shares one cell, so the block keeps the tallest panel's height and nothing jumps */
.dx-panels { display: grid; }
.dx-panel { grid-area: 1 / 1; transition: opacity .35s var(--ease), transform .35s var(--ease); }
.dx-panel[hidden] { display: block; visibility: hidden; opacity: 0; transform: translateY(8px); }
.dx-panel p { margin: 0; color: #c9ceda; font-size: var(--fs-lede); line-height: var(--lh-lede); max-width: 34em; }
.dx-panel .dx-count { margin-bottom: var(--space-6); color: #4b5263; font: 600 1rem/1 var(--display); }
.dx-count b { color: var(--ink); font-size: clamp(3.5rem, 6vw, 5rem); line-height: .8; letter-spacing: -.03em; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .dx-panel, .dx-tab { transition: none; } }
