/* =============================================
   TOKENS
   ============================================= */
:root {
    --paper:      #f6f6f3;
    --paper-2:    #ecece8;
    --ink:        #111318;
    --ink-2:      #454a54;
    --ink-3:      #7a808c;
    --rule:       #d9dadd;
    --accent:     #2447ff;
    --accent-ink: #ffffff;
    --ok:         #2f7d4f;
    --warn:       #c8371d;
    --term-bg:    #14161c;
    --term-fg:    #e9ebf0;
    --shadow:     0 24px 60px -20px rgba(12, 16, 30, 0.35);

    --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
    --sans:  'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono:  'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

    --wrap: 1160px;
    --gutter: clamp(16px, 4vw, 40px);
    --mast-h: 60px;

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper:   #0d0f14;
        --paper-2: #151821;
        --ink:     #e9ebf0;
        --ink-2:   #aeb4c0;
        --ink-3:   #747b88;
        --rule:    #262a35;
        --accent:  #7d97ff;
        --ok:      #5cc28a;
        --warn:    #ff6a4d;
        --term-bg: #08090c;
        --shadow:  0 24px 60px -20px rgba(0, 0, 0, 0.7);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --paper:   #0d0f14;
    --paper-2: #151821;
    --ink:     #e9ebf0;
    --ink-2:   #aeb4c0;
    --ink-3:   #747b88;
    --rule:    #262a35;
    --accent:  #7d97ff;
    --ok:      #5cc28a;
    --warn:    #ff6a4d;
    --term-bg: #08090c;
    --shadow:  0 24px 60px -20px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
}

/* =============================================
   BASE
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--mast-h) + 16px);
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

/* faint paper grain over everything; it is a fixed layer so it costs one composite */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] body::before { filter: invert(1); opacity: 0.045; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) body::before { filter: invert(1); opacity: 0.045; } }

::selection { background: var(--accent); color: var(--accent-ink); }

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

code, kbd, pre { font-family: var(--mono); }

code {
    font-size: 0.86em;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--paper-2);
    border: 1px solid var(--rule);
}

kbd {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    font-size: 11px;
    line-height: 1;
    padding: 3px 5px;
    border: 1px solid var(--rule);
    border-bottom-width: 2px;
    border-radius: 4px;
    color: var(--ink-2);
    background: var(--paper);
}

.wrap {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -60px;
    z-index: 100;
    padding: 8px 14px;
    background: var(--ink);
    color: var(--paper);
    border-radius: 6px;
}
.skip-link:focus { top: 12px; }

em { font-style: italic; }

/* =============================================
   MASTHEAD
   ============================================= */
.masthead {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--mast-h);
    background: color-mix(in srgb, var(--paper) 86%, transparent);
    backdrop-filter: saturate(1.4) blur(12px);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}
.masthead.scrolled { border-bottom-color: var(--rule); }

/* reading progress along the bottom edge of the masthead, where the browser can drive it from scroll */
@supports (animation-timeline: scroll()) {
    .masthead::after {
        content: '';
        position: absolute;
        left: 0;
        right: 0;
        bottom: -1px;
        height: 2px;
        background: var(--accent);
        transform-origin: 0 50%;
        transform: scaleX(0);
        animation: read-progress linear both;
        animation-timeline: scroll(root block);
    }
}
@keyframes read-progress { to { transform: scaleX(1); } }

.masthead-inner {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 24px;
}

.wordmark {
    font-family: var(--serif);
    font-size: 24px;
    letter-spacing: -0.01em;
    margin-right: auto;
}

.masthead-nav { display: flex; gap: 26px; font-size: 14px; }
.masthead-nav a {
    color: var(--ink-2);
    position: relative;
    padding: 4px 0;
    transition: color 0.15s;
}
.masthead-nav a::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -2px;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}
.masthead-nav a:hover,
.masthead-nav a.active { color: var(--ink); }
.masthead-nav a:hover::after,
.masthead-nav a.active::after { transform: scaleX(1); }

.masthead-tools { display: flex; align-items: center; gap: 8px; }

.kbd-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 8px 0 12px;
    font-size: 13px;
    color: var(--ink-2);
    border: 1px solid var(--rule);
    border-radius: 999px;
    transition: border-color 0.15s, color 0.15s;
}
.kbd-btn:hover { color: var(--ink); border-color: var(--ink-3); }

.icon-btn {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    border: 1px solid var(--rule);
    border-radius: 50%;
    color: var(--ink-2);
    transition: border-color 0.15s, color 0.15s;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.icon-btn svg {
    width: 16px; height: 16px;
    fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round;
}
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .icon-sun { display: none; }
    :root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* =============================================
   HERO
   ============================================= */
.hero { padding: clamp(48px, 9vw, 112px) 0 clamp(56px, 8vw, 96px); }

.hero-meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-3);
    padding-bottom: 14px;
    border-bottom: 1px solid var(--ink);
}

.hero-title {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(52px, 9.4vw, 128px);
    line-height: 0.95;
    letter-spacing: -0.025em;
    margin: clamp(28px, 5vw, 56px) 0 clamp(32px, 5vw, 56px);
    max-width: 15ch;
    text-wrap: balance;
}
.hero-title em { color: var(--accent); }

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: clamp(28px, 6vw, 88px);
    align-items: end;
}

.hero-lede {
    font-size: clamp(17px, 1.6vw, 20px);
    line-height: 1.55;
    color: var(--ink-2);
    max-width: 58ch;
}

.status {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: var(--ink-2);
    margin-bottom: 18px;
}
.status-dot {
    flex: none;
    width: 8px; height: 8px;
    margin-top: 7px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent);
    animation: pulse 2.4s infinite;
}
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); }
    70%  { box-shadow: 0 0 0 8px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

.hero-links { display: flex; flex-wrap: wrap; gap: 10px; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 18px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 999px;
    transition: transform 0.15s, background 0.15s, color 0.15s, border-color 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-solid { background: var(--ink); color: var(--paper); }
.btn-solid:hover { background: var(--accent); color: var(--accent-ink); }
.btn-line { border: 1px solid var(--rule); }
.btn-line:hover { border-color: var(--ink); }

.figures {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: clamp(48px, 7vw, 88px);
    border-top: 1px solid var(--rule);
}
.figures > div {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 20px 20px 0 0;
}
.figures > div + div { padding-left: 20px; border-left: 1px solid var(--rule); }
.figures dd {
    order: -1;
    font-family: var(--serif);
    font-size: clamp(40px, 5vw, 64px);
    line-height: 1;
    letter-spacing: -0.02em;
}
.figures dt { font-size: 13px; color: var(--ink-3); line-height: 1.35; }

.sim { margin-top: clamp(40px, 6vw, 72px); }
.sim canvas {
    display: block;
    width: 100%;
    height: clamp(150px, 20vw, 260px);
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    cursor: crosshair;
}
.sim figcaption {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding-top: 10px;
    font-family: var(--mono);
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--ink-3);
}
.sim-readout { color: var(--accent); white-space: nowrap; }

/* =============================================
   TAPE
   ============================================= */
.tape {
    overflow: hidden;
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--ink);
    background: var(--paper-2);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.tape-track { display: flex; width: max-content; animation: tape 70s linear infinite; }
.tape:hover .tape-track, .tape:focus-within .tape-track { animation-play-state: paused; }
.tape ul { display: flex; flex: none; }
.tape li {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 13px 28px;
    font-family: var(--mono);
    font-size: 12.5px;
    white-space: nowrap;
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
}
.tape li::after { content: '◆'; margin-left: 46px; font-size: 7px; color: var(--accent); transform: translateY(-2px); }
.tape b {
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink);
}
@keyframes tape { to { transform: translateX(-50%); } }

.text-btn {
    flex: none;
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--ink-2);
    border-bottom: 1px solid var(--rule);
    transition: color 0.15s, border-color 0.15s;
}
.text-btn:hover { color: var(--accent); border-color: currentColor; }

/* =============================================
   SECTIONS
   ============================================= */
.section {
    padding: clamp(64px, 9vw, 120px) 0;
    border-top: 1px solid var(--rule);
}
.tape + .section { border-top: 0; }

.section-head {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 16px;
    margin-bottom: clamp(32px, 5vw, 56px);
}
.section-num {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    color: var(--accent);
}
.section-head h2 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(38px, 5.4vw, 68px);
    line-height: 1;
    letter-spacing: -0.02em;
}
.section-note { font-size: 14px; color: var(--ink-3); max-width: 30ch; text-align: right; }

.sub-head {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 16px;
}

.muted { color: var(--ink-2); }

/* =============================================
   WORK
   ============================================= */
.work-index {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.04em;
    color: var(--ink-3);
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.tags li {
    font-family: var(--mono);
    font-size: 11.5px;
    padding: 3px 9px;
    border: 1px solid var(--rule);
    border-radius: 999px;
    color: var(--ink-2);
}

.links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 18px;
    font-size: 14px;
}
.links a {
    color: var(--ink-2);
    border-bottom: 1px solid var(--rule);
    transition: color 0.15s, border-color 0.15s;
}
.links a:hover { color: var(--ink); border-color: var(--ink); }
.links a.link-primary { color: var(--accent); border-color: currentColor; }
.links a.link-primary:hover { color: var(--ink); border-color: var(--ink); }
.org { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }

.evidence {
    display: grid;
    gap: 8px;
    margin-top: 16px;
    padding-left: 14px;
    border-left: 1px solid var(--rule);
    font-size: 14.5px;
}
.evidence > div { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.evidence dt {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.evidence dd { color: var(--ink-2); max-width: 62ch; }
.evidence > div:first-child dt { color: var(--accent); }

.feature {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: clamp(28px, 5vw, 72px);
    align-items: center;
    padding-bottom: clamp(40px, 6vw, 72px);
}
.feature h3 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(34px, 4.4vw, 56px);
    line-height: 1.02;
    letter-spacing: -0.02em;
    margin: 12px 0 18px;
}
.feature p { color: var(--ink-2); font-size: 16.5px; max-width: 60ch; }
.feature .links { margin-top: 22px; }

.terminal {
    background: var(--term-bg);
    color: var(--term-fg);
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
    transform: perspective(900px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)) rotate(1.2deg);
    transition: transform 0.4s cubic-bezier(.2,.8,.2,1);
}
.feature:hover .terminal { transform: perspective(900px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)) translateY(-4px); transition-duration: 0.12s; }
/* soft highlight that follows the pointer across the glass */
.terminal::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(420px circle at var(--glare-x, 50%) var(--glare-y, 0%), rgba(255, 255, 255, 0.09), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
}
.feature:hover .terminal::after { opacity: 1; }
.terminal-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.terminal-bar span { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); }
.terminal-bar span:first-child { background: var(--accent); }
.terminal-bar b {
    margin-left: auto;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 400;
    opacity: 0.5;
}
.terminal pre {
    padding: 22px 22px 26px;
    font-size: clamp(12.5px, 1.25vw, 14.5px);
    line-height: 1.85;
    white-space: pre-wrap;
}
.t-dim { opacity: 0.45; }
.t-ok  { color: #6fd39a; }
.t-bad { color: #ff7a5c; }
.caret {
    display: inline-block;
    width: 0.55em; height: 1.1em;
    margin-left: 4px;
    vertical-align: -0.18em;
    background: currentColor;
    animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.work-list { border-top: 1px solid var(--rule); }
.work-row {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr) 220px;
    gap: 16px 24px;
    padding: 30px 0;
    border-bottom: 1px solid var(--rule);
    position: relative;
}
.work-row::before {
    content: '';
    position: absolute;
    left: 0; top: -1px;
    height: 1px; width: 100%;
    background: var(--ink);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.45s cubic-bezier(.2,.8,.2,1);
}
.work-row:hover::before { transform: scaleX(1); }
.work-row .work-index { padding-top: 8px; }
.work-row h3 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(26px, 2.8vw, 34px);
    line-height: 1.1;
    letter-spacing: -0.01em;
    margin-bottom: 10px;
}
.work-row p { color: var(--ink-2); max-width: 64ch; }
.work-row .links { align-self: start; padding-top: 10px; justify-content: flex-end; text-align: right; }

/* =============================================
   RESEARCH
   ============================================= */
.papers { border-top: 1px solid var(--rule); }
.paper {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 20px clamp(28px, 5vw, 72px);
    align-items: start;
    padding: 34px 0;
    border-bottom: 1px solid var(--rule);
}
.paper-kind {
    display: block;
    font-family: var(--mono);
    font-size: 11.5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin-bottom: 10px;
}
.paper h3 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(24px, 2.5vw, 31px);
    line-height: 1.14;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
    text-wrap: balance;
}
.paper p { color: var(--ink-2); max-width: 62ch; }
.paper p a { color: var(--accent); border-bottom: 1px solid currentColor; }
.paper p a:hover { color: var(--ink); }

.mini {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-top: 26px;
}
.mini th, .mini td { padding: 9px 0; border-bottom: 1px dashed var(--rule); vertical-align: baseline; }
.mini tr:first-child th, .mini tr:first-child td { border-top: 1px solid var(--ink); }
.mini th { text-align: left; font-weight: 400; color: var(--ink-2); padding-right: 16px; }
.mini td {
    text-align: right;
    font-family: var(--mono);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    color: var(--ink);
}

/* =============================================
   MARKETS
   ============================================= */
.quant-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-top: 1px solid var(--ink);
    border-left: 1px solid var(--rule);
}
.quant-card {
    display: flex;
    flex-direction: column;
    padding: 26px 24px 28px;
    border-right: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}
.quant-lead { grid-column: 1 / -1; }
.quant-wide { grid-column: span 2; }
.quant-card h3 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(24px, 2.4vw, 30px);
    line-height: 1.12;
    letter-spacing: -0.01em;
    margin-bottom: 10px;
}
.quant-lead h3 { font-size: clamp(32px, 4vw, 48px); }
.quant-card p { color: var(--ink-2); font-size: 15px; max-width: 78ch; }
.quant-card .links { margin-top: auto; padding-top: 16px; }
.quant-card .tags { margin-top: auto; padding-top: 16px; }

.method {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 32px;
    margin: 20px 0 4px;
    font-size: 14.5px;
}
.method li {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--rule);
    color: var(--ink-2);
}
.method b {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
    padding-top: 3px;
}
.formula { font-family: var(--serif); font-style: italic; font-size: 19px; line-height: 1.2; color: var(--ink); }
.formula sub { font-size: 0.62em; }

.caveat { margin-top: 14px; font-size: 14px !important; }
.caveat b {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--warn);
    margin-right: 4px;
}

/* =============================================
   EXPERIENCE
   ============================================= */
.ledger { border-top: 1px solid var(--rule); }
.ledger li {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 8px 24px;
    padding: 26px 0;
    border-bottom: 1px solid var(--rule);
}
.ledger-date {
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--ink-3);
    padding-top: 4px;
}
.ledger h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.ledger-org { font-size: 14px; color: var(--ink-3); margin: 2px 0 8px; }
.ledger p:not(.ledger-org) { color: var(--ink-2); max-width: 70ch; }

.split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(32px, 6vw, 80px);
    margin-top: clamp(48px, 7vw, 80px);
}
.plain-list li {
    display: flex;
    flex-direction: column;
    padding: 12px 0;
    border-bottom: 1px dashed var(--rule);
}
.plain-list b { font-weight: 500; }
.plain-list span { font-size: 14px; color: var(--ink-3); }

/* =============================================
   WRITING
   ============================================= */
.writing-list { border-top: 1px solid var(--rule); }
.writing-list a {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 16px;
    padding: 24px 0;
    border-bottom: 1px solid var(--rule);
    transition: padding 0.25s ease;
}
.writing-date { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); }
.writing-title {
    font-family: var(--serif);
    font-size: clamp(22px, 2.6vw, 32px);
    line-height: 1.15;
    letter-spacing: -0.01em;
}
.writing-arrow { font-size: 20px; color: var(--ink-3); transition: transform 0.25s, color 0.25s; }
.writing-list a:hover { padding-left: 10px; }
.writing-list a:hover .writing-title { color: var(--accent); }
.writing-list a:hover .writing-arrow { transform: translateX(6px); color: var(--accent); }

/* =============================================
   ABOUT
   ============================================= */
.about-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: clamp(32px, 6vw, 88px);
}
.about-copy p { color: var(--ink-2); font-size: 17px; max-width: 60ch; }
.about-copy p + p { margin-top: 16px; }
.about-copy .pull {
    font-family: var(--serif);
    font-size: clamp(30px, 3.6vw, 44px);
    line-height: 1.12;
    letter-spacing: -0.015em;
    color: var(--ink);
    margin-bottom: 28px;
    text-wrap: balance;
}

.now-head { margin-top: 36px; }
.now-list li {
    position: relative;
    padding: 9px 0 9px 22px;
    border-bottom: 1px dashed var(--rule);
    color: var(--ink-2);
    font-size: 15px;
}
.now-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    font-family: var(--mono);
    font-size: 12px;
    top: 12px;
    color: var(--accent);
}

.fact-block + .fact-block { margin-top: 32px; }
.fact-block p { font-size: 15px; color: var(--ink-2); }
.fact-block p + p { margin-top: 10px; }
.fact-block b { color: var(--ink); font-weight: 500; }

.toolkit {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 8px 16px;
    font-size: 15px;
}
.toolkit dt { color: var(--ink-3); font-size: 13px; padding-top: 2px; }
.toolkit dd { color: var(--ink-2); }
.toolkit-note { margin-top: 12px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }

/* =============================================
   POSTS
   ============================================= */
.post { padding: clamp(36px, 6vw, 72px) 0 clamp(64px, 9vw, 120px); }
.post-wrap { max-width: 760px; margin: 0 auto; padding: 0 var(--gutter); }

.back-link {
    display: inline-flex;
    gap: 8px;
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--ink-3);
    margin-bottom: clamp(28px, 5vw, 48px);
    transition: color 0.15s;
}
.back-link:hover { color: var(--accent); }

.article-header { padding-bottom: 28px; margin-bottom: 36px; border-bottom: 1px solid var(--ink); }
.article-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.article-tag {
    font-family: var(--mono);
    font-size: 11.5px;
    padding: 3px 9px;
    border: 1px solid var(--rule);
    border-radius: 999px;
    color: var(--ink-2);
}
.article-title {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(36px, 5.6vw, 60px);
    line-height: 1.04;
    letter-spacing: -0.02em;
    text-wrap: balance;
}
.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 0;
    margin-top: 20px;
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--ink-3);
}
.article-meta span + span::before { content: '·'; margin: 0 10px; }
.article-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.article-links .btn { height: 36px; padding: 0 15px; font-size: 13.5px; }

.article-body { font-size: 17px; line-height: 1.72; color: var(--ink-2); }
.article-body > * + * { margin-top: 1.15em; }
.article-body strong { color: var(--ink); font-weight: 600; }
.article-body h2 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(28px, 3.4vw, 38px);
    line-height: 1.12;
    letter-spacing: -0.015em;
    color: var(--ink);
    margin-top: 0.4em;
    text-wrap: balance;
}
.article-body h3 { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); margin-top: 1.9em; }
.article-body h4 { font-size: 16px; font-weight: 600; color: var(--ink); }
.article-body ul, .article-body ol { padding-left: 1.3em; }
.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }
.article-body li + li { margin-top: 0.4em; }
.article-body li::marker { color: var(--ink-3); }
.article-body a { color: var(--ink); border-bottom: 1px solid var(--accent); transition: color 0.15s; }
.article-body a:hover { color: var(--accent); }
.article-body hr { border: 0; border-top: 1px solid var(--rule); margin: 2.6em 0 2.2em; }
.article-body blockquote {
    padding-left: 20px;
    border-left: 2px solid var(--accent);
    font-family: var(--serif);
    font-size: 22px;
    line-height: 1.35;
    color: var(--ink);
}

.article-body pre {
    padding: 18px 20px;
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--term-fg);
    background: var(--term-bg);
    border-radius: 10px;
    overflow-x: auto;
}
.article-body pre code { padding: 0; font-size: inherit; background: none; border: 0; color: inherit; }
.article-body pre.term { white-space: pre; }
.article-body pre .comment { opacity: 0.5; }
.article-body pre .cmd { color: #6fd39a; }
.article-body pre .err { color: #ff7a5c; }
.article-body pre .warn { color: #e8b84e; }

.callout {
    padding: 16px 20px;
    border: 1px solid var(--rule);
    border-left: 2px solid var(--ink);
    background: var(--paper-2);
    color: var(--ink);
    border-radius: 2px 8px 8px 2px;
}
.callout.warning { border-left-color: var(--warn); }

.article-body table { width: 100%; border-collapse: collapse; font-size: 15px; }
.article-body th {
    text-align: left;
    padding: 10px 12px 10px 0;
    font-family: var(--mono);
    font-size: 11.5px;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-3);
    border-bottom: 1px solid var(--ink);
}
.article-body td {
    padding: 10px 12px 10px 0;
    border-bottom: 1px dashed var(--rule);
    font-variant-numeric: tabular-nums;
}
.article-body tr.best td { color: var(--ink); }
.best-val { color: var(--ok) !important; font-weight: 600; }
.worst-val { color: var(--accent) !important; }

.grade-badge {
    display: inline-grid;
    place-items: center;
    width: 26px; height: 26px;
    font-family: var(--mono);
    font-size: 13px;
    border: 1px solid currentColor;
    border-radius: 6px;
}
.grade-a, .grade-b { color: var(--ok); }
.grade-c { color: var(--ink-2); }
.grade-d, .grade-f { color: var(--accent); }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--rule);
}
.stat-card { padding: 16px 12px 16px 0; }
.stat-card + .stat-card { padding-left: 16px; border-left: 1px solid var(--rule); }
.stat-num { font-family: var(--serif); font-size: 38px; line-height: 1; color: var(--ink); }
.stat-label { margin-top: 6px; font-size: 13px; line-height: 1.35; color: var(--ink-3); }

.try-it-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.article-body a.try-it-link {
    padding: 12px 14px;
    font-size: 14.5px;
    border: 1px solid var(--rule);
    border-radius: 8px;
    transition: border-color 0.15s, color 0.15s;
}
.article-body a.try-it-link:hover { border-color: var(--accent); }

.figure-block img {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--rule);
    border-radius: 8px;
    background: #fff;
}
.figure-caption { margin-top: 10px; font-size: 13.5px; line-height: 1.5; color: var(--ink-3); }
.figure-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

.model-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-top: 1.9em; }
.model-heading h3 { margin-top: 0; }
.accuracy-badge { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.acc-high { color: var(--ok); }
.acc-low { color: var(--accent); }

.pdf-wrapper { margin-top: 18px; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.pdf-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 16px;
    padding: 10px 14px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--ink-3);
    background: var(--paper-2);
    border-bottom: 1px solid var(--rule);
}
.pdf-frame { display: block; width: 100%; height: min(80vh, 900px); border: 0; background: #fff; }

.command-section { padding-top: 1.15em; border-top: 1px dashed var(--rule); }
.command-section > * + * { margin-top: 0.6em; }
.command-section > code {
    display: block;
    padding: 10px 14px;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--term-fg);
    background: var(--term-bg);
    border: 0;
    border-radius: 8px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.post-foot { border-top: 1px solid var(--rule); padding: 22px 0 28px; font-size: 13px; color: var(--ink-3); }
.post-foot-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; }
.post-foot-links { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.post-foot a { color: var(--ink-2); border-bottom: 1px solid var(--rule); }
.post-foot a:hover { color: var(--accent); border-color: currentColor; }

/* =============================================
   CONTACT / FOOTER
   ============================================= */
.contact {
    background: var(--ink);
    color: var(--paper);
    padding: clamp(72px, 11vw, 140px) 0 32px;
}
.contact .section-num { color: var(--accent); }
.contact-title {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(48px, 8.4vw, 116px);
    line-height: 0.98;
    letter-spacing: -0.025em;
    margin: 18px 0 20px;
    max-width: 12ch;
    text-wrap: balance;
}
.contact-title em { color: var(--accent); }
.contact-note { font-size: 17px; opacity: 0.7; max-width: 48ch; }

.contact-links {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 14px 28px;
    margin-top: 40px;
    font-size: 15px;
}
.contact-links a {
    border-bottom: 1px solid color-mix(in srgb, var(--paper) 30%, transparent);
    transition: border-color 0.15s, color 0.15s;
    overflow-wrap: anywhere;
}
.contact-links a:hover { border-color: var(--accent); color: var(--accent); }
.contact-email { font-family: var(--serif); font-size: clamp(24px, 3vw, 34px); }

.colophon {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: clamp(64px, 9vw, 110px);
    padding-top: 20px;
    border-top: 1px solid color-mix(in srgb, var(--paper) 18%, transparent);
    font-size: 13px;
    opacity: 0.6;
}
.colophon a { border-bottom: 1px solid currentColor; }
.contact kbd { background: transparent; color: inherit; border-color: color-mix(in srgb, var(--paper) 30%, transparent); }

/* =============================================
   COMMAND PALETTE
   ============================================= */
.palette { position: fixed; inset: 0; z-index: 90; }
.palette[hidden] { display: none; }
.palette-backdrop {
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--ink) 35%, transparent);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: fade 0.15s ease;
}
.palette-panel {
    position: relative;
    width: min(620px, calc(100% - 32px));
    margin: min(14vh, 120px) auto 0;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
    animation: rise 0.18s cubic-bezier(.2,.8,.2,1);
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(0.985); } }

.palette-input {
    width: 100%;
    padding: 18px 20px;
    font: inherit;
    font-size: 17px;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--rule);
    outline: none;
}
.palette-input::placeholder { color: var(--ink-3); }

.palette-list { max-height: min(56vh, 420px); overflow-y: auto; padding: 6px; }
.palette-group {
    padding: 12px 12px 6px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.palette-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
}
.palette-item small { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.palette-item[aria-selected="true"] { background: var(--paper-2); }
.palette-item[aria-selected="true"]::before {
    content: '';
    width: 3px;
    align-self: stretch;
    margin: -2px 0 -2px -6px;
    border-radius: 2px;
    background: var(--accent);
}
.palette-empty { padding: 24px 14px; color: var(--ink-3); font-size: 14px; }
.palette-foot {
    display: flex;
    gap: 16px;
    padding: 10px 16px;
    border-top: 1px solid var(--rule);
    font-size: 12px;
    color: var(--ink-3);
}
.palette-foot span { display: inline-flex; align-items: center; gap: 4px; }

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 95;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--paper);
    background: var(--ink);
    border-radius: 999px;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translate(-50%, 12px);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* =============================================
   REVEAL
   ============================================= */
/* hero comes in as a short sequence on load */
@keyframes hero-in { from { opacity: 0; transform: translateY(18px); } }
@keyframes title-in { from { opacity: 0; transform: translateY(0.18em); filter: blur(10px); letter-spacing: -0.05em; } }
.js .hero-meta   { animation: hero-in 0.7s cubic-bezier(.2,.8,.2,1) both; }
.js .hero-title  { animation: title-in 1.1s cubic-bezier(.2,.8,.2,1) 0.08s both; }
.js .hero-grid   { animation: hero-in 0.8s cubic-bezier(.2,.8,.2,1) 0.35s both; }
.js .figures     { animation: hero-in 0.8s cubic-bezier(.2,.8,.2,1) 0.5s both; }
.js .sim         { animation: hero-in 0.8s cubic-bezier(.2,.8,.2,1) 0.65s both; }
.figures dd { font-variant-numeric: tabular-nums; }

/* theme switch: the new colours wipe out from the toggle, driven from main.js */
.theme-switch::view-transition-old(root),
.theme-switch::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
.theme-switch::view-transition-new(root) { z-index: 1; }

.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(.2,.8,.2,1); }
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .js .reveal { opacity: 1; transform: none; }
    .terminal { transform: none; }
    .tape { -webkit-mask-image: none; mask-image: none; }
    .tape-track { width: auto; }
    .tape ul { flex-wrap: wrap; }
    .tape ul[aria-hidden] { display: none; }
    .eq i { transform: scaleY(0.6); }
}

/* cross-page fade between the home page and posts */
@view-transition { navigation: auto; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 960px) {
    .masthead-nav { display: none; }
    .hero-grid, .feature, .about-grid, .paper { grid-template-columns: minmax(0, 1fr); }
    .mini { margin-top: 0; }
    .quant-grid { grid-template-columns: minmax(0, 1fr); }
    .quant-wide { grid-column: auto; }
    .method { grid-template-columns: minmax(0, 1fr); }
    .terminal { transform: none; max-width: 520px; }
    .work-row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .work-row .work-index { padding-top: 0; }
    .work-row .links { justify-content: flex-start; text-align: left; padding-top: 4px; }
    .section-head { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .section-note { text-align: left; }
    .ledger li { grid-template-columns: minmax(0, 1fr); }
    .ledger-date { padding-top: 0; }
}

@media (max-width: 640px) {
    :root { --gutter: 16px; }
    .kbd-hint { display: none; }
    .kbd-btn { padding: 0 14px; }
    .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .figures > div { padding: 18px 12px 18px 0; }
    .figures > div + div { padding-left: 0; border-left: 0; }
    .figures > div:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--rule); }
    .figures > div:nth-child(n+3) { border-top: 1px solid var(--rule); }
    .split { grid-template-columns: minmax(0, 1fr); }
    .writing-list a { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
    .writing-date { grid-column: 1 / -1; }
    .hero-meta span:last-child { display: none; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-card:nth-child(3) { padding-left: 0; border-left: 0; }
    .stat-card:nth-child(n+3) { border-top: 1px solid var(--rule); }
    .try-it-grid, .figure-row { grid-template-columns: minmax(0, 1fr); }
    .article-body { font-size: 16px; }
    .sim figcaption { flex-direction: column; gap: 6px; }
    .evidence > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .method li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .quant-card { padding: 22px 16px 24px; }
}

/* =============================================
   404
   ============================================= */
.lost { min-height: 100vh; display: grid; align-items: center; padding: 64px 0; }
.lost .contact-title { max-width: 14ch; }
.lost .contact-note { color: var(--ink-2); opacity: 1; margin-bottom: 32px; }

/* =============================================
   NOW
   ============================================= */
.desk { border-top: 1px solid var(--ink); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(28px, 5vw, 72px); }
.desk li {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr) auto;
    gap: 16px;
    align-items: start;
    padding: 20px 0 22px;
    border-bottom: 1px solid var(--rule);
}
.desk-kind {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-top: 5px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.live { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulse 2.4s infinite; }
.desk li:nth-child(odd) .live { animation-delay: 0.8s; }
.desk h3 { font-family: var(--serif); font-weight: 400; font-size: clamp(21px, 2vw, 25px); line-height: 1.15; letter-spacing: -0.01em; }
.desk p { margin-top: 6px; font-size: 14.5px; color: var(--ink-2); max-width: 52ch; }
.desk-link { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); padding-top: 6px; white-space: nowrap; transition: color 0.15s; }
.desk-link:hover { color: var(--accent); }

/* photos and poster under a research entry */
.paper-media { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 190px)); gap: 12px; align-items: start; }
.paper-media figure { border: 1px solid var(--rule); background: var(--paper-2); }
.paper-media figure img { display: block; width: 100%; height: 132px; object-fit: cover; object-position: 50% 22%; filter: saturate(0.92); transition: filter 0.3s; }
.paper-media figure:hover img { filter: none; }
.paper-media figcaption { padding: 6px 9px; font-family: var(--mono); font-size: 10.5px; line-height: 1.35; color: var(--ink-3); border-top: 1px solid var(--rule); }
.paper-media .poster-thumb { margin-top: 0; max-width: none; }
.paper-media .poster-thumb img { height: 132px; object-fit: cover; object-position: 50% 0; }
.paper-media .poster-thumb span { padding: 6px 9px; font-size: 10.5px; }
@media (max-width: 640px) { .paper-media { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } .paper-media figure img, .paper-media .poster-thumb img { height: 96px; } }
/* small photo pair inside an article */
.photo-pair { max-width: 460px; }
.photo-pair img { height: 190px; object-fit: cover; object-position: 50% 22%; }

/* poster thumbnail in the research list */
.paper-more { margin-top: 14px; font-size: 14px; }
.poster-thumb { display: inline-block; margin-top: 18px; max-width: 340px; border: 1px solid var(--rule); background: #fff; transition: border-color 0.15s, transform 0.25s cubic-bezier(.2,.8,.2,1); }
.poster-thumb:hover { border-color: var(--ink); transform: translateY(-3px) rotate(-0.4deg); }
.poster-thumb img { display: block; width: 100%; height: auto; }
.poster-thumb span { display: block; padding: 8px 12px; font-family: var(--mono); font-size: 11.5px; color: #4a463e; border-top: 1px solid #d6cfbf; }

/* off the clock */
.offclock { margin-top: 12px !important; }
.rotation { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.rotation a {
    display: inline-block;
    padding: 5px 13px;
    border: 1px solid var(--rule);
    border-radius: 999px;
    font-family: var(--serif);
    font-style: italic;
    font-size: 18px;
    line-height: 1.3;
    transition: color 0.15s, border-color 0.15s, transform 0.2s;
}
.rotation a:hover { color: var(--accent); border-color: currentColor; transform: rotate(-2deg); }
.spotify { margin-top: 16px !important; font-size: 14.5px !important; }
.lick { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; margin-top: 22px; }
.lick .btn { gap: 10px; }
.lick-note { flex: 1 1 220px; font-family: var(--mono); font-size: 11.5px; line-height: 1.5; color: var(--ink-3); }
.lick .eq i { animation-play-state: paused; }
.lick .playing .eq i { animation-play-state: running; }
.lick .playing { border-color: var(--accent); color: var(--accent); }

/* work rows answer the pointer */
.work-row { transition: background-color 0.25s; }
.work-row .work-index { transition: color 0.2s, transform 0.3s cubic-bezier(.2,.8,.2,1); }
@media (hover: hover) {
    .work-row:hover { background: color-mix(in srgb, var(--paper-2) 60%, transparent); }
    .work-row:hover .work-index { color: var(--accent); transform: translateX(6px); }
    .desk li:hover h3 { color: var(--accent); }
}
.desk h3 { transition: color 0.2s; }

/* =============================================
   DOCK (phones)
   ============================================= */
.dock { display: none; }
@media (max-width: 760px) {
    .dock {
        position: fixed;
        left: 50%;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        z-index: 60;
        display: flex;
        gap: 2px;
        max-width: calc(100vw - 24px);
        padding: 5px;
        overflow-x: auto;
        scrollbar-width: none;
        transform: translateX(-50%);
        border: 1px solid var(--rule);
        border-radius: 999px;
        background: color-mix(in srgb, var(--paper) 82%, transparent);
        backdrop-filter: saturate(1.4) blur(14px);
        -webkit-backdrop-filter: saturate(1.4) blur(14px);
        box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.45);
    }
    .dock::-webkit-scrollbar { display: none; }
    .dock a {
        flex: none;
        padding: 9px 13px;
        border-radius: 999px;
        font-size: 13px;
        line-height: 1;
        color: var(--ink-2);
        transition: background-color 0.2s, color 0.2s;
    }
    .dock a.active { background: var(--ink); color: var(--paper); }
    /* room for the dock under the last line of the footer */
    .contact { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
    .toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}

.offclock-note { display: flex; gap: 12px; align-items: baseline; margin-top: 20px !important; font-size: 14.5px !important; color: var(--ink-3) !important; }
.eq { flex: none; display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.eq i { width: 3px; height: 100%; background: var(--accent); transform-origin: 50% 100%; animation: eq 1.1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -0.35s; }
.eq i:nth-child(3) { animation-delay: -0.7s; }
.eq i:nth-child(4) { animation-delay: -0.15s; }
@keyframes eq { 0%, 100% { transform: scaleY(0.25); } 50% { transform: scaleY(1); } }

@media (max-width: 960px) { .desk { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
    .desk li { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
    .desk-kind { grid-column: 1 / -1; padding-top: 0; }
}

/* =============================================
   LAB
   ============================================= */
.lab { padding: clamp(36px, 6vw, 72px) 0 clamp(64px, 9vw, 120px); }
.lab > .wrap { max-width: 1020px; }

.lab-head { padding-bottom: clamp(28px, 4vw, 44px); border-bottom: 1px solid var(--ink); }
.lab-head h1 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(44px, 7vw, 84px);
    line-height: 1;
    letter-spacing: -0.02em;
    margin: 10px 0 18px;
}
.lab-head p { max-width: 62ch; color: var(--ink-2); font-size: 17px; }

.lab-fig { padding: clamp(40px, 6vw, 72px) 0; border-bottom: 1px solid var(--rule); }
.lab-fig-head { margin-bottom: 28px; }
.lab-fig-head h2 {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(30px, 4vw, 46px);
    line-height: 1.08;
    letter-spacing: -0.01em;
    margin: 8px 0 10px;
}
.lab-fig-head p { max-width: 64ch; color: var(--ink-2); }

.lab-panel {
    border: 1px solid var(--rule);
    border-top-color: var(--ink);
    padding: clamp(16px, 3vw, 28px);
    background: color-mix(in srgb, var(--paper-2) 45%, transparent);
}

/* risk rows */
.risk-legend {
    display: flex;
    gap: 20px;
    justify-content: flex-end;
    margin-bottom: 14px;
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--ink-3);
}
.swatch { display: inline-block; width: 10px; height: 10px; margin-right: 7px; vertical-align: -1px; }
.swatch-capital { background: var(--ink-3); }
.swatch-risk { background: var(--accent); }

.risk-row {
    display: grid;
    grid-template-columns: 132px minmax(110px, 0.8fr) minmax(0, 1.4fr);
    gap: 20px;
    align-items: center;
    padding: 12px 0;
    border-top: 1px dashed var(--rule);
}
.risk-name { font-size: 15px; line-height: 1.25; }
.risk-name small {
    display: block;
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--ink-3);
    margin-top: 2px;
}
.risk-bars { display: grid; gap: 5px; }
.risk-bar { display: grid; grid-template-columns: minmax(0, 1fr) 54px; gap: 10px; align-items: center; }
.risk-bar .bar {
    display: block;
    height: 9px;
    min-width: 1px;
    transition: width 0.25s ease;
}
.bar-capital { background: var(--ink-3); }
.bar-risk { background: var(--accent); }
.risk-bar output {
    font-family: var(--mono);
    font-size: 12px;
    text-align: right;
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
}
.risk-row.is-hedge .risk-bar:last-child output { color: var(--ok); }

.lab input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 24px;
    background: transparent;
    cursor: pointer;
}
.lab input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--ink-3); }
.lab input[type="range"]::-moz-range-track { height: 2px; background: var(--ink-3); }
.lab input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    margin-top: -6px;
    border-radius: 50%;
    background: var(--paper);
    border: 2px solid var(--ink);
}
.lab input[type="range"]::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--paper);
    border: 2px solid var(--ink);
}
.lab input[type="range"]:hover::-webkit-slider-thumb { border-color: var(--accent); }
.lab input[type="range"]:hover::-moz-range-thumb { border-color: var(--accent); }

.lab-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    align-items: baseline;
    padding-top: 16px;
    border-top: 1px dashed var(--rule);
}
.lab-actions .text-btn { font-size: 12.5px; }
.lab-actions-label {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
}

/* readouts under each figure */
.lab-stats { display: flex; flex-wrap: wrap; gap: 20px 48px; margin-top: 24px; }
.lab-stats div { display: flex; flex-direction: column; }
.lab-stats dd {
    order: -1;
    font-family: var(--mono);
    font-size: clamp(22px, 2.6vw, 30px);
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.lab-stats dd small { font-size: 13px; letter-spacing: 0; color: var(--ink-3); }
.lab-stats dt { font-size: 13px; color: var(--ink-3); }
.lab-reading { margin-top: 16px; max-width: 70ch; color: var(--ink-2); min-height: 3.2em; }

.lab-notes {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 32px 48px;
    margin-top: 28px;
    align-items: start;
}
.lab-notes h3 {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.lab-notes .method { grid-template-columns: minmax(0, 1fr); margin-top: 8px; }
.lab-notes .method li { grid-template-columns: 148px minmax(0, 1fr); }
.lab-notes .caveat { color: var(--ink-2); max-width: 70ch; }
.lab-try { margin-top: 8px; font-size: 14.5px; color: var(--ink-2); }
.lab-try li { padding: 9px 0; border-bottom: 1px dashed var(--rule); }

.lab-inputs summary {
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--ink-2);
    cursor: pointer;
}
.lab-inputs summary:hover { color: var(--accent); }
.lab-inputs p { margin-top: 12px; font-size: 13.5px; color: var(--ink-3); }
.corr {
    width: 100%;
    margin-top: 14px;
    border-collapse: collapse;
    font-family: var(--mono);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.corr th, .corr td { padding: 6px 4px; border-bottom: 1px dashed var(--rule); text-align: right; font-weight: 400; }
.corr th { color: var(--ink-3); }
.corr th[scope="row"] { text-align: left; white-space: nowrap; }

/* option pricer */
.opt { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px 36px; align-items: start; }
.opt-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
.opt-form label, .opt-toggle legend {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.opt-form input[type="number"], .opt-form select {
    display: block;
    width: 100%;
    height: 38px;
    margin-top: 5px;
    padding: 0 10px;
    font-family: var(--mono);
    font-size: 14px;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 0;
}
.opt-form input[type="number"]:hover, .opt-form select:hover { border-color: var(--ink-3); }
.opt-toggle { border: 0; grid-column: 1 / -1; display: flex; gap: 18px; align-items: center; }
.opt-toggle legend { float: left; margin-right: 18px; }
.opt-form .opt-toggle label, .opt-form .opt-check {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: var(--sans);
    font-size: 14px;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink-2);
    cursor: pointer;
}
.opt-check { grid-column: 1 / -1; }
.opt-form input[type="radio"], .opt-form input[type="checkbox"] { accent-color: var(--accent); }

.plane-figure canvas { display: block; width: 100%; height: clamp(260px, 38vw, 420px); }
.plane-figure figcaption {
    padding-top: 10px;
    font-family: var(--mono);
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--ink-3);
}

.opt-figure canvas { display: block; width: 100%; height: clamp(220px, 28vw, 300px); }
.opt-figure figcaption {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding-top: 10px;
    font-family: var(--mono);
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--ink-3);
}
.opt-figure figcaption b { font-weight: 500; color: var(--ink-2); }

.lab-source { margin-top: 32px; max-width: 76ch; font-size: 14.5px; color: var(--ink-2); }
.lab-source a, .lab-link { border-bottom: 1px solid var(--rule); transition: color 0.15s, border-color 0.15s; }
.lab-source a:hover, .lab-link:hover { color: var(--accent); border-color: currentColor; }

@media (max-width: 860px) {
    .opt { grid-template-columns: minmax(0, 1fr); }
    .opt-form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lab-notes { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
    .risk-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 4px 16px; }
    .risk-bars { grid-column: 1 / -1; }
    .risk-legend { justify-content: flex-start; }
    .opt-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .opt-figure figcaption { flex-direction: column; gap: 6px; }
    .lab-notes .method li { grid-template-columns: minmax(0, 1fr); }
    .lab-stats { gap: 16px 28px; }
}
