/* ==========================================================================
   UHL Blog, Margin
   A fixed left rail holds identity, author, topics and sign-up; the right
   column is a calm reading stream. Newsreader + Schibsted Grotesk.
   ========================================================================== */

@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("../fonts/newsreader.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-style: italic; font-weight: 200 800; font-display: swap; src: url("../fonts/newsreader-italic.woff2") format("woff2"); }
@font-face { font-family: "Schibsted Grotesk"; font-style: normal; font-weight: 400 900; font-display: swap; src: url("../fonts/schibsted-grotesk.woff2") format("woff2"); }

/* --------------------------------------------------------------------------
   Tokens (names shared with main.js, which themes Ghost's pop-up windows)
   -------------------------------------------------------------------------- */

:root {
    --paper: #fcfcfb;
    --surface: #fcfcfb;
    --ink: #181a1f;
    --ink-soft: #3b3f47;
    --muted: #61656e;
    --rule: #e3e5e9;
    --wash: #f4f5f7;
    --accent: oklch(0.5 0.14 262);
    --accent-text: var(--accent);
    --on-accent: #ffffff;
    --error: #b3261e;

    --serif: var(--gh-font-heading, "Newsreader", Georgia, serif);
    --serif-body: var(--gh-font-body, "Newsreader", Georgia, serif);
    --sans: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

    --rail: 380px;
    --pad: 64px;
    --measure: 680px;
    --wide: 860px;

    color-scheme: light;
}

:root[data-theme="dark"] {
    --paper: #0f1115;
    --surface: #15181e;
    --ink: #e8eaee;
    --ink-soft: #c3c7cf;
    --muted: #949aa5;
    --rule: #252932;
    --wash: #14171d;
    --accent: oklch(0.74 0.11 262);
    --on-accent: #0f1115;
    --error: #ffb4ab;
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #0f1115;
        --surface: #15181e;
        --ink: #e8eaee;
        --ink-soft: #c3c7cf;
        --muted: #949aa5;
        --rule: #252932;
        --wash: #14171d;
        --accent: oklch(0.74 0.11 262);
        --on-accent: #0f1115;
        --error: #ffb4ab;
        color-scheme: dark;
    }
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

img, video, svg { max-width: 100%; height: auto; }

a { color: inherit; text-decoration: none; }
a:hover { color: inherit; }

button { font: inherit; color: inherit; }

::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }

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

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 16px;
    z-index: 50;
    padding: 10px 16px;
    background: var(--ink);
    color: var(--paper);
}

.skip-link:focus { top: 16px; }

.acc { color: var(--accent); }

.empty { margin: 0; padding: 48px 0; color: var(--muted); }

/* --------------------------------------------------------------------------
   Shell: rail + stage
   -------------------------------------------------------------------------- */

.shell {
    display: grid;
    grid-template-columns: var(--rail) minmax(0, 1fr);
    min-height: 100vh;
}

.rail {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid var(--rule);
    background: var(--wash);
}

.rail-inner {
    display: flex;
    flex-direction: column;
    gap: 44px;
    min-height: 100%;
    padding: 40px 44px;
}

.stage {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stage-main {
    flex: 1;
    padding: 48px var(--pad) 64px;
}

/* --------------------------------------------------------------------------
   Rail
   -------------------------------------------------------------------------- */

.rail-id { display: flex; flex-direction: column; gap: 18px; }

.rail-brand {
    font: 500 30px/1 var(--serif);
    letter-spacing: -0.02em;
}

.brand-logo { display: block; max-height: 44px; width: auto; }

.rail-tagline {
    margin: 0;
    font: italic 400 21px/1.4 var(--serif);
    text-wrap: pretty;
}

.rail-author {
    display: flex;
    gap: 14px;
    align-items: center;
}

.avatar {
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--rule);
    color: var(--ink);
    font: 500 15px var(--serif);
}

.rail-author-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
}

.rail-muted { color: var(--muted); font-size: 13px; }

.rail-author-name { font-weight: 500; }

.rail-author:hover .rail-author-name { text-decoration: underline; text-underline-offset: 3px; }

.rail-label {
    margin: 0;
    padding-bottom: 10px;
    font: 400 11px/1.4 var(--sans);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.topic-list ul {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.topic-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 40px;
    padding: 9px 0;
    border-bottom: 1px solid var(--rule);
    font-size: 15px;
}

.topic-name { display: flex; gap: 10px; align-items: center; }

.topic-dot {
    display: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.topic-link.is-active .topic-dot { display: inline-block; }

.topic-link:hover .topic-name { text-decoration: underline; text-underline-offset: 3px; }

.topic-count { font-size: 12px; color: var(--muted); }

.rail-subscribe { display: flex; flex-direction: column; gap: 12px; }

.rail-subscribe-heading {
    margin: 0;
    font: 500 18px/1.3 var(--serif);
}

.rail-muted-text {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
}

.field-group {
    display: flex;
    padding: 4px;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: var(--paper);
}

.field-group:focus-within { border-color: var(--accent); }

.field-input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font: 400 14px var(--sans);
}

.field-input:focus { outline: none; }
.field-input::placeholder { color: var(--muted); opacity: 1; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border: 0;
    border-radius: 4px;
    background: var(--accent);
    color: var(--on-accent);
    font: 500 13px var(--sans);
    cursor: pointer;
}

.button:hover { background: color-mix(in oklab, var(--accent) 88%, var(--ink)); color: var(--on-accent); }

.button-loading { display: none; }
.subscribe-form.loading .button-label { display: none; }
.subscribe-form.loading .button-loading { display: inline; }

.form-message { display: none; margin: 10px 0 0; font-size: 13px; line-height: 1.5; }
.subscribe-form.success .form-success { display: block; }
.subscribe-form.success .field-group { display: none; }
.subscribe-form.error .form-error { display: block; color: var(--error); }

.text-link { font-size: 13px; color: var(--accent); }
.text-link:hover { color: var(--accent); text-decoration: underline; }

.rail-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: auto;
    font-size: 12px;
    color: var(--muted);
}

.rail-foot a:hover { color: var(--ink); }

/* --------------------------------------------------------------------------
   Top bar and navigation
   -------------------------------------------------------------------------- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px var(--pad);
    font-size: 14px;
    color: var(--muted);
}

.topbar-brand { display: none; }

.nav-panel { display: flex; align-items: center; min-width: 0; }

.nav-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 26px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.js .nav-list > .is-child { display: none; }

.nav-item { position: relative; }

.nav-link,
.nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    border: 0;
    background: none;
    color: var(--muted);
    cursor: pointer;
}

.nav-link:hover,
.nav-toggle:hover,
.nav-toggle[aria-expanded="true"],
.nav-list > .is-current > .nav-link,
.nav-list > .has-current > .nav-toggle { color: var(--ink); }

.chevron { width: 12px; height: 12px; transition: transform 0.15s ease; }
.nav-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.submenu {
    position: absolute;
    top: calc(100% + 10px);
    left: -12px;
    z-index: 30;
    display: none;
    min-width: 200px;
    margin: 0;
    padding: 6px;
    list-style: none;
    border: 1px solid var(--rule);
    border-radius: 8px;
    background: var(--paper);
    box-shadow: 0 12px 32px rgb(0 0 0 / 0.1);
}

.nav-item.is-open > .submenu { display: block; }

.submenu .nav-link {
    display: flex;
    width: 100%;
    padding: 8px 10px;
    border-radius: 5px;
    color: var(--ink);
}

.submenu .nav-link:hover,
.submenu .is-current > .nav-link { background: var(--wash); }

.panel-extras { display: none; }

.topbar-tools {
    display: flex;
    align-items: center;
    gap: 22px;
}

.tool-link {
    padding: 4px 0;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
}

.tool-link:hover { color: var(--ink); }

.tool-accent { color: var(--accent); font-weight: 500; }
.tool-accent:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.header-members { display: flex; align-items: center; gap: 22px; }

/* The theme switch: a small half-filled circle. */
.theme-dot {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin: -7px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    cursor: pointer;
}

.theme-dot-icon {
    width: 14px;
    height: 14px;
    border: 1.5px solid var(--muted);
    border-radius: 50%;
    background: linear-gradient(90deg, var(--muted) 50%, transparent 50%);
}

.theme-dot:hover .theme-dot-icon { border-color: var(--ink); background: linear-gradient(90deg, var(--ink) 50%, transparent 50%); }

.theme-toggle-light { display: none; }
:root[data-theme="dark"] .theme-toggle-light { display: inline; }
:root[data-theme="dark"] .theme-toggle-dark { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle-light { display: inline; }
    :root:not([data-theme="light"]) .theme-toggle-dark { display: none; }
}

.menu-button { display: none; }

/* --------------------------------------------------------------------------
   Shared text pieces
   -------------------------------------------------------------------------- */

.meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
}

.meta-tag { color: var(--accent); font-weight: 500; }
a.meta-tag:hover { text-decoration: underline; text-underline-offset: 3px; }

.more-link {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
}

.more-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* --------------------------------------------------------------------------
   Homepage: lead essay and stream
   -------------------------------------------------------------------------- */

/* The rule under the lead spans the stream; the text keeps its measure. */
.lead {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding-bottom: 56px;
    border-bottom: 1px solid var(--rule);
}

.lead > * { max-width: 760px; }

.lead-image {
    display: block;
    margin-bottom: 10px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--wash);
}

.lead-image img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

.lead-title {
    margin: 0;
    font: 400 64px/1.02 var(--serif);
    letter-spacing: -0.025em;
    text-wrap: balance;
}

.lead-title a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; }

.lead-excerpt {
    margin: 0;
    font: 400 22px/1.5 var(--serif-body);
    color: var(--muted);
    text-wrap: pretty;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    overflow: hidden;
}

.lead .more-link { padding-top: 6px; }

.stream-top { border-top: 1px solid var(--rule); }

.row {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 40px;
    padding: 32px 0;
    border-bottom: 1px solid var(--rule);
}

.row-text {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 600px;
}

.row .meta { font-size: 12px; gap: 4px 10px; }

.row-title {
    margin: 0;
    font: 400 30px/1.15 var(--serif);
    letter-spacing: -0.015em;
    text-wrap: balance;
}

.row-link::after { content: ""; position: absolute; inset: 0; }
.row:hover .row-link { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.row:focus-within { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 3px; }
.row-link:focus-visible { outline: none; }

.row-excerpt {
    margin: 0;
    font: 400 17px/1.55 var(--serif-body);
    color: var(--muted);
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.row-image {
    flex: none;
    width: 150px;
    height: 100px;
    border: 1px solid var(--rule);
    border-radius: 6px;
    overflow: hidden;
    background: var(--wash);
}

.row-image img { display: block; width: 100%; height: 100%; object-fit: cover; }

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 28px 0 0;
    font-size: 14px;
    color: var(--muted);
}

.pagination-links { display: flex; gap: 28px; }
.pagination-links a { color: var(--ink); }
.pagination-links a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* --------------------------------------------------------------------------
   Page headers (archive, topic, author, Topics page, errors)
   -------------------------------------------------------------------------- */

.page-head {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 760px;
    padding-bottom: 48px;
}

.page-banner {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 10px;
}

.page-title {
    margin: 0;
    font: 400 64px/1.02 var(--serif);
    letter-spacing: -0.025em;
    text-wrap: balance;
}

.page-dek {
    margin: 0;
    font: 400 22px/1.5 var(--serif-body);
    color: var(--muted);
    text-wrap: pretty;
}

.profile-row { display: flex; align-items: center; gap: 24px; }

.profile-photo {
    flex: none;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-photo.avatar-initials { font-size: 30px; }

.profile .page-title { font-size: 52px; }

/* Topics page */
.topics { border-top: 1px solid var(--rule); max-width: 760px; }

.topic {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 32px 0;
    border-bottom: 1px solid var(--rule);
}

.topic-head { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; }

.topic-title { margin: 0; font: 400 36px/1.1 var(--serif); letter-spacing: -0.015em; }
.topic-title a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }

.topic-dek { margin: 0; font: 400 18px/1.55 var(--serif-body); color: var(--muted); }

.topic-posts { margin: 4px 0; padding: 0; list-style: none; }

.topic-posts li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 24px;
    padding: 8px 0;
    border-top: 1px solid var(--rule);
    font: 400 18px/1.4 var(--serif);
}

.topic-posts a:hover { text-decoration: underline; text-underline-offset: 3px; }
.topic-posts .meta { flex: none; font-size: 12px; }

.topics-intro { margin-bottom: 40px; }

/* --------------------------------------------------------------------------
   Essay page
   -------------------------------------------------------------------------- */

.entry-head {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 760px;
    padding-bottom: 40px;
}

.entry-title {
    margin: 0;
    font: 400 64px/1.02 var(--serif);
    letter-spacing: -0.025em;
    text-wrap: balance;
}

.entry-dek {
    margin: 0;
    font: 400 22px/1.5 var(--serif-body);
    color: var(--muted);
    text-wrap: pretty;
}

.entry-byline { margin: 0; font-size: 14px; color: var(--muted); }
.entry-byline a { color: var(--ink); font-weight: 500; }
.entry-byline a:hover { text-decoration: underline; text-underline-offset: 3px; }

.feature-image { max-width: var(--wide); margin: 0 0 48px; }

.feature-image img {
    display: block;
    width: 100%;
    max-height: min(70vh, 640px);
    object-fit: cover;
    border-radius: 6px;
    background: var(--wash);
}

.feature-image figcaption,
.gh-content figcaption {
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
}

/* Content column: left-aligned with the headings; wide cards extend right. */
.gh-canvas {
    display: grid;
    grid-template-columns:
        [full-start wide-start main-start] minmax(0, var(--measure))
        [main-end] minmax(0, calc(var(--wide) - var(--measure)))
        [wide-end] minmax(0, 1fr) [full-end];
}

.gh-canvas > * { grid-column: main; }
.gh-canvas > .kg-width-wide { grid-column: wide; }
.gh-canvas > .kg-width-full { grid-column: full; }

.gh-content {
    font: 400 20px/1.7 var(--serif-body);
    color: var(--ink);
}

.gh-content > * { margin-top: 0; margin-bottom: 0; }
.gh-content > * + * { margin-top: 1.3em; }

.gh-content > p, .gh-content > ul, .gh-content > ol { text-wrap: pretty; }

.has-drop-cap .post:not(.page) .gh-content > p:first-child::first-letter {
    float: left;
    margin: 0.08em 0.1em 0 0;
    font: 500 3.4em/0.8 var(--serif);
    color: var(--accent);
}

@supports (initial-letter: 2) or (-webkit-initial-letter: 2) {
    .has-drop-cap .post:not(.page) .gh-content > p:first-child::first-letter {
        float: none;
        margin: 0 0.08em 0 0;
        font-size: inherit;
        line-height: inherit;
        -webkit-initial-letter: 2;
        initial-letter: 2;
    }
}

.gh-content h2, .gh-content h3, .gh-content h4 {
    font-family: var(--serif);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.015em;
    text-wrap: balance;
}

.gh-content > h2 { margin-top: 1.9em; font-size: 34px; }
.gh-content > h3 { margin-top: 1.7em; font-size: 26px; }
.gh-content > h4 { margin-top: 1.6em; font-size: 21px; }
.gh-content > :is(h2, h3, h4) + * { margin-top: 0.55em; }

.gh-content a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.gh-content ul, .gh-content ol { padding-left: 1.3em; }
.gh-content li + li { margin-top: 0.4em; }
.gh-content li::marker { color: var(--muted); }
.gh-content strong { font-weight: 600; }

.gh-content blockquote:not([class]) {
    margin-inline: 0;
    padding-left: 1.1em;
    border-left: 2px solid var(--accent);
    font-style: italic;
    color: var(--ink-soft);
}

.gh-content blockquote.kg-blockquote-alt {
    margin-block: 1.8em;
    padding: 0;
    border: 0;
    font: italic 400 30px/1.35 var(--serif);
    text-align: left;
    color: var(--ink);
}

.gh-content hr {
    height: 1px;
    margin-block: 2.4em;
    border: 0;
    background: var(--rule);
}

.gh-content > hr + * { margin-top: 0; }

.gh-content figure { margin-inline: 0; }
.gh-content .kg-image-card img { border-radius: 6px; }
.gh-content .kg-width-full img { border-radius: 0; }

.gh-content code {
    font-family: var(--mono);
    font-size: 0.85em;
    padding: 0.1em 0.3em;
    border-radius: 4px;
    background: var(--wash);
}

.gh-content pre {
    overflow-x: auto;
    padding: 1.2em 1.4em;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: var(--wash);
    font-size: 0.8em;
    line-height: 1.55;
}

.gh-content pre code { padding: 0; background: none; }

.gh-content table { width: 100%; border-collapse: collapse; font: 400 15px/1.5 var(--sans); }
.gh-content th, .gh-content td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.gh-content th { font-weight: 500; }

.gh-content .kg-callout-card,
.gh-content .kg-toggle-card,
.gh-content .kg-bookmark-card a.kg-bookmark-container { border-radius: 6px; }
.gh-content .kg-bookmark-card a.kg-bookmark-container { border-color: var(--rule); color: var(--ink); text-decoration: none; }
.gh-content .kg-bookmark-title { font-family: var(--sans); font-weight: 500; }
.gh-content .kg-bookmark-description, .gh-content .kg-bookmark-metadata { font-family: var(--sans); color: var(--muted); }
.gh-content .kg-toggle-card { border-color: var(--rule); }
.gh-content .kg-button-card a.kg-btn { border-radius: 4px; font-family: var(--sans); text-decoration: none; }

/* End of essay */
.entry-foot {
    display: flex;
    flex-direction: column;
    gap: 28px;
    max-width: var(--measure);
    margin-top: 56px;
    padding-top: 28px;
    border-top: 1px solid var(--rule);
}

.share {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 20px;
    font-size: 14px;
}

.share a, .link-button { color: var(--ink); }
.share a:hover, .link-button:hover { color: var(--accent); }

.link-button { padding: 0; border: 0; background: none; font-size: 14px; cursor: pointer; }

.copy-done { display: none; }
.is-copied .copy-default { display: none; }
.is-copied .copy-done { display: inline; }

.entry-tags { margin: 0; font-size: 14px; color: var(--muted); }
.entry-tags a { color: var(--accent); }
.entry-tags a:hover { text-decoration: underline; text-underline-offset: 3px; }

.author-box {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    padding: 24px;
    border-radius: 6px;
    background: var(--wash);
}

.avatar-lg { width: 64px; height: 64px; }
.avatar-lg.avatar-initials { font-size: 20px; }

.author-box-name { margin: 2px 0 0; font: 500 22px/1.3 var(--serif); }
.author-box-bio { margin: 6px 0 12px; font: 400 17px/1.55 var(--serif-body); color: var(--muted); }

.post-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.post-nav-link {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 0;
    border-top: 1px solid var(--rule);
}

.post-nav-older { text-align: right; align-items: flex-end; }
.post-nav-older:only-child { grid-column: 1 / -1; }

.post-nav-title { font: 400 22px/1.25 var(--serif); }
.post-nav-link:hover .post-nav-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }

.comments { max-width: var(--measure); margin-top: 56px; }
.comments iframe { color-scheme: normal; }

.related { max-width: 760px; margin-top: 64px; }
.related .stream { border-top: 1px solid var(--rule); }

/* --------------------------------------------------------------------------
   Search window
   -------------------------------------------------------------------------- */

.search-dialog {
    width: min(640px, calc(100% - 32px));
    max-width: none;
    max-height: min(80vh, 720px);
    margin: 10vh auto auto;
    padding: 0;
    border: 1px solid var(--rule);
    border-radius: 10px;
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 24px 64px rgb(0 0 0 / 0.22);
}

.search-dialog[open] { display: flex; }
.search-dialog::backdrop { background: rgb(10 12 16 / 0.45); backdrop-filter: blur(3px); }

.search-panel { display: flex; flex-direction: column; width: 100%; min-height: 0; padding: 24px; }

.search-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }

.search-label { font: 500 22px/1.2 var(--serif); }

.dialog-close {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: none;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
}

.dialog-close svg { width: 16px; height: 16px; }
.dialog-close:hover { color: var(--ink); }

.search-field { position: relative; }

.search-field svg {
    position: absolute;
    top: 50%;
    left: 12px;
    width: 18px;
    height: 18px;
    translate: 0 -50%;
    color: var(--muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border: 1px solid var(--rule);
    border-radius: 6px;
    background: var(--wash);
    color: var(--ink);
    font: 400 17px var(--sans);
}

.search-input:focus { outline: none; border-color: var(--accent); }
.search-input::placeholder { color: var(--muted); opacity: 1; }

.search-status { margin: 14px 0 6px; font-size: 13px; color: var(--muted); }

.search-results { flex: 1; min-height: 0; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.search-results li + li { border-top: 1px solid var(--rule); }
.search-results a { display: block; padding: 14px 8px; border-radius: 6px; }
.search-results a:hover, .search-results a:focus-visible { background: var(--wash); }

.search-result-title { display: block; font: 400 21px/1.25 var(--serif); }
.search-result-excerpt {
    display: -webkit-box;
    margin-top: 4px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font: 400 15px/1.5 var(--serif-body);
    color: var(--muted);
}
.search-result-meta { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }
.search-results mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 2px; }

/* --------------------------------------------------------------------------
   Medium screens
   -------------------------------------------------------------------------- */

@media (max-width: 1180px) {
    :root { --rail: 320px; --pad: 44px; }
    .rail-inner { padding: 36px 32px; }
    .lead-title, .page-title, .entry-title { font-size: 54px; }
}

/* --------------------------------------------------------------------------
   Small screens: one column. The rail's parts are placed around the stream:
   top bar, intro, topics, stream, sign-up, footer.
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
    :root { --pad: 20px; }

    .shell { display: flex; flex-direction: column; }
    .rail, .rail-inner, .stage { display: contents; }
    .rail { position: static; height: auto; }

    .topbar { order: 1; }
    .rail-id { order: 2; }
    .rail-author { order: 3; }
    .topic-list { order: 4; }
    .stage-main { order: 5; }
    .rail-subscribe { order: 6; }
    .rail-foot { order: 7; }

    .rail-id,
    .rail-author,
    .topic-list,
    .rail-subscribe,
    .rail-foot { padding-inline: var(--pad); }

    .rail-id { padding-top: 28px; gap: 10px; }
    .rail-id .rail-brand { display: none; }
    .rail-tagline { font-size: 20px; }
    .rail-author { padding-top: 16px; }

    /* Topics become a row of chips that scrolls sideways. */
    .topic-list { padding-top: 24px; }
    .topic-list .rail-label { display: none; }
    .topic-list ul {
        flex-direction: row;
        gap: 8px;
        overflow-x: auto;
        scrollbar-width: none;
        margin-inline: calc(var(--pad) * -1);
        padding-inline: var(--pad);
    }
    .topic-list ul::-webkit-scrollbar { display: none; }
    .topic-link {
        flex: none;
        gap: 8px;
        min-height: 40px;
        padding: 8px 14px;
        border: 1px solid var(--rule);
        border-radius: 999px;
        font-size: 14px;
    }
    .topic-link.is-active { border-color: var(--ink); }

    .stage-main { padding: 32px var(--pad) 48px; }

    .rail-subscribe {
        margin: 0 var(--pad);
        padding: 24px;
        border-radius: 6px;
        background: var(--wash);
    }

    .rail-foot { padding-block: 32px 40px; }

    /* Top bar: brand, Search and Menu; the menu opens as a panel. */
    .topbar {
        position: sticky;
        top: 0;
        z-index: 20;
        padding: 14px var(--pad);
        border-bottom: 1px solid var(--rule);
        background: var(--paper);
    }

    .topbar-brand {
        display: block;
        margin-right: auto;
        font: 500 24px/1 var(--serif);
        letter-spacing: -0.02em;
        color: var(--ink);
    }

    .header-only { display: none !important; }

    .topbar-tools { gap: 16px; }

    .tool-link, .menu-button { min-height: 40px; }

    .menu-button {
        display: inline-flex;
        align-items: center;
        padding: 8px 14px;
        border: 1px solid var(--rule);
        border-radius: 999px;
        background: none;
        color: var(--ink);
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
    }

    .menu-close-label { display: none; }
    .menu-button[aria-expanded="true"] .menu-open-label { display: none; }
    .menu-button[aria-expanded="true"] .menu-close-label { display: inline; }

    .nav-panel {
        position: fixed;
        inset: var(--header-h, 69px) 0 0 0;
        z-index: 19;
        display: none;
        flex-direction: column;
        align-items: stretch;
        overflow-y: auto;
        padding: 8px var(--pad) 40px;
        background: var(--paper);
    }

    .site-header.menu-open .nav-panel { display: flex; }

    .nav-list { flex-direction: column; align-items: stretch; gap: 0; }
    .nav-list > .nav-item { border-bottom: 1px solid var(--rule); }

    .nav-link, .nav-toggle {
        width: 100%;
        justify-content: space-between;
        min-height: 56px;
        font: 400 26px/1.2 var(--serif);
        color: var(--ink);
    }

    .nav-list > .is-current > .nav-link { color: var(--accent); }

    .submenu {
        position: static;
        min-width: 0;
        padding: 0 0 12px 16px;
        border: 0;
        background: none;
        box-shadow: none;
    }

    .submenu .nav-link { min-height: 44px; padding: 0; font-size: 20px; }
    .submenu .nav-link:hover, .submenu .is-current > .nav-link { background: none; color: var(--accent); }

    .panel-extras { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }

    .panel-extras .tool-link,
    .panel-row {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 48px;
        border: 1px solid var(--rule);
        border-radius: 999px;
        background: none;
        color: var(--ink);
        font-size: 15px;
        font-weight: 500;
        cursor: pointer;
    }

    .panel-extras .tool-accent { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }

    .menu-locked { overflow: hidden; }

    .lead-title, .page-title, .entry-title { font-size: 40px; line-height: 1.06; }
    .profile .page-title { font-size: 36px; }
    .lead-excerpt, .page-dek, .entry-dek { font-size: 19px; }
    .lead { padding-bottom: 40px; }

    .row { gap: 16px; padding: 24px 0; }
    .row-title { font-size: 24px; }
    .row-excerpt { font-size: 16px; }
    .row-image { width: 88px; height: 88px; }

    .gh-content { font-size: 19px; }
    .gh-content > h2 { font-size: 28px; }
    .gh-content > h3 { font-size: 23px; }

    .feature-image { margin-inline: calc(var(--pad) * -1); }
    .feature-image img { border-radius: 0; }
    .feature-image figcaption { padding-inline: var(--pad); }

    .post-nav-older { text-align: left; align-items: flex-start; }
    .profile-row { flex-direction: column; align-items: flex-start; gap: 16px; }
    .topic-title { font-size: 30px; }

    .search-dialog { width: 100%; height: 100%; max-height: none; margin: 0; border: 0; border-radius: 0; }
    .search-panel { padding: 16px var(--pad); }
}

@media (prefers-reduced-motion: reduce) {
    .chevron { transition: none; }
}

@media print {
    .rail, .topbar, .share, .comments, .related, .post-nav, .search-dialog { display: none !important; }
    .shell { display: block; }
    body { background: #fff; color: #000; }
}
