/* Case studies: the screen first, then what it proves. Dark, flat, ruled. */
.case-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 12px; margin-top: 44px; }
.case-card { display: flex; flex-direction: column; gap: 6px; min-height: 148px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; text-decoration: none; transition: border-color 160ms var(--ease), transform 100ms ease-out; }
.case-card:hover { border-color: var(--text-3); }
.case-card:active { transform: scale(0.985); }
.case-card .mark { display: flex; align-items: center; gap: 9px; height: 26px; margin-bottom: 22px; }
.case-card .mark img { height: 22px; width: auto; }
.case-card .mark .qm-icon { height: 26px; }
.case-card .name { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.case-card .role { font-size: 15px; line-height: 1.4; color: var(--text); }
.case-card .status { margin-top: auto; padding-top: 12px; font-family: var(--mono); font-size: 12px; color: var(--text-3); }

.case { padding: 112px 0; border-top: 1px solid var(--line); scroll-margin-top: 76px; }
.case-mark { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.case-mark img { height: 34px; width: auto; }
.case-mark .qm-icon { height: 40px; }
.case-mark .word { font-weight: 600; font-size: 22px; letter-spacing: -0.02em; }
.case-mark .text-mark { font-weight: 600; font-size: 28px; letter-spacing: -0.035em; }
.case-labels { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 18px; font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.case h2 { margin-top: 30px; max-width: 17em; font-size: clamp(36px, 5vw, 64px); line-height: 1.03; letter-spacing: -0.032em; }
.case .standfirst { margin-top: 24px; max-width: 36em; font-size: 18px; color: var(--text-2); }

.case figure { margin-top: 56px; }
.case figure + figure { margin-top: 16px; }
.case .shot { overflow: hidden; background: #0b0b0b; border: 1px solid var(--line); border-radius: 10px; }
.case .shot img { width: 100%; height: auto; }
.case figcaption { margin-top: 12px; font-family: var(--mono); font-size: 12px; line-height: 1.5; color: var(--text-3); }

.results { list-style: none; margin: 56px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.results li { padding: 30px 32px 32px 0; }
.results li + li { padding-left: 32px; border-left: 1px solid var(--line); }
.results .figure { display: block; font-family: var(--serif); font-weight: 500; font-size: clamp(28px, 3.2vw, 40px); line-height: 1.05; letter-spacing: -0.025em; }
.results .figure.num { font-family: var(--mono); letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.results .label { display: block; margin-top: 12px; max-width: 26em; font-size: 15px; line-height: 1.5; color: var(--text-2); }

.narrative { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 64px; margin-top: 48px; }
.narrative h3 { font-size: 15px; font-weight: 600; }
.narrative p { margin-top: 8px; font-size: 15px; line-height: 1.6; color: var(--text-2); }

/* Diagrams are HTML, so they reflow on a phone */
.diagram { margin-top: 56px; padding: 40px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.dg-cols { display: grid; grid-template-columns: minmax(0, 1fr) 56px minmax(0, 1fr) 56px minmax(0, 1fr); align-items: center; }
.dg-col { display: flex; flex-direction: column; gap: 10px; }
.dg-head { margin-bottom: 6px; font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.dg-box { padding: 16px 18px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; }
.dg-box strong { display: block; font-family: var(--mono); font-size: 14px; font-weight: 500; letter-spacing: -0.02em; }
.dg-box span { display: block; margin-top: 5px; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; color: var(--text-2); }
.dg-box--key { border-color: var(--text-3); background: #262524; }
.dg-arrow { display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.dg-arrow svg { width: 30px; height: 12px; }
.dg-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; counter-reset: step; }
.dg-steps li { counter-increment: step; display: flex; }
.dg-steps .dg-box { flex: 1; }
.dg-steps .dg-box::before { content: counter(step, decimal-leading-zero); display: block; margin-bottom: 10px; font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.diagram figcaption { margin-top: 20px; }

.prior-head { padding: 96px 0 0; border-top: 1px solid var(--line); }
.prior-note { margin-top: 18px; max-width: 40em; color: var(--text-2); }
.prior-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding-top: 40px; padding-bottom: 112px; }
.prior-card { display: flex; flex-direction: column; padding: 36px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; scroll-margin-top: 96px; }
.prior-card h3 { margin-top: 26px; font-family: var(--serif); font-weight: 500; font-size: clamp(24px, 2.4vw, 30px); line-height: 1.12; letter-spacing: -0.022em; text-wrap: balance; }
.prior-card .results { margin-top: 32px; }
.prior-card .results li { padding: 22px 18px 22px 0; }
.prior-card .results li + li { padding-left: 18px; }
.prior-card .results .figure { font-size: clamp(22px, 2.3vw, 30px); }
.prior-card .results .label { margin-top: 8px; font-size: 13px; }
.prior-card dl { margin: 28px 0 0; display: grid; gap: 16px; }
.prior-card dt { font-size: 14px; font-weight: 600; }
.prior-card dd { margin: 4px 0 0; font-size: 14px; line-height: 1.6; color: var(--text-2); }
.prior-card .source { margin-top: auto; padding-top: 24px; font-family: var(--mono); font-size: 12px; line-height: 1.5; color: var(--text-3); }

@media (max-width: 1100px) { .dg-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .case { padding: 72px 0; }
  .narrative, .prior-cards { grid-template-columns: minmax(0, 1fr); }
  .results { grid-template-columns: minmax(0, 1fr); }
  .results li, .results li + li, .prior-card .results li, .prior-card .results li + li { padding: 22px 0; border-left: 0; }
  .results li + li { border-top: 1px solid var(--line); }
  .dg-cols { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .dg-arrow { height: 36px; }
  .dg-arrow svg { transform: rotate(90deg); }
  .dg-steps { grid-template-columns: minmax(0, 1fr); }
  .diagram, .prior-card { padding: 22px; }
  .prior-cards { padding-bottom: 72px; }
}
@media (prefers-reduced-motion: reduce) { .case-card { transition: none; } }
/* On a phone a wide screenshot keeps a readable scale and scrolls sideways */
@media (max-width: 760px) {
  .diagram--pipe { padding: 0; background: transparent; border: 0; }
}

/* A tall screenshot sits beside its results */
.show { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 56px; align-items: start; margin-top: 56px; }
.show figure { margin-top: 0; }
.results--stack { margin-top: 0; grid-template-columns: minmax(0, 1fr); border-bottom: 0; }
.results--stack li, .results--stack li + li { padding: 28px 0; border-left: 0; }
.results--stack li + li { border-top: 1px solid var(--line); }
.results--stack li:last-child { border-bottom: 1px solid var(--line); }
@media (min-width: 901px) { .show .results--stack { position: sticky; top: 108px; } }
@media (max-width: 900px) { .show { grid-template-columns: minmax(0, 1fr); gap: 32px; } }


/* Pipeline breakdown: a row of steps with one open detail panel; an accordion on narrow screens */
.pipe { display: flex; flex-direction: column; gap: 8px; }
.pipe-btn { display: flex; flex-direction: column; gap: 10px; width: 100%; min-height: 76px; padding: 14px 14px 16px; text-align: left; font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; transition: border-color 120ms var(--ease), background-color 120ms var(--ease), transform 100ms ease-out; }
.pipe-btn .n { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.pipe-btn .t { font-family: var(--mono); font-size: 13.5px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.35; }
.pipe-btn:hover { border-color: var(--text-3); }
.pipe-btn:active { transform: scale(0.985); }
.pipe-btn[aria-expanded="true"] { background: #262524; border-color: var(--text-2); }
.pipe-item--lab .pipe-btn { border-style: dashed; }
.pipe-panel { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 16px 48px; padding: 28px 4px 12px; }
.pipe-panel[hidden] { display: none; }
.pipe-panel h3 { font-family: var(--serif); font-weight: 500; font-size: 26px; line-height: 1.1; letter-spacing: -0.022em; }
.pipe-panel .lead p { margin-top: 10px; font-size: 15px; line-height: 1.55; color: var(--text-2); }
.pipe-panel ul { list-style: none; margin: 0; padding: 0; }
.pipe-panel li { padding: 12px 0; border-top: 1px solid var(--line); font-size: 15px; line-height: 1.55; color: var(--text); }
.pipe-panel li:first-child { padding-top: 0; border-top: 0; }
html:not(.js) .pipe-panel[hidden] { display: grid; }
html:not(.js) .pipe { display: flex; flex-direction: column; }
html:not(.js) .pipe-item { display: block; }
html:not(.js) .pipe-panel { min-height: 0; }
@media (min-width: 1101px) {
  .pipe { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
  .pipe-item { display: contents; }
  .pipe-btn { grid-row: 1; }
  .pipe-panel { grid-row: 2; grid-column: 1 / -1; min-height: 232px; padding: 32px 8px 8px; }
}
@media (max-width: 1100px) {
  .pipe-btn { flex-direction: row; align-items: baseline; gap: 14px; min-height: 52px; }
  .pipe-panel { grid-template-columns: minmax(0, 1fr); padding: 18px 4px 20px; }
}
@media (prefers-reduced-motion: reduce) { .pipe-btn { transition: none; } }

/* Making the sequence legible: a key figure per step, a rail that fills to the open step,
   a tour that plays the steps in order, and panel content that arrives in sequence */
.pipe-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.pipe-head .pipe-hint { margin: 0; }
.pipe-tour { flex-shrink: 0; min-height: 36px; padding: 0 12px; font-family: var(--mono); font-size: 12px; color: var(--text-2); background: transparent; border: 1px solid var(--line); border-radius: 5px; cursor: pointer; transition: color 140ms var(--ease), border-color 140ms var(--ease), transform 100ms ease-out; }
.pipe-tour:hover { color: var(--text); border-color: var(--text-3); }
.pipe-tour:active { transform: scale(0.97); }
.pipe-btn { position: relative; overflow: hidden; }
.pipe-btn .k { font-family: var(--mono); font-size: 11px; line-height: 1.3; color: var(--text-3); transition: color 200ms var(--ease); }
.pipe-btn[aria-expanded="true"] .k { color: var(--text-2); }
.pipe-btn .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--text); transform: scaleX(0); transform-origin: left; pointer-events: none; }
.pipe.is-touring .pipe-btn[aria-expanded="true"] .bar { animation: pipe-bar var(--tour-ms, 4200ms) linear forwards; }
@keyframes pipe-bar { to { transform: scaleX(1); } }

.pipe-rail { display: none; }
@media (min-width: 1101px) {
  .pipe-btn { min-height: 104px; }
  .pipe-btn .k { margin-top: auto; }
  .pipe-rail { --g: 8px; --col: calc((100% + var(--g)) / 7); display: block; position: relative; grid-row: 2; grid-column: 1 / -1; height: 22px; }
  .pipe-panel { grid-row: 3; padding-top: 22px; }
  /* the main track runs from the centre of step 01 to the centre of step 06; a dashed branch leads to the lab */
  .pipe-rail::before { content: ""; position: absolute; top: 10px; height: 1px; left: calc(var(--col) / 2 - var(--g) / 2); width: calc(var(--col) * 5); background: var(--line); }
  .rail-branch { position: absolute; top: 10px; height: 0; left: calc(var(--col) * 5.5 - var(--g) / 2); width: var(--col); border-top: 1px dashed var(--line); transition: border-color 300ms var(--ease); }
  .pipe.on-lab .rail-branch { border-top-color: var(--text-2); }
  .rail-fill { position: absolute; top: 10px; height: 1px; left: calc(var(--col) / 2 - var(--g) / 2); width: calc(var(--at, 0) * var(--col)); background: var(--text-2); transition: width 520ms var(--ease); }
  .rail-dot { position: absolute; top: 7px; left: calc((var(--i) + 0.5) * var(--col) - var(--g) / 2 - 3.5px); width: 7px; height: 7px; box-sizing: border-box; border: 1px solid var(--text-3); border-radius: 50%; background: var(--surface); transition: background-color 300ms var(--ease), border-color 300ms var(--ease), transform 300ms var(--ease); }
  .rail-dot--lab { border-style: dashed; }
  .rail-dot.is-past { background: var(--text-2); border-color: var(--text-2); }
  .rail-dot.is-at { background: var(--text); border-color: var(--text); transform: scale(1.45); }
  /* a small mark travels the track, so the direction of flow reads at a glance */
  .rail-packet { position: absolute; top: 9px; left: calc((100% + var(--g)) / 12 - var(--g) / 2); width: 3px; height: 3px; border-radius: 50%; background: var(--text); opacity: 0; animation: pipe-packet 3.6s cubic-bezier(0.45, 0, 0.55, 1) infinite; }
  @keyframes pipe-packet {
    0% { transform: translateX(0); opacity: 0; }
    8% { opacity: 0.9; }
    88% { opacity: 0.9; }
    100% { transform: translateX(var(--span, 600px)); opacity: 0; }
  }
  .pipe.on-lab .rail-fill { width: calc(5 * var(--col)); }
}

/* Step diagrams: one small moving illustration per step, under its summary */
.pipe-viz { margin-top: 22px; border: 1px solid var(--line); border-radius: 8px; background: #161615; overflow: hidden; }
.pipe-viz svg { display: block; width: 100%; height: auto; }
.viz-note { margin-top: 8px !important; font-family: var(--mono); font-size: 11px !important; color: var(--text-3) !important; }
.pipe-viz text { font-family: var(--mono); font-size: 10px; fill: var(--text-3); }
.pipe-viz .t2 { fill: var(--text-2); }
.pipe-viz .t1 { fill: var(--text); }
.pipe-viz .big { font-size: 12px; }
.pipe-viz .ln { stroke: var(--line); fill: none; }
.pipe-viz .ln2 { stroke: var(--text-3); fill: none; }
.pipe-viz .fg { fill: var(--text); }
.pipe-viz .mid { fill: var(--text-2); }
.pipe-viz .dim { fill: var(--text-3); }
.pipe-viz .box { fill: var(--surface-2); stroke: var(--line); }
.pipe-viz .hollow { fill: none; stroke: var(--text-3); }
.pipe-viz .path { fill: none; stroke: var(--text); stroke-width: 1.5; stroke-linejoin: round; }
.pipe-viz .path2 { fill: none; stroke: var(--text-3); stroke-width: 1.2; stroke-linejoin: round; }
@media (max-width: 1100px) { .pipe-viz { max-width: 520px; } }
@media (max-width: 1100px) {
  /* a short connector between steps shows the order */
  .pipe-item + .pipe-item:not(.pipe-item--lab) { position: relative; }
  .pipe-item + .pipe-item:not(.pipe-item--lab)::before { content: ""; position: absolute; left: 20px; top: -8px; width: 1px; height: 8px; background: var(--text-3); }
  .pipe-item--lab { margin-top: 14px; }
  .pipe-btn .k { margin-left: auto; text-align: right; }
  .pipe-tour { display: none; }
}

/* Panel content arrives in reading order */
.pipe-panel.is-entering .lead, .pipe-panel.is-entering li { animation: pipe-in 460ms var(--ease) both; }
.pipe-panel.is-entering li:nth-child(1) { animation-delay: 70ms; }
.pipe-panel.is-entering li:nth-child(2) { animation-delay: 130ms; }
.pipe-panel.is-entering li:nth-child(3) { animation-delay: 190ms; }
.pipe-panel.is-entering li:nth-child(4) { animation-delay: 250ms; }
@keyframes pipe-in { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) {
  .rail-packet { display: none; }
  .rail-fill, .rail-dot { transition: none; }
  .pipe-panel.is-entering .lead, .pipe-panel.is-entering li { animation: none; }
  .pipe.is-touring .pipe-btn[aria-expanded="true"] .bar { animation: none; }
}

/* Version 1 to version 2, in plain words */
.vv { display: grid; grid-template-columns: minmax(0, 1fr) 96px minmax(0, 1fr); align-items: stretch; margin-top: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.vv-side { padding: 28px 32px; }
.vv-tag { font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.vv-what { margin-top: 12px; font-family: var(--serif); font-weight: 500; font-size: clamp(21px, 2.1vw, 27px); line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; }
.vv-note { margin-top: 12px; font-size: 15px; line-height: 1.5; color: var(--text-2); }
.vv-arrow { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.vv-arrow svg { width: 44px; height: 14px; color: var(--text-2); }
.pipe-hint { margin-bottom: 14px; }
@media (max-width: 760px) {
  .vv { grid-template-columns: minmax(0, 1fr); }
  .vv-side { padding: 22px; }
  .vv-arrow { flex-direction: row; padding: 12px 22px; border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); justify-content: flex-start; }
  .vv-arrow svg { transform: rotate(90deg); width: 28px; }
}

/* Small flows inside the employer cards: from, built, result, read top to bottom on one rail */
.flows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 32px; margin-top: 28px; }
.flow-label { font-family: var(--sans); font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--text); }
.flow-rail { list-style: none; margin: 14px 0 0; padding: 0; }
.flow-rail li { position: relative; display: grid; gap: 2px; padding: 0 0 16px 22px; }
.flow-rail li:last-child { padding-bottom: 0; }
.flow-rail li::before { content: ""; position: absolute; left: 0; top: 5px; width: 9px; height: 9px; box-sizing: border-box; border: 1px solid var(--text-3); border-radius: 50%; background: var(--surface); }
.flow-rail li::after { content: ""; position: absolute; left: 4px; top: 16px; bottom: 2px; width: 1px; background: var(--line); }
.flow-rail li:last-child::before { background: var(--text); border-color: var(--text); }
.flow-rail li:last-child::after { display: none; }
.flow-rail .stage { font-family: var(--mono); font-size: 11px; line-height: 18px; color: var(--text-3); }
.flow-rail .what { font-size: 14px; line-height: 1.45; color: var(--text-2); text-wrap: pretty; }
.flow-rail li:last-child .what { color: var(--text); }
@media (max-width: 640px) { .flows { grid-template-columns: minmax(0, 1fr); } }

/* On a phone a cropped screenshot says it can be swiped */

/* Booking link after a case */
.case-cta { margin-top: 40px; }
