
.tp-hist-note--top { margin-top: 0.75rem; }

.ab-wrap { max-width: 820px; margin: 0 auto; padding: 1.5rem var(--spacing-md, 1rem) 4rem; }
.ab-wrap h1 { font-size: var(--fs-3xl); margin: 0 0 0.5rem; }
.ab-lead { color: var(--text-muted); font-size: var(--fs-lg); line-height: 1.6; margin: 0 0 2rem; }
.ab-h1-icon { color: var(--primary-color); }
.ab-wrap h2 { font-size: var(--fs-xl); margin: 2rem 0 0.6rem; }
.ab-wrap p { line-height: 1.65; margin: 0 0 1rem; }
.ab-wrap ul { line-height: 1.65; margin: 0 0 1rem; padding-left: 1.25rem; }
.ab-cta { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1.5rem; }
.ab-note { font-size: var(--fs-sm); color: var(--text-muted); border-top: 1px solid var(--border-color); padding-top: 1rem; margin-top: 2rem; }

.tp-about-cta { margin-top: 1.75rem; }

.tp-wrap { max-width: 1100px; margin: 0 auto; padding: 1.5rem var(--spacing-md, 1rem) 4rem; }
.tp-breadcrumb { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: 1rem; }
.tp-breadcrumb a { color: var(--text-muted); text-decoration: none; }
.tp-breadcrumb a:hover { color: var(--primary-color, #3b82f6); }

.tp-lead { color: var(--text-muted); font-size: var(--fs-lg); margin: 0 0 1.75rem; }

.tp-article { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 10px; padding: 1.75rem 2rem; }
.tp-article p { line-height: 1.65; font-size: var(--fs-base); margin: 0 0 1rem; }
.tp-article p:last-child { margin-bottom: 0; }

.tp-links { margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--border-color); }
.tp-links-title { font-size: var(--fs-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.6rem; }
.tp-links-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.tp-subtopics { margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--border-color); }
.tp-subtopics-grid { display: flex; flex-direction: column; gap: 0.15rem; margin-top: 0.5rem; }

.tp-links-list { list-style: none; margin: 0; padding: 0; }
.tp-links-list li { margin: 0 0 0.35rem; }
.tp-links-list li:last-child { margin-bottom: 0; }
.tp-link {
    display: inline-flex; align-items: baseline; gap: 0.35rem;
    text-decoration: none; font-size: var(--fs-md); font-weight: 500;
    color: var(--primary-color, #3b82f6);
    border-bottom: 1px solid transparent;
}
.tp-link::before { content: "\203A"; color: var(--text-muted); font-weight: 700; }
.tp-link:hover { border-bottom-color: currentColor; }

.tp-pager {
    display: flex; align-items: stretch; gap: 0.6rem;
    margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--border-color);
}
.tp-pager-btn {
    display: inline-flex; align-items: center; gap: 0.55rem;
    padding: 0.6rem 0.95rem; border-radius: 10px;
    border: 1px solid var(--border-color); background: var(--bg-card);
    color: var(--text-main); text-decoration: none;
    transition: border-color 0.15s, color 0.15s, transform 0.15s;
}
.tp-pager-btn:hover { border-color: var(--primary-color, #3b82f6); color: var(--primary-color, #3b82f6); }
.tp-pager-prev { flex: 1 1 0; justify-content: flex-start; }
.tp-pager-next { flex: 1 1 0; justify-content: flex-end; text-align: right; }
.tp-pager-index { flex: 0 0 auto; font-weight: 600; }
.tp-pager-index i { color: var(--primary-color, #3b82f6); }
.tp-pager-empty { flex: 1 1 0; border: none; background: none; pointer-events: none; }
.tp-pager-lbl { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.tp-pager-dir { font-size: var(--fs-3xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.tp-pager-name { font-size: var(--fs-md); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-pager-next .tp-pager-lbl { align-items: flex-end; }
@media (max-width: 560px) {
    .tp-pager-index .tp-pager-txt { display: none; }
    .tp-pager-name { max-width: 34vw; }
}
.tp-chip {
    display: inline-block; text-decoration: none; font-size: var(--fs-sm); font-weight: 600;
    padding: 0.4rem 0.85rem; border-radius: 999px;
    border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-main);
    transition: border-color 0.15s, color 0.15s;
}
.tp-chip:hover { border-color: var(--primary-color, #3b82f6); color: var(--primary-color, #3b82f6); }

.tp-toc { max-width: 780px; }
.tp-toc-group { margin-bottom: 1.75rem; }
.tp-toc-group:last-child { margin-bottom: 0; }
.tp-toc-group-h {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-muted); margin: 0 0 0.7rem;
}
.tp-toc-group-h i { color: var(--primary-color, #3b82f6); font-size: var(--fs-md); }
.tp-toc-group-h a { color: inherit; text-decoration: none; }
.tp-toc-group-h a:hover { color: var(--primary-color, #3b82f6); }
.tp-toc-items .tp-toc-group { margin-bottom: 1rem; }
.tp-toc-items {
    display: flex; flex-direction: column; gap: 0.15rem;
    margin-left: 0.45rem; padding-left: 1.1rem;
    border-left: 2px solid var(--border-color);
}
.tp-toc-items > .tp-toc-group { margin-top: 0.6rem; }
.tp-grid { display: flex; flex-direction: column; gap: 0.6rem; max-width: 760px; }
.tp-card {
    display: flex; gap: 0.9rem; align-items: flex-start; padding: 0.9rem 1.1rem;
    background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 10px;
    text-decoration: none; color: inherit;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.tp-card:hover { transform: translateX(3px); box-shadow: 0 6px 16px rgba(0,0,0,0.08); border-color: var(--primary-color, #3b82f6); }
.tp-card-icon { flex-shrink: 0; width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: rgba(59,130,246,0.12); color: var(--primary-color, #3b82f6); font-size: var(--fs-lg); }
.tp-card-title { margin: 0 0 0.25rem; font-size: var(--fs-lg); font-weight: 700; }
.tp-card-sum { margin: 0; color: var(--text-muted); font-size: var(--fs-md); line-height: 1.45; }

.tp-card--sub {
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.8rem;
    border-radius: 8px;
}
.tp-card--sub:hover { transform: translateX(2px); box-shadow: none; }

.tp-card-bullet {
    flex: 0 0 auto;
    width: 6px; height: 6px;
    margin: 0 0.15rem;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.5;
    transition: background-color 0.15s, opacity 0.15s, transform 0.15s;
}
.tp-card--sub:hover .tp-card-bullet {
    background: var(--primary-color, #3b82f6);
    opacity: 1;
    transform: scale(1.25);
}

.tp-card--sub .tp-card-title { margin: 0; font-size: var(--fs-md); font-weight: 600; line-height: 1.35; }
.tp-card--sub .tp-card-sum   { margin: 0.1rem 0 0; font-size: var(--fs-sm); line-height: 1.4; }

.tp-falists { margin-top: 1.5rem; }
.tp-falist { margin: 1.25rem 0; }
.tp-falist-h { font-size: var(--fs-base); font-weight: 700; margin: 0 0 0.4rem; display: flex; align-items: center; gap: 0.5rem; }
.tp-falist-count { font-size: var(--fs-2xs); font-weight: 700; color: var(--text-muted); background: var(--bg-surface-2, #eef2f7); border-radius: 999px; padding: 1px 9px; }
.tp-falist-note { margin: 0 0 0.6rem; color: var(--text-muted); font-size: var(--fs-sm); line-height: 1.45; }
.tp-falist-empty { color: var(--text-muted); font-style: italic; font-size: var(--fs-sm); }
.tp-fachips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.tp-fachip {
    display: inline-flex; align-items: baseline; gap: 0.35rem; text-decoration: none;
    font-size: var(--fs-sm); font-weight: 600; padding: 0.32rem 0.7rem; border-radius: 8px;
    border: 1px solid var(--border-color); background: var(--bg-card); color: var(--text-main);
    transition: border-color 0.15s, color 0.15s;
}
.tp-fachip:hover { border-color: var(--primary-color, #3b82f6); color: var(--primary-color, #3b82f6); }
.tp-fachip-no { font-size: var(--fs-2xs); font-weight: 500; color: var(--text-muted); }
.tp-fachip-trace { font-size: var(--fs-3xs); font-weight: 700; color: #854d0e; background: #fef9c3; border-radius: 5px; padding: 0 4px; }

.tp-page--article { --fap-side-menu-w: 300px; }
.tp-sidebar { width: var(--fap-side-menu-w, 300px); }

.tp-page--article .tp-wrap { max-width: 1100px; margin: 0 auto; }

.tp-page--article {
    display: flex;
    align-items: flex-start;
    gap: 0;
    margin: 0;
    padding: 0 0 4rem;
    padding-left: var(--fap-side-menu-w, 300px);
}
.tp-page--article .tp-wrap {
    padding: 0 var(--col-pad, 1rem);
}

.coreInnerPage:has(.tp-page--article:not(.is-undocked)) { --tp-docked-w: 300px; }
.coreInnerPage:has(.tp-page--article:not(.is-undocked)) .app-footer {
    padding-left: var(--tp-docked-w, 0px);
}
.tp-main { flex: 1; min-width: 0; }

.tp-page--article .tp-wrap > .tp-lead { margin: 0 0 1.25rem; }

.tp-sidebar {
    flex-shrink: 0;
    position: fixed;
    top: var(--app-header-h, 64px);
    left: 0;
    bottom: 0;
    width: var(--fap-side-menu-w, 300px);
    max-height: none;
    margin: 0;
    overflow-y: auto;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    z-index: 25;
}

.tp-nav {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0.5rem;
}
.tp-nav-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: var(--fs-md);
    padding: 0.6rem 0.7rem;
    color: var(--text-main);
}
.tp-nav-head i { color: var(--primary-color, #3b82f6); margin-right: 0.4rem; }
.tp-nav-home { color: inherit; text-decoration: none; }
.tp-nav-home:hover { color: var(--primary-color, #3b82f6); }

.tp-nav-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: var(--fs-xl);
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
}
.tp-nav-close:hover { color: var(--text-main); background: rgba(127,127,127,0.12); }

.tp-nav-head-actions { display: flex; align-items: center; gap: 0.15rem; flex-shrink: 0; }

.tp-nav-dock {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: var(--fs-base);
    cursor: pointer;
    padding: 0.2rem 0.45rem;
    border-radius: 6px;
}
.tp-nav-dock:hover { color: var(--primary-color, #3b82f6); background: rgba(127,127,127,0.12); }
.tp-nav-dock i { transition: transform 0.18s ease; }
.tp-page--article.is-undocked .tp-nav-dock i { transform: rotate(-40deg); }

.tp-nav-group { border-radius: 8px; }
.tp-nav-group-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.7rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: var(--fs-sm);
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-radius: 8px;
}
.tp-nav-group-btn:hover { color: var(--text-main); background: rgba(127,127,127,0.08); }
.tp-nav-group-ico { font-size: var(--fs-sm); width: 1.1em; text-align: center; }
.tp-nav-group-label { flex: 1; text-align: left; }
.tp-nav-caret { font-size: 0.7em; opacity: 0.7; transition: transform 0.18s ease; }
.tp-nav-group.is-open > .tp-nav-grow .tp-nav-caret,
.tp-nav-group.is-open > .tp-nav-group-btn .tp-nav-caret { transform: rotate(180deg); }
.tp-nav-group.is-top > .tp-nav-grow .tp-nav-caret,
.tp-nav-group.is-top > .tp-nav-group-btn .tp-nav-caret { display: none; }

.tp-nav-list {
    list-style: none;
    margin: 0;
    padding: 0 0 0.35rem;
    display: none;
}
.tp-nav-group.is-open > .tp-nav-list { display: block; }

.tp-nav-link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: var(--text-main);
    font-size: var(--fs-md);
    line-height: 1.3;
    padding: 0.45rem 0.7rem 0.45rem 1.55rem;
    border-radius: 7px;
    border-left: 2px solid transparent;
}
.tp-nav-link:hover { background: rgba(59,130,246,0.08); color: var(--primary-color, #3b82f6); }
.tp-nav-link-ico { font-size: var(--fs-xs); width: 1.1em; text-align: center; color: var(--text-muted); flex-shrink: 0; }
.tp-nav-link:hover .tp-nav-link-ico { color: var(--primary-color, #3b82f6); }

.tp-nav-link.is-active {
    background: rgba(59,130,246,0.12);
    color: var(--primary-color, #3b82f6);
    font-weight: 600;
    border-left-color: var(--primary-color, #3b82f6);
}
.tp-nav-link.is-active .tp-nav-link-ico { color: var(--primary-color, #3b82f6); }

.tp-nav-grow { display: flex; align-items: stretch; gap: 0.15rem; }
.tp-nav-glink {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: 0.55rem;
    text-decoration: none; color: var(--text-main);
    font-size: var(--fs-sm); font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase;
    padding: 0.55rem 0.5rem 0.55rem 0.7rem; border-radius: 8px;
}
.tp-nav-glink:hover { color: var(--primary-color, #3b82f6); background: rgba(59,130,246,0.08); }
.tp-nav-glink.is-active { color: var(--primary-color, #3b82f6); }
.tp-nav-glink span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-nav-toggle-grp {
    background: none; border: none; cursor: pointer; color: var(--text-muted);
    padding: 0 0.5rem; border-radius: 8px; flex-shrink: 0;
}
.tp-nav-toggle-grp:hover { color: var(--text-main); background: rgba(127,127,127,0.08); }

.tp-nav-img { width: 1.05em; height: 1.05em; object-fit: contain; border-radius: 3px; flex-shrink: 0; }
.tp-img-icon { width: 1em; height: 1em; object-fit: contain; border-radius: 3px; vertical-align: -0.12em; }

.tp-nav-list {
    position: relative;
    margin-left: 0.85rem;
    padding-left: 0.85rem;
    border-left: 1.5px solid var(--border-color);
}
.tp-nav-list > .tp-nav-link,
.tp-nav-list > .tp-nav-group > .tp-nav-grow,
.tp-nav-list > .tp-nav-group > .tp-nav-group-btn { position: relative; }
.tp-nav-list > .tp-nav-link::before,
.tp-nav-list > .tp-nav-group > .tp-nav-grow::before,
.tp-nav-list > .tp-nav-group > .tp-nav-group-btn::before {
    content: "";
    position: absolute;
    left: -0.85rem;
    top: 50%;
    width: 0.6rem;
    height: 0;
    border-top: 1.5px solid var(--border-color);
}
.tp-nav-link:not(.is-top) { padding-left: 0.7rem; }
.tp-nav-list .tp-nav-group > .tp-nav-grow,
.tp-nav-list .tp-nav-group > .tp-nav-group-btn { padding-left: 0.55rem; }
.tp-nav-group.is-open > .tp-nav-list { border-left-color: var(--primary-color, #3b82f6); opacity: 1; }

.tp-nav-all {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.35rem;
    padding: 0.6rem 0.7rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: var(--fs-sm);
    font-weight: 600;
    text-decoration: none;
}
.tp-nav-all:hover { color: var(--primary-color, #3b82f6); }

.tp-nav-toggle {
    display: none;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
    font-size: var(--fs-md);
    font-weight: 600;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    margin-bottom: 1rem;
}
.tp-nav-toggle:hover { border-color: var(--primary-color, #3b82f6); color: var(--primary-color, #3b82f6); }
.tp-nav-toggle i { color: var(--primary-color, #3b82f6); }

.tp-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 390;
}

.tp-page--article.is-undocked { display: block; padding: 0 0 4rem; }

.tp-page--article.is-undocked .tp-nav-toggle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: left;
    gap: 2.2rem;
    position: fixed;
    left: 0;
    top: 153px;
    width: 2.3rem;
    min-height: 7.5rem;
    margin: 0;
    padding: 0.7rem 0;
    border-left: 0;
    border-radius: 0 8px 8px 0;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.12);
    z-index: 60;
}
.tp-page--article.is-undocked .tp-nav-toggle .tp-nav-toggle-label {
    display: inline-block;
    transform: rotate(-90deg);
    white-space: nowrap;
    line-height: 1;
}
/* Geometry matches the docked rail exactly — same top (below the app header),
   same width, same padding — so the pin only changes whether the sidebar
   floats over the article, never its position or size. */
.tp-page--article.is-undocked .tp-sidebar {
    position: fixed;
    top: var(--app-header-h, 64px);
    left: 0;
    bottom: 0;
    width: var(--fap-side-menu-w, 300px);
    max-width: 86vw;
    max-height: none;
    margin: 0;
    padding: 0;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    /* Rounded only on the three edges that float free of the viewport; the
       left edge stays square against the window. */
    border-radius: 0 10px 10px 0;
    box-shadow: 0 0 40px rgba(0,0,0,0.28);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 400;
}
.tp-page--article.is-undocked .tp-sidebar.is-open { transform: translateX(0); }
.tp-page--article.is-undocked .tp-sidebar .tp-nav { border: none; border-radius: 0; padding: 0.5rem; }
.tp-page--article.is-undocked .tp-nav-close { display: inline-flex; }
.tp-page--article.is-undocked .tp-sidebar-backdrop.is-open { display: block; }

@media (max-width: 860px) {
    .coreInnerPage:has(.tp-page--article:not(.is-undocked)) { --tp-docked-w: 0px; }

    .tp-page--article {
        display: block;
        padding-top: 0;
        padding-left: 0;
    }
    .tp-nav-toggle { display: inline-flex; }
    .tp-nav-dock { display: none; }

    .tp-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 290px;
        max-width: 86vw;
        max-height: none;
        margin: 0;
        padding: 0.75rem;
        background: var(--bg-card);
        border-right: 1px solid var(--border-color);
        box-shadow: 0 0 40px rgba(0,0,0,0.28);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 400;
    }
    .tp-sidebar.is-open { transform: translateX(0); }
    .tp-sidebar .tp-nav { border: none; border-radius: 0; padding: 0; }

    .tp-nav-close { display: inline-flex; }
    .tp-sidebar-backdrop.is-open { display: block; }
}


/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE — the drawer opener lives in the title band
   ═══════════════════════════════════════════════════════════════════════════ */

.pageHeader-row > .tp-nav-toggle {
    flex: 0 0 auto;
    margin: 0 0 0 auto;
}

/* The topic's one feedback button, beside the title rather than pushed to the
   right edge: it is about THIS topic, and the drawer opener already owns the
   far right (margin-left:auto above). Never shrink it — the title is the
   flexible item in this row, not the controls. */
.pageHeader-row > .fb-btn { flex: 0 0 auto; }

@media (max-width: 860px) {
    .tp-page--article .pageHeader-row > .tp-nav-toggle {
        /* Undo the desktop edge-tab geometry — the `.is-undocked` rule above
           makes it `position: fixed` at 250px down the left edge, and that
           rule is live at this width too. */
        position: static;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 0;
        width: 34px;
        height: 34px;
        min-height: 0;
        padding: 0;
        border: 1px solid var(--border-color);
        border-left: 1px solid var(--border-color);
        border-radius: 8px;
        box-shadow: none;
        /* Sized the house way — an em multiplier on the icon box, so it tracks
           the reader's text scale like every other tool icon. */
        --toolIcon-size: 1.15em;
    }

    .tp-page--article .pageHeader-row > .tp-nav-toggle .tp-nav-toggle-label {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
        border: 0;
        transform: none;
    }
}
