/* Long-form article (prose) styles — prepared for the upcoming blog.
   Wrap rendered post body in <div class="app-prose"> … </div>. */
.app-prose {
    max-width: var(--app-prose-width);
    color: var(--app-text);
    font-size: 1.05rem;
    line-height: 1.75;
}

.app-prose > * + * {
    margin-top: 1.1rem;
}

/* Wide Markdown tables scroll horizontally instead of overflowing the viewport
   on mobile (the renderer's <table> output can't carry a wrapper class). */
.app-prose :where(table) {
    display: block;
    width: max-content;
    max-width: 100%;
    overflow-x: auto;
}

.app-prose h2,
.app-prose h3,
.app-prose h4 {
    margin-top: 2.25rem;
    scroll-margin-top: 5rem;
}

.app-prose a {
    text-decoration: underline;
}

/* Internal cross-reference whose target post is not published yet: shown as muted,
   non-clickable text with a "planned" badge (resolved on render, see
   apps/blog/markdown.py). Becomes a real link automatically once the target goes
   live, so no styling change is needed there. */
.app-link-planned {
    color: var(--app-muted);
    border-bottom: 1px dotted var(--app-muted);
    cursor: help;
}

.app-link-planned__badge {
    margin-left: 0.35em;
    padding: 0 0.35em;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    font-family: var(--app-font-mono);
    font-size: 0.78em;
    text-transform: lowercase;
}

.app-prose ul,
.app-prose ol {
    padding-left: 1.4rem;
}

.app-prose li + li {
    margin-top: 0.4rem;
}

.app-prose blockquote {
    margin: 1.5rem 0;
    padding: 0.6rem 1.2rem;
    border-left: 3px solid var(--app-green-strong);
    color: var(--app-muted);
    font-style: italic;
}

.app-prose pre {
    margin-block: 1.5rem;
}

.app-prose img {
    margin-block: 1.5rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
}

/* Detail page: keep the whole article (header, cover, prose, comments) in a
   single readable column, left-aligned, so the wide window frame doesn't strand
   a narrow text block beside empty space. */
.app-article {
    max-width: var(--app-article-width);
}

/* Mono metadata line for article headers (date · reading time · tags). */
.app-post-meta {
    color: var(--app-muted);
    font-family: var(--app-font-mono);
    font-size: 0.85rem;
}

/* Code blocks: keep the Pygments token colours, but the container matches the
   app surface instead of the theme's own (warm) background. */
.app-prose .codehilite {
    margin-block: 1.5rem;
    overflow: auto;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    background: var(--app-bg-soft);
}

.app-prose .codehilite pre {
    margin: 0;
    padding: 1rem 1.1rem;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
}

/* Post list (homepage) — terminal `ls -l` style rows. */
.app-post-list {
    margin-top: 1.75rem;
    border-top: 1px solid var(--app-border);
}

.app-post-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0 1.5rem;
    padding: 1.25rem 0.75rem;
    border-bottom: 1px solid var(--app-border);
    transition: background var(--app-transition);
}

/* Hover highlights the whole row, like a selected line in a file listing. */
.app-post-row:hover {
    background: var(--app-green-soft);
}

/* One `ls -l`-style line above the title: date · reading time · file name. */
.app-post-row__meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0 0 0.4rem;
    color: var(--app-muted);
    font-family: var(--app-font-mono);
    font-size: 0.78rem;
    white-space: nowrap;
}

.app-post-row__date + .app-post-row__read::before,
.app-post-row__file::before {
    margin-right: 0.6rem;
    color: var(--app-faint);
    content: "·";
}

.app-post-row__read {
    color: var(--app-faint);
}

/* Long slugs truncate instead of wrapping the meta line. */
.app-post-row__file {
    min-width: 0;
    overflow: hidden;
    color: var(--app-faint);
    text-overflow: ellipsis;
}

.app-post-row__title {
    margin: 0;
    font-family: var(--app-font-mono);
    font-size: 1.2rem;
    line-height: 1.35;
}

.app-post-row__title a {
    color: var(--app-text-strong);
    text-decoration: none;
}

.app-post-row__title a:hover {
    color: var(--app-link);
}

/* Clamp to three lines so rows next to a cover stay a similar height. */
.app-post-row__summary {
    display: -webkit-box;
    margin-top: 0.5rem;
    overflow: hidden;
    color: var(--app-muted);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.app-post-row__summary::before {
    margin-right: 0.4ch;
    color: var(--app-green);
    content: ">";
}

/* Cover images. */
.app-post-cover {
    width: 100%;
    /* height:auto lets the browser derive the box height from the width/height
       attributes' aspect ratio, reserving space before load (prevents CLS)
       without distorting the image. No max-height: covers are made at the
       og:image size (1200x630), and capping the height would crop them. */
    height: auto;
    margin-bottom: 1.5rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
}

/* Row with a cover: the image leads and stretches to the height of the text
   block next to it. The image is absolutely positioned, so it never adds
   height of its own; object-fit crops it to whatever the row needs. */
.app-post-row--has-cover {
    grid-template-columns: min(24rem, 38%) minmax(0, 1fr);
}

.app-post-row__thumb {
    position: relative;
    display: block;
    min-height: 9rem;
    overflow: hidden;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    transition: border-color var(--app-transition);
}

.app-post-row__thumb img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--app-transition);
}

.app-post-row:hover .app-post-row__thumb {
    border-color: var(--app-green);
}

.app-post-row:hover .app-post-row__thumb img {
    transform: scale(1.03);
}

@media (prefers-reduced-motion: reduce) {
    .app-post-row:hover .app-post-row__thumb img {
        transform: none;
    }
}

/* Phones: the cover stacks above the text at full width, back at its own
   1200x630 ratio since there is no text block beside it to match. */
@media (max-width: 575.98px) {
    .app-post-row,
    .app-post-row--has-cover {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.85rem 0;
    }

    .app-post-row__thumb {
        min-height: 0;
    }

    .app-post-row__thumb img {
        position: static;
        height: auto;
        aspect-ratio: 1200 / 630;
    }
}

.app-post-detail-meta {
    margin-bottom: 1.75rem;
}

.app-draft-flag {
    color: var(--app-warning);
}

/* Staff-only status chip in the drafts & scheduled listing. */
.app-post-row__status {
    flex-shrink: 0;
    padding: 0.05rem 0.4rem;
    border: 1px solid var(--app-border-strong);
    border-radius: var(--app-radius-sm);
    color: var(--app-warning);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.app-post-row__status--scheduled {
    color: var(--app-info);
}

/* Page-level staff action row (e.g. "edit series" on a series page). */
.app-page-actions {
    margin: -0.5rem 0 1.5rem;
}

/* Search form (on the /search/ page). */
.app-search-form {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 2rem;
}

.app-search-input {
    flex: 1;
}

/* Tags (chips). */
.app-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.75rem;
}

.app-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-sm);
    color: var(--app-muted);
    font-family: var(--app-font-mono);
    font-size: 0.78rem;
    text-decoration: none;
}

.app-tag::before {
    margin-right: 0.15rem;
    color: var(--app-green);
    content: "#";
}

.app-tag:hover {
    border-color: var(--app-green);
    color: var(--app-text-strong);
}

.app-post-footer {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--app-border);
}

/* Public profile page. */
.app-profile-meta {
    margin-top: 0.5rem;
}

.app-profile-actions {
    margin-top: 1.5rem;
}

.app-profile-comments {
    margin-top: 2.5rem;
}

/* Comments. */
.app-comments {
    max-width: var(--app-prose-width);
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--app-border);
}

.app-comments__title {
    margin-bottom: 1.25rem;
    font-family: var(--app-font-mono);
    font-size: 1.1rem;
}

.app-comments__title::before {
    margin-right: 0.5ch;
    color: var(--app-green);
    content: "//";
}

.app-comment {
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--app-border);
}

.app-comment__meta {
    margin-bottom: 0.35rem;
    color: var(--app-muted);
    font-family: var(--app-font-mono);
    font-size: 0.8rem;
}

.app-comment__author {
    color: var(--app-text-strong);
}

.app-comment-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.app-comment-login {
    margin-top: 1.25rem;
}

/* --- Comment replies (one level) ----------------------------------------- */
.app-comment--reply {
    margin-top: 0.9rem;
    margin-left: 1.25rem;
    padding-left: 0.9rem;
    border-left: 2px solid var(--app-border-strong);
}

.app-reply {
    margin-top: 0.6rem;
}

.app-reply__toggle {
    display: inline-block;
    color: var(--app-link);
    font-family: var(--app-font-mono);
    font-size: 0.8rem;
    cursor: pointer;
}

.app-reply__toggle::before {
    content: "↳ ";
    color: var(--app-faint);
}

.app-reply__form {
    margin-top: 0.75rem;
}

.app-reply__input {
    width: 100%;
    box-sizing: border-box;
}

/* --- Table of contents --------------------------------------------------- */
.app-toc {
    margin: 1.5rem 0;
    padding: 0.85rem 1.1rem;
    border: 1px solid var(--app-border);
    border-left: 2px solid var(--app-green);
    border-radius: var(--app-radius);
    background: var(--app-bg-soft);
}

.app-toc__title {
    margin: 0 0 0.4rem;
    color: var(--app-muted);
    font-family: var(--app-font-mono);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.app-toc .toc {
    font-size: 0.92rem;
}

.app-toc .toc ul {
    margin: 0;
    padding-left: 1.1rem;
    list-style: none;
}

.app-toc .toc > ul {
    padding-left: 0;
}

.app-toc .toc li {
    margin: 0.15rem 0;
}

.app-toc .toc a {
    color: var(--app-link);
}

.app-toc .toc a:hover {
    color: var(--app-link-hover);
}

/* Scrollspy: app.js marks the section currently being read (reading pager). */
.app-toc .toc a.is-active {
    color: var(--app-green);
}

.app-toc .toc a.is-active::before {
    content: "› ";
}

/* --- Related posts ------------------------------------------------------- */
.app-related {
    margin-top: 2.5rem;
}

.app-related__title {
    margin: 0 0 0.9rem;
    font-size: 1.05rem;
    color: var(--app-text-strong);
}

.app-related__title::before {
    content: "// ";
    color: var(--app-green);
}

.app-related__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.app-related__item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--app-border);
}

.app-related__item:last-child {
    border-bottom: 0;
}

.app-related__link {
    color: var(--app-link);
    font-weight: 600;
}

.app-related__summary {
    color: var(--app-muted);
    font-size: 0.88rem;
}

/* --- Branch graph (homepage) ---------------------------------------------- */
/* The blog's history like `git log --graph`: main plus one lane per series,
   one dot per post in publish order. The SVG geometry is fixed in px (ROW in
   apps/blog/branch_graph.py = 26px; keep --graph-row in sync), so the HTML
   lane labels line up with the lanes and the SVG scrolls sideways instead of
   shrinking. app.js marks the hovered lane (.is-active) and, with the reading
   log on, sets data-state="open|started|read" on each commit. */
.app-graph {
    --graph-row: 26px;
    --graph-axis: 22px;
    margin: 1.75rem 0 0;
    padding: 0.85rem 1.1rem 0.75rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    background: var(--app-bg-soft);
    font-family: var(--app-font-mono);
    font-size: 0.8rem;
}

.app-graph__cmd {
    margin: 0 0 0.6rem;
    color: var(--app-text);
    font-family: var(--app-font-mono);
    font-size: 0.8rem;
    font-weight: 400;
}

.app-graph__cmd::before {
    color: var(--app-green);
    content: "$ ";
}

.app-graph__body {
    display: grid;
    grid-template-columns: minmax(7rem, 13rem) minmax(0, 1fr);
    gap: 0 0.5rem;
}

.app-graph__lanes {
    margin: 0;
    padding: 0 0 var(--graph-axis);
    list-style: none;
}

.app-graph__lane {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    height: var(--graph-row);
    transition: opacity var(--app-transition);
}

.app-graph__branch {
    overflow: hidden;
    color: var(--hue);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-graph__branch::before {
    color: var(--app-faint);
    content: "⎇ ";
}

a.app-graph__branch:hover,
a.app-graph__branch:focus-visible {
    color: var(--app-text-strong);
    text-decoration: underline;
}

.app-graph__branch--main {
    color: var(--app-text);
}

.app-graph__count {
    flex-shrink: 0;
    margin-left: auto;
    color: var(--app-faint);
    font-size: 0.72rem;
}

.app-graph__scroll {
    overflow-x: auto;
    scrollbar-color: var(--app-border-strong) transparent;
    scrollbar-width: thin;
}

.app-graph__svg {
    display: block;
    max-width: none;
    overflow: visible;
}

.app-graph__grid {
    stroke: var(--app-border);
    stroke-dasharray: 2 3;
}

.app-graph__tick {
    fill: var(--app-faint);
    font-family: var(--app-font-mono);
    font-size: 10px;
}

.app-graph__line {
    fill: none;
    stroke: var(--hue);
    stroke-linecap: round;
    stroke-width: 2;
    opacity: 0.55;
}

.app-graph__g {
    transition: opacity var(--app-transition);
}

.app-graph__commit circle {
    fill: var(--hue);
    stroke: var(--app-bg-soft);
    stroke-width: 2;
    transition: r var(--app-transition), stroke var(--app-transition);
}

.app-graph__commit:hover circle,
.app-graph__commit:focus-visible circle {
    r: 7px;
    stroke: var(--app-text-strong);
}

.app-graph__commit:focus-visible {
    outline: none;
}

/* HEAD: a ring around the newest commit, like a cursor on the last line. */
.app-graph__commit.is-head circle {
    stroke: var(--app-green);
}

/* Reading log on: open = hollow ring, started = half-filled look, read = solid. */
.app-graph__commit[data-state="open"] circle {
    fill: var(--app-bg-soft);
    stroke: var(--hue);
    stroke-width: 1.5;
}

.app-graph__commit[data-state="started"] circle {
    fill: var(--app-bg-soft);
    stroke: var(--hue);
    stroke-dasharray: 2 2;
    stroke-width: 2.5;
}

/* Hovering a commit or a branch label dims the other lanes. */
.app-graph.has-active .app-graph__g:not(.is-active),
.app-graph.has-active .app-graph__lane:not(.is-active) {
    opacity: 0.3;
}

.app-graph__preview {
    overflow: hidden;
    min-height: 1.2em;
    margin: 0.45rem 0 0;
    padding-top: 0.45rem;
    border-top: 1px solid var(--app-border);
    color: var(--app-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-graph__ref {
    color: var(--app-green);
}

@media (max-width: 640px) {
    .app-graph {
        padding: 0.75rem 0.75rem 0.65rem;
    }

    .app-graph__body {
        grid-template-columns: 6.5rem minmax(0, 1fr);
    }

    .app-graph__count {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-graph__lane,
    .app-graph__g,
    .app-graph__commit circle {
        transition: none;
    }
}

/* --- Series map ----------------------------------------------------------- */
/* One numbered cell per published part, like a block map, instead of a list
   of long titles. The short part title shows in the preview line (hover or
   focus a cell) and in the prev/next links. app.js sets data-state on each
   cell from the per-browser reading log: open, started or read. */
.app-track {
    font-family: var(--app-font-mono);
    font-size: 0.82rem;
}

.app-track--inline {
    margin: 1.5rem 0;
    padding: 0.85rem 1.1rem 1rem;
    border: 1px solid var(--app-border);
    border-left: 2px solid var(--app-link);
    border-radius: var(--app-radius);
    background: var(--app-bg-soft);
}

.app-track--rail {
    margin: 0 0 1.25rem;
    padding: 0 0 1.1rem;
    border-bottom: 1px solid var(--app-border);
}

.app-track__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0 0 0.65rem;
}

.app-track__name {
    min-width: 0;
    color: var(--app-text-strong);
    font-weight: 600;
}

.app-track__name:hover {
    color: var(--app-link-hover);
}

.app-track--rail .app-track__name {
    color: var(--app-muted);
    font-size: 0.72rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.app-track__count {
    flex-shrink: 0;
    color: var(--app-faint);
    font-size: 0.75rem;
    white-space: nowrap;
}

.app-track__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(2.25rem, 1fr));
    gap: 0.3rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.app-track--rail .app-track__grid {
    grid-template-columns: repeat(auto-fill, minmax(1.95rem, 1fr));
    gap: 0.25rem;
}

.app-track__cell {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 1.95rem;
    border: 1px solid var(--app-border-strong);
    border-radius: var(--app-radius-sm);
    color: var(--app-muted);
    font-variant-numeric: tabular-nums;
    text-decoration: none;
    transition: background var(--app-transition), border-color var(--app-transition), color var(--app-transition);
}

a.app-track__cell:hover,
a.app-track__cell:focus-visible {
    border-color: var(--app-link);
    background: var(--app-link-soft);
    color: var(--app-text-strong);
}

a.app-track__cell:focus-visible {
    outline: 2px solid var(--app-link);
    outline-offset: 1px;
}

.app-track__cell[data-state="started"] {
    border-style: dashed;
    border-color: var(--app-green);
    color: var(--app-text);
}

.app-track__cell[data-state="read"] {
    border-color: var(--app-green);
    background: var(--app-green-soft);
    color: var(--app-green);
}

/* "You are here": a solid block, like the prompt cursor in the navbar. */
.app-track__cell.is-current {
    border-style: solid;
    border-color: var(--app-green);
    background: var(--app-green);
    color: var(--app-bg);
    font-weight: 700;
}

.app-track__preview {
    display: -webkit-box;
    min-height: 2.6em;
    margin: 0.6rem 0 0;
    overflow: hidden;
    color: var(--app-text-strong);
    font-family: var(--app-font-sans);
    font-size: 0.88rem;
    line-height: 1.3;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.app-track__nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin: 0.7rem 0 0;
}

.app-track--rail .app-track__nav {
    grid-template-columns: 1fr;
    gap: 0.4rem;
}

/* Phones: stack the prev/next cards so a lone card isn't half-width. */
@media (max-width: 575.98px) {
    .app-track__nav {
        grid-template-columns: 1fr;
    }
}

.app-track__link {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    color: var(--app-text);
    text-decoration: none;
    transition: border-color var(--app-transition), background var(--app-transition);
}

.app-track__link:hover,
.app-track__link:focus-visible {
    border-color: var(--app-link);
    background: var(--app-link-soft);
}

.app-track__link--next {
    grid-column: -2;
    text-align: right;
}

.app-track__dir {
    color: var(--app-link);
    font-size: 0.72rem;
}

.app-track__link-title {
    display: -webkit-box;
    overflow: hidden;
    font-family: var(--app-font-sans);
    font-size: 0.85rem;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.app-track__legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem 0.8rem;
    margin: 0.7rem 0 0;
    color: var(--app-faint);
    font-size: 0.7rem;
}

.app-track__legend[hidden] {
    display: none;
}

.app-track__key::before {
    display: inline-block;
    width: 0.6rem;
    height: 0.6rem;
    margin-right: 0.3rem;
    border: 1px solid var(--app-border-strong);
    border-radius: var(--app-radius-sm);
    vertical-align: -0.05rem;
    content: "";
}

.app-track__key--read::before {
    border-color: var(--app-green);
    background: var(--app-green-soft);
}

.app-track__key--started::before {
    border-style: dashed;
    border-color: var(--app-green);
}

.app-track__keys {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.8rem;
}

.app-track__keys[hidden] {
    display: none;
}

.app-track__tally {
    color: var(--app-green);
}

.app-track__tally:empty {
    display: none;
}

/* Opt-in switch for the reading log: a quiet text button. */
.app-track__remember {
    margin-left: auto;
    padding: 0;
    border: 0;
    background: none;
    color: var(--app-link);
    font: inherit;
    text-decoration: underline dotted;
    text-underline-offset: 0.2em;
    cursor: pointer;
}

.app-track__remember:hover {
    color: var(--app-link-hover);
}

.app-track__remember:focus-visible {
    outline: 2px solid var(--app-link);
    outline-offset: 2px;
}

/* --- Detail outline rail — a floating mini terminal window ---------------- */
/* The rail is taken OUT OF FLOW (position: fixed) so the article column is
   byte-for-byte identical whether or not a rail exists — no reserved column,
   no reflow. It sits OUTSIDE the centred main window, in the right margin —
   which only fits on wide viewports, so the breakpoint is high; below it the
   inline TOC takes over. */
.app-detail__rail {
    display: none;
}

/* Breakpoint = main window (--app-content-width: 1020px) + rail (16rem) + gaps;
   keep it in sync if --app-content-width changes (media queries can't read vars). */
@media (min-width: 1580px) {
    .app-detail__rail {
        display: block;
        position: fixed;
        /* Flush with the main window's top edge: sticky navbar (3.5rem + 1px
           border) + the window's 1.75rem top margin. Stays fixed while scrolling. */
        top: calc(3.5rem + 1.75rem + 1px);
        /* Anchor just past the centred window's right edge (half its width from
           centre) so the panel lives outside the main window. Tied to the token
           so it follows --app-content-width. fixed is not clipped by overflow. */
        left: calc(50vw + var(--app-content-width) / 2 + 6px);
        width: var(--app-rail-width);
        max-height: calc(100vh - 7rem);
        overflow-y: auto;
        z-index: 40;
        /* Its own little terminal window: frame + lift, mirroring .app-window. */
        border: 1px solid var(--app-border-strong);
        border-radius: var(--app-radius-lg);
        background: var(--app-bg-soft);
        box-shadow: var(--app-shadow);
    }

    /* The floating rail carries the TOC and series map, so the inline ones step aside. */
    .app-toc--inline,
    .app-track--inline {
        display: none;
    }
}

/* Mini-window chrome for the rail (title bar + traffic-light dots + body). */
.app-rail__bar {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.7rem;
    border-bottom: 1px solid var(--app-border);
    background: var(--app-term-titlebar);
    font-family: var(--app-font-mono);
    font-size: 0.72rem;
    color: var(--app-muted);
}

.app-rail__dots {
    display: inline-flex;
    flex-shrink: 0;
    gap: 0.35rem;
}

.app-rail__dots i {
    display: block;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: var(--app-radius-pill);
    background: var(--app-faint);
}

.app-rail__dots i:nth-child(1) {
    background: var(--app-danger);
}

.app-rail__dots i:nth-child(2) {
    background: var(--app-warning);
}

.app-rail__dots i:nth-child(3) {
    background: var(--app-success);
}

.app-rail__label::before {
    color: var(--app-faint);
    content: "geekblog:";
}

.app-rail__body {
    padding: 0.95rem 1rem 1.1rem;
}

/* Rail TOC — drop the boxed look of the inline TOC (the rail frame contains it). */
.app-toc--rail {
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
}

.app-toc--rail .toc {
    font-size: 0.84rem;
}

/* Google-style SERP snippet preview in the post editor (enhanced by app.js). */
.app-serp {
    margin: 2.5rem 0 1rem;
}

.app-serp__label {
    margin-bottom: 0.5rem;
    color: var(--app-muted);
    font-family: var(--app-font-mono);
    font-size: 0.8rem;
}

.app-serp__card {
    max-width: 600px;
    padding: 0.9rem 1rem;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    background: var(--app-surface);
}

.app-serp__url {
    display: block;
    color: var(--app-green);
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-serp__title {
    display: block;
    margin: 0.2rem 0;
    color: var(--app-link);
    font-size: 1.15rem;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-serp__desc {
    display: block;
    color: var(--app-text);
    font-size: 0.9rem;
    line-height: 1.4;
}

.app-serp__warn {
    margin-top: 0.5rem;
    color: var(--app-warning);
    font-size: 0.82rem;
}
