@import url('https://fonts.googleapis.com/css2?family=Inclusive+Sans:ital,wght@0,300..700;1,300..700&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; }

:root {
    /* tells the UA to render native widgets - select popups, scrollbars,
       date pickers - in the matching palette */
    color-scheme: light;

    --surface: #fff;
    --field: #fff;
    --ink: #000;
    --body: #374151;
    --muted: #6b7280;
    --rule: #e5e7eb;
    --nav-rule: #f0f0f0;
    --bar: #888;

    --accent: #1f77b4;
    --accent-soft: rgba(31, 119, 180, 0.28);
    --accent-wash: rgba(31, 119, 180, 0.07);
    --accent-tint: rgba(31, 119, 180, 0.08);

    /* signed values in stat cards - encodes direction, not decoration */
    --pos: #047857;
    --neg: #be123c;

    /* charts have white baked in, so figures stay light plates in both
       themes - see .figure iframe */
    --plate: #fff;

    --content: 1100px;
    --gutter: 64px;

    --measure: 44rem;
}

/* Dark theme. The inline head script resolves system/light/dark into a
   concrete data-theme value before first paint, so this one block covers
   every case and there is no media-query duplicate to keep in sync. */
:root[data-theme="dark"] {
    color-scheme: dark;

    --surface: #0e0f11;
    --field: #1a1d21;
    --ink: #f2f3f5;
    --body: #c3c8d0;
    --muted: #8b929c;
    --rule: #2a2d31;
    --nav-rule: #232629;
    --bar: #6b7280;

    /* #1f77b4 is too dark to use as-is here. This keeps the light accent's
       green:blue ratio (0.67, vs 0.77 for a naive lightening, which reads
       cyan) and raises saturation to 89% so it holds presence. 7.4:1. */
    --accent: #5aa5f5;
    --accent-soft: rgba(90, 165, 245, 0.30);
    --accent-wash: rgba(90, 165, 245, 0.10);
    --accent-tint: rgba(90, 165, 245, 0.12);

    --pos: #34d399;
    --neg: #fb7185;
}

:root[data-theme="dark"] img:not(.about-photo) { filter: brightness(0.94); }

/* ═══ TYPOGRAPHY TAXONOMY ═══════════════════════════════════════════

   Display roles (T1-T3L, T5, callout) are fluid via clamp(); body and
   chrome (T6-T9, TN) are fixed on purpose - shrinking reading text on
   small screens hurts legibility, and 12-13px chrome is already at the
   floor. There are no font-size breakpoint overrides as a result.

   ROLE          SIZE                        WEIGHT  TRACKING  COLOUR   USED BY
   T1 Display    clamp(1.9 - 3.5rem)         600     -0.032em  ink      .hero h1
   T2 Title      clamp(1.6 - 2.5rem)         600     -0.028em  ink      .case-hero h1
   T3 Heading    clamp(1.25 - 1.5rem)        600     -0.018em  ink      .case-body h2, .case-next a
   T3L Head lg   clamp(1.375 - 1.75rem)      600     -0.02em   ink      .project-card h3 (home is
                                                                        display-led, runs a step up)
   T4 Subhead    1.0625rem                   600     -0.005em  ink      .case h3
   T5 Lead       clamp(1.0625 - 1.125rem)    400     normal    muted    .hero-sub, .case-sub
                 floor == T6, so the lead can never end up smaller than the body it introduces
   T6 Body       1.0625rem / 1.7             400     normal    body     .about-body p, .case-body p,
                 max-width var(--measure)                               .project-card p (muted)
   T6s Body sm   0.9375rem / 1.6             400     normal    muted    .about-list li
   T7 Label      0.8125rem                   500     0.09em    accent   .section-head, .about-block h1/h2,
                                             UPPER                      .source-group h3, .case-next .label
   T7m Label mut same as T7                  500     0.09em    muted    .case-toc h2, .case-details summary
                                             UPPER                      (chrome for a control, not a
                                                                        section title - accent there would
                                                                        clash with the active/open state)
   T8 Nav        0.75rem                     500     0.08em    ink      .nav-links a, .footer-links a,
                                             UPPER                      .nav-mark (600)
   T9 Caption    0.75rem                     400     normal    muted    .figure-note, .colophon,
                                                                        .source-note, .stat-label
   T9m Meta      0.8125rem                   400     normal    muted    .hero-meta, .project-meta
   TS Stat       2rem                        700     -0.02em   signed   .stat-value
   TM Math       1.0625rem, serif stack      400     italic    ink      .case-equation (notation only)
   TN Numeric    0.75rem, IBM Plex Sans      400     normal    body     .case-table (tabular-nums;
                                                                        Inclusive Sans has no tabular
                                                                        figures, so columns misalign)
   ══════════════════════════════════════════════════════════════════ */

body {
    font-family: 'Inclusive Sans', sans-serif;
    background: var(--surface);
    color: var(--ink);
    margin: 0;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

/* ── Nav ───────────────────────────────────────────────── */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: var(--surface);
    /* full-bleed - the border (the scroll-triggered "bar") spans the
       whole viewport; .nav-inner below constrains the actual controls */
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.nav.is-scrolled { border-bottom-color: var(--nav-rule); }

.nav-inner {
    max-width: var(--content);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 26px var(--gutter);
}

.nav-mark {
    font-size: 0.8125rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: -0.005em;
    color: var(--ink);
    text-decoration: none;
    transition: color 0.2s ease;
}

.nav-mark:hover { color: var(--accent); }

.nav-links {
    display: flex;
    gap: 56px;
}

.nav-links a {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.nav-links a:hover { color: var(--accent); }
.nav-links a[aria-current="page"] { color: var(--ink); }

.nav-right {
    display: flex;
    align-items: center;
    gap: 32px;
}

/* Theme toggle: one button cycling system -> light -> dark */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.theme-toggle:hover {
    background: var(--accent-tint);
    color: var(--ink);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.theme-toggle svg {
    display: none;
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* only the icon for the current preference is shown; the :not() keeps an
   icon visible if the head script never ran */
:root:not([data-theme-pref]) .theme-toggle .i-system,
:root[data-theme-pref="system"] .theme-toggle .i-system,
:root[data-theme-pref="light"] .theme-toggle .i-light,
:root[data-theme-pref="dark"] .theme-toggle .i-dark { display: block; }

/* ── Hero ──────────────────────────────────────────────── */
.hero {
    min-height: 100vh;
    max-width: var(--content);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    text-align: start;
    padding: 140px var(--gutter) 96px;
    gap: 40px;
}

.hero h1 {
    margin: 0;
    max-width: 1000px;
    font-size: clamp(1.9rem, 4.4vw, 3.5rem);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.032em;
    text-wrap: balance;
}

.hero h1 .name {
    background: var(--accent-soft);
    font-weight: 400;
    padding: 0 0.08em;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

/* the name may wrap a link - it should read as the name, not as a link.
   The highlight is the affordance; the anchor adds nothing visually. */
.hero h1 .name a {
    color: inherit;
    font: inherit;
    text-decoration: none;
    text-underline-offset: 4px;
    transition: text-decoration-color 0.2s ease;
}

.hero h1 .name a:hover {
    text-decoration: underline dotted;
    text-decoration-thickness: 2px;
}

/* no underline means keyboard focus needs its own cue */
.hero h1 .name a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

.hero-sub {
    margin: 0;
    max-width: 68ch;
    font-size: clamp(1.0625rem, 1.6vw, 1.125rem);
    line-height: 1.65;
    color: var(--muted);
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.8125rem;
    color: var(--muted);
}

.bar {
    display: inline-block;
    width: 1px;
    height: 11px;
    background: var(--bar);
    opacity: 0.5;
    flex-shrink: 0;
}

/* ── Page shell ────────────────────────────────────────── */
.page {
    max-width: var(--content);
    margin: 0 auto;
    padding: 0 var(--gutter) 120px;
}

.section-head {
    margin: 0 0 24px;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--accent);
}

/* ── Projects (stacked full-width rows) ────────────────── */
.projects {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 900px){
    .projects {
        grid-template-columns: 1fr;
    }
}

.project-card {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 14px;
    border-radius: 4px;
    transition: background 0.25s ease;
}

.project-card:hover { background: var(--accent-wash); }

.project-thumb {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    margin-bottom: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-tint);
    border-radius: 4px;
    padding: 32px;
}

.project-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.project-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    /* matches .hero-meta */
    font-size: 0.8125rem;
    color: var(--muted);
    margin-bottom: 10px;
}

.project-title {
    margin: 0 0 10px;
    display: flex;
    align-items: flex-start;
}

/* T3L - the home page is display-led, so its card titles run a step above
   the 1.5rem used for headings inside the case studies */
.project-card h3 {
    margin: 0;
    font-size: clamp(1.375rem, 2.6vw, 1.75rem);
    font-weight: 600;
    line-height: 1.18;
    letter-spacing: -0.02em;
    /* reserve 3 lines so cards in a row align. In em (not rem) so it tracks
       the font-size above automatically instead of needing recalculation. */
    min-height: calc(3 * 1.18em);
    transition: color 0.2s ease;
}

.project-card:hover h3 { color: var(--accent); }

/* T6 - these are the home page's primary prose, so they take the body size
   rather than the smaller card-summary size */
.project-card p {
    margin: 0;
    max-width: var(--measure);
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--muted);
}

/* ── About page ────────────────────────────────────────── */
.about {
    max-width: var(--content);
    margin: 0 auto;
    padding: 168px var(--gutter) 120px;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 72px;
    align-items: start;
}

.about-photo {
    display: block;
    width: 100%;
    aspect-ratio: 3/4;
    border-radius: 4px;
    object-fit: cover;
    object-position: center 20%;
}

.about-body p {
    margin: 0 0 20px;
    max-width: var(--measure);
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--body);
}

.about-block {
    margin-top: 52px;
    padding-top: 32px;
    border-top: 1px solid var(--rule);
}

/* leading block sits flush with the top of the photo */
.about-block:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* the About heading is the page's h1, but shares the section-label style */
.about-block h1,
.about-block h2 {
    margin: 0 0 18px;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--accent);
}

.about-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.about-list li {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 6px 18px;
    font-size: 0.9375rem;
    line-height: 1.5;
}

.about-list .label { color: var(--muted); }

.certs {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ── Footer ────────────────────────────────────────────── */
footer {
    max-width: var(--content);
    display: flex;
    justify-content: space-between;
    align-content: center;
    margin: 0 auto;
    padding: 72px var(--gutter) 88px;
    border-top: 1px solid var(--rule);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    margin-bottom: 56px;
}

.footer-links a {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover { color: var(--accent); }

.colophon {
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.7;
}

/* ── Case study ────────────────────────────────────────── */

/* full-bleed accent band; inner wrapper re-aligns to the shared column */
.case-hero {
    background: var(--accent-tint);
    padding: 136px 0 60px;
}

.case-hero-inner {
    max-width: var(--content);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

/* T2 */
.case-hero h1 {
    margin: 0;
    font-size: clamp(1.6rem, 3.4vw, 2.5rem);
    font-weight: 600;
    line-height: 1.14;
    letter-spacing: -0.028em;
}


/* T5 */
.case-sub {
    margin: 16px 0 0;
    font-size: clamp(1.0625rem, 1.6vw, 1.125rem);
    color: var(--muted);
}

.case {
    max-width: var(--content);
    margin: 0 auto;
    padding: 64px var(--gutter) 96px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 64px;
    align-items: start;
}

.case-body > section { margin-bottom: 64px; }
.case-body > section:last-child { margin-bottom: 0; }

/* T3 */
.case-body h2 {
    margin: 0 0 14px;
    font-size: clamp(1.25rem, 2.2vw, 1.5rem);
    font-weight: 600;
    line-height: 1.18;
    letter-spacing: -0.018em;
}

/* T4 */
.case-body h3 {
    margin: 36px 0 10px;
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.005em;
}

/* T6 - unclassed paragraphs only, so role classes below aren't outranked
   by this selector's higher specificity. The measure cap matters as much as
   the size: the 718px column ran ~92 characters per line, well past the
   45-75 comfortable range. Expressed in rem rather than ch: `ch` measures
   the "0" glyph, which is far wider than this font's average lowercase
   letter, so ch values read misleadingly large. */
.case-body p:not([class]) {
    margin: 0 0 16px;
    max-width: var(--measure);
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--body);
}

.case-body ul {
    margin: 0 0 16px;
    max-width: var(--measure);
    padding-left: 20px;
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--body);
}

.case-body li { margin-bottom: 6px; }

.case-body a { color: var(--accent); }

/* hanging indent; raw URLs must break or they overflow narrow screens */
.biblio { list-style: none; padding-left: 0; }
.biblio li { padding-left: 28px; text-indent: -28px; }
.biblio a { overflow-wrap: anywhere; }

/* TM - notation only, deliberately outside the sans stack */
.case-equation {
    margin: 24px 0;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.0625rem;
    font-style: italic;
    text-align: center;
    color: var(--ink);
}

/* opt-in: plain equations must stay inline or <sub> becomes its own flex item */
.case-equation.has-frac {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.frac {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    font-style: normal;
    line-height: 1.3;
}

.frac > span:first-child {
    padding: 0 6px 2px;
    border-bottom: 1px solid currentColor;
}

.frac > span:last-child { padding: 2px 6px 0; }

/* Interactive chart controls */
.chart-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 28px;
    margin-bottom: 16px;
    padding: 14px 18px;
    background: var(--accent-tint);
    border-radius: 4px;
}

.chart-controls .field {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-controls label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--body);
}

.chart-controls select {
    font-family: inherit;
    font-size: 0.8125rem;
    color: var(--ink);
    padding: 7px 10px;
    background: var(--field);
    border: 1px solid var(--rule);
    border-radius: 4px;
}

/* the popup list is UA-rendered; color-scheme above handles most of it,
   these make the option rows explicit */
.chart-controls option {
    background: var(--field);
    color: var(--ink);
}

.chart-controls input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
}

/* Data sources */
.sources { margin-top: 32px; }
.source-group { margin-bottom: 40px; }
.source-group:last-child { margin-bottom: 0; }

/* T7 */
.source-group h3 {
    margin: 0 0 16px;
    padding-bottom: 10px;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--accent);
    border-bottom: 1px solid var(--rule);
}

.source-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.source-list li {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 18px;
    margin-bottom: 18px;
}

.source-list li:last-child { margin-bottom: 0; }

/* T9 */
.source-year {
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    padding-top: 2px;
}

.source-list a { font-weight: 500; }

/* T9 */
.source-note {
    margin: 3px 0 0;
    font-size: 0.75rem;
    line-height: 1.6;
    color: var(--muted);
}


/* T9 */
.case-note {
    margin: 0 0 16px;
    font-size: 0.75rem;
    line-height: 1.65;
    color: var(--muted);
}

/* Collapsible cards - the whole header row is the hit target. Shrink-wraps
   to the capped body inside, same as .findings, so the card tracks the
   reading measure. Sized from the token rather than fit-content, which
   would size to the summary alone when collapsed and jump on open. */
.case-details {
    max-width: calc(var(--measure) + 36px);
    margin: 0 0 20px;
    border: 1px solid var(--rule);
    border-radius: 4px;
    overflow: hidden;
}

/* T7 */
.case-details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
    cursor: pointer;
    user-select: none;
    /* both lines needed to drop the native disclosure triangle */
    list-style: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.case-details summary::-webkit-details-marker { display: none; }

.case-details summary strong { font-weight: inherit; }

.case-details summary:hover {
    background: var(--accent-tint);
    color: var(--ink);
}

.case-details summary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

/* chevron, pointing down when closed and up when open */
.case-details summary::after {
    content: '';
    flex: none;
    width: 7px;
    height: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 0.2s ease;
}

.case-details[open] summary::after { transform: translateY(2px) rotate(-135deg); }

.case-details[open] summary {
    background: var(--accent-tint);
    border-bottom: 1px solid var(--rule);
}

.case-details-body { padding: 16px 18px; }
.case-details-body > *:last-child { margin-bottom: 0; }
.case-details-body ul { margin: 0; }

/* Case meta block - key facts as a scannable key/value strip */
.case-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    margin: 0 0 48px;
    padding: 24px 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}

/* T7m - same chrome as case-toc/case-details labels, not accent */
.case-meta dt {
    margin: 0 0 6px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
}

.case-meta dd {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--ink);
}

/* Callout - set shorter than body prose: it's display text, so it wants a
   tighter measure (~55 chars) than the 70 the paragraphs run at */
.case-callout {
    margin: 0 0 24px;
    max-width: 54ch;
    padding: 4px 0 4px 20px;
    border-left: 3px solid var(--accent);
    font-size: clamp(1.0625rem, 1.9vw, 1.1875rem);
    font-weight: 500;
    line-height: 1.45;
    letter-spacing: -0.01em;
    color: var(--ink);
}

/* Stat cards */
.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
}

.stat {
    display: flex;
    flex-direction: column;
    justify-content: start;
    align-items: start;
    gap: 6px;
    padding: 14px 0px;
    text-align: left;
}

/* TS */
.stat-value {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.stat-value.is-pos { color: var(--pos); }
.stat-value.is-neg { color: var(--neg); }

/* T9 */
.stat-label {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--muted);
}

/* Figures - same tinted panel the home page uses for charts */
.figure {
    margin: 0 0 24px;
    background: var(--accent-tint);
    border-radius: 4px;
    padding: 20px;
}

.figure iframe {
    display: block;
    width: 100%;
    height: 520px;
    border: 0;
    border-radius: 4px;
    /* charts have white baked in, so the plate stays light in both themes */
    background: var(--plate);
}

.figure img {
    display: block;
    width: 100%;
    border-radius: 4px;
}

/* T9 */
.figure-note {
    margin: 14px 4px 0;
    font-size: 0.75rem;
    line-height: 1.65;
    color: var(--muted);
}

/* Regression tables */
/* one per row: seven numeric columns need ~470px and never fit two-up
   inside the 718px body measure */
.table-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    margin-top: 28px;
}

/* each table is a card so the group reads as children of the section */
.table-card {
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 16px 16px 8px;
}

/* TN */
.case-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'IBM Plex Sans', sans-serif;
    font-variant-numeric: tabular-nums;
    font-size: 0.75rem;
    line-height: 1.5;
    text-align: right;
}

/* T7 - caption is a label, so it stays in the sans stack */
.case-table caption {
    caption-side: top;
    margin-bottom: 12px;
    font-family: 'Inclusive Sans', sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.35;
    text-align: left;
    color: var(--ink);
}

.case-table caption span {
    display: block;
    margin-top: 2px;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--muted);
}

.case-table th {
    padding: 0 6px 7px;
    font-weight: 500;
    font-size: 0.6875rem;
    color: var(--muted);
    text-align: right;
    white-space: nowrap;
    border-bottom: 1px solid var(--rule);
}

.case-table th:first-child,
.case-table td:first-child {
    text-align: left;
    white-space: nowrap;
}

.case-table td {
    padding: 7px 6px;
    border-bottom: 1px solid var(--nav-rule);
    color: var(--body);
    white-space: nowrap;
}

.case-table tbody tr:last-child td { border-bottom: 0; }

/* the interaction term is the estimate the study turns on */
.case-table tr.is-key td {
    background: var(--accent-tint);
    font-weight: 600;
    color: var(--ink);
}

.case-table tr.is-key td:first-child { border-radius: 3px 0 0 3px; }
.case-table tr.is-key td:last-child { border-radius: 0 3px 3px 0; }

/* Key findings - width follows the measure plus this panel's own padding */
.findings {
    max-width: calc(var(--measure) + 64px);
    background: var(--accent-tint);
    border-radius: 4px;
    padding: 32px;
}

.findings ul { list-style: none; margin: 0; padding: 0; }
.findings li { margin-bottom: 24px; }
.findings li:last-child { margin-bottom: 0; }

.findings .case-note { margin-top: 24px; }

/* T4 */
.findings strong {
    display: block;
    margin-bottom: 6px;
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--ink);
}

/* On this page */
.case-toc { position: sticky; top: 104px; }

/* T7 */
.case-toc h2 {
    margin: 0 0 14px;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--muted);
}

.case-toc a {
    display: block;
    margin-bottom: 9px;
    font-size: 0.8125rem;
    line-height: 1.35;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
}

.case-toc a.is-sub { padding-left: 12px; }
.case-toc a:hover { color: var(--ink); }
.case-toc a.is-active { color: var(--accent); font-weight: 600; }

/* Next-project link above the shared footer */
.case-next {
    max-width: var(--content);
    margin: 0 auto;
    padding: 0 var(--gutter) 72px;
}

/* T7 */
.case-next .label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--accent);
}

/* T3 */
.case-next a {
    font-size: clamp(1.25rem, 2.2vw, 1.5rem);
    font-weight: 600;
    letter-spacing: -0.018em;
    color: var(--ink);
    text-decoration: none;
    transition: color 0.2s ease;
}

.case-next a:hover { color: var(--accent); }

/* ── Mobile ────────────────────────────────────────────── */
@media (max-width: 780px) {
    :root { --gutter: 22px; }

    .nav-inner { padding: 18px var(--gutter); }
    .nav-links { gap: 22px; }
    .nav-right { gap: 16px; }

    .hero {
        min-height: 88vh;
        padding: 120px var(--gutter) 72px;
        gap: 28px;
    }

    .hero h1 { max-width: none; }

    .hero-meta {
        flex-direction: column;
        /* base rule centres on the cross axis, which goes horizontal once
           the direction flips - that indents the shorter line */
        align-items: flex-start;
        gap: 4px;
    }

    /* the divider reads as an orphan once the line wraps */
    .hero-meta .bar { display: none; }

    .page { padding-bottom: 80px; }
    .section-head { margin-bottom: 36px; }
    .projects { gap: 72px; }

    /* keep the bleed inside the 22px gutter or the page scrolls sideways */
    .project-card { padding: 16px; margin: 0 -16px; }

    /* 32px of mat leaves too little room for the chart on a phone */
    .project-thumb { padding: 14px; }


    /* single column on mobile, so no need to reserve equal title heights */
    .project-card h3 { min-height: 0; }

    .about {
        grid-template-columns: 1fr;
        gap: 36px;
        padding-top: 108px;
    }

    .about-photo { max-width: 240px; order: -1; }

    .about-list li { grid-template-columns: 1fr; gap: 3px; }
    .about-list .label { font-size: 0.8125rem; }

    footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 24px;
        padding: 48px var(--gutter) 64px;
    }
    .footer-links { gap: 24px; margin-bottom: 0; order: -1; }

    .case-hero { padding: 104px 0 40px; }

    .case {
        /* minmax(0,…) or the tables' min-content width blows out the track */
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
        padding: 40px var(--gutter) 64px;
    }

    .table-grid { grid-template-columns: minmax(0, 1fr); }
    .table-grid > div { overflow-x: auto; }

    .chart-controls { gap: 10px 16px; padding: 12px 14px; }
    .chart-controls .field { width: 100%; }
    .chart-controls select { flex: 1; min-width: 0; }

    .source-list li { grid-template-columns: minmax(0, 1fr); gap: 2px; }

    /* sticky sidebar has nowhere to stick in a single column */
    .case-toc { display: none; }

    .case-body > section { margin-bottom: 48px; }

    .case-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 16px; }
    .case-callout { padding-left: 16px; }
    .figure { padding: 12px; }
    /* fixed 520px height reads as stretched once width shrinks on phones */
    .figure iframe { height: 400px; }
    .findings { padding: 22px; }
    .case-next { padding-bottom: 48px; }
}

/* phones proper - 400px still reads tall/stretched against a ~340-375px
   wide screen, so shrink the chart box further once we're not just on a
   tablet-width window anymore */
@media (max-width: 480px) {
    .figure iframe { height: 300px; }
}
