:root {
    --ink-950: #071012;
    --ink-900: #0b1719;
    --ink-850: #102023;
    --paper: #f2efe4;
    --paper-dim: #aab8b5;
    --paper-muted: #71827f;
    --tail: #44e0ad;
    --tail-bright: #76f4c9;
    --tail-dim: rgba(68, 224, 173, .12);
    --loss: #ff6b4a;
    --loss-dim: rgba(255, 107, 74, .12);
    --amber: #efba5b;
    --bg: var(--ink-950);
    --bg-alt: var(--ink-900);
    --surface: rgba(255, 255, 255, .025);
    --surface-strong: #102023;
    --heading: var(--paper);
    --body: var(--paper-dim);
    --muted: var(--paper-muted);
    --line: rgba(226, 239, 234, .12);
    --line-strong: rgba(226, 239, 234, .22);
    --nav-bg: rgba(7, 16, 18, .88);
    --grid-line: rgba(226, 239, 234, .045);
    --shadow: 0 24px 70px rgba(0, 0, 0, .24);
    --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    --container: 1160px;
    --measure: 760px;
    --nav-height: 72px;
    --ease-out: cubic-bezier(.16, 1, .3, 1);
    color-scheme: dark;
}

[data-theme="light"] {
    --bg: #f7f4eb;
    --bg-alt: #eeeae0;
    --surface: rgba(8, 27, 29, .025);
    --surface-strong: #e7e5da;
    --heading: #102325;
    --body: #425b5b;
    --muted: #758582;
    --line: rgba(10, 35, 37, .13);
    --line-strong: rgba(10, 35, 37, .24);
    --nav-bg: rgba(247, 244, 235, .9);
    --grid-line: rgba(10, 35, 37, .055);
    --tail: #087f60;
    --tail-bright: #05694f;
    --tail-dim: rgba(8, 127, 96, .10);
    --loss: #c7462d;
    --loss-dim: rgba(199, 70, 45, .10);
    --amber: #93620d;
    --shadow: 0 24px 70px rgba(29, 42, 39, .10);
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-height) + 20px); }
body {
    position: relative;
    isolation: isolate;
    min-width: 320px;
    overflow-x: clip;
    background-color: var(--bg);
    color: var(--body);
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.72;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background-color .25s ease, color .25s ease;
}
body::before {
    content: "";
    position: fixed;
    z-index: -2;
    inset: -52px;
    pointer-events: none;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 48px 48px;
    will-change: transform;
    animation: grid-drift 32s linear infinite;
}
body::after {
    content: "";
    position: fixed;
    z-index: -1;
    inset: -12%;
    pointer-events: none;
    opacity: .42;
    background:
        radial-gradient(ellipse 40% 34% at 82% 12%, var(--tail-dim), transparent 72%),
        radial-gradient(ellipse 32% 28% at 8% 78%, var(--loss-dim), transparent 76%);
    will-change: transform, opacity;
    animation: ambient-breathe 16s ease-in-out infinite alternate;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
:focus-visible { outline: 2px solid var(--tail); outline-offset: 3px; }
::selection { background: var(--tail); color: var(--ink-950); }

h1, h2, h3, h4 {
    color: var(--heading);
    font-family: var(--font-display);
    font-weight: 500;
    line-height: 1.08;
    text-wrap: balance;
}
p { text-wrap: pretty; }
.container { width: min(100% - 48px, var(--container)); margin-inline: auto; }
.narrow { width: min(100% - 48px, var(--measure)); margin-inline: auto; }
.mono { font-family: var(--font-mono); }
.tail { color: var(--tail-bright); }
.loss { color: var(--loss); }
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    color: var(--tail);
    font-family: var(--font-mono);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 28px; height: 1px; background: currentColor; }
.section { padding: 108px 0; }
.section.alt { background: var(--bg-alt); border-block: 1px solid var(--line); }
.section-head { max-width: 760px; margin-bottom: 52px; }
.section-head h2 { font-size: clamp(2rem, 4vw, 3.2rem); letter-spacing: -.025em; }
.section-head p { margin-top: 20px; max-width: 670px; font-size: 1.08rem; }
.kicker { color: var(--heading); font-family: var(--font-mono); font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; }

/* Navigation */
.site-nav {
    position: fixed;
    inset: 0 0 auto;
    z-index: 100;
    height: var(--nav-height);
    border-bottom: 1px solid var(--line);
    background: var(--nav-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: background-color .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.site-nav.is-scrolled { box-shadow: 0 12px 36px rgba(0, 0, 0, .16); border-bottom-color: var(--line-strong); }
.nav-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--heading); font-family: var(--font-display); font-size: 1.12rem; white-space: nowrap; }
.brand-mark { position: relative; width: 34px; height: 18px; border-bottom: 1px solid var(--line-strong); }
.brand-mark::before { content: ""; position: absolute; left: 2px; right: 3px; bottom: 5px; height: 1px; background: var(--body); transform: rotate(-6deg); transform-origin: right; }
.brand-mark::after { content: ""; position: absolute; right: 1px; bottom: 5px; width: 13px; height: 2px; background: var(--tail); transform: rotate(-30deg); transform-origin: right; box-shadow: 4px -3px 0 -1px var(--tail); }
.brand:hover .brand-mark::after { animation: tail-tick .55s var(--ease-out); }
.brand .dotcom { color: var(--tail); }
.nav-list { display: flex; align-items: center; gap: 28px; list-style: none; padding: 0; }
.nav-list a { position: relative; color: var(--body); font-size: .88rem; font-weight: 600; }
.nav-list a:hover, .nav-list a[aria-current="page"] { color: var(--heading); }
.nav-list a:not(.nav-cta)::after { content: ""; position: absolute; left: 0; right: 0; bottom: -7px; height: 1px; background: var(--tail); transform: scaleX(0); transform-origin: right; transition: transform .3s var(--ease-out); }
.nav-list a:not(.nav-cta):hover::after, .nav-list a[aria-current="page"]::after { transform: scaleX(1); transform-origin: left; }
.theme-toggle { min-width: 66px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; font-family: var(--font-mono); font-size: .64rem; letter-spacing: .07em; }
.theme-toggle:hover { border-color: var(--tail); color: var(--tail); }
.nav-cta { padding: 9px 15px; border: 1px solid var(--tail) !important; border-radius: 3px; color: var(--tail-bright) !important; font-family: var(--font-mono); font-size: .72rem !important; letter-spacing: .04em; text-transform: uppercase; }

/* Hero */
.hero { position: relative; overflow: hidden; padding: calc(var(--nav-height) + 84px) 0 94px; }
.hero::before {
    content: "";
    position: absolute;
    width: 760px;
    height: 760px;
    top: -420px;
    right: -260px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--tail-dim), transparent 68%);
    pointer-events: none;
}
.hero-grid { position: relative; z-index: 2; display: grid; grid-template-columns: 1.04fr .96fr; gap: 68px; align-items: center; }
.hero-grid > *, .equation-panel > *, .worked-example > *, .calculator > *, .article-layout > * { min-width: 0; }
.hero h1 { max-width: 760px; font-size: clamp(3rem, 6.1vw, 5.4rem); letter-spacing: -.045em; }
.hero h1 em { color: var(--tail-bright); font-style: italic; }
.hero .lede { max-width: 650px; margin-top: 26px; font-size: clamp(1.05rem, 1.6vw, 1.2rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 11px 20px; border: 1px solid transparent; border-radius: 3px; overflow: hidden; font-family: var(--font-mono); font-size: .76rem; font-weight: 700; letter-spacing: .055em; line-height: 1.2; text-transform: uppercase; transition: transform .18s, background .18s, border-color .18s; }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--tail); color: var(--ink-950); }
.btn-primary:hover { background: var(--tail-bright); }
.btn-primary::after { content: ""; position: absolute; inset: -40% auto -40% -45%; width: 30%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .42), transparent); transform: skewX(-16deg); transition: left .55s var(--ease-out); }
.btn-primary:hover::after { left: 118%; }
.btn-ghost { border-color: var(--line-strong); color: var(--heading); background: var(--surface); }
.btn-ghost:hover { border-color: var(--tail); color: var(--tail-bright); }
.distribution-card { --tilt-x: 0deg; --tilt-y: 0deg; --pointer-x: 75%; --pointer-y: 20%; position: relative; border: 1px solid var(--line-strong); border-radius: 6px; background: linear-gradient(145deg, var(--surface), transparent), var(--bg-alt); box-shadow: var(--shadow); overflow: hidden; transform: perspective(1100px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)); transform-style: preserve-3d; transition: transform .35s var(--ease-out), border-color .25s ease, box-shadow .25s ease; will-change: transform; }
.distribution-card::before { content: ""; position: absolute; z-index: 2; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(280px circle at var(--pointer-x) var(--pointer-y), var(--tail-dim), transparent 72%); transition: opacity .3s ease; }
.distribution-card:hover { border-color: rgba(68, 224, 173, .36); box-shadow: 0 28px 80px rgba(0, 0, 0, .3); }
.distribution-card:hover::before { opacity: 1; }
.chart-head { display: flex; justify-content: space-between; gap: 20px; padding: 16px 18px; border-bottom: 1px solid var(--line); font-family: var(--font-mono); font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; }
.chart-head strong { color: var(--heading); font-weight: 600; }
.chart-head span { color: var(--muted); }
.distribution-card svg { width: 100%; height: auto; }
.motion-enabled .distribution-card svg > rect { transform-box: fill-box; transform-origin: center bottom; animation: bar-rise .9s var(--ease-out) both; }
.motion-enabled .distribution-card svg > rect:nth-of-type(2) { animation-delay: .16s; }
.motion-enabled .distribution-card svg > rect:nth-of-type(3) { animation-delay: .32s; }
.motion-enabled .distribution-card svg > path:nth-of-type(2) { stroke-dasharray: 7 7; animation: chart-dash 18s linear infinite; }
.motion-enabled .distribution-card svg > path:nth-of-type(3) { stroke-dasharray: 120; stroke-dashoffset: 120; animation: tail-draw 1.5s .55s var(--ease-out) forwards, tail-glow 3.6s 2s ease-in-out infinite; }
.motion-enabled .distribution-card svg > text { opacity: 0; animation: label-in .55s .65s var(--ease-out) forwards; }
.chart-caption { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.chart-caption div { padding: 14px 16px; border-left: 1px solid var(--line); }
.chart-caption div:first-child { border-left: 0; }
.chart-caption b { display: block; color: var(--heading); font-family: var(--font-mono); font-size: .85rem; }
.chart-caption small { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; }

/* Thesis strip */
.thesis-strip { border-block: 1px solid var(--line); background: var(--bg-alt); }
.thesis-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.thesis-item { min-height: 132px; padding: 28px 24px; border-left: 1px solid var(--line); }
.thesis-item:first-child { border-left: 0; }
.thesis-item b { display: block; margin-bottom: 6px; color: var(--heading); font-family: var(--font-display); font-size: 1.45rem; font-weight: 500; }
.thesis-item span { color: var(--muted); font-size: .82rem; }

/* Core math */
.equation-panel { display: grid; grid-template-columns: 1fr .9fr; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; background: var(--bg-alt); }
.equation-main { padding: 54px; }
.equation-main .formula { margin: 24px 0; color: var(--heading); font-family: var(--font-mono); font-size: clamp(1.4rem, 3vw, 2.25rem); letter-spacing: -.04em; }
.equation-main .formula .p { color: var(--tail-bright); }
.equation-main .formula .q { color: var(--loss); }
.equation-main p { max-width: 620px; }
.equation-notes { display: grid; align-content: center; gap: 1px; background: var(--line); border-left: 1px solid var(--line); }
.equation-notes div { padding: 24px 28px; background: var(--bg-alt); }
.equation-notes code { display: block; color: var(--tail); font-family: var(--font-mono); font-size: .78rem; }
.equation-notes span { display: block; margin-top: 5px; font-size: .86rem; }
.worked-example { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 28px; }
.payoff-ledger { border: 1px solid var(--line); border-radius: 5px; background: var(--surface); overflow: hidden; }
.ledger-row { display: grid; grid-template-columns: 1fr 90px 90px; padding: 14px 18px; border-bottom: 1px solid var(--line); font-family: var(--font-mono); font-size: .78rem; }
.ledger-row:last-child { border-bottom: 0; }
.ledger-head { color: var(--muted); font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; }
.ledger-row span:nth-child(n+2) { text-align: right; }
.ledger-total { color: var(--heading); background: var(--tail-dim); }
.tail-proof { padding: 28px; border: 1px solid var(--tail); border-radius: 5px; background: var(--tail-dim); }
.tail-proof .big-number { display: block; margin: 8px 0 10px; color: var(--tail-bright); font-family: var(--font-display); font-size: clamp(2.8rem, 5vw, 4.3rem); line-height: 1; }
.tail-proof p { font-size: .9rem; }

/* Cards */
.pillars-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.pillar { min-height: 300px; padding: 28px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); transition: border-color .2s, transform .2s; }
.pillar:hover { border-color: var(--line-strong); transform: translateY(-3px); }
.pillar .index { color: var(--tail); font-family: var(--font-mono); font-size: .7rem; letter-spacing: .08em; }
.pillar h3 { margin-top: 46px; font-size: 1.55rem; }
.pillar p { margin-top: 14px; font-size: .91rem; }
.pillar .mini-formula { display: block; margin-top: 24px; color: var(--heading); font-family: var(--font-mono); font-size: .78rem; }
.warning-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.warning-card { padding: 28px; border-top: 2px solid var(--loss); background: var(--loss-dim); }
.warning-card h3 { font-family: var(--font-sans); font-size: 1rem; font-weight: 700; }
.warning-card p { margin-top: 10px; font-size: .9rem; }

/* Calculator */
.calculator { display: grid; grid-template-columns: .95fr 1.05fr; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg-alt); overflow: hidden; box-shadow: var(--shadow); }
.calc-form { padding: 42px; }
.calc-form h3 { font-size: 2rem; }
.calc-form > p { margin: 12px 0 28px; font-size: .92rem; }
.input-grid { display: grid; gap: 18px; }
.input-grid label { display: grid; grid-template-columns: 1fr 120px; align-items: center; gap: 18px; color: var(--heading); font-size: .86rem; font-weight: 600; }
.input-grid small { display: block; color: var(--muted); font-weight: 400; }
.input-grid input { width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 3px; background: var(--bg); color: var(--heading); font-family: var(--font-mono); }
.calc-results { display: grid; grid-template-columns: 1fr 1fr; align-content: center; gap: 1px; background: var(--line); border-left: 1px solid var(--line); }
.result { min-height: 142px; padding: 30px; background: var(--surface-strong); }
.result span { color: var(--muted); font-family: var(--font-mono); font-size: .67rem; letter-spacing: .07em; text-transform: uppercase; }
.result output { display: block; margin-top: 10px; color: var(--heading); font-family: var(--font-display); font-size: 2rem; font-variant-numeric: tabular-nums; }
.motion-enabled .result output.value-updated { animation: value-tick .34s var(--ease-out); }
.result.primary output { color: var(--tail-bright); }
.result.negative output { color: var(--loss); }
.calc-note { grid-column: 1 / -1; padding: 14px 24px; background: var(--surface-strong); color: var(--muted); font-size: .75rem; }

/* Tables and article elements */
.table-wrap { margin-top: 30px; overflow-x: auto; border: 1px solid var(--line); border-radius: 5px; }
table { width: 100%; min-width: 590px; border-collapse: collapse; background: var(--bg-alt); }
th, td { padding: 15px 18px; border-bottom: 1px solid var(--line); text-align: left; font-size: .9rem; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-family: var(--font-mono); font-size: .67rem; letter-spacing: .06em; text-transform: uppercase; }
td:first-child { color: var(--heading); font-weight: 600; }
.note { margin-top: 12px; color: var(--muted); font-size: .78rem; }
.callout { margin-top: 28px; padding: 24px 26px; border-left: 2px solid var(--tail); background: var(--tail-dim); }
.callout.warning { border-left-color: var(--loss); background: var(--loss-dim); }
.callout strong { color: var(--heading); }
.formula-block { margin-top: 28px; padding: 26px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--bg-alt); color: var(--heading); font-family: var(--font-mono); font-size: clamp(1rem, 2.3vw, 1.4rem); overflow-x: auto; }

/* Blog and book cards */
.content-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.article-card { position: relative; display: flex; min-height: 330px; flex-direction: column; padding: 30px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); transition: transform .2s, border-color .2s; }
.article-card:hover { transform: translateY(-4px); border-color: var(--tail); }
.article-card .meta { display: flex; justify-content: space-between; gap: 18px; color: var(--muted); font-family: var(--font-mono); font-size: .65rem; letter-spacing: .05em; text-transform: uppercase; }
.article-card h3, .article-card h2 { margin-top: 54px; font-size: 1.65rem; }
.article-card p { margin-top: 14px; font-size: .9rem; }
.text-link { display: inline-flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 26px; color: var(--tail-bright); font-family: var(--font-mono); font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.article-card:hover .text-link { gap: 13px; }
.books-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.book-card { display: flex; min-height: 390px; flex-direction: column; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); overflow: hidden; transition: transform .2s, border-color .2s; }
.book-card:hover { transform: translateY(-4px); border-color: var(--amber); }
.book-cover { position: relative; display: flex; min-height: 180px; flex-direction: column; justify-content: flex-end; padding: 26px; border-bottom: 1px solid var(--line); background: linear-gradient(145deg, #17302f, #081214); overflow: hidden; }
.book-cover::after { content: ""; position: absolute; width: 160px; height: 160px; right: -68px; top: -78px; border: 1px solid rgba(239, 186, 91, .38); border-radius: 50%; box-shadow: 0 0 0 18px rgba(239, 186, 91, .035), 0 0 0 40px rgba(239, 186, 91, .025); }
.book-cover b { position: relative; z-index: 1; color: #f3ead7; font-family: var(--font-display); font-size: 1.35rem; font-weight: 500; line-height: 1.15; }
.book-cover small { position: relative; z-index: 1; margin-top: 9px; color: #c9b98d; font-family: var(--font-mono); font-size: .67rem; letter-spacing: .07em; text-transform: uppercase; }
.book-copy { display: flex; flex: 1; flex-direction: column; padding: 23px; }
.book-copy .tag { color: var(--amber); font-family: var(--font-mono); font-size: .64rem; letter-spacing: .07em; text-transform: uppercase; }
.book-copy p { margin-top: 12px; font-size: .85rem; }
.book-copy .text-link { color: var(--amber); }
.affiliate-note { margin-top: 26px; color: var(--muted); font-size: .78rem; }

/* Page and article */
.page-hero { position: relative; overflow: hidden; padding: calc(var(--nav-height) + 76px) 0 68px; border-bottom: 1px solid var(--line); background: var(--bg-alt); }
.page-hero .inner { position: relative; z-index: 2; max-width: 880px; }
.breadcrumbs { margin-bottom: 28px; color: var(--muted); font-family: var(--font-mono); font-size: .7rem; letter-spacing: .04em; text-transform: uppercase; }
.breadcrumbs a { color: var(--tail); }
.breadcrumbs .sep { margin: 0 9px; }
.page-hero h1 { font-size: clamp(2.7rem, 6vw, 5rem); letter-spacing: -.04em; }
.page-hero .lede { max-width: 760px; margin-top: 22px; font-size: 1.12rem; }
.byline { margin-top: 24px; color: var(--muted); font-family: var(--font-mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
.article-layout { display: grid; grid-template-columns: minmax(0, var(--measure)) 220px; gap: 84px; align-items: start; padding-block: 70px 110px; }
.article-body { min-width: 0; }
.article-body > p:first-child { color: var(--heading); font-family: var(--font-display); font-size: 1.35rem; line-height: 1.55; }
.article-body h2 { margin-top: 64px; font-size: clamp(1.8rem, 3vw, 2.35rem); }
.article-body h3 { margin-top: 38px; font-family: var(--font-sans); font-size: 1.08rem; font-weight: 700; }
.article-body p, .article-body ul, .article-body ol { margin-top: 19px; }
.article-body ul, .article-body ol { padding-left: 23px; }
.article-body li + li { margin-top: 10px; }
.article-body li::marker { color: var(--tail); }
.article-body strong { color: var(--heading); }
.article-body em { color: var(--heading); }
.inline-link { color: var(--tail-bright); border-bottom: 1px solid var(--tail); }
.article-aside { position: sticky; top: calc(var(--nav-height) + 28px); padding-left: 20px; border-left: 1px solid var(--line); }
.article-aside span { color: var(--muted); font-family: var(--font-mono); font-size: .65rem; letter-spacing: .08em; text-transform: uppercase; }
.article-aside ol { margin-top: 16px; padding: 0; list-style: none; counter-reset: toc; }
.article-aside li { counter-increment: toc; }
.article-aside li + li { margin-top: 11px; }
.article-aside a { color: var(--body); font-size: .78rem; line-height: 1.35; }
.article-aside a:hover { color: var(--tail); }
.article-aside a::before { content: "0" counter(toc) " "; color: var(--muted); font-family: var(--font-mono); font-size: .62rem; }
.related { margin-top: 72px; padding-top: 38px; border-top: 1px solid var(--line); }
.related h2 { margin: 0 0 24px; font-size: 1.5rem; }
.related .content-grid { grid-template-columns: 1fr 1fr; }
.related .article-card { min-height: 230px; }
.related .article-card h3 { margin-top: 26px; font-size: 1.25rem; }
.book-review { display: grid; grid-template-columns: 210px 1fr; gap: 34px; padding: 44px 0; border-bottom: 1px solid var(--line); }
.book-review .book-cover { position: sticky; top: calc(var(--nav-height) + 24px); min-height: 245px; border: 1px solid var(--line); border-radius: 4px; }
.book-review h2 { margin-top: 0; font-size: 1.8rem; }
.book-review .rank { color: var(--amber); font-family: var(--font-mono); font-size: .7rem; text-transform: uppercase; }
.book-review .by { margin-top: 5px; color: var(--muted); font-size: .82rem; }
.book-review .btn { margin-top: 22px; background: var(--amber); color: var(--ink-950); }

/* FAQ and footer */
.faq { max-width: 820px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { display: flex; justify-content: space-between; gap: 24px; padding: 22px 0; color: var(--heading); cursor: pointer; list-style: none; font-family: var(--font-display); font-size: 1.2rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary span { color: var(--tail); font-family: var(--font-mono); transition: transform .2s; }
.faq details[open] summary span { transform: rotate(45deg); }
.faq .answer { max-width: 730px; padding: 0 0 24px; }
.site-footer { padding: 60px 0 36px; border-top: 1px solid var(--line); background: var(--bg-alt); }
.footer-main { display: flex; justify-content: space-between; gap: 48px; padding-bottom: 38px; }
.footer-brand { color: var(--heading); font-family: var(--font-display); font-size: 1.25rem; }
.footer-main p { margin-top: 8px; font-size: .85rem; }
.footer-links { display: flex; flex-wrap: wrap; align-content: flex-start; justify-content: flex-end; gap: 12px 24px; list-style: none; padding: 0; font-size: .82rem; }
.footer-links a:hover { color: var(--tail); }
.fine-print { padding-top: 26px; border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; }
.fine-print p + p { margin-top: 8px; }

/* Motion system */
.probability-field { position: absolute; z-index: 1; inset: 0; overflow: hidden; pointer-events: none; opacity: .82; -webkit-mask-image: linear-gradient(90deg, transparent, #000 30%, #000 100%); mask-image: linear-gradient(90deg, transparent, #000 30%, #000 100%); }
.page-hero .probability-field { opacity: .58; -webkit-mask-image: linear-gradient(90deg, transparent 18%, #000 58%, #000); mask-image: linear-gradient(90deg, transparent 18%, #000 58%, #000); }
.probability-field svg { width: 100%; height: 100%; }
.probability-field .trace { fill: none; stroke: var(--body); stroke-width: 1; stroke-dasharray: 5 15; opacity: .11; animation: field-dash 24s linear infinite; vector-effect: non-scaling-stroke; }
.probability-field .trace:nth-child(2) { animation-duration: 31s; animation-direction: reverse; }
.probability-field .trace:nth-child(3) { animation-duration: 19s; }
.probability-field .tail-trace { fill: none; stroke: var(--tail); stroke-width: 1.35; stroke-dasharray: 18 20; opacity: .24; animation: field-dash 13s linear infinite; vector-effect: non-scaling-stroke; }
.probability-field .event-dot { fill: var(--tail-bright); opacity: .7; filter: drop-shadow(0 0 5px var(--tail)); }
.probability-field .event-ring { fill: none; stroke: var(--tail); stroke-width: 1; opacity: .4; transform-box: fill-box; transform-origin: center; animation: event-ring 2.4s ease-out infinite; }
.motion-enabled .hero-grid > div > *, .motion-enabled .page-hero .inner > * { animation: hero-enter .75s var(--ease-out) both; }
.motion-enabled .hero-grid > div > *:nth-child(2), .motion-enabled .page-hero .inner > *:nth-child(2) { animation-delay: .08s; }
.motion-enabled .hero-grid > div > *:nth-child(3), .motion-enabled .page-hero .inner > *:nth-child(3) { animation-delay: .16s; }
.motion-enabled .hero-grid > div > *:nth-child(4), .motion-enabled .page-hero .inner > *:nth-child(4) { animation-delay: .24s; }
.motion-enabled .hero-grid > .distribution-card { animation: card-unmask .9s .2s var(--ease-out) both; }
.motion-enabled .reveal { opacity: 0; filter: blur(4px); transform: translateY(22px); transition: opacity .72s var(--ease-out), filter .72s var(--ease-out), transform .72s var(--ease-out); transition-delay: var(--reveal-delay, 0ms); }
.motion-enabled .reveal.is-visible { opacity: 1; filter: blur(0); transform: translateY(0); }
.motion-enabled .article-card.reveal.is-visible:hover, .motion-enabled .book-card.reveal.is-visible:hover { transform: translateY(-4px); }
.motion-enabled .pillar.reveal.is-visible:hover { transform: translateY(-3px); }
.reading-progress { --reading-progress: 0; position: fixed; z-index: 160; top: 0; left: 0; width: 100%; height: 2px; pointer-events: none; background: linear-gradient(90deg, var(--tail), var(--tail-bright)); box-shadow: 0 0 10px var(--tail); transform: scaleX(var(--reading-progress)); transform-origin: left center; }

@keyframes grid-drift {
    to { transform: translate3d(48px, 48px, 0); }
}
@keyframes ambient-breathe {
    0% { opacity: .3; transform: translate3d(-1.5%, 0, 0) scale(.98); }
    100% { opacity: .5; transform: translate3d(1.5%, -1%, 0) scale(1.04); }
}
@keyframes tail-tick {
    0%, 100% { transform: rotate(-30deg) scaleX(1); }
    45% { transform: rotate(-38deg) scaleX(1.22); }
}
@keyframes hero-enter {
    from { opacity: 0; transform: translateY(18px); filter: blur(4px); }
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}
@keyframes card-unmask {
    from { opacity: 0; clip-path: inset(0 0 100% 0); }
    to { opacity: 1; clip-path: inset(0); }
}
@keyframes bar-rise {
    from { transform: scaleY(0); opacity: .25; }
    to { transform: scaleY(1); opacity: 1; }
}
@keyframes chart-dash {
    to { stroke-dashoffset: -280; }
}
@keyframes tail-draw {
    to { stroke-dashoffset: 0; }
}
@keyframes tail-glow {
    0%, 100% { opacity: .72; filter: drop-shadow(0 0 0 transparent); }
    50% { opacity: 1; filter: drop-shadow(0 0 5px var(--tail)); }
}
@keyframes label-in {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes field-dash {
    to { stroke-dashoffset: -420; }
}
@keyframes event-ring {
    0% { opacity: .55; transform: scale(.55); }
    75%, 100% { opacity: 0; transform: scale(2.6); }
}
@keyframes value-tick {
    0% { opacity: .35; transform: translateY(5px); }
    100% { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1020px) {
    .hero-grid { grid-template-columns: 1fr; gap: 52px; }
    .distribution-card { max-width: 660px; }
    .pillars-grid, .books-grid { grid-template-columns: 1fr 1fr; }
    .content-grid { grid-template-columns: 1fr 1fr; }
    .article-layout { grid-template-columns: minmax(0, var(--measure)); justify-content: center; }
    .article-aside { display: none; }
}

@media (max-width: 780px) {
    .container, .narrow { width: min(100% - 36px, var(--container)); }
    .section { padding: 78px 0; }
    .nav-list { gap: 12px; }
    .nav-hide { display: none; }
    .brand { font-size: 1rem; }
    .thesis-grid { grid-template-columns: 1fr 1fr; }
    .thesis-item:nth-child(3) { border-left: 0; }
    .thesis-item:nth-child(n+3) { border-top: 1px solid var(--line); }
    .equation-panel, .worked-example, .calculator { grid-template-columns: 1fr; }
    .equation-notes, .calc-results { border-left: 0; border-top: 1px solid var(--line); }
    .warning-grid { grid-template-columns: 1fr; }
    .book-review { grid-template-columns: 1fr; }
    .book-review .book-cover { position: static; max-width: 290px; min-height: 190px; }
    .probability-field { opacity: .4; }
}

@media (max-width: 560px) {
    :root { --nav-height: 64px; }
    .container, .narrow { width: min(100% - 30px, var(--container)); }
    .site-nav { height: var(--nav-height); }
    .nav-inner { gap: 8px; }
    .brand .dotcom { display: none; }
    .brand { font-size: .96rem; }
    .brand-mark { width: 28px; }
    .nav-list { gap: 8px; }
    .theme-toggle { display: none; }
    .nav-cta { padding: 8px 10px; }
    .hero { padding-top: calc(var(--nav-height) + 58px); }
    .hero h1 { font-size: clamp(2.5rem, 13vw, 3.4rem); }
    .chart-caption { grid-template-columns: 1fr; }
    .chart-caption div { border-left: 0; border-top: 1px solid var(--line); }
    .chart-caption div:first-child { border-top: 0; }
    .thesis-grid, .pillars-grid, .content-grid, .books-grid { grid-template-columns: 1fr; }
    .thesis-item { border-left: 0; border-top: 1px solid var(--line); }
    .thesis-item:first-child { border-top: 0; }
    .equation-main, .calc-form { padding: 32px 24px; }
    .ledger-row { grid-template-columns: 1fr 66px 66px; padding-inline: 13px; }
    .input-grid label { grid-template-columns: 1fr 96px; }
    .calc-results { grid-template-columns: 1fr; }
    .calc-note { grid-column: auto; }
    .article-card { min-height: 280px; }
    .article-card h3, .article-card h2 { margin-top: 36px; }
    .related .content-grid { grid-template-columns: 1fr; }
    .footer-main { flex-direction: column; }
    .footer-links { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
    body::before, body::after, .probability-field, .reading-progress { animation: none !important; }
    .motion-enabled .reveal { opacity: 1; filter: none; transform: none; }
    .distribution-card { transform: none !important; }
}
