/* ======================= ARTICLE CONTENT BLOCKS =======================
   Markup comes from ArticleBlocks.php ([toc], [tip], [specs], [steps] …).
   Colours are mixed with currentColor, so the blocks follow the text colour
   of any article theme (dark or light). Themes may set the --ab-* variables. */

.article-content {
    --ab-tint: color-mix(in srgb, currentColor 5%, transparent);
    --ab-line: color-mix(in srgb, currentColor 14%, transparent);
    --ab-dim: color-mix(in srgb, currentColor 62%, transparent);
    --ab-radius: 0.75rem;
}

/* Sections linked as #id stop below the sticky header. */
.article-content [id] {
    scroll-margin-top: 6rem;
}

html:has(.ab-toc) {
    scroll-behavior: smooth;
}

/* ------------------------------ anchors ------------------------------ */

.article-content .ab-anchor {
    margin-left: 0.4em;
    font-weight: 400;
    text-decoration: none;
    color: var(--ab-dim);
    opacity: 0;
    transition: opacity 0.15s;
}

.article-content h2:hover .ab-anchor,
.article-content h3:hover .ab-anchor,
.article-content h4:hover .ab-anchor,
.article-content .ab-anchor:focus {
    opacity: 1;
}

/* ------------------------------ [toc] ------------------------------ */

.ab-toc {
    margin: 2rem 0 2.5rem;
    border: 1px solid var(--ab-line);
    border-radius: var(--ab-radius);
    background: var(--ab-tint);
    font-size: 1rem;
    line-height: 1.5;
}

.ab-toc summary {
    cursor: pointer;
    padding: 0.85rem 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.85rem;
    color: var(--ab-dim);
    list-style: none;
}

.ab-toc summary::-webkit-details-marker { display: none; }

.ab-toc summary::after {
    content: '\25BE';
    float: right;
    transition: transform 0.2s;
}

.ab-toc details:not([open]) summary::after { transform: rotate(-90deg); }

.article-content .ab-toc-list,
.article-content .ab-toc-list ol {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: ab-toc;
}

.article-content .ab-toc-list {
    padding: 0 1.25rem 1rem;
}

.ab-toc-cols {
    columns: 2 16rem;
    column-gap: 2rem;
}

.article-content .ab-toc-list li {
    margin: 0;
    padding: 0.2rem 0;
    break-inside: avoid;
    counter-increment: ab-toc;
}

.article-content .ab-toc-list > li {
    position: relative;
    padding-left: 2.1em;
}

.article-content .ab-toc-list > li::before {
    content: counter(ab-toc) '.';
    position: absolute;
    left: 0;
    color: var(--ab-dim);
    font-variant-numeric: tabular-nums;
}

.article-content .ab-toc-list ol {
    padding-left: 0.9em;
    font-size: 0.92em;
}

.article-content .ab-toc a {
    color: inherit;
    text-decoration: none;
}

.article-content .ab-toc a:hover {
    color: var(--p-color, #ff4d5a);
}

/* ------------------------- [tip] [note] [warning] [danger] ------------------------- */

.ab-callout {
    --ab-c: var(--ab-tip, #3fb27f);
    margin: 2rem 0;
    padding: 1rem 1.25rem;
    border: 1px solid color-mix(in srgb, var(--ab-c) 35%, transparent);
    border-left: 4px solid var(--ab-c);
    border-radius: var(--ab-radius);
    background: color-mix(in srgb, var(--ab-c) 9%, transparent);
    font-size: 1.02rem;
    line-height: 1.7;
}

.ab-callout-note { --ab-c: var(--ab-note, #4a90d9); }
.ab-callout-warning { --ab-c: var(--ab-warning, #e0a030); }
.ab-callout-danger { --ab-c: var(--ab-danger, #e04444); }

.ab-callout-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.4rem;
    font-weight: 700;
    color: color-mix(in srgb, var(--ab-c) 70%, currentColor);
}

.ab-callout-body > :first-child { margin-top: 0; }
.ab-callout-body > :last-child { margin-bottom: 0; }
.ab-callout-body p { margin-bottom: 0.8rem; }

.article-content .ab-callout img {
    margin: 1rem 0;
    box-shadow: none;
}

/* ------------------------------ [specs] ------------------------------ */

.ab-specs {
    display: grid;
    grid-template-columns: 1fr;
    margin: 2rem 0;
    border: 1px solid var(--ab-line);
    border-radius: var(--ab-radius);
    background: var(--ab-tint);
    overflow: hidden;
    font-size: 1rem;
    line-height: 1.5;
}

@media (min-width: 720px) {
    .ab-specs-has-media {
        grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    }
}

.ab-specs-media {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: color-mix(in srgb, currentColor 4%, transparent);
}

.article-content .ab-specs-media img {
    margin: 0;
    max-height: 22rem;
    width: auto;
    box-shadow: none;
}

.ab-specs-main {
    padding: 1rem 1.25rem 1.1rem;
    min-width: 0;
}

.ab-specs-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.ab-specs-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.ab-badge {
    display: inline-block;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--p-color, #ff4d5a);
    border: 1px solid color-mix(in srgb, var(--p-color, #ff4d5a) 55%, transparent);
    background: color-mix(in srgb, var(--p-color, #ff4d5a) 10%, transparent);
}

.article-content .ab-specs-list {
    margin: 0;
}

.ab-specs-row {
    display: grid;
    grid-template-columns: minmax(8rem, 2fr) 3fr;
    gap: 0.25rem 1rem;
    padding: 0.45rem 0;
    border-top: 1px solid var(--ab-line);
}

.ab-specs-row:first-child { border-top: 0; }

.ab-specs-row dt {
    font-weight: 400;
    color: var(--ab-dim);
}

.ab-specs-row dd {
    margin: 0;
    font-weight: 600;
}

.ab-specs-group {
    margin-top: 0.8rem;
    padding-bottom: 0.2rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ab-dim);
}

@media (max-width: 480px) {
    .ab-specs-row { grid-template-columns: 1fr; }
}

/* ------------------------------ [steps] ------------------------------ */

.ab-steps {
    margin: 2rem 0;
}

.ab-steps-title {
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.article-content .ab-steps-list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: ab-step;
}

.article-content .ab-steps-list > li {
    position: relative;
    margin: 0;
    padding: 0 0 1.25rem 3.25rem;
    min-height: 2.25rem;
    counter-increment: ab-step;
}

.article-content .ab-steps-list > li::before {
    content: counter(ab-step);
    position: absolute;
    left: 0;
    top: 0;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
    color: var(--p-color, #ff4d5a);
    border: 2px solid color-mix(in srgb, var(--p-color, #ff4d5a) 70%, transparent);
    background: color-mix(in srgb, var(--p-color, #ff4d5a) 10%, transparent);
}

/* The line linking a step to the next one. */
.article-content .ab-steps-list > li:not(:last-child)::after {
    content: '';
    position: absolute;
    left: calc(1.125rem - 1px);
    top: 2.5rem;
    bottom: 0.25rem;
    width: 2px;
    background: var(--ab-line);
}

.ab-step-title {
    font-weight: 700;
    line-height: 2.25rem;
}

.ab-steps-list > li > :first-child,
.ab-step-body > :first-child { margin-top: 0; }
.ab-steps-list > li > :last-child,
.ab-step-body > :last-child { margin-bottom: 0; }

.article-content .ab-steps-list img {
    margin: 1rem 0;
}

/* ------------------------------ [details] ------------------------------ */

.ab-details {
    margin: 1.5rem 0;
    border: 1px solid var(--ab-line);
    border-radius: var(--ab-radius);
    background: var(--ab-tint);
}

.ab-details > summary {
    cursor: pointer;
    padding: 0.8rem 1.25rem;
    font-weight: 700;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.ab-details > summary::-webkit-details-marker { display: none; }

.ab-details > summary::before {
    content: '\25B8';
    color: var(--ab-dim);
    transition: transform 0.2s;
}

.ab-details[open] > summary::before { transform: rotate(90deg); }

.ab-details > summary:hover { color: var(--p-color, #ff4d5a); }

.ab-details-body {
    padding: 0 1.25rem 1rem;
}

.ab-details-body > :first-child { margin-top: 0; }
.ab-details-body > :last-child { margin-bottom: 0; }

/* ------------------------------ [figure] [gallery] ------------------------------ */

.article-content .ab-figure {
    margin: 2.5rem auto;
}

.article-content .ab-figure img {
    margin: 0 auto;
}

.ab-figure-small { max-width: 24rem; }
.ab-figure-medium { max-width: 36rem; }

.ab-figure-row .ab-figure-media {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    align-items: flex-start;
}

.ab-figure-row .ab-figure-media img {
    flex: 1 1 14rem;
    min-width: 0;
    max-width: 100%;
}

.article-content .ab-figure figcaption,
.article-content .ab-gallery figcaption {
    margin-top: 0.6rem;
    text-align: center;
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--ab-dim);
}

.ab-gallery {
    display: grid;
    gap: 1rem;
    margin: 2rem 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 720px) {
    .ab-gallery.ab-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .ab-gallery.ab-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.article-content .ab-gallery-item {
    margin: 0;
    min-width: 0;
}

.article-content .ab-gallery-item img {
    margin: 0;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    background: var(--ab-tint);
    box-shadow: none;
    border: 1px solid var(--ab-line);
}

/* ------------------------------ [table] ------------------------------ */

.ab-table {
    margin: 2rem 0;
    border: 1px solid var(--ab-line);
    border-radius: var(--ab-radius);
    overflow: hidden;
}

.ab-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.article-content .ab-table table {
    margin: 0;
    width: 100%;
    min-width: 32rem;
    border-collapse: collapse;
    /* cobalt.css gives tables a fixed light-grey text: follow the article (themes, paper) instead */
    color: inherit !important;
    font-size: 0.98rem;
    line-height: 1.5;
    word-break: normal;
}

.ab-table-caption {
    padding: 0.75rem 0.9rem 0.5rem;
    font-weight: 700;
    line-height: 1.4;
}

.article-content .ab-table th,
.article-content .ab-table td {
    padding: 0.6rem 0.9rem;
    border: 0;
    /* cobalt.css gives every table cell a 4px top border with !important. */
    border-top: 1px solid var(--ab-line) !important;
    border-bottom: 0 !important;
    color: inherit;
    text-align: left;
    vertical-align: top;
}

.article-content .ab-table thead th {
    border-top: 0 !important;
    border-bottom: 1px solid var(--ab-line) !important;
    background: var(--ab-tint);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ab-dim);
}

.article-content .ab-table-caption + .ab-table-scroll thead th {
    border-top: 1px solid var(--ab-line) !important;
}

.article-content .ab-table td:first-child {
    font-weight: 600;
}

.article-content .ab-table tbody tr:hover {
    background: var(--ab-tint);
}

.ab-yes { color: var(--ab-tip, #3fb27f); font-weight: 700; }
.ab-no { color: var(--ab-dim); }

/* ------------------------------ [key] ------------------------------ */

.ab-keys {
    white-space: nowrap;
}

.ab-keys-plus {
    margin: 0 0.2em;
    color: var(--ab-dim);
}

.ab-key {
    display: inline-block;
    min-width: 1.6em;
    padding: 0.05em 0.45em;
    border: 1px solid var(--ab-line);
    border-bottom-width: 3px;
    border-radius: 0.35em;
    background: var(--ab-tint);
    color: inherit;
    font-family: inherit;
    font-size: 0.85em;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
}

/* ------------------------------ lightbox caption ------------------------------ */

.article-lightbox-caption {
    position: absolute;
    left: 50%;
    bottom: 1.5rem;
    transform: translateX(-50%);
    max-width: min(46rem, calc(100% - 2rem));
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    background: rgba(0, 0, 0, 0.65);
    color: #eee;
    font-size: 0.95rem;
    text-align: center;
}

.article-lightbox-caption:empty { display: none; }

.article-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 3rem;
    height: 3rem;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}

.article-lightbox-nav[hidden] { display: none; }
.article-lightbox-prev { left: 1rem; }
.article-lightbox-next { right: 1rem; }

/* ------------------------------ editor cheat sheet ------------------------------ */

.ab-help {
    margin-top: 0.75rem;
    border: 1px solid var(--al-border, rgba(255, 255, 255, 0.08));
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    font-size: 0.9rem;
}

.ab-help > summary {
    cursor: pointer;
    padding: 0.6rem 0.9rem;
    font-weight: 600;
}

.ab-help-intro {
    margin: 0 0.9rem 0.6rem;
    color: var(--al-text-dim, rgba(255, 255, 255, 0.6));
}

.ab-help-list {
    margin: 0;
    padding: 0 0.9rem 0.9rem;
}

.ab-help-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 0.4rem 1rem;
    padding: 0.6rem 0;
    border-top: 1px solid var(--al-border, rgba(255, 255, 255, 0.08));
}

.ab-help-row pre {
    margin: 0;
    padding: 0.45rem 0.6rem;
    border-radius: 0.35rem;
    background: rgba(0, 0, 0, 0.35);
    color: #e8e8e8;
    font-size: 0.82rem;
    white-space: pre-wrap;
    user-select: all;
}

.ab-help-row dd {
    margin: 0;
    color: var(--al-text-dim, rgba(255, 255, 255, 0.7));
}

@media (max-width: 720px) {
    .ab-help-row { grid-template-columns: 1fr; }
}

/* ======================= WIKI MODE (article setting) =======================
   Layout and chrome for js/article-wiki.js: side contents, breadcrumbs bar,
   search results, copy-link buttons, back-to-top. */

/* Defaults on the article and on the portal that carries the drawer, back-to-top and toast
   (in <body>, with the article's theme classes); article-themes.css overrides them per theme. */
.ab-wiki,
.ab-wiki-portal {
    --ab-wiki-accent: var(--p-color, #ff4d5a);
    --ab-wiki-panel: rgba(18, 18, 22, 0.92);
    --ab-wiki-drawer: #141418;
    --ab-wiki-line: rgba(255, 255, 255, 0.09);
    --ab-wiki-text: #ddd;
    --ab-wiki-strong: #fff;
    --ab-wiki-dim: rgba(255, 255, 255, 0.55);
    --ab-wiki-hover: rgba(255, 255, 255, 0.06);
    --ab-wiki-field: rgba(255, 255, 255, 0.05);
    --ab-wiki-thumb: #26262b;
    --ab-wiki-font-head: inherit;
    --ab-wiki-radius: 0.75rem;
}

/* The fixed header box is taller than its navbar; its empty lower part would swallow clicks on the bar under it. */
.ab-wiki .article-sticky-header { pointer-events: none; }
.ab-wiki .article-sticky-header > * { pointer-events: auto; }

.ab-wiki .article-content [id] {
    scroll-margin-top: calc(var(--ab-wiki-top, 70px) + var(--ab-wiki-bar, 44px) + 1rem);
}

.ab-wiki-layout {
    position: relative;
}

@media (min-width: 1200px) {
    .ab-wiki-layout {
        display: grid;
        grid-template-columns: 17rem minmax(0, 1fr);
        gap: 2rem;
        align-items: start;
    }

    .ab-wiki-layout .article-body {
        max-width: none;
        margin: 0;
        min-width: 0;
    }
}

/* ------------------------------ side panel ------------------------------ */

.ab-wiki-side {
    position: sticky;
    top: calc(var(--ab-wiki-top, 70px) + 1rem);
    max-height: calc(100vh - var(--ab-wiki-top, 70px) - 2rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    margin-top: 1rem;
    padding: 0.9rem 0.75rem 1rem;
    border: 1px solid var(--ab-wiki-line);
    border-radius: var(--ab-wiki-radius);
    background: var(--ab-wiki-panel);
    color: var(--ab-wiki-text);
    font-size: 0.92rem;
    line-height: 1.4;
    visibility: hidden;
}

/* Same scrollbar as the site (base.css), only slimmer. No scrollbar-width here: in Chrome it switches the styled bar off. */
.ab-wiki-side::-webkit-scrollbar { width: 6px; }
.ab-wiki-side::-webkit-scrollbar-track { background: transparent; }
.ab-wiki-side::-webkit-scrollbar-thumb { background: var(--ab-wiki-thumb); border-radius: 3px; }
.ab-wiki-side::-webkit-scrollbar-thumb:hover { background: var(--ab-wiki-accent); }

@supports not selector(::-webkit-scrollbar) {
    .ab-wiki-side { scrollbar-width: thin; scrollbar-color: var(--ab-wiki-thumb) transparent; }
}

.ab-wiki-side.ready { visibility: visible; }

.ab-wiki-side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0.25rem 0.6rem;
}

.ab-wiki-side-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ab-wiki-dim);
    font-family: var(--ab-wiki-font-head);
}

.ab-wiki-side-title i { margin-right: 0.35rem; }

.ab-wiki-close {
    display: none;
    border: 0;
    background: none;
    color: inherit;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.ab-wiki-search {
    position: relative;
    margin-bottom: 0.75rem;
}

.ab-wiki-search i {
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ab-wiki-dim);
    font-size: 0.85rem;
    pointer-events: none;
}

.ab-wiki-side .ab-wiki-search input,
.ab-wiki-side .ab-wiki-search input:focus {
    width: 100%;
    padding: 0.45rem 0.7rem 0.45rem 2rem;
    border: 1px solid var(--ab-wiki-line);
    border-radius: 0.5rem;
    /* cobalt.css paints every input in dark mode with !important */
    background: var(--ab-wiki-field) !important;
    color: inherit !important;
    font-size: 0.9rem;
    outline: none;
}

.ab-wiki-side .ab-wiki-search input:focus {
    border-color: color-mix(in srgb, var(--ab-wiki-accent) 70%, transparent);
}

/* The browser's blue clear cross, recoloured with the accent */
.ab-wiki-search input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    width: 0.75rem;
    height: 0.75rem;
    background: var(--ab-wiki-accent);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M1 1l8 8M9 1L1 9' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
    cursor: pointer;
}

.ab-wiki-list,
.ab-wiki-list ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ab-wiki-list a {
    display: block;
    padding: 0.3rem 0.5rem 0.3rem 0.65rem;
    border-left: 2px solid transparent;
    border-radius: 0 0.35rem 0.35rem 0;
    color: inherit;
    text-decoration: none;
}

.ab-wiki-list a:hover {
    background: var(--ab-wiki-hover);
    color: var(--ab-wiki-strong);
}

.ab-wiki-h2 > a { font-weight: 600; }

.ab-wiki-list ol {
    display: none;
    margin: 0.1rem 0 0.3rem 0.6rem;
    border-left: 1px solid var(--ab-wiki-line);
}

.ab-wiki-h2.open > ol { display: block; }

.ab-wiki-h3 > a {
    padding-left: 0.8rem;
    font-size: 0.88em;
    color: var(--ab-wiki-dim);
}

.ab-wiki-list a.in-path { color: var(--ab-wiki-strong); }

.ab-wiki-list a.active {
    border-left-color: var(--ab-wiki-accent);
    background: color-mix(in srgb, var(--ab-wiki-accent) 14%, transparent);
    color: var(--ab-wiki-strong);
}

/* ------------------------------ search results ------------------------------ */

.ab-wiki-result {
    display: block;
    width: 100%;
    margin: 0 0 0.35rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid transparent;
    border-radius: 0.45rem;
    background: var(--ab-wiki-field);
    color: inherit;
    text-align: left;
    font-size: 0.86rem;
    line-height: 1.4;
    cursor: pointer;
}

.ab-wiki-result:hover {
    border-color: var(--ab-wiki-line);
    background: var(--ab-wiki-hover);
}

.ab-wiki-result small {
    display: block;
    margin-bottom: 0.15rem;
    color: var(--ab-wiki-dim);
    font-size: 0.75rem;
    font-weight: 600;
}

.ab-wiki-result mark,
.ab-wiki-hit mark {
    padding: 0 0.1em;
    border-radius: 0.2em;
    background: color-mix(in srgb, var(--ab-wiki-accent) 45%, transparent);
    color: var(--ab-wiki-strong);
}

.ab-wiki-none {
    padding: 0.5rem;
    color: var(--ab-wiki-dim);
}

@keyframes ab-wiki-hit {
    from { background: color-mix(in srgb, var(--ab-wiki-accent) 30%, transparent); }
    to { background: transparent; }
}

.ab-wiki-hit {
    animation: ab-wiki-hit 2.2s ease-out;
    border-radius: 0.3rem;
}

/* ------------------------------ breadcrumbs bar ------------------------------ */

.ab-wiki-bar {
    position: sticky;
    top: var(--ab-wiki-top, 70px);
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 2.75rem;
    margin: 0 0 1rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--ab-wiki-line);
    border-radius: 0.6rem;
    background: var(--ab-wiki-panel);
    backdrop-filter: blur(8px);
    color: var(--ab-wiki-text);
    font-size: 0.9rem;
    overflow: hidden;
}

/* On wide screens the bar has nothing to say before the first section. */
@media (min-width: 1200px) {
    .ab-wiki-bar:not(.active) {
        opacity: 0;
        pointer-events: none;
    }
}

.ab-wiki-bar {
    transition: opacity 0.2s;
}

.ab-wiki-toggle {
    flex: none;
    display: none;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--ab-wiki-line);
    border-radius: 0.45rem;
    background: var(--ab-wiki-field);
    color: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.ab-wiki-crumbs {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    white-space: nowrap;
}

.ab-wiki-crumb {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0.15rem 0.3rem;
    border: 0;
    border-radius: 0.3rem;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.ab-wiki-crumb:last-child { color: var(--ab-wiki-strong); font-weight: 600; }
.ab-wiki-crumb:hover { background: var(--ab-wiki-hover); }
.ab-wiki-sep { flex: none; color: var(--ab-wiki-dim); }

.ab-wiki-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    width: 0;
    background: var(--ab-wiki-accent);
    transition: width 0.1s linear;
}

/* ------------------------------ heading links ------------------------------ */

.ab-wiki-link {
    margin-left: 0.5rem;
    padding: 0.1em 0.3em;
    border: 0;
    border-radius: 0.3rem;
    background: none;
    color: inherit;
    font-size: 0.55em;
    vertical-align: middle;
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.15s;
}

.article-content h2:hover .ab-wiki-link,
.article-content h3:hover .ab-wiki-link,
.ab-wiki-link:focus-visible {
    opacity: 0.7;
}

.ab-wiki-link:hover { opacity: 1 !important; background: rgba(127, 127, 127, 0.15); }

@media (hover: none) {
    .ab-wiki-link { opacity: 0.45; }
}

/* ------------------------------ back to top, toast ------------------------------ */

.ab-wiki-top {
    position: fixed;
    right: 1.5rem;
    bottom: 5.5rem;
    z-index: 900;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid var(--ab-wiki-line);
    border-radius: 50%;
    background: var(--ab-wiki-panel);
    color: var(--ab-wiki-strong);
    font-size: 1rem;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(0.5rem);
    transition: opacity 0.2s, transform 0.2s;
}

.ab-wiki-top.show {
    opacity: 1;
    pointer-events: auto;
    transform: none;
}

.ab-wiki-top:hover { border-color: var(--ab-wiki-accent); }

.ab-wiki-toast {
    position: fixed;
    left: 50%;
    bottom: 2rem;
    z-index: 2000;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    background: var(--ab-wiki-drawer);
    border: 1px solid var(--ab-wiki-line);
    color: var(--ab-wiki-strong);
    font-size: 0.9rem;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 0.5rem);
    transition: opacity 0.2s, transform 0.2s;
}

.ab-wiki-toast.show { opacity: 1; transform: translate(-50%, 0); }

.ab-wiki-backdrop { display: none; }

/* ------------------------------ narrow: drawer ------------------------------ */

@media (max-width: 1199.98px) {
    .ab-wiki-toggle { display: inline-flex; align-items: center; gap: 0.4rem; }
    .ab-wiki-close { display: block; }

    .ab-wiki-side {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1100;
        width: min(20rem, 86vw);
        max-height: none;
        margin: 0;
        border-radius: 0 0.75rem 0.75rem 0;
        background: var(--ab-wiki-drawer);
        transform: translateX(-105%);
        transition: transform 0.25s ease;
    }

    .ab-wiki-side.open { transform: none; }

    .ab-wiki-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1050;
        background: rgba(0, 0, 0, 0.55);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s;
    }

    .ab-wiki-backdrop.open { opacity: 1; pointer-events: auto; }

    .ab-wiki-crumb:not(:last-child),
    .ab-wiki-sep { display: none; }
}

@media (max-width: 576px) {
    .ab-wiki-top { right: 1rem; bottom: 5rem; }
}

/* ------------------------------ editor switch ------------------------------ */

.ab-wiki-check {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-weight: 600;
    cursor: pointer;
}

.ab-wiki-check input { width: 1.1rem; height: 1.1rem; }
