/*
 * components.css — shared UI components.
 * Load order: base.css → components.css → page sheet (see css/base.css).
 *
 * Contract: every component in this file appears in the living gallery
 * at /components. If you add a component here, add it to the gallery.
 * Components consume tokens from css/base.css — customize them per page
 * by overriding tokens, not by restyling component internals.
 */

@layer components {
    /* Back Button */
    .back-button {
        position: fixed;
        top: var(--space-xl);
        left: var(--space-xl);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: var(--space-sm);
        padding: calc(var(--space-sm) + var(--space-xs)) var(--space-md);
        border-radius: var(--radius-md);
        color: var(--text-primary) !important;
        font-size: var(--font-size-sm);
        font-weight: 500;
        text-decoration: none;
        transition: all 0.2s ease;
        z-index: 100;
        white-space: nowrap;
    }

    .back-button:hover {
        color: var(--primary) !important;
    }

    @media only screen and (max-width: 768px) {
        .back-button {
            position: relative;
            display: inline-flex;
        }

        .back-button {
            top: var(--space-md);
            left: var(--space-md);
        }
    }

    /* Buttons — Atelier control grammar: ink-filled primary, hairline ghost
       (the newsletter submit button is the reference) */
    .btn-primary {
        background: var(--text-bold);
        border: none;
        color: var(--background);
        padding: calc(var(--space-sm) + var(--space-xs)) var(--space-lg);
        border-radius: 12px;
        font-size: var(--font-size-sm);
        font-weight: 600;
        font-family: 'Inter', sans-serif;
        cursor: pointer;
        transition: opacity 0.2s ease;
    }

    .btn-primary:hover {
        opacity: 0.85;
    }

    .btn-ghost {
        background: var(--card);
        color: var(--text-primary);
        padding: var(--space-sm) var(--space-lg);
        border: 1px solid var(--card-edge);
        border-radius: 12px;
        font-size: var(--font-size-sm);
        font-weight: 500;
        font-family: 'Inter', sans-serif;
        cursor: pointer;
        transition: border-color 0.2s ease, background 0.2s ease;
    }

    .btn-ghost:hover {
        background: var(--background);
        border-color: var(--card-edge-hi);
    }

    .btn-primary:disabled, .btn-ghost:disabled,
    .btn-primary[disabled], .btn-ghost[disabled] {
        opacity: 0.5;
        cursor: not-allowed;
        pointer-events: none;
    }

    .btn-loading {
        position: relative;
        color: transparent !important;
        pointer-events: none;
    }

    .btn-loading::after {
        content: '';
        position: absolute;
        width: 16px;
        height: 16px;
        top: 50%;
        left: 50%;
        margin: -8px 0 0 -8px;
        border: 2px solid currentColor;
        border-radius: 50%;
        border-top-color: transparent;
        animation: btn-spin 0.6s linear infinite;
        color: var(--primary);
    }

    .btn-ghost.btn-loading::after {
        color: var(--text-primary);
    }

    .btn-primary.btn-loading::after {
        color: var(--background);
    }

    @keyframes btn-spin {
        to { transform: rotate(360deg); }
    }

    .tooltip {
        position: relative;
        display: inline-block;
    }

    .tooltip-text {
        visibility: hidden;
        position: absolute;
        bottom: 125%;
        left: 50%;
        transform: translateX(-50%);
        background: var(--background-grey);
        color: var(--text-primary);
        border: 1px solid var(--border-light);
        padding: 0.5rem 0.75rem;
        border-radius: 6px;
        font-size: 0.85rem;
        white-space: nowrap;
        opacity: 0;
        transition: opacity 0.2s ease;
        pointer-events: none;
        z-index: 1000;
    }

    .tooltip:hover .tooltip-text,
    .tooltip:focus .tooltip-text {
        visibility: visible;
        opacity: 1;
        transition-delay: 0.3s;
    }

    .btn-sm { padding: var(--space-sm) var(--space-md); font-size: 0.85rem; }
    .btn-md { padding: calc(var(--space-sm) + var(--space-xs)) var(--space-lg); font-size: var(--font-size-sm); }
    .btn-lg { padding: var(--space-md) var(--space-xl); font-size: 1rem; }

    /* Callouts — card surface + hairline, like the Atelier cards */
    .callout {
        background: var(--card);
        border: 1px solid var(--card-edge);
        padding: var(--space-lg);
        border-radius: var(--r-card);
        margin: var(--space-xl) 0;
    }

    .callout-border {
        background: var(--background);
        border: 1px solid var(--card-edge);
        padding: var(--space-lg);
        border-radius: var(--r-card);
        margin: var(--space-xl) 0;
    }

    .callout p:last-child, .callout-border p:last-child {
        margin-bottom: 0;
    }

    /* Checklist — interactive review list in the card grammar. The select
       affordance (border step at rest → ghost check on hover → ink fill +
       checkmark when ticked) is the poll ring squared off. Native checkboxes
       drive state and a11y; the box reflects :checked through the adjacent
       sibling, so it works with zero JavaScript. Markup order per item is
       fixed: <input type="checkbox"> then .checklist-box then .checklist-text,
       all inside the .checklist-item <label>. */
    .checklist {
        display: flex;
        flex-direction: column;
        margin: var(--space-xl) 0;
        padding: clamp(1.25rem, 3.5vw, 1.9rem);
        background: var(--card);
        border: 1px solid var(--card-edge);
        border-radius: var(--r-panel);
    }

    .checklist-item {
        position: relative;
        display: grid;
        grid-template-columns: auto 1fr;
        gap: var(--space-md);
        align-items: start;
        padding: var(--space-md) 0;
        border-top: 1px solid var(--card-edge);
        cursor: pointer;
    }

    .checklist-item:first-child { border-top: 0; padding-top: 0; }
    .checklist-item:last-child { padding-bottom: 0; }

    /* the real checkbox: off-screen but focusable and announced */
    .checklist-item input {
        position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
        border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
    }

    .checklist-box {
        display: inline-flex; align-items: center; justify-content: center;
        width: 20px; height: 20px; margin-top: 2px; flex: none;
        border: 1.5px solid var(--text-muted);
        border-radius: 6px;
        color: var(--card);
        transition: background-color 0.2s ease, border-color 0.2s ease;
    }

    .checklist-box svg { opacity: 0; transition: opacity 0.2s ease; }
    .checklist-item:hover .checklist-box { border-color: var(--text-primary); }
    .checklist-item:hover .checklist-box svg { opacity: 0.4; color: var(--text-primary); }

    .checklist-item input:checked + .checklist-box {
        background: var(--text-bold); border-color: var(--text-bold);
    }
    .checklist-item input:checked + .checklist-box svg { opacity: 1; color: var(--card); }

    .checklist-item input:focus-visible + .checklist-box {
        outline: 2px solid var(--text-tertiary); outline-offset: 2px;
    }

    .checklist-text {
        font-size: var(--font-size-sm); line-height: 1.55;
        color: var(--text-secondary); text-wrap: pretty; transition: color 0.2s ease;
    }
    .checklist-text b { color: var(--text-primary); font-weight: 500; transition: color 0.2s ease; }
    /* addressed → dim a step so the eye falls to what's left */
    .checklist-item input:checked ~ .checklist-text,
    .checklist-item input:checked ~ .checklist-text b { color: var(--text-tertiary); }

    @media (prefers-reduced-motion: reduce) {
        .checklist-box, .checklist-box svg, .checklist-text, .checklist-text b { transition: none; }
    }

    /* Cards */
    .card-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-md);
        margin: var(--space-lg) 0;
    }

    .card {
        background: var(--card);
        border: 1px solid var(--card-edge);
        padding: var(--space-lg);
        border-radius: var(--r-card);
    }

    .card h3, .card h4 {
        margin-top: 0;
    }

    .card p:last-child {
        margin-bottom: 0;
    }

    .card-media-top img, .card-media-side img {
        display: block;
        width: 100%;
        height: auto;
        object-fit: cover;
    }

    .card-media-top img {
        border-radius: calc(var(--r-card) - 1px) calc(var(--r-card) - 1px) 0 0; /* concentric with the 1px border */
        margin: calc(var(--space-lg) * -1) calc(var(--space-lg) * -1) var(--space-md);
    }

    .card-media-side {
        display: grid;
        grid-template-columns: 200px 1fr;
        gap: var(--space-lg);
    }

    .card-media-side img {
        border-radius: calc(var(--r-card) - 1px) 0 0 calc(var(--r-card) - 1px);
        margin: calc(var(--space-lg) * -1) 0 calc(var(--space-lg) * -1) calc(var(--space-lg) * -1);
        height: 100%;
    }

    .card-actions {
        display: flex;
        gap: calc(var(--space-sm) + var(--space-xs));
        margin-top: var(--space-md);
        padding-top: var(--space-md);
        border-top: 1px solid var(--border-light);
    }

    /* Cards - Responsive */
    @media (max-width: 768px) {
        .card-grid {
            grid-template-columns: 1fr;
        }

        .card-media-side {
            grid-template-columns: 1fr;
        }
        .card-media-side img {
            border-radius: calc(var(--r-card) - 1px) calc(var(--r-card) - 1px) 0 0;
            margin: -1.5rem -1.5rem 0;
            height: auto;
        }
    }

    /* Dividers — Atelier hairline; the token themes itself */
    .intro-hr {
        margin-top: var(--space-4xl);
        margin-bottom: var(--space-2xl);
        border: 0;
        border-top: 1px solid var(--card-edge);
    }

    /* Icons */
    .icon-sm { width: 16px; height: 16px; }
    .icon-md { width: 24px; height: 24px; }
    .icon-lg { width: 32px; height: 32px; }

    /* Links - Special Variants */
    .headtag {
        display: inline-flex;
        height: 20px;
        text-decoration: none !important;
    }

    .arr {
        display: none;
        color: var(--red);
    }

    .headtag:hover .arr {
        display: flex;
        margin-left: 10px;
    }

    .headtag:hover {
        color: var(--red);
        text-decoration: none !important;
    }

    .hyp-p {
        color: var(--primary) !important;
    }

    .hyp-p:hover {
        color: var(--red) !important;
    }

    /* References */
    #intro-tags1 {
        margin-top: var(--space-2xl);
        color: var(--text-secondary) !important;
    }

    .references {
        margin-top: var(--space-md);
    }

    .references p {
        line-height: 1.5;
        margin-top: var(--space-sm);
        margin-bottom: 0;
    }

    .ref-inline {
        position: relative;
        isolation: isolate;
        overflow: hidden;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-left: var(--space-xs);
        padding: 0.2rem 0.6rem;
        border: 1px solid var(--card-edge);
        border-radius: 7px;
        background: var(--card);
        color: var(--text-primary) !important;
        font-size: 0.7rem;
        font-weight: 500;
        line-height: 1;
        text-decoration: none !important;
        vertical-align: middle;
        transition: color 0.2s ease, border-color 0.2s ease, border-radius 0.25s ease;
    }

    /* the card grammar's whisper wash scaled to a chip: a 9% red gradient
       fades in under the label while the corners round out to a pill */
    .ref-inline::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        background: linear-gradient(150deg, color-mix(in srgb, var(--red) 9%, transparent), transparent 65%);
        opacity: 0;
        transition: opacity 0.25s ease;
    }

    .ref-inline:hover,
    .ref-inline:focus-visible,
    p a.ref-inline:hover,
    p a.ref-inline:focus-visible {
        color: var(--red) !important;
        text-decoration: none !important;
        border-color: color-mix(in srgb, var(--red) 24%, var(--card-edge-hi));
        border-radius: 999px;
    }

    .ref-inline:hover::before,
    .ref-inline:focus-visible::before {
        opacity: 1;
    }

    .ref-inline:focus-visible {
        outline: 2px solid color-mix(in srgb, var(--red) 45%, white 55%);
        outline-offset: 2px;
    }

    .reference-links {
        display: flex;
        flex-wrap: wrap;
        gap: calc(var(--space-sm) + var(--space-xs));
        margin-top: var(--space-md);
    }

    .reference-chip {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: var(--space-sm) 0.85rem;
        border: 1px solid var(--card-edge);
        border-radius: 999px;
        background: var(--background);
        color: var(--text-primary);
        font-size: var(--font-size-sm);
        font-weight: 500;
        text-decoration: none;
        transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, transform 0.2s ease;
    }

    .reference-chip:hover {
        color: var(--primary);
        border-color: color-mix(in srgb, var(--primary) 35%, var(--border-light));
        background: color-mix(in srgb, var(--primary) 8%, var(--background));
    }

    /* Share Button */
    #copyUrl, .share-button {
        background: var(--background);
        color: var(--text-primary);
        border: 1px solid var(--card-edge);
        border-radius: 12px;
        padding: 10px 20px;
        font-size: var(--font-size-sm);
        font-weight: 500;
        font-family: 'Inter', sans-serif;
        cursor: pointer;
        transition: all 0.2s ease;
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }

    #copyUrl:hover, .share-button:hover {
        background: var(--background-grey);
        color: var(--text-primary);
        border-color: var(--border-light);
    }

    /* Share Fan — <share-fan>: a hover-morph share button (Atelier recreation
       of the animate-ui component). A ghost pill whose "Share" face morphs into
       a staggered, springy fan of share actions on hover / keyboard focus, and
       tap-to-toggle on touch. Reuses the .copy-toast grammar for copy-link. */
    .sf {
        position: relative; overflow: hidden; isolation: isolate;
        display: inline-flex; align-items: center; justify-content: center;
        min-width: 124px; height: 40px; padding: 0 18px;
        background: var(--background); color: var(--text-primary);
        border: 1px solid var(--card-edge); border-radius: 12px;
        font-family: 'Inter', sans-serif; font-size: var(--font-size-sm); font-weight: 500;
        cursor: pointer; user-select: none;
        transition: border-color 0.2s ease, background-color 0.2s ease;
    }
    @supports (corner-shape: squircle) { .sf { corner-shape: squircle; } }
    .sf:hover, .sf:focus-within, .sf[data-open="true"] {
        border-color: var(--card-edge-hi); background: var(--background-grey);
    }

    /* two stacked layers cross-fading with a vertical slide */
    .sf-face, .sf-icons {
        position: absolute; inset: 0;
        display: inline-flex; align-items: center; justify-content: center;
        transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.26s ease;
    }
    .sf-face { gap: 8px; transform: translateY(0); opacity: 1; }
    .sf-face svg { width: 16px; height: 16px; }
    .sf-icons { gap: 14px; transform: translateY(100%); opacity: 0; pointer-events: none; }

    /* open (hover / keyboard focus / tapped on touch): face exits up, fan enters */
    .sf:hover .sf-face, .sf:focus-within .sf-face, .sf[data-open="true"] .sf-face {
        transform: translateY(-100%); opacity: 0;
    }
    .sf:hover .sf-icons, .sf:focus-within .sf-icons, .sf[data-open="true"] .sf-icons {
        transform: translateY(0); opacity: 1; pointer-events: auto;
    }

    /* each action: parked below, pops up with a backOut "spring", staggered */
    .sf-act {
        display: inline-flex; align-items: center; justify-content: center;
        width: 30px; height: 30px; padding: 0;
        background: none; border: none; border-radius: 8px; cursor: pointer;
        color: var(--text-secondary);
        transform: translateY(22px); opacity: 0;
        transition: transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease,
                    color 0.2s ease, background-color 0.2s ease;
    }
    @supports (corner-shape: squircle) { .sf-act { corner-shape: squircle; } }
    .sf-act svg { width: 17px; height: 17px; }
    .sf:hover .sf-act, .sf:focus-within .sf-act, .sf[data-open="true"] .sf-act {
        transform: translateY(0); opacity: 1;
    }
    .sf-act:nth-child(1) { transition-delay: 0s; }
    .sf-act:nth-child(2) { transition-delay: 0.06s; }
    .sf-act:nth-child(3) { transition-delay: 0.12s; }

    /* per-icon lift on its own hover — pure y-transform. Must out-specify the
       `.sf:hover .sf-act` reveal rule (which pins transform to 0), so it's
       scoped under each open state. no stagger lag on the lift itself. */
    .sf-act:hover { color: var(--text-bold); transition-delay: 0s; }
    .sf:hover .sf-act:hover,
    .sf:focus-within .sf-act:hover,
    .sf[data-open="true"] .sf-act:hover { transform: translateY(-5px); }
    .sf-act:focus-visible { outline: 2px solid var(--text-tertiary); outline-offset: 2px; }

    /* reduced motion: a short, small move instead of the big springy slide —
       never `transform: none !important`, which kills the hover lift too */
    @media (prefers-reduced-motion: reduce) {
        .sf-face, .sf-icons, .sf-act {
            transition: transform 0s ease, opacity 0.18s ease;
        }
        .sf-icons, .sf-act { transform: translateY(6px); }
    }

    /* Tables — frameless; border-collapse must stay `separate` or the
       radius can't render, and the corner cells need their own rounding so
       header/first-col fills keep the rounded shape */
    table {
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;
        margin: var(--space-xl) 0;
        border-radius: 12px;
        overflow: hidden;
    }

    table tr:first-child > th:first-child,
    table tr:first-child > td:first-child { border-top-left-radius: 12px; }
    table tr:first-child > th:last-child,
    table tr:first-child > td:last-child { border-top-right-radius: 12px; }
    table tr:last-child > th:first-child,
    table tr:last-child > td:first-child { border-bottom-left-radius: 12px; }
    table tr:last-child > th:last-child,
    table tr:last-child > td:last-child { border-bottom-right-radius: 12px; }

    table th {
        text-align: left;
        font-weight: 600;
        font-size: 0.95rem;
    }

    table td {
        font-size: 0.95rem;
        line-height: 1.5;
    }

    table th, table td {
        padding: calc(var(--space-sm) + var(--space-xs)) var(--space-md);
        vertical-align: top;
    }

    .table-header {
        background-color: var(--table-header);
    }

    .table-first-col {
        font-weight: 600;
        background-color: var(--table-first-col);
    }

    .table-header .table-first-col {
        background-color: var(--table-header);
    }

    /* Atelier table — the reusable table convention ("the new normal").
       Author a plain semantic table with ONE class and no per-row/per-cell
       classes; the header fill and first-column accent are derived from the
       <thead>/<tbody> structure:

         <table class="atelier-table">
           <thead><tr><th>Col 1</th><th>Col 2</th></tr></thead>
           <tbody><tr><td>A</td><td>B</td></tr></tbody>
         </table>

       Edit the two rules below to restyle every atelier-table site-wide.
       Legacy posts using .table-header/.table-first-col are unaffected. */
    .atelier-table thead th,
    .atelier-table thead td {
        background-color: var(--table-header);
    }

    .atelier-table tbody td:first-child,
    .atelier-table tbody th:first-child {
        font-weight: 600;
        background-color: var(--table-first-col);
    }

    /* Theme Toggle */
    .theme-toggle {
        position: fixed;
        bottom: 20px;
        right: 20px;
        padding: 8px 8px;
        border-radius: 50%;
        background: var(--background);
        color: var(--text-primary);
        font-weight: 600;
        font-size: 0.86rem;
        border: 1px solid var(--border-light);
        cursor: pointer;
        box-shadow: none;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        z-index: 195;
        transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
    }

    .theme-toggle:hover {
        background: var(--background-grey);
        border: 1px solid var(--border-light);
    }

    /* the icon wrapper must not introduce a baseline gap */
    .theme-toggle span { display: inline-flex; }
    .theme-toggle svg { display: block; }

    /* Toast — the light-mode suggestion in the Atelier card grammar:
       card surface, hairline edge stepped to edge-high because it floats
       (Border-Not-Shadow — separation comes from the border, never a
       shadow). It sits over the theme toggle at the corner; its own
       buttons cover that choice while it's open. */
    .toast {
        position: fixed;
        bottom: 20px; /* the theme toggle's corner — the toast speaks for it */
        right: 20px;
        box-sizing: border-box;
        width: min(360px, calc(100vw - 40px));
        padding: var(--space-lg);
        background: var(--card);
        color: var(--text-primary);
        border: 1px solid var(--card-edge-hi);
        border-radius: var(--r-card);
        display: none;
        z-index: 200;
    }

    .toast.show {
        display: block;
        /* the page's at-rise grammar, trailing the content's own entrance */
        animation: toast-rise 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.35s backwards;
    }

    @keyframes toast-rise {
        from { opacity: 0; transform: translateY(10px); }
    }

    @media (prefers-reduced-motion: reduce) {
        .toast.show { animation: none; }
    }

    .toast-top {
        display: flex;
        align-items: center;
        gap: var(--space-sm);
        font-size: var(--font-size-xs);
        font-weight: 500;
        color: var(--text-tertiary);
    }

    .toast-top svg { display: block; flex: none; }

    .toast-title {
        margin-top: var(--space-md);
        font-size: var(--font-size-md);
        font-weight: 500;
        letter-spacing: -0.01em;
        line-height: 1.3;
        color: var(--text-bold);
        text-wrap: balance;
    }

    .toast-text {
        margin-top: var(--space-sm);
        font-size: var(--font-size-sm);
        line-height: 1.5;
        color: var(--text-secondary);
        text-wrap: pretty;
    }

    .toast-actions {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: var(--space-sm);
        margin-top: var(--space-lg);
    }

    /* Copy toast — the share button's "Link copied" confirmation. Same card
       material as .toast but a transient pill: bottom-centre so it clears the
       toggle/vote cluster in the corner, auto-dismissed by share-button.js. */
    .copy-toast {
        position: fixed;
        left: 50%;
        bottom: 24px;
        z-index: 210;
        display: inline-flex;
        align-items: center;
        gap: var(--space-sm);
        padding: 0.6rem 0.95rem;
        background: var(--card);
        color: var(--text-bold);
        border: 1px solid var(--card-edge-hi);
        border-radius: var(--r-card);
        corner-shape: squircle;
        font-family: "Inter", sans-serif;
        font-size: var(--font-size-sm);
        font-weight: 500;
        opacity: 0;
        pointer-events: none;
        transform: translateX(-50%) translateY(10px);
        transition: opacity 0.25s ease, transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .copy-toast.show {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    .copy-toast svg { display: block; flex: none; color: var(--text-secondary); }

    @media (prefers-reduced-motion: reduce) {
        .copy-toast { transition: opacity 0.2s ease; }
        .copy-toast, .copy-toast.show { transform: translateX(-50%); }
    }

    /* Table of Contents */

    /* <toc-panel> carries its curated links as raw <a> children, which
       would flash as inline links at the top of the page until the module
       upgrades the element — keep it invisible until defined */
    toc-panel:not(:defined) { display: none; }

    .toc-sticky {
        position: fixed;
        top: var(--space-xl);
        right: 24px;
        width: 220px;
        z-index: 110;
    }

    .toc-wrapper {
        position: relative;
        padding-left: 22px;
        background: var(--background);
        border: none;
        border-radius: 12px;
        padding: 14px 16px;
        box-shadow: none;
        transition: transform 0.2s ease;
    }

    .toc-title {
        font-size: 0.78rem;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        margin: 0 0 8px 0;
        color: var(--text-tertiary);
    }

    .toc-list {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .toc-list li {
        margin: 6px 0;
    }

    .toc-list a {
        display: block;
        padding: 4px 0 4px var(--space-sm);
        border-left: 2px solid transparent;
        color: var(--text-muted);
        font-size: var(--font-size-sm);
        text-decoration: none;
        transition: all 0.2s ease;
    }

    .toc-list a:hover {
        color: var(--primary);
        border-left: 2px solid transparent;
    }

    .toc-list a.active {
        color: var(--text-primary);
        border-left: 2px solid transparent;
    }

    .toc-top {
        display: inline-block;
        margin-top: 10px;
        font-size: 0.85rem;
        color: var(--primary);
    }

    .reading-progress {
        position: absolute;
        left: 0;
        width: 2px;
        background: rgba(0, 0, 0, 0.05);
        border-radius: 999px;
        overflow: hidden;
        pointer-events: none;
    }

    .reading-progress-fill {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 0;
        background: var(--text-secondary);
        border-radius: inherit;
        transition: height 0.1s linear;
    }

    @media only screen and (max-width: 1227px) {
        .toc-sticky {
            display: none;
        }
    }
}
