/* Case studies, essays and the 404 page. Same tokens and type as site.css. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --ink: #1d1d1b;
    --ink-muted: #5f5d58;
    --ink-faint: #6b6963;
    --paper: #ffffff;
    --paper-warm: #f6f5f1;
    --rule: #e3e0d8;
    --accent: #1f4b7a;
    --accent-soft: rgba(31, 75, 122, 0.08);
    --green: #3d7a4f;
    --pen: #e0a83a;
    --mark: rgba(255, 214, 102, 0.6);
    --serif: 'Source Sans 3', system-ui, sans-serif;
    --sans: 'Source Sans 3', system-ui, sans-serif;
    --mono: 'Source Sans 3', system-ui, sans-serif;
    --gutter: 24px;
}

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { font: 18px/1.65 var(--sans); background: var(--paper); color: var(--ink); font-variant-numeric: lining-nums; overflow-x: hidden; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

/* Nav */
.subnav { padding: 0 var(--gutter); }
.subnav-inner { max-width: 820px; margin: 0 auto; padding: 26px 0; display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.subnav .logo { font-weight: 700; color: var(--ink); text-decoration: none; }
.subnav .back { color: var(--ink); text-decoration: none; }
.subnav .back:hover { text-decoration: underline; }

/* Header */
.page-head { padding: 36px var(--gutter) 40px; }
.page-head-inner { max-width: 820px; margin: 0 auto; }
.eyebrow { display: block; font-size: 15px; color: var(--ink-muted); margin-bottom: 8px; }
.page-head h1 { font-weight: 700; font-size: 2.4rem; line-height: 1.15; letter-spacing: -0.01em; margin-bottom: 18px; max-width: 760px; }
.page-head h1 em { font-style: normal; }
.standfirst { font-size: 1.15rem; color: var(--ink-muted); max-width: 690px; line-height: 1.6; }
.meta-row { display: flex; flex-wrap: wrap; margin-top: 26px; border-top: 1px solid var(--rule); max-width: 690px; }
.meta-row div { padding: 12px 28px 0 0; }
.meta-row dt { font-size: 14px; color: var(--ink-muted); }
.meta-row dd { font-size: 1rem; font-weight: 600; }

/* Body */
.prose { padding: 8px var(--gutter) 32px; }
.prose-inner { max-width: 820px; margin: 0 auto; }
.prose-inner > * { max-width: 690px; }
.prose-inner > figure, .prose-inner > .results, .prose-inner > .cmp { max-width: 760px; }
.prose h2 { font-weight: 700; font-size: 1.5rem; line-height: 1.25; margin: 44px 0 12px; display: inline-block; position: relative; }
.prose h2::after { content: ""; position: absolute; left: -2px; right: -4px; bottom: -6px; height: 8px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 12' preserveAspectRatio='none'%3E%3Cpath d='M2 8 C60 3,120 11,180 6 S260 4,298 7' stroke='%23e0a83a' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 100% 100%; }
.prose h2:first-child { margin-top: 0; }
.prose h2 .n { display: none; }
.prose h2 + * { clear: both; }
.prose p { margin-bottom: 16px; }
.prose p strong { font-weight: 600; }
.prose ul { margin: 0 0 18px 20px; }
.prose li { margin-bottom: 8px; }
.prose li::marker { color: var(--ink-muted); }

.callout { background: var(--paper-warm); border-left: 4px solid var(--pen); border-radius: 0 8px 8px 0; padding: 16px 20px; margin: 24px 0; }
.callout h3 { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.callout p { margin: 0; }
.pull { font-size: 1.3rem; line-height: 1.45; font-weight: 600; margin: 28px 0; padding-left: 18px; border-left: 4px solid var(--pen); }

/* Figures */
figure { margin: 28px 0 32px; }
.fig-frame { border: 1px solid var(--rule); border-radius: 8px; background: #fbfaf7; padding: 16px; overflow: hidden; }
figure svg { display: block; width: 100%; height: auto; }
figcaption { margin-top: 8px; font-size: 15px; color: var(--ink-muted); line-height: 1.5; }
figcaption .tag { display: inline-block; font-size: 13px; font-weight: 600; color: #6a5114; background: rgba(224,168,58,0.18); padding: 1px 7px; border-radius: 4px; margin-right: 6px; }

/* SVG diagram tokens */
.d-box { fill: #f3f2ee; stroke: #d6d3cb; stroke-width: 1; }
.d-box-strong { fill: #fff; stroke: var(--ink); stroke-width: 1.2; }
.d-box-accent { fill: rgba(224,168,58,0.16); stroke: #c99230; stroke-width: 1.2; }
.d-box-good { fill: rgba(61,122,79,0.1); stroke: var(--green); stroke-width: 1.2; }
.d-line { stroke: #8f8c85; stroke-width: 1.2; fill: none; }
.d-line-accent { stroke: #c99230; stroke-width: 1.4; fill: none; }
.d-line-dash { stroke: #c99230; stroke-width: 1.2; fill: none; stroke-dasharray: 4 4; }
.d-t { font-family: var(--sans); font-size: 13px; fill: var(--ink); }
.d-tb { font-family: var(--sans); font-size: 13px; font-weight: 600; fill: var(--ink); }
.d-ts { font-family: var(--sans); font-size: 11px; fill: var(--ink-muted); }
.d-tl { font-family: var(--sans); font-size: 11px; font-weight: 600; fill: var(--ink-muted); }
.d-ta { font-family: var(--sans); font-size: 11px; font-weight: 600; fill: #8a5f12; }
.d-tg { font-family: var(--sans); font-size: 11px; font-weight: 600; fill: var(--green); }

/* Results strip: highlighted numbers */
.results-label { font-size: 15px; color: var(--ink-muted); margin: 20px 0 -8px; }
.results { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 16px 0 28px; }
.results div { padding: 14px 16px 14px 0; }
.results div + div { padding-left: 16px; border-left: 1px solid var(--rule); }
.results b { display: inline; font-size: 1.6rem; font-weight: 700; line-height: 1.2; background: linear-gradient(104deg, rgba(255,214,102,0) 0.5%, var(--mark) 2.5%, rgba(255,214,102,0.45) 97%, rgba(255,214,102,0)); padding: 0 4px; }
.results span { display: block; margin-top: 6px; font-size: 15px; color: var(--ink-muted); line-height: 1.45; }

/* Essay extras */
.essay-byline { font-size: 15px; color: var(--ink-muted); margin-top: 16px; }
.prose-inner > p:first-of-type::first-letter { all: unset; }

/* Next / footer */
.next { padding: 8px var(--gutter) 40px; }
.next-inner { max-width: 820px; margin: 0 auto; border-top: 1px solid var(--rule); padding-top: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.next a { text-decoration: none; display: block; color: var(--ink); }
.next a span { display: block; font-size: 15px; color: var(--ink-muted); margin-bottom: 2px; }
.next a b { font-weight: 700; font-size: 1.1rem; line-height: 1.3; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.next a.right { text-align: right; }

.sub-foot { border-top: 1px solid var(--rule); padding: 32px var(--gutter) 48px; }
.sub-foot > * { max-width: 820px; margin-left: auto; margin-right: auto; }
.sub-foot h2 { font-size: 1.3rem; font-weight: 700; line-height: 1.3; margin-bottom: 12px; }
.sub-foot h2 em { font-style: normal; }
.sub-foot .links { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; font-weight: 600; }
.sub-foot a.primary { color: var(--accent); }
.sub-foot button.copy-email { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

@media (max-width: 720px) {
    body { font-size: 17px; }
    .page-head h1 { font-size: 1.9rem; }
    .fig-frame { padding: 8px; }
    .results { grid-template-columns: 1fr; }
    .results div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
    .next-inner { grid-template-columns: 1fr; }
    .next a.right { text-align: left; }
}
