/* Case study pages. Same tokens as the homepage: charcoal ground, one grotesk at two sizes, one sage action,
   one pale concrete field for the hardest conversation. */
:root {
  color-scheme: dark;
  --bg: #1c1c1c; --surface: #262626; --surface-2: #303030;
  --ink: #f1f1ef; --muted: #9a9b96;
  --accent: #8fa68e; --accent-ink: #1c1c1c;
  --field: #c8c5ba; --field-ink: #1c1c1c; --field-muted: #4a4a46;
  --font: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-head: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  --step-title: clamp(2.5rem, 1.2rem + 4.6vw, 5rem);
  --m: clamp(1.25rem, 2.2vw, 2rem);
  --gutter: clamp(1rem, 2vw, 2rem);
  --section: clamp(6rem, 11vw, 11rem);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-press: 140ms; --t-hover: 180ms; --t-reveal: 800ms;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: var(--step-body); line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3, p, figure, ul, ol, dl, dd, dt { margin: 0; }
ul[class], ol[class] { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
p { max-width: 62ch; text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }
.wrap { padding-left: max(16px, env(safe-area-inset-left, 0px), var(--m)); padding-right: max(16px, env(safe-area-inset-right, 0px), var(--m)); }
.muted { color: var(--muted); }
.todo { color: var(--muted); }
.nums { font-variant-numeric: tabular-nums; }
.link { text-decoration: underline; text-underline-offset: 0.2em; text-decoration-thickness: 0.07em; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); transition: text-decoration-color var(--t-hover) ease; }
@media (hover: hover) and (pointer: fine) { .link:hover { text-decoration-color: currentColor; } }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 2.5rem; padding: 0 1rem; background: var(--accent); color: var(--accent-ink); font-weight: 500; text-decoration: none; white-space: nowrap; transition: transform var(--t-press) var(--ease-out), background-color var(--t-hover) ease; }
.button:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .button:hover { background: var(--ink); } }

/* bar */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: calc(env(safe-area-inset-top, 0px) + 1.1rem); padding-bottom: 1.1rem; }
.bar__mark { font-weight: 500; text-decoration: none; }
.bar__nav { display: flex; align-items: center; gap: clamp(1rem, 2.4vw, 2.25rem); font-size: var(--step-small); font-weight: 500; }
.bar__nav a:not(.button) { text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .bar__nav a:not(.button):hover { text-decoration: underline; text-underline-offset: 0.2em; } }

/* top block */
.top { padding-top: clamp(3rem, 7vw, 6rem); padding-bottom: var(--section); display: flex; flex-direction: column; gap: 2.5rem; }
.top__meta { color: var(--muted); }
.top__title { font-size: var(--step-title); font-weight: 500; line-height: 0.98; letter-spacing: -0.04em; max-width: 18ch; }
.top__summary { font-size: var(--step-lead); line-height: 1.35; max-width: 40ch; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gutter); background: var(--surface); padding: 1.5rem; }
.facts div { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.facts dt { color: var(--muted); font-size: var(--step-small); }
.facts dd { font-weight: 500; }
.outcomes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gutter); }
.outcome { display: flex; flex-direction: column; gap: 0.5rem; }
.outcome__fig { font-size: clamp(2.5rem, 1.5rem + 3vw, 4rem); font-weight: 500; line-height: 1; letter-spacing: -0.03em; }
.outcome__txt { max-width: 30ch; }
.outcome__how { font-size: var(--step-small); color: var(--muted); max-width: 34ch; }
.cover { aspect-ratio: 21 / 9; overflow: hidden; background: var(--surface); margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px), var(--m))); }
.cover svg { width: 100%; height: 100%; }
@media (max-width: 800px) {
  .top { gap: 2rem; }
  .facts { grid-template-columns: 1fr 1fr; padding: 1.25rem; }
  .outcomes { grid-template-columns: 1fr; gap: 1.5rem; }
  .outcome { display: grid; grid-template-columns: 96px minmax(0, 1fr); column-gap: 16px; align-items: baseline; }
  .outcome__fig { grid-row: 1 / 3; font-size: 1.75rem; text-align: right; }
  .cover { aspect-ratio: 4 / 3; }
}

/* a word at the left, the content from the 34% line */
.row { display: grid; grid-template-columns: 34% minmax(0, 1fr); padding-bottom: var(--section); }
.row__word { font-weight: 500; }
.row__body { display: flex; flex-direction: column; gap: 1.25rem; }
.row__head { font-size: var(--step-head); font-weight: 500; line-height: 1.1; letter-spacing: -0.02em; max-width: 28ch; }
.row__body p { font-size: var(--step-lead); line-height: 1.35; max-width: 48ch; }
.row__body p.plain { font-size: var(--step-body); line-height: 1.5; max-width: 62ch; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gutter); }
.pair div { background: var(--surface); padding: 1.5rem; display: flex; flex-direction: column; gap: 0.75rem; }
.pair h3 { font-size: var(--step-body); font-weight: 500; }
.pair ul { display: flex; flex-direction: column; gap: 0.35rem; color: var(--ink); }
@media (max-width: 800px) {
  .row { display: flex; flex-direction: column; gap: 1.25rem; padding-bottom: 5rem; }
  .pair { grid-template-columns: 1fr; }
}

/* decisions */
.led { padding-bottom: var(--section); display: flex; flex-direction: column; gap: 2.5rem; }
.led__head { font-size: var(--step-head); font-weight: 500; line-height: 1.1; letter-spacing: -0.02em; max-width: 28ch; }
.decisions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gutter); }
.decision { background: var(--surface); padding: 1.75rem 1.5rem 1.5rem; display: flex; flex-direction: column; gap: 0.9rem; min-width: 0; }
.decision h3 { font-size: var(--step-lead); font-weight: 500; line-height: 1.15; letter-spacing: -0.02em; }
.decision p { font-size: var(--step-body); }
.decision .cost { margin-top: auto; padding-top: 0.5rem; }
.decision .cost b { font-weight: 500; color: var(--ink); }
.stages { counter-reset: stage; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gutter); padding-left: 0; }
.stages li { counter-increment: stage; display: flex; flex-direction: column; gap: 0.35rem; padding-top: 0.75rem; }
.stages li::before { content: counter(stage); font-size: var(--step-head); font-weight: 500; line-height: 1; letter-spacing: -0.02em; }
.stages b { font-weight: 500; }
.stages span { font-size: var(--step-body); }
@media (max-width: 800px) { .decisions { grid-template-columns: 1fr; } .stages { grid-template-columns: 1fr 1fr; } }

/* the hardest conversation: the one field change on the page */
.field { background: var(--field); color: var(--field-ink); padding-block: var(--section); display: flex; flex-direction: column; gap: 1.5rem; }
.field h2 { font-size: var(--step-head); font-weight: 500; line-height: 1.1; letter-spacing: -0.02em; max-width: 28ch; }
.field p { font-size: var(--step-lead); line-height: 1.35; max-width: 44ch; }
.field .todo { color: var(--field-muted); }
.field .muted { color: var(--field-muted); }

/* results */
.results { padding-block: var(--section); display: flex; flex-direction: column; gap: 2.5rem; }
.results__head { font-size: var(--step-head); font-weight: 500; line-height: 1.1; letter-spacing: -0.02em; max-width: 28ch; }
.tablewrap { overflow-x: auto; background: var(--surface); }
table { border-collapse: collapse; width: 100%; min-width: 640px; font-size: var(--step-body); }
th, td { text-align: left; padding: 0.9rem 1.25rem; vertical-align: top; border-bottom: 1px solid var(--surface-2); }
th { font-weight: 500; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.change { font-weight: 500; white-space: nowrap; }
td.how { color: var(--muted); }
.aside { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gutter); align-items: start; }
.panel { background: var(--surface); padding: 1.5rem; display: flex; flex-direction: column; gap: 1.1rem; min-width: 0; }
.panel h3 { font-size: var(--step-body); font-weight: 500; }
.panel p { font-size: var(--step-body); }
@media (max-width: 800px) { .aside { grid-template-columns: 1fr; } }

/* calculator */
.calc { display: flex; flex-direction: column; gap: 1rem; }
.calc__label { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; font-weight: 500; }
.calc input[type=range] { width: 100%; accent-color: var(--accent); height: 2.75rem; margin: 0; cursor: pointer; }
.calc__out { font-size: var(--step-lead); line-height: 1.3; }
.calc__out strong { font-weight: 500; color: var(--accent); }
.calc__note { font-size: var(--step-small); color: var(--muted); }

/* interface fragments keep the product's own conventions */
[data-ui] { --muted: #b3b4af; font-size: 13px; line-height: 1.35; background: var(--surface-2); color: var(--ink); display: flex; flex-direction: column; }
[data-ui] .ui-bar { display: flex; justify-content: space-between; padding: 10px 12px; background: #3a3a3a; font-weight: 500; }
[data-ui] .ui-bar span:last-child { color: var(--muted); font-weight: 400; }
[data-ui] .ui-rows { display: flex; flex-direction: column; padding: 6px 12px 10px; gap: 1px; }
[data-ui] .ui-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px solid #3a3a3a; }
[data-ui] .ui-row:last-child { border-bottom: 0; }
[data-ui] .ui-row.is-on { background: #3a3a3a; margin: 0 -8px; padding: 5px 8px; }
[data-ui] .ui-bars { display: flex; gap: 2px; align-items: center; }
[data-ui] .ui-bars i { display: block; width: 7px; height: 9px; background: var(--accent); }
[data-ui] .ui-val { color: var(--muted); font-variant-numeric: tabular-nums; }
[data-ui] .ui-val b { color: var(--ink); font-weight: 500; }
[data-ui] .ui-stat { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid #3a3a3a; }
[data-ui] .ui-stat:last-child { border-bottom: 0; }
[data-ui] .ui-stat b { font-size: 20px; font-weight: 500; letter-spacing: -0.02em; }
[data-ui] .ui-stat span { color: var(--muted); }

/* learned, pager, footer */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gutter); padding-bottom: var(--section); }
.pager a { text-decoration: none; display: flex; flex-direction: column; gap: 0.5rem; background: var(--surface); padding: 1.5rem; min-height: 9rem; transition: background-color var(--t-hover) ease; }
.pager a:last-child { text-align: right; align-items: flex-end; }
.pager span { color: var(--muted); font-size: var(--step-small); }
.pager b { font-size: var(--step-head); font-weight: 500; line-height: 1.1; letter-spacing: -0.02em; }
@media (hover: hover) and (pointer: fine) { .pager a:hover { background: var(--surface-2); } }
@media (max-width: 800px) { .pager { grid-template-columns: 1fr; } .pager a:last-child { text-align: left; align-items: flex-start; } }
.foot { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 1rem; padding-block: 2rem; font-size: var(--step-small); color: var(--muted); }
.foot a { color: var(--ink); }

/* motion: content stays visible without script */
@media (prefers-reduced-motion: no-preference) {
  .js [data-rise] { opacity: 0; transform: translateY(18px); animation: rise var(--t-reveal) var(--ease-out) forwards; animation-delay: calc(var(--i, 0) * 90ms + 120ms); }
  .js [data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity 700ms var(--ease-out), transform 900ms var(--ease-out); transition-delay: calc(var(--i, 0) * 80ms); }
  .js [data-reveal].is-in { opacity: 1; transform: none; }
}
@keyframes rise { to { opacity: 1; transform: none; } }
