/* ============================================================
   Shoal Research — article reading theme (Paradigm-style, light)
   Used by every /research/writing/<slug> page.
   Roboto Mono for structure, Roboto Serif for body.
   ============================================================ */

:root {
    --paper: #fbfaf8;
    --ink: #1f1f1f;
    --ink-soft: #43423f;
    --muted: #6b6a66;
    --line: rgba(31, 31, 31, 0.14);
    --accent: #5b47c9;        /* readable purple for links/interaction on paper */
    --accent-soft: #9aa3ff;   /* Shoal periwinkle, graphic accents only */
    --code-bg: #14131a;       /* dark code panel, Paradigm-style */
    --sans: "Inter", -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

html {
    color-scheme: light;
    scrollbar-color: rgba(0, 0, 0, 0.25) #efece6;
    scrollbar-width: thin;
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #efece6; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.22); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.4); }

.post__page { background: var(--paper); color: var(--ink); min-height: 100vh; }
.post__page,
.post__page * { user-select: text; -webkit-user-select: text; }

/* ---- recolor the shared dark header/footer to read on paper ---- */
.post__page .header {
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}
.post__page .header__logo img { filter: invert(1) brightness(0.08); }
.post__page .header__menu__center__item { color: var(--ink-soft); }
.post__page .header__menu__center__item:hover { color: var(--ink); }
.post__page .header__menu__right__item__b {
    color: var(--ink);
    border-color: rgba(31, 31, 31, 0.3);
}
.post__page .header__menu__right__item__b:hover {
    background: var(--ink);
    color: var(--paper);
}

.post__page .footer {
    background: var(--paper);
    border-top: 1px solid var(--line);
}
.post__page .footer__column__title { color: var(--ink); }
.post__page .footer__column__line,
.post__page .footer__last__copyright,
.post__page .footer__last__totop { color: var(--muted); }
.post__page .footer__column__line:hover { color: var(--ink); }

/* Reading-progress bar */
.post__progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0;
    background: var(--accent);
    z-index: 90;
    transition: width 0.08s linear;
}

/* ---------- article shell: single centered column ---------- */
.post__shell {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 24px;
    text-align: left;
}
.post__page main, .post__shell, .post__shell * { text-align: left; }
/* styles.css sets div/span/a to inline-block globally; restore block flow in the article */
.post__page main, .post__shell, .post__shell div, .post__shell figure, .post__shell nav { display: block; }
.post__body a { display: inline; }
.post__shell .post__eyebrow { display: inline-flex; width: auto; }

.post__shell .post__head {
    display: grid;
    grid-template-columns: auto auto;
    justify-content: center;
    align-items: center;
    column-gap: 18px;
    width: min(1000px, calc(100vw - 48px));
    margin-left: 50%;
    padding: 64px 0 56px;
    transform: translateX(-50%);
    text-align: center;
}

.post__back {
    display: none;
    width: fit-content;
    align-items: center;
    gap: 8px;
    font-family: "Roboto Mono", monospace;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.15s ease-out;
}
.post__back:hover { color: var(--accent); }
.post__back:focus-visible,
.post__outline a:focus-visible,
.post__body a:focus-visible,
.post__share a:focus-visible,
.post__cta__btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.post__eyebrow {
    display: inline-flex;
    grid-column: 2;
    grid-row: 1;
    align-items: center;
    height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1;
    text-transform: none;
    letter-spacing: 0;
}

.post__title {
    grid-column: 1 / -1;
    grid-row: 2;
    max-width: 920px;
    margin: 42px auto 0;
    font-family: var(--sans);
    font-weight: 400;
    font-size: clamp(38px, 4.2vw, 64px);
    line-height: 1.06;
    letter-spacing: -0.038em;
    color: var(--ink);
    text-align: center;
}

.post__byline {
    grid-column: 1;
    grid-row: 1;
    margin: 0;
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1;
    letter-spacing: 0;
    color: var(--muted);
    text-align: right;
}
.post__byline strong { color: var(--ink); font-weight: 500; }

.post__dek {
    grid-column: 1 / -1;
    grid-row: 3;
    max-width: 720px;
    margin: 30px auto 0;
    font-family: var(--sans);
    font-size: clamp(17px, 1.5vw, 21px);
    font-weight: 400;
    line-height: 1.55;
    color: var(--ink-soft);
    text-align: center;
}
.post__shell .post__title, .post__shell .post__dek { text-align: center; }
.post__shell .post__byline { text-align: right; }

.post__page--episode .post__shell .post__head { padding-bottom: 58px; }
.post__page--episode .post__eyebrow { display: none; }
.post__page--episode .post__byline {
    grid-column: 1 / -1;
    text-align: center;
}
.post__page--episode .post__title {
    max-width: 880px;
    font-size: clamp(38px, 3.2vw, 50px);
    line-height: 1.06;
    letter-spacing: -0.038em;
}
.post__page--episode .post__dek { max-width: 680px; margin-top: 32px; font-size: clamp(17px, 1.5vw, 21px); }

.post__rule { display: none; }

.post__shell .post__actionrail {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    margin: 0 0 24px;
    padding: 0;
}
.post__actionrail__group { display: flex !important; align-items: center; gap: 22px; }
.post__actionrail a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--ink);
    font-family: var(--sans);
    font-size: 15px;
    text-decoration: none;
    transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.post__actionrail a:hover {
    border-color: var(--accent);
    background: rgba(91, 71, 201, 0.06);
    color: var(--accent);
}
.post__actionrail svg { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.post__actionrail .post__actionrail__link--substack svg,
.post__actionrail .post__actionrail__link--telegram svg,
.post__actionrail .post__actionrail__link--x svg { fill: currentColor; stroke: none; }

/* OUTLINE table of contents — content-anchored sticky left rail on wide screens. */
.post__outline { padding: 28px 0 6px; }

@media (min-width: 1180px) {
    .post__outline {
        position: relative;
        float: left;
        z-index: 10;
        top: auto;
        width: 180px;
        max-height: calc(100vh - 144px);
        overflow-y: auto;
        margin-left: calc((100vw - 640px) / -2 + 24px);
        margin-bottom: 28px;
        padding: 0 14px 18px 0;
        background: var(--paper);
        scrollbar-width: thin;
    }
    .post__outline__label { font-size: 11px; }
    .post__outline a {
        font-size: 13px;
        line-height: 1.45;
        padding: 5px 0;
        transition: color 0.15s ease-out;
    }
    .post__outline ol { margin-top: 12px; }
    .post__outline.is-stuck {
        position: fixed;
        top: 112px;
        left: 48px;
        margin-left: 0;
    }
}
.post__outline__label {
    font-family: var(--sans);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}
.post__outline ol {
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
    counter-reset: outline;
}
.post__outline li { counter-increment: outline; margin: 0; }
.post__outline a {
    display: block;
    padding: 6px 0;
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 450;
    line-height: 1.45;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.15s ease-out;
}
.post__outline a:hover { color: var(--ink); }
.post__outline a.is-active { color: var(--accent); }

/* ---------- body: serif prose ---------- */
.post__body { padding: 18px 0 40px; }
.post__body img { max-width: 100%; height: auto; display: block; }
.post__body > p {
    margin: 0 0 24px;
    font-family: "Roboto Serif", serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.7;
    color: var(--ink-soft);
    letter-spacing: 0.002em;
}
.post__body > p:first-of-type {
    font-size: 19px;
    line-height: 1.65;
    color: var(--ink);
}

/* Section headings */
.post__body h2 {
    margin: 52px 0 22px;
    font-family: var(--sans);
    font-weight: 600;
    font-size: clamp(20px, 2.2vw, 24px);
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--ink);
    scroll-margin-top: 24px;
}
.post__body h2::before {
    content: "";
    display: block;
    width: 38px;
    height: 2px;
    margin-bottom: 18px;
    background: var(--accent-soft);
}
.post__body h3 {
    margin: 34px 0 12px;
    font-family: var(--sans);
    font-weight: 600;
    font-size: 16px;
    line-height: 1.3;
    color: var(--ink);
}

.post__body a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(91, 71, 201, 0.45);
    transition: border-color 0.15s ease-out, color 0.15s ease-out;
}
.post__body a:hover { color: var(--ink); border-color: var(--ink); }
.post__body strong { color: var(--ink); font-weight: 600; }

.post__body ul, .post__body ol {
    margin: 0 0 26px;
    padding-left: 22px;
}
.post__body li {
    font-family: "Roboto Serif", serif;
    font-size: 16.5px;
    line-height: 1.62;
    color: var(--ink-soft);
    margin-bottom: 9px;
}

/* Inline + block code, Paradigm-style dark panels */
.post__body code {
    font-family: "Roboto Mono", monospace;
    font-size: 0.86em;
    padding: 2px 7px;
    background: #efece6;
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #3a2e6b;
}
.post__codeblock {
    margin: 32px 0;
    background: var(--code-bg);
    border: 1px solid rgba(0, 0, 0, 0.18);
    overflow-x: auto;
}
.post__codeblock pre {
    margin: 0;
    padding: 20px 22px;
    font-family: "Roboto Mono", monospace;
    font-size: 13.5px;
    line-height: 1.65;
    color: #e8e6f3;
}
.post__codeblock code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }

.post__pull {
    margin: 40px 0;
    padding: 4px 0 4px 26px;
    border-left: 2px solid var(--accent-soft);
    font-family: "Roboto Serif", serif;
    font-style: italic;
    font-weight: 400;
    font-size: 20px;
    line-height: 1.5;
    color: var(--ink);
}

.post__figure { margin: 40px 0; }
.post__figure img { display: block; width: 100%; border: 1px solid var(--line); }
.post__figure figcaption {
    margin-top: 12px;
    font-family: "Roboto Mono", monospace;
    font-size: 12px;
    letter-spacing: 0.04em;
    color: var(--muted);
}

/* Episode pages: video embed + transcript turns */
.post__video {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 30px 0 6px;
    background: #000;
    border: 1px solid var(--line);
}
.post__video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.post__turn {
    margin: 0 0 22px;
    font-family: "Roboto Serif", serif;
    font-weight: 400;
    font-size: 16.5px;
    line-height: 1.68;
    color: var(--ink-soft);
}
.post__speaker {
    display: block;
    margin-bottom: 4px;
    font-family: "Roboto Mono", monospace;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink);
}
.post__ts {
    font-weight: 400;
    color: var(--muted);
    text-transform: none;
    letter-spacing: 0.02em;
}

/* Draft / in-progress note (for pieces being migrated) */
.post__draft {
    margin: 8px 0 34px;
    padding: 18px 20px;
    border: 1px dashed rgba(91, 71, 201, 0.4);
    background: rgba(91, 71, 201, 0.05);
    font-family: "Roboto Mono", monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--ink-soft);
}

/* ---------- footer of article ---------- */
.post__foot { margin-top: 26px; padding: 34px 0 0; border-top: 1px solid var(--line); }
.post__shell .post__share, .post__share { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.post__share__label {
    font-family: "Roboto Mono", monospace;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
}
.post__share a {
    display: inline-flex;
    align-items: center;
    height: 38px;
    padding: 0 16px;
    border: 1px solid rgba(31, 31, 31, 0.2);
    font-family: "Roboto Mono", monospace;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink);
    text-decoration: none;
    transition: border-color 0.15s ease-out, background 0.15s ease-out, color 0.15s ease-out;
}
.post__share a:hover { border-color: var(--accent); color: var(--accent); }

.post__cta {
    margin: 56px 0 90px;
    padding: 32px;
    border: 1px solid rgba(91, 71, 201, 0.28);
    background: rgba(91, 71, 201, 0.05);
}
.post__cta__title {
    display: block;
    font-family: "Roboto Serif", serif;
    font-size: 26px;
    font-weight: 500;
    line-height: 1.15;
    color: var(--ink);
}
.post__cta__text {
    display: block;
    margin-top: 12px;
    font-family: "Roboto Serif", serif;
    font-size: 16px;
    line-height: 1.55;
    color: var(--muted);
}
.post__cta a.post__cta__btn {
    display: inline-flex;
    align-items: center;
    height: 44px;
    margin-top: 22px;
    padding: 0 20px;
    background: var(--accent);
    color: #fff;
    font-family: "Roboto Mono", monospace;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-decoration: none;
    transition: background 0.15s ease-out;
}
.post__cta a.post__cta__btn:hover { background: #43349e; }

@media (max-width: 600px) {
    .post__head { grid-template-columns: 1fr; row-gap: 10px; width: calc(100vw - 40px); padding: 54px 0 48px; }
    .post__byline, .post__eyebrow { grid-column: 1; text-align: center; justify-self: center; }
    .post__shell .post__byline { text-align: center; }
    .post__byline { grid-row: 1; }
    .post__shell .post__byline { font-size: 12px; white-space: nowrap; }
    .post__eyebrow { grid-row: 2; }
    .post__title { grid-row: 3; margin-top: 26px; font-size: clamp(40px, 12vw, 58px); }
    .post__dek { grid-row: 4; margin-top: 26px; font-size: 18px; }
    .post__page--episode .post__shell .post__head { padding-bottom: 42px; }
    .post__page--episode .post__title { grid-row: 2; font-size: clamp(34px, 9vw, 42px); }
    .post__page--episode .post__dek { grid-row: 3; }
    .post__page--episode .post__dek { margin-top: 22px; font-size: 17px; }
    .post__actionrail { width: 100%; margin-bottom: 22px; padding: 0; }
    .post__actionrail__group { gap: 18px; }
    .post__actionrail a { width: 34px; height: 34px; }
    .post__actionrail svg { width: 19px; height: 19px; }
    .post__body > p { font-size: 16.5px; }
    .post__body > p:first-of-type { font-size: 18px; }
    .post__cta { padding: 24px; }
}

/* Cover images break out wider than the body column on large screens.
   Episode videos remain centered at the article-column width. */
@media (min-width: 1100px) {
    .post__cover {
        margin-left: calc(-1 * clamp(0px, (100vw - 1240px) / 2, 160px));
        margin-right: calc(-1 * clamp(0px, (100vw - 1240px) / 2, 160px));
    }
}

/* Keep article chrome compact on small screens. */
@media (max-width: 760px) {
    .post__page .header__menu__center,
    .post__page .header__menu__right { display: none !important; }
}
