/*
 * NOCO EMS Education - Common Learn Page Styles
 * Used across all cardiology, pulmonology, and pharmacology content pages
 * Version: 1.0
 */

/* Container Styles */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    padding-bottom: 2rem;
}

@media (min-width: 769px) {
    .container {
        max-width: 1000px;
    }
}

/* Back button (.learn-back-btn): an alias of .page-back, styled in
   /includes/styles.css with the phone spacing it had here. */

/* Breadcrumb Navigation */
.breadcrumb-nav {
    margin-bottom: 1.5rem;
}

.breadcrumb-nav .breadcrumb {
    background: var(--card-bg, #f8f9fa);
    border: 1px solid var(--border-soft, #e9ecef);
    border-radius: 10px;
    padding: 0.65rem 1.25rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.breadcrumb-nav .breadcrumb-item {
    font-size: 1.13rem;
    font-weight: 500;
}

.breadcrumb-nav .breadcrumb-item a {
    color: var(--primary-soft);
    text-decoration: none;
    transition: color 0.15s ease;
}

.breadcrumb-nav .breadcrumb-item a:hover {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.breadcrumb-nav .breadcrumb-item.active {
    color: var(--text-muted);
    font-weight: 600;
}

.breadcrumb-nav .breadcrumb-item + .breadcrumb-item::before {
    content: '\203A';
    color: var(--text-muted);
    font-weight: 400;
    padding: 0 0.4rem;
}

[data-theme="dark"] .breadcrumb-nav .breadcrumb {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .breadcrumb-nav .breadcrumb-item.active {
    color: #888;
}

@media (max-width: 768px) {
    .breadcrumb-nav {
        overflow-x: auto;
        overscroll-behavior-x: contain;
    }

    .breadcrumb-nav .breadcrumb {
        flex-wrap: nowrap;
        white-space: nowrap;
        padding: 0.5rem 1rem;
    }

    .breadcrumb-nav .breadcrumb-item {
        font-size: 0.85rem;
    }
}

[data-theme="dark"] .breadcrumb-item a {
    color: #8DB9E8;
    text-decoration: underline;
    text-decoration-color: rgba(141, 185, 232, 0.4);
    text-underline-offset: 2px;
}

[data-theme="dark"] .breadcrumb-item a:hover {
    color: #A8CCE8;
    text-decoration-color: rgba(168, 204, 232, 0.8);
}

[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before {
    color: #666;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

/* Page Title Row - title + CE badge */
.page-title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.page-title-row .page-title {
    margin-bottom: 0;
}

/* The topic viewer's completion badge (.section-completion) is a
   .status-pill: "Not complete" (muted) until every requirement is met,
   then "Complete" (success). section-scripts.js swaps the tone. */

/* Topic Requirements Strip */
.topic-reqs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.topic-req-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1.5px solid var(--border-medium);
    background: var(--neutral-bg);
    color: var(--text-muted);
    transition: all 0.25s ease;
}

.topic-req-item .req-icon-done { display: none; }
.topic-req-item .req-icon-pending { display: inline-block; }

.topic-req-item.done {
    border-color: #70AD47;
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    color: #2D8B57;
}

.topic-req-item.done .req-icon-done { display: inline-block; }
.topic-req-item.done .req-icon-pending { display: none; }

[data-theme="dark"] .topic-req-item {
    border-color: #444;
    background: rgba(255,255,255,0.05);
    color: #888;
}

[data-theme="dark"] .topic-req-item.done {
    border-color: #70AD47;
    background: linear-gradient(135deg, #1B3A1B 0%, #2E4D2E 100%);
    color: #8BC34A;
}

/* Best Score Badge - next to completion badge */
.section-best-score {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.65rem;
    background: linear-gradient(135deg, #FFF3E0 0%, #FFE0B2 100%);
    border: 1.5px solid #FF9800;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #E65100;
    white-space: nowrap;
    flex-shrink: 0;
}

.section-best-score i {
    font-size: 0.85rem;
}

[data-theme="dark"] .section-best-score {
    background: linear-gradient(135deg, #3E2C1E 0%, #4E3524 100%);
    border-color: #FF9800;
    color: #FFB74D;
}

.page-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #D6E9F8 0%, #BDD7EE 100%);
    color: #3979B3;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.page-title {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.page-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Section Cards: a .surface-panel look (opaque card colour, soft frame).
   In the topic viewer the card sits flat inside .content-main, which is
   the panel (section.css); this standalone look is what the SCORM export
   (api/export-scorm.php) starts from before repainting the frame. */
.section-card {
    background: var(--card-bg);
    border: var(--frame-w) solid var(--frame-panel);
    border-radius: var(--r-lg);
    padding: 2.25rem;
    margin-bottom: 2rem;
    /* Only fade the visual props (theme changes) — NOT padding/size, so
       leaving fullscreen doesn't animate the padding back down and make the
       regular card momentarily look padded. */
    transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--elev-1);
}

/* Full-screen toggle: sits at the far right of the topic header row. */
/* The inline Edit button shares this look but NOT the class: the
   fullscreen sync in section-scripts.js rewrites every .section-fullscreen-btn
   icon and label on each fullscreen change. */
.section-fullscreen-btn,
.section-inline-edit-btn {
    margin-left: auto;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 2rem;
    padding: 0 0.7rem;
    border-radius: 8px;
    border: 1px solid var(--border-soft, #d8dee6);
    background: transparent;
    color: var(--text-secondary, #566);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.section-fullscreen-btn i,
.section-inline-edit-btn i { font-size: 1.05rem; }
/* Fullscreen: the site's standard filled button (.btn-primary look):
   white label on the fixed fill token, darker (not green) on hover. */
.section-fullscreen-btn {
    background: var(--primary-fill, #3A6FA8);
    border-color: var(--primary-fill, #3A6FA8);
    color: #fff;
}
.section-fullscreen-btn:hover {
    background: color-mix(in srgb, var(--primary-fill, #3A6FA8) 85%, #000);
    border-color: color-mix(in srgb, var(--primary-fill, #3A6FA8) 85%, #000);
    color: #fff;
}

/* ── Inline editing (creators): Quick Edit button, editable surface, toolbar ── */
/* Quick Edit: filled yellow so it is unmistakable next to Fullscreen. Dark
   text on the yellow keeps it readable in both themes. */
.section-inline-edit-btn {
    margin-left: 0;
    background: #F5C542;
    border-color: #F5C542;
    color: #1F1A05;
}
.section-inline-edit-btn:hover {
    background: #E9B42A;
    border-color: #E9B42A;
    color: #1F1A05;
}
/* While editing: a deeper amber with a soft ring, so "on" reads as a state
   rather than a hover. */
.section-inline-edit-btn.is-on {
    background: #C6931A;
    border-color: #C6931A;
    color: #fff;
    box-shadow: 0 0 0 3px color-mix(in srgb, #F5C542 40%, transparent);
}
.section-card.ie-active .section-content-inner {
    outline: 2px dashed color-mix(in srgb, var(--primary-soft, #3A6FA8) 55%, transparent);
    outline-offset: 12px;
    border-radius: 6px;
    min-height: 6rem;
    caret-color: var(--primary-soft, #3A6FA8);
}
.section-card.ie-active .section-content-inner:focus { outline-style: solid; }
/* Text opened up inside an embed (callout, key points, table). */
.section-card.ie-active [data-ie] {
    outline: 1px dashed color-mix(in srgb, var(--primary-soft, #3A6FA8) 45%, transparent);
    outline-offset: 3px;
    border-radius: 4px;
}
.section-card.ie-active .section-content-inner img { cursor: default; }
.section-card.ie-active .section-content-inner a { cursor: text; }

/* Fixed across the top of the window (mounted on <body> or on the
   full-screen element, never inside the card: see mountToolbar in
   inline-edit.js). While it is up, the page and the full-screen container
   pad down by its measured height (--ie-bar-h) so nothing hides under it. */
.ie-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1200;
    background: var(--card-bg, #fff);
    border-bottom: 1px solid var(--border-soft, #d8dee6);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}
.ie-toolbar .ie-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.15rem;
    padding: 0.4rem clamp(0.75rem, 3vw, 2rem);
}
body.ie-editing { padding-top: var(--ie-bar-h, 3rem); }
.content-main.is-fs-content.ie-editing { padding-top: calc(2.5rem + var(--ie-bar-h, 3rem)); }
.ie-toolbar .ie-title {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-right: 0.6rem;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--primary-soft, #3A6FA8);
    white-space: nowrap;
}
.ie-toolbar .ie-spacer { flex: 1; }
.ie-toolbar button,
.ie-toolbar .ie-color {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    height: 1.9rem;
    min-width: 1.9rem;
    padding: 0 0.45rem;
    border-radius: 7px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-primary, #1a2332);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
}
.ie-toolbar button i { font-size: 1.05rem; }
.ie-toolbar button:hover, .ie-toolbar .ie-color:hover { background: color-mix(in srgb, var(--primary-soft, #3A6FA8) 12%, transparent); }
.ie-toolbar .ie-chip { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; }
.ie-toolbar .ie-color { position: relative; }
.ie-toolbar .ie-color input[type="color"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.ie-toolbar .ie-select {
    height: 1.9rem;
    padding: 0 0.4rem;
    border-radius: 7px;
    border: 1px solid var(--border-soft, #d8dee6);
    background: var(--card-bg, #fff);
    color: var(--text-primary, #1a2332);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
}
.ie-toolbar .ie-sep { width: 1px; height: 1.3rem; background: var(--border-soft, #d8dee6); margin: 0 0.3rem; }
/* Save: white label on the fixed fill token; hover darkens (brightening cut contrast). */
.ie-toolbar .ie-save { background: var(--primary-fill, #3A6FA8); color: #fff; padding: 0 0.7rem; }
.ie-toolbar .ie-save:hover { background: color-mix(in srgb, var(--primary-fill, #3A6FA8) 85%, #000); }
.ie-toolbar .ie-cancel { color: var(--text-secondary, #566); }
.ie-toolbar .ie-status { font-size: 0.74rem; color: var(--text-muted, #778); margin-left: 0.3rem; white-space: nowrap; }

/* Table row: appears under the bar while the caret is in a table cell. */
.ie-toolbar .ie-table-row {
    border-top: 1px solid var(--border-soft, #d8dee6);
    background: color-mix(in srgb, var(--primary-soft, #3A6FA8) 5%, var(--card-bg, #fff));
}
.ie-toolbar .ie-table-row[hidden] { display: none; }

/* Popover forms (callout, table, link…) open as a second row under the bar. */
.ie-pop {
    padding: 0.6rem clamp(0.75rem, 3vw, 2rem) 0.8rem;
    border-top: 1px solid var(--border-soft, #d8dee6);
    background: color-mix(in srgb, var(--primary-soft, #3A6FA8) 5%, var(--card-bg, #fff));
    max-height: 60vh;
    overflow: auto;
}
.ie-pop .ie-form { max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; gap: 0.5rem; }
.ie-pop .ie-pop-title { font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--primary-soft, #3A6FA8); }
.ie-pop .ie-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.5rem 0.75rem; }
.ie-pop .ie-field { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.78rem; font-weight: 700; color: var(--text-secondary, #566); }
.ie-pop .ie-field code { font-size: 0.75rem; }
.ie-pop input:not([type="checkbox"]):not([type="color"]), .ie-pop select, .ie-pop textarea {
    width: 100%;
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--border-soft, #d8dee6);
    border-radius: 8px;
    background: var(--card-bg, #fff);
    color: var(--text-primary, #1a2332);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 500;
}
.ie-pop input[type="color"] { width: 3rem; height: 2rem; padding: 0.1rem; border: 1px solid var(--border-soft, #d8dee6); border-radius: 8px; background: var(--card-bg, #fff); }
.ie-pop textarea.ie-mono { font-family: 'Courier New', monospace; font-size: 0.82rem; }
.ie-pop .ie-inline { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; }
.ie-pop .ie-check { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; font-weight: 600; color: var(--text-primary, #1a2332); cursor: pointer; }
.ie-pop .ie-hint { font-size: 0.78rem; color: var(--text-muted, #778); }
.ie-pop .ie-pop-actions { display: flex; justify-content: flex-end; gap: 0.4rem; }
.ie-pop .ie-acc-items { display: flex; flex-direction: column; gap: 0.5rem; }
.ie-pop .ie-acc-item { display: grid; grid-template-columns: minmax(160px, 1fr) 2fr; gap: 0.5rem; padding: 0.5rem; border: 1px dashed var(--border-soft, #d8dee6); border-radius: 8px; }
.ie-pop .ie-ref-list { display: flex; flex-direction: column; gap: 0.35rem; }
.ie-pop .ie-ref { display: flex; align-items: center; gap: 0.6rem; padding: 0.35rem 0.5rem; border: 1px solid var(--border-soft, #d8dee6); border-radius: 8px; background: var(--card-bg, #fff); }
.ie-pop .ie-ref-cite { flex: 1; font-size: 0.82rem; color: var(--text-primary, #1a2332); }
.ie-toast {
    position: fixed;
    left: 50%;
    bottom: 5.5rem;
    transform: translate(-50%, 10px);
    z-index: 1300;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: var(--text-primary, #1a2332);
    color: var(--card-bg, #fff);
    font-size: 0.85rem;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}
.ie-toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 600px) {
    .ie-toolbar .ie-row { padding: 0.35rem 0.5rem; justify-content: center; }
    .ie-toolbar .ie-title, .ie-toolbar .ie-status { display: none; }
    .ie-toolbar .ie-spacer { flex: 0; }
    .ie-pop .ie-acc-item { grid-template-columns: 1fr; }
}

/* Full-screen focus mode.
   We full-screen the STABLE `.content-main` wrapper (which holds every topic
   card), NOT the individual card — so arrow-key navigation swaps the visible
   card INSIDE the persistent full-screen element and never force-exits.
   Styling keys off an `.is-fs-content` class the JS toggles on the actual
   full-screen element, which sidesteps the fragile `:fullscreen` /
   `:-webkit-full-screen` vendor-pseudo rules entirely (an unknown pseudo in a
   selector list drops the whole rule). The browser handles the top-layer /
   sizing via requestFullscreen; this just sets the appearance. Solid opaque
   background + no backdrop-filter keeps text off the black backdrop. */
.content-main.is-fs-content {
    width: 100vw; height: 100vh;
    /* Tighter side gutters than the old clamp(2rem, 7vw, 6rem): full screen
       is for reading, so the margins give way to the text. Clearance for
       the fixed prev/next bar comes from the ::after spacer below, NOT
       from bottom padding: some browsers don't count a scroll container's
       own bottom padding as scrollable space, which left the last lines
       of long topics stuck underneath the bar. */
    padding: 2.5rem clamp(1.25rem, 3.5vw, 3rem);
    overflow-y: auto;
    /* The screen is the surface: no panel frame. */
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: var(--neutral-bg);
    color: var(--text-primary);
    /* All three must stay none: any of them would make this element the
       containing block for the fixed-position nav bar below, which would
       then be clipped by this element's own overflow instead of sitting
       on the screen edge. */
    -webkit-backdrop-filter: none; backdrop-filter: none;
    filter: none;
    transform: none;
}
/* In-flow spacer at the end of the scroll content — reliably scrollable in
   every browser, unlike container bottom padding. The JS measures the real
   bar height into --fs-nav-clearance; 9rem covers first paint. */
.content-main.is-fs-content::after {
    content: "";
    display: block;
    height: var(--fs-nav-clearance, 9rem);
    flex-shrink: 0;
}
.content-main.is-fs-content::backdrop { background: var(--neutral-bg); }
/* iPhone (and any browser without an element fullscreen API, or that
   refused the request): the same reading surface, pinned over the page by
   CSS instead of the browser's top layer (section-scripts.js
   setFsFallback). Above the navbar and the phone TOC strip (999), below
   the editor and other overlays (1050+). */
.content-main.is-fs-content.is-fs-fallback {
    position: fixed;
    inset: 0;
    z-index: 1040;
    width: auto;
    height: auto;
    max-height: none;
    margin: 0;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-top: calc(2.5rem + env(safe-area-inset-top, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
}
html.fs-fallback-open,
html.fs-fallback-open body { overflow: hidden; }
/* The panel's ancestors must not interfere while it is open. A transformed
   / filtered / animated ancestor would become its reference box (the
   column's fade-in leaves a transform behind), and an ancestor that forms
   its own stacking layer (z-index, opacity, isolation, …) would cap the
   panel's z-order under the navbar and footer. The browser's own
   fullscreen is immune to all this; the fallback is not. */
html.fs-fallback-open :has(.content-main.is-fs-fallback) {
    transform: none !important;
    filter: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    animation: none !important;
    will-change: auto !important;
    contain: none !important;
    perspective: none !important;
    z-index: auto !important;
    opacity: 1 !important;
    isolation: auto !important;
    mix-blend-mode: normal !important;
    clip-path: none !important;
    -webkit-mask-image: none !important;
    mask-image: none !important;
}
/* The scroll container is given tabindex="-1" and focused after a topic
   swap so Up / Down keep scrolling (see restoreScrollFocus). It's a
   scroll box, not a control, so it shouldn't draw a focus ring. */
.content-main[tabindex="-1"]:focus,
.content-main .fl-scroll[tabindex="-1"]:focus {
    outline: none;
}
/* The inner card is already flat (section.css: .content-main is the
   surface); in full screen it is centred and capped at 1500px, so the
   text still fills a wide screen. */
.content-main.is-fs-content .section-card {
    margin: 0 auto;
    max-width: 1500px;
}
/* The site's blue scrollbar in full screen. On desktop (>= 1025px)
   FLScrollbar wraps the topics in .fl-scroll and draws its track inside
   .content-main; full screen used to collapse that and let the browser's
   native bar show. Keep the same arrangement as the normal page instead:
   the full-screen element is a flex column clipped to the screen, the
   wrapper is the scroll box (flex: 1 + min-height: 0 pins its BOX to the
   screen height while the content scrolls inside it), and the prev/next
   clearance spacer is the wrapper's ::after, at the end of the scrollable
   content where it is always reachable. Without FLScrollbar (narrow
   screens) the rules above still apply: .content-main scrolls itself. */
.content-main.is-fs-content.fl-scrolled {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Room for the 26px track band (6px in + 20px wide) plus a gap, as
       on the normal page (38px), on screens where the gutter clamps down. */
    padding-right: max(38px, clamp(1.25rem, 3.5vw, 3rem));
}
.content-main.is-fs-content.fl-scrolled::after { content: none; }
.content-main.is-fs-content.fl-scrolled > .fl-scroll {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
}
.content-main.is-fs-content.fl-scrolled > .fl-scroll::after {
    content: "";
    display: block;
    height: var(--fs-nav-clearance, 9rem);
}
/* The track stops above the fixed prev/next bar. The JS measures
   --fs-nav-clearance as bar height + 60px, and the bar's top edge sits
   (clearance - 40px) from the bottom of the screen; 8px of air on top of
   that. While Quick Edit is open its toolbar is fixed across the top of
   the screen, so the track starts below it. */
.content-main.is-fs-content.fl-scrolled > .fl-scrollbar-track {
    top: 12px;
    bottom: calc(var(--fs-nav-clearance, 9rem) - 32px);
}
.content-main.is-fs-content.fl-scrolled.ie-editing > .fl-scrollbar-track {
    top: calc(12px + var(--ie-bar-h, 3rem));
}
/* Prev / Next bar, moved in here by the JS while full screen is active
   (it normally lives outside .content-main and would be hidden by the top
   layer). Fixed to the bottom of the screen, not sticky: sticky leaves the
   bar at its natural position whenever the topic is short enough not to
   overflow, which parks it halfway down the page. A full-screen element
   fills the viewport, so a fixed descendant lands on the screen edge.
   Opaque, since content scrolls behind it. */
.content-main.is-fs-content > .content-nav-bar {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    width: min(1500px, calc(100vw - 2.5rem));
    box-sizing: border-box;
    z-index: 5;
    margin: 0;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: var(--elev-3);
}
/* Light / dark toggle for focus reading (a .btn-secondary). Only shown
   while the bar is inside the full-screen element — everywhere else the
   site's regular theme control applies, and the reading bar stays Prev /
   counter / Next. */
.content-nav-theme-btn {
    display: none;
}
.content-main.is-fs-content > .content-nav-bar .content-nav-theme-btn {
    display: inline-flex;
}


.section-card-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-header-content {
    flex: 1;
}

/* Topic viewer heading (learn/view.php). Its own class: the shared
   section heading size in styles.css had pinned it to 1.3rem, the same
   size as its preview line and smaller than the headings inside it. */
.topic-viewer-title {
    font-size: var(--fs-topic-title, clamp(1.6rem, 1.35rem + 0.7vw, 1.85rem));
    font-weight: 800;
    line-height: 1.25;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

/* Title row: the topic title, creator pills and cog, the completion
   pill, then the updated stamp and the Quick Edit / Fullscreen buttons
   pushed to the right edge. */
.topic-header-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.topic-header-row .topic-viewer-title {
    margin-bottom: 0;
}
.topic-updated-stamp {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: auto;
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 600;
    white-space: nowrap;
}

.section-preview {
    font-size: 1.05rem;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
}

/* Key Points Preview (Always Visible): the info tint with a primary
   frame and bullets, in both themes. */
.key-points-preview[data-pres-only="1"] {
    display: none;
}

.key-points-preview {
    background: var(--primary-tint);
    border: 1.5px solid var(--info-border);
    border-left: 4px solid var(--primary-soft);
    border-radius: var(--r-md);
    padding: 1.25rem 1.5rem;
    margin-top: 1.5rem;
}

.key-points-preview-title {
    display: none;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: var(--primary-text);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.key-points-preview-title i {
    font-size: 1.2rem;
}

.key-points-preview ul {
    margin: 0;
    padding-left: 1.5rem;
    list-style: none;
}

/* Two classes plus the element: out-ranks section.css's dark
   ".section-content-inner li" body colour without !important. */
.key-points-preview ul li,
[data-theme="dark"] .key-points-preview ul li {
    margin-bottom: 0.6rem;
    color: var(--text-primary);
    font-size: 1em;
    line-height: 1.6;
    position: relative;
    padding-left: 0.5rem;
}

/* No trailing gap inside the box (out-ranks the content list margins). */
.key-points-preview ul:last-child,
.key-points-preview ul li:last-child {
    margin-bottom: 0;
}

.key-points-preview li:before {
    content: "•";
    color: var(--primary-soft);
    font-weight: bold;
    font-size: 1.2rem;
    position: absolute;
    left: -1rem;
}

/* Quill list rendering. Quill nests lists by adding .ql-indent-N (padding-left)
   to each <li> and draws the marker as an INLINE element that overhangs to the
   left of the text. Native list markers (list-style) sit pinned to the list's
   left edge and don't follow that per-item padding, so nested bullets/numbers
   lose their indentation in the viewer. Rendering the marker as an inline
   ::before (part of the content flow) makes it move right with every level —
   matching the editor. */
.section-content-inner ol li[data-list] {
    list-style: none;
    position: relative;
}
.section-content-inner ol li[data-list] > .ql-ui { display: none; }
.section-content-inner ol li[data-list]::before {
    display: inline-block;
    white-space: nowrap;
    width: 1.3em;
    margin-left: -1.6em;
    margin-right: 0.3em;
    text-align: right;
    color: var(--text-secondary, #55606e);
}
.section-content-inner ol li[data-list="bullet"]::before { content: '\2022'; }
.section-content-inner ol { counter-reset: ql-list-counter; }
.section-content-inner ol li[data-list="ordered"] { counter-increment: ql-list-counter; }
.section-content-inner ol li[data-list="ordered"]::before { content: counter(ql-list-counter, decimal) '.'; }

/* Styled Info Cards */
.styled-info-card {
    border-radius: 12px;
    margin: 1.5rem 0;
    overflow: hidden;
    border: 2px solid #D4E1EC;
    background: #FAFBFC;
    box-shadow: 0 3px 12px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
    transition: box-shadow 0.25s, border-color 0.25s, transform 0.25s;
}

.styled-info-card:hover {
    box-shadow: 0 8px 28px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    transform: translateY(-2px);
}

.sic-header {
    padding: 0.95rem 1.25rem;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    background: rgba(252, 253, 255, 0.92);
}

.sic-title {
    font-size: 1.2rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.01em;
}

.sic-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted, #6B7B8C);
    margin: 0.2rem 0 0;
}

.sic-body {
    padding: 1.2rem;
}

.sic-body p {
    margin: 0 0 0.75rem;
    font-size: 1em;     /* the reading size of the content around it */
    color: var(--text-primary, #1a2332);
    line-height: 1.6;
}

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

.sic-examples {
    margin-top: 0.85rem;
}

.sic-example {
    padding: 0.85rem 1.05rem;
    border-radius: 8px;
    border-left: 5px solid currentColor;
    margin-bottom: 0.65rem;
    font-size: 0.93rem;
    color: var(--text-primary, #1a2332);
    line-height: 1.7;
    background: rgba(0,0,0,0.025);
    transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}

.sic-example:hover {
    background: rgba(0,0,0,0.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transform: translateX(2px);
}

.sic-example:last-child { margin-bottom: 0; }

.sic-example-name {
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--text-primary, #1a2332);
}

.sic-example-text {
    color: var(--text-primary, #1a2332);
}

.sic-phase-tag {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.4rem;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.info-card-embed {
    margin: 1rem 0;
}

/* Card color variants — light mode. Phase tags sit on the example row's
   tint at a small size, so their text is --text-primary in both themes
   (the accent text fell under AA there); the tag's tint carries the
   accent. */
.styled-info-card[data-accent="#6B7B8C"] { background: rgba(107,123,140,0.14); border-color: rgba(107,123,140,0.55); }
.styled-info-card[data-accent="#6B7B8C"]:hover { border-color: #6B7B8C; box-shadow: 0 8px 28px rgba(107,123,140,0.22); }
.styled-info-card[data-accent="#6B7B8C"] .sic-title { color: #3d4d5d; }
.styled-info-card[data-accent="#6B7B8C"] .sic-example { border-left-color: #6B7B8C; background: rgba(107,123,140,0.12); }
.styled-info-card[data-accent="#6B7B8C"] .sic-example:hover { background: rgba(107,123,140,0.2); }
.styled-info-card[data-accent="#6B7B8C"] .sic-phase-tag { background: rgba(107,123,140,0.28); color: var(--text-primary); }

.styled-info-card[data-accent="#3a7bd5"] { background: rgba(58,123,213,0.12); border-color: rgba(58,123,213,0.55); }
.styled-info-card[data-accent="#3a7bd5"]:hover { border-color: #3a7bd5; box-shadow: 0 8px 28px rgba(58,123,213,0.22); }
.styled-info-card[data-accent="#3a7bd5"] .sic-title { color: #1e55a0; }
.styled-info-card[data-accent="#3a7bd5"] .sic-example { border-left-color: #3a7bd5; background: rgba(58,123,213,0.1); }
.styled-info-card[data-accent="#3a7bd5"] .sic-example:hover { background: rgba(58,123,213,0.18); }
.styled-info-card[data-accent="#3a7bd5"] .sic-phase-tag { background: rgba(58,123,213,0.28); color: var(--text-primary); }

.styled-info-card[data-accent="#2D8B57"] { background: rgba(45,139,87,0.12); border-color: rgba(45,139,87,0.55); }
.styled-info-card[data-accent="#2D8B57"]:hover { border-color: #2D8B57; box-shadow: 0 8px 28px rgba(45,139,87,0.22); }
.styled-info-card[data-accent="#2D8B57"] .sic-title { color: #185e38; }
.styled-info-card[data-accent="#2D8B57"] .sic-example { border-left-color: #2D8B57; background: rgba(45,139,87,0.1); }
.styled-info-card[data-accent="#2D8B57"] .sic-example:hover { background: rgba(45,139,87,0.18); }
.styled-info-card[data-accent="#2D8B57"] .sic-phase-tag { background: rgba(45,139,87,0.28); color: var(--text-primary); }

.styled-info-card[data-accent="#D9985F"] { background: rgba(217,152,95,0.14); border-color: rgba(217,152,95,0.55); }
.styled-info-card[data-accent="#D9985F"]:hover { border-color: #D9985F; box-shadow: 0 8px 28px rgba(217,152,95,0.22); }
.styled-info-card[data-accent="#D9985F"] .sic-title { color: #7f4c14; }
.styled-info-card[data-accent="#D9985F"] .sic-example { border-left-color: #D9985F; background: rgba(217,152,95,0.12); }
.styled-info-card[data-accent="#D9985F"] .sic-example:hover { background: rgba(217,152,95,0.2); }
.styled-info-card[data-accent="#D9985F"] .sic-phase-tag { background: rgba(217,152,95,0.28); color: var(--text-primary); }

.styled-info-card[data-accent="#c0392b"] { background: rgba(192,57,43,0.12); border-color: rgba(192,57,43,0.55); }
.styled-info-card[data-accent="#c0392b"]:hover { border-color: #c0392b; box-shadow: 0 8px 28px rgba(192,57,43,0.22); }
.styled-info-card[data-accent="#c0392b"] .sic-title { color: #8a2218; }
.styled-info-card[data-accent="#c0392b"] .sic-example { border-left-color: #c0392b; background: rgba(192,57,43,0.1); }
.styled-info-card[data-accent="#c0392b"] .sic-example:hover { background: rgba(192,57,43,0.18); }
.styled-info-card[data-accent="#c0392b"] .sic-phase-tag { background: rgba(192,57,43,0.28); color: var(--text-primary); }

.styled-info-card[data-accent="#7b2cbf"] { background: rgba(123,44,191,0.12); border-color: rgba(123,44,191,0.55); }
.styled-info-card[data-accent="#7b2cbf"]:hover { border-color: #7b2cbf; box-shadow: 0 8px 28px rgba(123,44,191,0.22); }
.styled-info-card[data-accent="#7b2cbf"] .sic-title { color: #501888; }
.styled-info-card[data-accent="#7b2cbf"] .sic-example { border-left-color: #7b2cbf; background: rgba(123,44,191,0.1); }
.styled-info-card[data-accent="#7b2cbf"] .sic-example:hover { background: rgba(123,44,191,0.18); }
.styled-info-card[data-accent="#7b2cbf"] .sic-phase-tag { background: rgba(123,44,191,0.28); color: var(--text-primary); }

.styled-info-card[data-accent="#1a9988"] { background: rgba(26,153,136,0.12); border-color: rgba(26,153,136,0.55); }
.styled-info-card[data-accent="#1a9988"]:hover { border-color: #1a9988; box-shadow: 0 8px 28px rgba(26,153,136,0.22); }
.styled-info-card[data-accent="#1a9988"] .sic-title { color: #0e6458; }
.styled-info-card[data-accent="#1a9988"] .sic-example { border-left-color: #1a9988; background: rgba(26,153,136,0.1); }
.styled-info-card[data-accent="#1a9988"] .sic-example:hover { background: rgba(26,153,136,0.18); }
.styled-info-card[data-accent="#1a9988"] .sic-phase-tag { background: rgba(26,153,136,0.28); color: var(--text-primary); }

/* Dark mode */
[data-theme="dark"] .styled-info-card {
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
[data-theme="dark"] .styled-info-card:hover {
    box-shadow: 0 6px 24px rgba(0,0,0,0.4);
}
[data-theme="dark"] .sic-header { background: rgba(0, 0, 0, 0.25); border-bottom-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .sic-subtitle { color: var(--text-muted, #A8B8CA); }
[data-theme="dark"] .sic-body p,
[data-theme="dark"] .sic-example-name,
[data-theme="dark"] .sic-example-text { color: var(--text-primary, #F5F8FB); }

[data-theme="dark"] .styled-info-card[data-accent="#6B7B8C"] { background: rgba(168,184,202,0.18); border-color: rgba(168,184,202,0.6); }
[data-theme="dark"] .styled-info-card[data-accent="#6B7B8C"]:hover { border-color: #A8B8CA; box-shadow: 0 8px 32px rgba(168,184,202,0.25); }
[data-theme="dark"] .styled-info-card[data-accent="#6B7B8C"] .sic-title { color: #d0d8e2; }
[data-theme="dark"] .styled-info-card[data-accent="#6B7B8C"] .sic-example { border-left-color: #A8B8CA; background: rgba(168,184,202,0.15); }
[data-theme="dark"] .styled-info-card[data-accent="#6B7B8C"] .sic-example:hover { background: rgba(168,184,202,0.25); }
[data-theme="dark"] .styled-info-card[data-accent="#6B7B8C"] .sic-phase-tag { background: rgba(168,184,202,0.3); color: var(--text-primary); }

[data-theme="dark"] .styled-info-card[data-accent="#3a7bd5"] { background: rgba(100,168,240,0.18); border-color: rgba(100,168,240,0.6); }
[data-theme="dark"] .styled-info-card[data-accent="#3a7bd5"]:hover { border-color: #64a8f0; box-shadow: 0 8px 32px rgba(100,168,240,0.25); }
[data-theme="dark"] .styled-info-card[data-accent="#3a7bd5"] .sic-title { color: #90c4f8; }
[data-theme="dark"] .styled-info-card[data-accent="#3a7bd5"] .sic-example { border-left-color: #64a8f0; background: rgba(100,168,240,0.15); }
[data-theme="dark"] .styled-info-card[data-accent="#3a7bd5"] .sic-example:hover { background: rgba(100,168,240,0.25); }
[data-theme="dark"] .styled-info-card[data-accent="#3a7bd5"] .sic-phase-tag { background: rgba(100,168,240,0.3); color: var(--text-primary); }

[data-theme="dark"] .styled-info-card[data-accent="#2D8B57"] { background: rgba(111,168,135,0.18); border-color: rgba(111,168,135,0.6); }
[data-theme="dark"] .styled-info-card[data-accent="#2D8B57"]:hover { border-color: #6FA887; box-shadow: 0 8px 32px rgba(111,168,135,0.25); }
[data-theme="dark"] .styled-info-card[data-accent="#2D8B57"] .sic-title { color: #a0d4b2; }
[data-theme="dark"] .styled-info-card[data-accent="#2D8B57"] .sic-example { border-left-color: #6FA887; background: rgba(111,168,135,0.15); }
[data-theme="dark"] .styled-info-card[data-accent="#2D8B57"] .sic-example:hover { background: rgba(111,168,135,0.25); }
[data-theme="dark"] .styled-info-card[data-accent="#2D8B57"] .sic-phase-tag { background: rgba(111,168,135,0.3); color: var(--text-primary); }

[data-theme="dark"] .styled-info-card[data-accent="#D9985F"] { background: rgba(212,160,112,0.18); border-color: rgba(212,160,112,0.6); }
[data-theme="dark"] .styled-info-card[data-accent="#D9985F"]:hover { border-color: #D4A070; box-shadow: 0 8px 32px rgba(212,160,112,0.25); }
[data-theme="dark"] .styled-info-card[data-accent="#D9985F"] .sic-title { color: #f0c890; }
[data-theme="dark"] .styled-info-card[data-accent="#D9985F"] .sic-example { border-left-color: #D4A070; background: rgba(212,160,112,0.15); }
[data-theme="dark"] .styled-info-card[data-accent="#D9985F"] .sic-example:hover { background: rgba(212,160,112,0.25); }
[data-theme="dark"] .styled-info-card[data-accent="#D9985F"] .sic-phase-tag { background: rgba(212,160,112,0.3); color: var(--text-primary); }

[data-theme="dark"] .styled-info-card[data-accent="#c0392b"] { background: rgba(224,123,110,0.18); border-color: rgba(224,123,110,0.6); }
[data-theme="dark"] .styled-info-card[data-accent="#c0392b"]:hover { border-color: #e07b6e; box-shadow: 0 8px 32px rgba(224,123,110,0.25); }
[data-theme="dark"] .styled-info-card[data-accent="#c0392b"] .sic-title { color: #f8a898; }
[data-theme="dark"] .styled-info-card[data-accent="#c0392b"] .sic-example { border-left-color: #e07b6e; background: rgba(224,123,110,0.15); }
[data-theme="dark"] .styled-info-card[data-accent="#c0392b"] .sic-example:hover { background: rgba(224,123,110,0.25); }
[data-theme="dark"] .styled-info-card[data-accent="#c0392b"] .sic-phase-tag { background: rgba(224,123,110,0.3); color: var(--text-primary); }

[data-theme="dark"] .styled-info-card[data-accent="#7b2cbf"] { background: rgba(155,143,216,0.18); border-color: rgba(155,143,216,0.6); }
[data-theme="dark"] .styled-info-card[data-accent="#7b2cbf"]:hover { border-color: #9B8FD8; box-shadow: 0 8px 32px rgba(155,143,216,0.25); }
[data-theme="dark"] .styled-info-card[data-accent="#7b2cbf"] .sic-title { color: #c8bef0; }
[data-theme="dark"] .styled-info-card[data-accent="#7b2cbf"] .sic-example { border-left-color: #9B8FD8; background: rgba(155,143,216,0.15); }
[data-theme="dark"] .styled-info-card[data-accent="#7b2cbf"] .sic-example:hover { background: rgba(155,143,216,0.25); }
[data-theme="dark"] .styled-info-card[data-accent="#7b2cbf"] .sic-phase-tag { background: rgba(155,143,216,0.3); color: var(--text-primary); }

[data-theme="dark"] .styled-info-card[data-accent="#1a9988"] { background: rgba(80,200,180,0.18); border-color: rgba(80,200,180,0.6); }
[data-theme="dark"] .styled-info-card[data-accent="#1a9988"]:hover { border-color: #50C8B4; box-shadow: 0 8px 32px rgba(80,200,180,0.25); }
[data-theme="dark"] .styled-info-card[data-accent="#1a9988"] .sic-title { color: #88e8d4; }
[data-theme="dark"] .styled-info-card[data-accent="#1a9988"] .sic-example { border-left-color: #50C8B4; background: rgba(80,200,180,0.15); }
[data-theme="dark"] .styled-info-card[data-accent="#1a9988"] .sic-example:hover { background: rgba(80,200,180,0.25); }
[data-theme="dark"] .styled-info-card[data-accent="#1a9988"] .sic-phase-tag { background: rgba(80,200,180,0.3); color: var(--text-primary); }

@media print {
    .styled-info-card {
        border-color: #ccc;
        background: #fafafa;
        box-shadow: none;
        transform: none !important;
    }
    .styled-info-card:hover { box-shadow: none; transform: none; }
    .sic-header { background: #f0f0f0; }
    .sic-example { transform: none !important; box-shadow: none !important; }
    /* Interactive chrome that has no place on paper (also covers a raw
       browser Ctrl+P that bypasses the print button's JS). Exam topics are
       excluded by printAllTopics via [data-has-exam]. */
    .section-fullscreen-btn,
    .section-inline-edit-btn,
    .learn-back-btn {
        display: none !important;
    }
}

/* ============================================================
   Callout Box
   Authored callouts (.callout-embed > .styled-callout[data-type], written
   by the editor blot, Quick Edit and the Markdown importer) take the
   shared .callout.is-{tone} recipe from includes/styles.css: the tone's
   tint, a 4px left rule in the tone's text colour, no outer frame, the
   icon and label in the tone colour and body text in --text-primary.
   The stored markup can't gain classes, so each type maps to a tone here:
     important -> danger, warning -> warning, tip -> success,
     remember -> info, note -> muted.
   ============================================================ */
.styled-callout {
    --callout-tone: var(--info-text);
    --callout-tint: var(--info-tint);
    display: flex;
    gap: 0.85rem;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    border: 0;
    border-left: 4px solid var(--callout-tone);
    border-radius: var(--r-md);
    background: var(--callout-tint);
    color: var(--text-primary);
}
.styled-callout[data-type="important"] { --callout-tone: var(--danger-text);  --callout-tint: var(--danger-tint); }
.styled-callout[data-type="warning"]   { --callout-tone: var(--warning-text); --callout-tint: var(--warning-tint); }
.styled-callout[data-type="tip"]       { --callout-tone: var(--success-text); --callout-tint: var(--success-tint); }
.styled-callout[data-type="remember"]  { --callout-tone: var(--info-text);    --callout-tint: var(--info-tint); }
.styled-callout[data-type="note"]      { --callout-tone: var(--text-muted);   --callout-tint: var(--surface-2); }
.styled-callout .sc-icon {
    font-size: 1.35rem;
    line-height: 1.2;
    flex-shrink: 0;
    color: var(--callout-tone);
}
/* The text column (label + body) is the second flex child. min-width: 0
   lets it shrink below the intrinsic width of its content so inline
   tags ("Minute Volume", etc.) wrap to the next line instead of
   pushing the column wider than the card. flex: 1 + min-width: 0 is
   the standard fix for "child overflows flex container" cases. */
.styled-callout .sc-content {
    flex: 1;
    min-width: 0;
}
.styled-callout .sc-label {
    margin-bottom: 0.2rem;
    color: var(--callout-tone);
    font-size: 1.05em;
    font-weight: 700;
    line-height: 1.35;
}
/* Body text at the reading size, in --text-primary on every tint. Two
   classes out-rank section.css's dark content colours. */
.styled-callout .sc-text,
[data-theme="dark"] .styled-callout .sc-text {
    font-size: 1em;
    line-height: 1.6;
    color: var(--text-primary);
}
.styled-callout .sc-text p,
.styled-callout .sc-text li,
[data-theme="dark"] .styled-callout .sc-text p,
[data-theme="dark"] .styled-callout .sc-text li {
    color: inherit;
}
.callout-embed { margin: 1rem 0; }

@media print { .styled-callout { border: 1px solid #ccc; border-left: 4px solid #999; background: #fafafa; box-shadow: none; transform: none !important; } }

/* ============================================================
   Comparison Block
   ============================================================ */
.styled-comparison {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    margin: 1.25rem 0;
    border: 1px solid var(--border-soft, #D4E1EC);
}
.scomp-col {
    padding: 1.15rem;
}
.scomp-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.scomp-text {
    font-size: 0.93rem;
    line-height: 1.7;
    color: var(--text-primary, #1a2332);
}
.scomp-vs {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted, #6B7B8C);
    padding: 0 0.25rem;
    background: var(--neutral-bg, #F5F7FA);
    border-left: 1px solid var(--border-soft, #D4E1EC);
    border-right: 1px solid var(--border-soft, #D4E1EC);
}
.comparison-embed { margin: 1rem 0; }

/* Comparison colors via data-accent */
.styled-comparison[data-accent="#6B7B8C"] { background: rgba(107,123,140,0.04); }
.styled-comparison[data-accent="#6B7B8C"] .scomp-title { color: #6B7B8C; }
.styled-comparison[data-accent="#3a7bd5"] { background: rgba(58,123,213,0.04); }
.styled-comparison[data-accent="#3a7bd5"] .scomp-title { color: #3a7bd5; }
.styled-comparison[data-accent="#2D8B57"] { background: rgba(45,139,87,0.04); }
.styled-comparison[data-accent="#2D8B57"] .scomp-title { color: #2D8B57; }
.styled-comparison[data-accent="#D9985F"] { background: rgba(217,152,95,0.04); }
.styled-comparison[data-accent="#D9985F"] .scomp-title { color: #D9985F; }
.styled-comparison[data-accent="#c0392b"] { background: rgba(192,57,43,0.04); }
.styled-comparison[data-accent="#c0392b"] .scomp-title { color: #c0392b; }
.styled-comparison[data-accent="#7b2cbf"] { background: rgba(123,44,191,0.04); }
.styled-comparison[data-accent="#7b2cbf"] .scomp-title { color: #7b2cbf; }
.styled-comparison[data-accent="#1a9988"] { background: rgba(26,153,136,0.04); }
.styled-comparison[data-accent="#1a9988"] .scomp-title { color: #1a9988; }

[data-theme="dark"] .styled-comparison { background: rgba(255,255,255,0.02); border-color: var(--border-soft, #3D4A5C); }
[data-theme="dark"] .scomp-vs { background: var(--neutral-bg, #252B3A); border-color: var(--border-soft, #3D4A5C); }
[data-theme="dark"] .scomp-text { color: var(--text-primary, #F5F8FB); }

@media (max-width: 600px) {
    .styled-comparison { grid-template-columns: 1fr; }
    .scomp-vs { padding: 0.5rem; border-left: none; border-right: none; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); }
}
@media print { .styled-comparison { border-color: #ccc; background: #fafafa; } }

/* ============================================================
   Step / Process List
   ============================================================ */
.styled-steps {
    margin: 1.25rem 0;
    padding: 0;
}
.sstep {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    position: relative;
    padding-bottom: 1.25rem;
}
.sstep:last-child { padding-bottom: 0; }
/* Connecting line */
.sstep:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 17px;
    top: 36px;
    bottom: 0;
    width: 2px;
    background: var(--border-soft, #D4E1EC);
}
.sstep-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    color: #fff;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.sstep-content { flex: 1; padding-top: 0.35rem; }
.sstep-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.15rem;
}
.sstep-text {
    font-size: 0.93rem;
    line-height: 1.7;
    color: var(--text-primary, #1a2332);
}
.steplist-embed { margin: 1rem 0; }

/* Step colors via data-accent */
.styled-steps[data-accent="#6B7B8C"] .sstep-num { background: #6B7B8C; }
.styled-steps[data-accent="#6B7B8C"] .sstep-title { color: #6B7B8C; }
.styled-steps[data-accent="#3a7bd5"] .sstep-num { background: #3a7bd5; }
.styled-steps[data-accent="#3a7bd5"] .sstep-title { color: #3a7bd5; }
.styled-steps[data-accent="#2D8B57"] .sstep-num { background: #2D8B57; }
.styled-steps[data-accent="#2D8B57"] .sstep-title { color: #2D8B57; }
.styled-steps[data-accent="#D9985F"] .sstep-num { background: #D9985F; }
.styled-steps[data-accent="#D9985F"] .sstep-title { color: #D9985F; }
.styled-steps[data-accent="#c0392b"] .sstep-num { background: #c0392b; }
.styled-steps[data-accent="#c0392b"] .sstep-title { color: #c0392b; }
.styled-steps[data-accent="#7b2cbf"] .sstep-num { background: #7b2cbf; }
.styled-steps[data-accent="#7b2cbf"] .sstep-title { color: #7b2cbf; }
.styled-steps[data-accent="#1a9988"] .sstep-num { background: #1a9988; }
.styled-steps[data-accent="#1a9988"] .sstep-title { color: #1a9988; }

[data-theme="dark"] .sstep:not(:last-child)::after { background: var(--border-soft, #3D4A5C); }
[data-theme="dark"] .sstep-text { color: var(--text-primary, #F5F8FB); }

@media print { .sstep-num { border: 2px solid #333; color: #333; background: #eee !important; } .sstep:not(:last-child)::after { background: #ccc; } }

/* ============================================================
   Tab Group
   ============================================================ */
.styled-tabs {
    border: 1px solid var(--border-soft, #D4E1EC);
    border-radius: 8px;
    overflow: hidden;
    margin: 1.25rem 0;
}
.stab-buttons {
    display: flex;
    border-bottom: 1px solid var(--border-soft, #D4E1EC);
    background: var(--neutral-bg, #F5F7FA);
    overflow-x: auto;
}
.stab-btn {
    flex: 1;
    padding: 0.65rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted, #6B7B8C);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.stab-btn:not(:last-child) { border-right: 1px solid var(--border-soft, #D4E1EC); }
.stab-btn:hover { color: var(--text-primary, #1a2332); background: rgba(0,0,0,0.02); }
.stab-btn.active {
    color: var(--primary-soft, #4A7BA7);
    border-bottom-color: var(--primary-soft, #4A7BA7);
    background: var(--container-bg, #fff);
}
.stab-panel {
    display: none;
    padding: 1.15rem;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-primary, #1a2332);
    background: var(--container-bg, #fff);
}
.stab-panel.active { display: block; }
.tabgroup-embed { margin: 1rem 0; }

[data-theme="dark"] .stab-buttons { background: var(--neutral-bg, #252B3A); }
[data-theme="dark"] .stab-btn:hover { background: rgba(255,255,255,0.03); }
[data-theme="dark"] .stab-btn.active { background: var(--container-bg, #1E2633); color: var(--primary-soft, #5A8BC4); border-bottom-color: var(--primary-soft, #5A8BC4); }
[data-theme="dark"] .stab-panel { background: var(--container-bg, #1E2633); color: var(--text-primary, #F5F8FB); }

@media print { .stab-buttons { display: none; } .stab-panel { display: block !important; border-bottom: 1px solid #ccc; padding: 0.75rem; } }

/* ============================================================
   Accordion / FAQ
   ============================================================ */
.styled-accordion {
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.sacc-item {
    border: 2px solid var(--border-soft, #D4E1EC);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.sacc-header {
    padding: 0.95rem 1.25rem;
    font-weight: 700;
    font-size: 0.97rem;
    color: var(--text-primary, #1a2332);
    cursor: pointer;
    background: var(--neutral-bg, #F5F7FA);
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    transition: background 0.2s, color 0.2s;
    word-wrap: break-word;
    overflow-wrap: break-word;
    user-select: none;
}
.sacc-header > span { min-width: 0; flex: 1; }

/* Alternating header colors */
.sacc-item:nth-child(even) > .sacc-header {
    background: rgba(0,0,0,0.02);
}
.sacc-header:hover {
    background: rgba(74,123,167,0.08);
    color: var(--primary-text);
}
.sacc-item[open] > .sacc-header {
    background: rgba(74,123,167,0.1);
    color: var(--primary-text);
    border-bottom: 1px solid var(--border-soft, #D4E1EC);
}
.sacc-header::after {
    content: '';
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236B7B8C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 18px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sacc-item[open] > .sacc-header::after {
    transform: rotate(180deg);
}
.sacc-header::-webkit-details-marker { display: none; }

/* Animated dropdown body */
.sacc-body {
    padding: 1.1rem 1.25rem;
    font-size: 0.93rem;
    line-height: 1.7;
    color: var(--text-primary, #1a2332);
    background: var(--container-bg, #fff);
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow-x: hidden;
}
.sacc-body p { margin: 0 0 0.6rem; }
.sacc-body p:last-child { margin-bottom: 0; }
.sacc-body ul, .sacc-body ol { margin: 0.4rem 0; padding-left: 1.5rem; }
.sacc-body li { margin-bottom: 0.3rem; }
.sacc-body img {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    border-radius: 6px;
    margin: 0.5rem 0;
    display: block;
}
.sacc-body .styled-image-card { margin: 0.75rem 0; text-align: center; }
.sacc-body .styled-image-card img { max-width: 100% !important; }
.sacc-body .simg-caption { text-align: center; }
.sacc-body strong { font-weight: 700; }
.sacc-body em { font-style: italic; }

.accordion-embed { margin: 1rem 0; }

/* Dark mode */
[data-theme="dark"] .sacc-item {
    border-color: var(--border-soft, #3D4A5C);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
[data-theme="dark"] .sacc-header {
    background: var(--neutral-bg, #252B3A);
    color: var(--text-primary, #F5F8FB);
}
[data-theme="dark"] .sacc-item:nth-child(even) > .sacc-header {
    background: rgba(255,255,255,0.03);
}
/* Hover and open headers take --primary-text: --primary-soft fell under
   AA on the tint over the opaque card. */
[data-theme="dark"] .sacc-header:hover {
    background: rgba(90,139,196,0.12);
    color: var(--primary-text);
}
[data-theme="dark"] .sacc-item[open] > .sacc-header {
    background: rgba(90,139,196,0.14);
    color: var(--primary-text);
    border-bottom-color: var(--border-soft, #3D4A5C);
}
[data-theme="dark"] .sacc-header::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23A8B8CA' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}
[data-theme="dark"] .sacc-body {
    background: var(--container-bg, #1E2633);
    color: var(--text-primary, #F5F8FB);
}

@media print {
    .styled-accordion { box-shadow: none; gap: 0.25rem; }
    .sacc-item { box-shadow: none; border: 1px solid #ccc; }
    details.sacc-item { display: block !important; }
    details.sacc-item[open], details.sacc-item:not([open]) { display: block !important; }
    .sacc-header::after { display: none; }
    .sacc-body { display: block !important; padding: 0.5rem 1rem; height: auto !important; overflow: visible !important; opacity: 1 !important; }
}

/* ============================================================
   Image Card
   ============================================================ */
.styled-image-card {
    margin: 1.25rem 0;
    text-align: center;
}
.styled-image-card img {
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    border-radius: 8px;
    display: block;
    margin: 0 auto !important;
    padding: 0 !important;
}
.simg-caption {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 0.25rem;
    background: none;
    border: none;
    border-radius: 0;
    line-height: 1.5;
    text-align: center;
}
.simg-text {
    font-size: 0.93rem;
    font-weight: 600;
    color: var(--text-primary, #1a2332);
}
.simg-ref {
    font-size: 0.78rem;
    font-style: italic;
    color: var(--text-muted, #6B7B8C);
    margin-top: 0.15rem;
}
.simg-caption .simg-text:only-child { text-align: center; }


.image-card-embed { margin: 1rem 0; }

[data-theme="dark"] .simg-text { color: var(--text-primary, #F5F8FB); }
[data-theme="dark"] .simg-ref { color: var(--text-muted, #A8B8CA); }

/* ---- Image alignment ---- */
.styled-image-card.simg-align-left { text-align: left; }
.styled-image-card.simg-align-left img { margin-left: 0 !important; margin-right: auto !important; }
.styled-image-card.simg-align-left .simg-caption { text-align: left; align-items: flex-start; }
.styled-image-card.simg-align-right { text-align: right; }
.styled-image-card.simg-align-right img { margin-left: auto !important; margin-right: 0 !important; }
.styled-image-card.simg-align-right .simg-caption { text-align: right; align-items: flex-end; }

/* Wrap modes: the card floats and body text flows beside it. */
.styled-image-card.simg-wrap-left,
.styled-image-card.simg-wrap-right { width: 45%; max-width: 360px; margin-top: 0.4rem; }
.styled-image-card.simg-wrap-left { float: left; margin-right: 1.5rem; margin-bottom: 0.85rem; }
.styled-image-card.simg-wrap-right { float: right; margin-left: 1.5rem; margin-bottom: 0.85rem; }

/* On phones, floats get cramped — fall back to full-width centered. */
@media (max-width: 600px) {
    .styled-image-card.simg-wrap-left,
    .styled-image-card.simg-wrap-right {
        float: none; width: auto; max-width: 100%; margin-left: 0; margin-right: 0;
    }
}

@media print {
    .styled-image-card img { max-width: 60% !important; border-radius: 4px; }
}

/* ---- Labelled images (includes/image-labels.js) ----
   The topic image rules cap the <img> itself (70% here, 40% on paper)
   and give it a border. Inside a label frame those move to the frame,
   so the frame stays exactly the image's box and the label percentages
   stay true. Same sizes as an unlabelled image card. */
.section-content-inner .simg-frame {
    max-width: 70%;
    border: 2px solid var(--border-soft);
    border-radius: 10px;
    box-shadow: 0 2px 8px var(--shadow-soft);
}
.section-content-inner .simg-frame > img {
    max-width: 100% !important;
    margin: 0 !important;
    border: 0;
    border-radius: 8px;
    box-shadow: none;
}
.section-content-inner .sacc-body .simg-frame { max-width: 100%; }
/* Phones: a labelled image takes the full width so its labels have room. */
@media (max-width: 600px) {
    .section-content-inner .simg-frame { max-width: 100%; }
}
@media print {
    /* Bigger than an unlabelled image on paper (40%), so labels have room. */
    .section-content-inner .simg-frame { max-width: 60%; box-shadow: none; border-color: #ccc; }
    .section-content-inner :is(.simg-wrap-left, .simg-wrap-right) .simg-frame { max-width: 100%; }
    .section-content-inner .simg-frame > img { max-width: 100% !important; }
}

/* ---- Rich-text formatting from the editor (align / indent / quote / code) ---- */
.section-content-inner .ql-align-center { text-align: center; }
.section-content-inner .ql-align-right { text-align: right; }
.section-content-inner .ql-align-justify { text-align: justify; }
/* Indent levels (the editor's ql-indent-N). Paragraphs indent with padding.
   List items indent with MARGIN: a bullet or number is drawn outside the
   item's box, so padding would push the text over and leave the marker
   behind at the left edge. A margin moves marker and text together. */
.section-content-inner .ql-indent-1 { padding-left: 3em; }
.section-content-inner .ql-indent-2 { padding-left: 6em; }
.section-content-inner .ql-indent-3 { padding-left: 9em; }
.section-content-inner .ql-indent-4 { padding-left: 12em; }
.section-content-inner .ql-indent-5 { padding-left: 15em; }
.section-content-inner .ql-indent-6 { padding-left: 18em; }
.section-content-inner .ql-indent-7 { padding-left: 21em; }
.section-content-inner .ql-indent-8 { padding-left: 24em; }
.section-content-inner li.ql-indent-1 { padding-left: 0; margin-left: 3em; }
.section-content-inner li.ql-indent-2 { padding-left: 0; margin-left: 6em; }
.section-content-inner li.ql-indent-3 { padding-left: 0; margin-left: 9em; }
.section-content-inner li.ql-indent-4 { padding-left: 0; margin-left: 12em; }
.section-content-inner li.ql-indent-5 { padding-left: 0; margin-left: 15em; }
.section-content-inner li.ql-indent-6 { padding-left: 0; margin-left: 18em; }
.section-content-inner li.ql-indent-7 { padding-left: 0; margin-left: 21em; }
.section-content-inner li.ql-indent-8 { padding-left: 0; margin-left: 24em; }
.section-content-inner sub, .section-content-inner sup { line-height: 0; }
.section-content-inner hr {
    border: none;
    border-top: 2px solid var(--border-soft, #d8dee6);
    margin: 1.75rem 0;
}
.section-content-inner blockquote {
    margin: 1.1rem 0;
    padding: 0.75rem 1.1rem;
    border-left: 4px solid var(--primary-soft, #3A6FA8);
    background: color-mix(in srgb, var(--primary-soft, #3A6FA8) 7%, transparent);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary, #44505f);
    font-style: italic;
    font-size: 1.15em;      /* quotes read larger than body text */
    line-height: 1.6;
}
.section-content-inner blockquote > :first-child { margin-top: 0; }
.section-content-inner blockquote > :last-child { margin-bottom: 0; }
.section-content-inner code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.88em;
    padding: 0.1em 0.4em;
    border-radius: 4px;
    background: color-mix(in srgb, var(--text-primary, #1a2332) 8%, transparent);
    border: 1px solid var(--border-soft, #d8dee6);
    color: var(--text-primary, #1a2332);
}

/* HTML Snippet Embed */
.html-snippet-embed {
    margin: 1rem 0;
}
.html-snippet-embed .snippet-render {
    /* No wrapper styling — renders raw */
}
/* Pasted HTML snippets (Word / email / newsletter exports) hardcode dark text
   colors that assume a white page. In dark mode those become dark-on-dark and
   unreadable, so render the snippet on its own light "paper" surface where the
   author's intended colors land correctly. Light mode is already light, so it's
   left untouched. */
[data-theme="dark"] .section-content-inner .snippet-render {
    background: #dad8d1; /* soft warm off-white — readable dark text without the pure-white glare */
    padding: 1.5rem 1.75rem;
    border-radius: 10px;
    box-sizing: border-box;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
}
/* Keep default text dark on the paper surface — the dark-theme content rules
   would otherwise force light text that vanishes on white. Inline author colors
   still win (higher specificity), so intended accents are preserved. */
[data-theme="dark"] .section-content-inner .snippet-render,
[data-theme="dark"] .section-content-inner .snippet-render p,
[data-theme="dark"] .section-content-inner .snippet-render li,
[data-theme="dark"] .section-content-inner .snippet-render td,
[data-theme="dark"] .section-content-inner .snippet-render th,
[data-theme="dark"] .section-content-inner .snippet-render h1,
[data-theme="dark"] .section-content-inner .snippet-render h2,
[data-theme="dark"] .section-content-inner .snippet-render h3 {
    color: #1a1a1a;
}
/* A table inside pasted HTML on that light paper keeps the light table
   look (frame, header tint, banding) so its dark text stays readable. */
[data-theme="dark"] .section-content-inner .snippet-render:not(:has(> table:only-child)) table {
    --tbl-line: #B8CDE0;
    --tbl-head: rgba(58, 111, 168, 0.16);
    --tbl-band: rgba(58, 111, 168, 0.05);
    background: transparent;
}
/* Tables are the exception. A snippet holding nothing but a table came from
   the editor's table button or the bulk importer, i.e. it is our own markup
   rather than foreign pasted HTML, so it takes the theme like any other
   content instead of sitting on a light panel. Older importer tables carry
   inline light colors (background:#eef3f9, border #d4e1ec), hence the
   !important overrides. */
[data-theme="dark"] .section-content-inner .snippet-render:has(> table:only-child) {
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}
[data-theme="dark"] .section-content-inner .snippet-render:has(> table:only-child) table {
    border-color: var(--tbl-line) !important;
}
[data-theme="dark"] .section-content-inner .snippet-render:has(> table:only-child) th,
[data-theme="dark"] .section-content-inner .snippet-render:has(> table:only-child) td {
    color: var(--text-primary);
    border-color: var(--tbl-line) !important;
    background: transparent !important;
}
/* Same header row and banding as every content table (section.css). */
[data-theme="dark"] .section-content-inner .snippet-render:has(> table:only-child) th,
[data-theme="dark"] .section-content-inner .snippet-render:has(> table:only-child) table:not(:has(th)) tr:first-child > td {
    background: var(--tbl-head) !important;
}
[data-theme="dark"] .section-content-inner .snippet-render:has(> table:only-child) tbody tr:nth-child(even) > td {
    background: var(--tbl-band) !important;
}

/* Expandable Content */
.section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.8s ease;
}

.section-content.expanded {
    max-height: 15000px;
}

/* Always-open accordion: no transition, content always visible */
.section-card.always-open .section-content.expanded {
    max-height: none;
    overflow: visible;
}

.section-content-inner {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-soft);
    margin-top: 1rem;
}


.content-text {
    font-size: 1.25rem;
    line-height: 1.9;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.term {
    font-weight: 700;
    color: #2E5C8A;
    background: linear-gradient(135deg, #E8F3FC 0%, #D6E9F8 100%);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

/* Glossary auto-links: bold + blue + dotted underline so defined terms stand
   out from body text, while the dotted (not solid) underline and help cursor
   keep them distinct from real links. Author .term chips that also carry a
   definition just get the help cursor (their chip styling already stands out).
   In the topic viewer both are role="button" spans with tabindex="0"
   (section-scripts.js), so they take Tab, Enter and Space and draw the site
   focus outline, and a multi-word term still wraps like the text around it.
   The SCORM export keeps the plain spans. */
.gloss-term {
    font-weight: 600;
    color: var(--primary-text);
    border-bottom: 1px dotted color-mix(in srgb, var(--primary-text) 85%, transparent);
    cursor: help;
}
[data-def] { cursor: help; }
.gloss-term:hover,
.gloss-term:focus-visible { background: color-mix(in srgb, var(--primary-text) 12%, transparent); }
.gloss-term:focus-visible,
.term[data-def]:focus-visible {
    outline: var(--focus-outline);
    outline-offset: 2px;
    border-radius: var(--r-xs);
}

/* Resources modal: the whole citation card is a link — tint it on hover so
   it reads as clickable. */
.resource-card-link { border-radius: 10px; transition: background 0.12s ease; }
.resource-card-link:hover,
.resource-card-link:focus-visible {
    background: color-mix(in srgb, var(--primary-soft, #3A6FA8) 10%, transparent);
}

.gloss-popover {
    position: fixed;
    /* Above the enlarged-image view (10000), whose image labels use it. */
    z-index: 10002;
    max-width: 320px;
    padding: 0.6rem 0.8rem;
    background: var(--card-bg, #fff);
    color: var(--text-primary, #1a2332);
    border: 1px solid var(--border-soft, #d8dee6);
    border-radius: 10px;
    box-shadow: 0 8px 26px rgba(0,0,0,0.18);
    font-size: 0.88rem;
    line-height: 1.5;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.12s ease, transform 0.12s ease;
    pointer-events: none;
}
.gloss-popover.is-on { opacity: 1; transform: translateY(0); }
.gloss-popover .gloss-popover-term {
    font-weight: 800;
    color: var(--primary-soft, #2E5C8A);
    margin-bottom: 0.2rem;
}

.subtext {
    font-size: 0.85em;
    color: #6c757d;
    font-style: italic;
}

/* Enhanced formatting for bold text in content */
.content-text strong,
.content-text b {
    font-weight: 700;
    color: #1E4D7A;
}

/* Enhanced formatting for italic text */
.content-text em,
.content-text i {
    font-style: italic;
    color: #4A8AC4;
}

/* Dark mode - Term, Subtext, Bold, Italic */
[data-theme="dark"] .subtext {
    color: #9e9e9e;
}

[data-theme="dark"] .term {
    color: #8DB9E8;
    background: linear-gradient(135deg, #1A2A3A 0%, #1E3248 100%);
}

[data-theme="dark"] .content-text strong,
[data-theme="dark"] .content-text b {
    color: #A8CCE8;
}

[data-theme="dark"] .content-text em,
[data-theme="dark"] .content-text i {
    color: #7AADE0;
}

/* ── Prose ladder: topic content ──────────────────────────────────────
   One set of sizes for everything an author writes into a topic. The
   heading order reads page title (hero h1), topic title
   (h2.topic-viewer-title at --fs-topic-title), then the author's h2, h3
   and h4 at three clear steps over 1rem body text. Text runs the full
   width of the reading panel (the owner prefers it to a 72ch cap).
   Protocol content keeps its own sizes (protocols/includes/view.css).
   This replaces a bare "h4 { 1.3rem, blue }" rule here, which restyled
   every h4 on the ~38 pages that link this file (the multiplayer quiz
   question, for one). Colours and spacing: section.css. */
.section-content-inner {
    font-size: 1rem;
    line-height: 1.6;
}
.section-content-inner h2 { font-size: 1.5rem;  font-weight: 800; }
.section-content-inner h3 { font-size: 1.25rem; font-weight: 700; }
.section-content-inner h4 { font-size: 1.1rem;  font-weight: 700; }

/* Action Buttons Grid */
.action-buttons {
    display: flex;
    justify-content: flex-start;
    gap: 1rem;
    margin-top: 1.5rem;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.5rem;
    border: 2px solid;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 0.9rem;
    flex: 1;
}

.action-btn i {
    font-size: 1.1rem;
}

/* Read More Button - Blue */
.action-btn.read-more {
    background: linear-gradient(135deg, #D6E9F8 0%, #BDD7EE 100%);
    color: #2E5C8A;
    border-color: #5B9BD5;
}

.action-btn.read-more:hover {
    background: linear-gradient(135deg, #BDD7EE 0%, #A5CAED 100%);
    border-color: #4A8AC4;
    color: #1E4D7A;
}

/* Video Button - Teal */
.action-btn.video {
    background: linear-gradient(135deg, #C6E7E8 0%, #A8D5D7 100%);
    color: #2B6B6E;
    border-color: #5DABAD;
}

.action-btn.video:hover {
    background: linear-gradient(135deg, #A8D5D7 0%, #8AC3C6 100%);
    border-color: #4A9A9C;
    color: #1E5456;
}

/* Quiz Button - Purple */
.action-btn.quiz {
    background: linear-gradient(135deg, #E5DBEF 0%, #D3C5E3 100%);
    color: #6B4C8A;
    border-color: #9B7AB8;
}

.action-btn.quiz:hover {
    background: linear-gradient(135deg, #D3C5E3 0%, #C1AED7 100%);
    border-color: #8A69A7;
    color: #5A3D74;
}

/* Retake Button - Teal */
.action-btn.retake {
    background: linear-gradient(135deg, #C6E7E8 0%, #A8D5D7 100%);
    color: #2B6B6E;
    border-color: #5DABAD;
}

.action-btn.retake:hover {
    background: linear-gradient(135deg, #A8D5D7 0%, #8AC3C6 100%);
    border-color: #4A9A9C;
    color: #1E5456;
}

[data-theme="dark"] .action-btn.retake {
    background: linear-gradient(135deg, #1E3A3B 0%, #2A4E50 100%);
    color: #8AC3C6;
    border-color: #5DABAD;
}

[data-theme="dark"] .action-btn.retake:hover {
    background: linear-gradient(135deg, #2A4E50 0%, #356264 100%);
}

/* Practice Questions Button - Blue/Green */
.action-btn.practice {
    background: linear-gradient(135deg, #4A7BA7 0%, #3A8B6A 100%);
    color: #fff;
    border-color: transparent;
}

.action-btn.practice:hover {
    background: linear-gradient(135deg, #3D6B94 0%, #2F7858 100%);
    color: #fff;
}

[data-theme="dark"] .action-btn.practice {
    background: linear-gradient(135deg, #3A6A91 0%, #2E7A5C 100%);
    color: #fff;
    border-color: transparent;
}

[data-theme="dark"] .action-btn.practice:hover {
    background: linear-gradient(135deg, #2E5A7E 0%, #246849 100%);
}

/* Active/Expanded States for Action Buttons */
.action-btn.read-more.expanded {
    background: linear-gradient(135deg, #A5CAED 0%, #8DB9E8 100%);
    color: #1E4D7A;
}

.action-btn.video.expanded {
    background: linear-gradient(135deg, #8AC3C6 0%, #6FB1B5 100%);
    color: #1E5456;
}

.action-btn.quiz.expanded {
    background: linear-gradient(135deg, #C1AED7 0%, #A997CB 100%);
    color: #5A3D74;
}

/* Action Button Completion Indicator */
.action-btn .activity-check {
    display: none;
    font-size: 1.1rem;
    margin-left: 0.2rem;
}

.action-btn.completed .activity-check {
    display: inline-flex;
}

/* Checkmark color matches each button's own color scheme */
.action-btn.read-more.completed .activity-check {
    color: #1E4D7A;
}

.action-btn.video.completed .activity-check {
    color: #1E5456;
}

.action-btn.quiz.completed .activity-check {
    color: #5A3D74;
}

/* Dark mode checkmark colors */
[data-theme="dark"] .action-btn.read-more.completed .activity-check {
    color: #8DB9E8;
}

[data-theme="dark"] .action-btn.video.completed .activity-check {
    color: #8AC3C6;
}

[data-theme="dark"] .action-btn.quiz.completed .activity-check {
    color: #C1AED7;
}

.coming-soon-box {
    background: var(--hover-bg);
    border: 2px dashed var(--border-soft);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
}

.coming-soon-box i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.coming-soon-box h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.coming-soon-box p {
    font-size: 0.9rem;
    margin: 0;
}

/* Responsive Video Embed */
.video-responsive {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
}

.video-responsive iframe,
.video-responsive video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #000000;
    background: #ffffff;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, background 0.2s ease, color 0.2s ease;
    box-shadow: 0 2px 8px var(--shadow-medium);
    z-index: 99;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    /* Tint + primary icon (its old colour variable was never declared). */
    background: color-mix(in srgb, var(--primary-soft) 14%, var(--card-bg));
    color: var(--primary-soft);
    border-color: var(--primary-soft);
}

[data-theme="dark"] .back-to-top {
    background: var(--card-bg);
    border-color: var(--border-soft);
}

/* Print Button */
.print-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 1rem;
    background: var(--primary-light);
    border: 2px solid var(--primary-soft);
    border-radius: 50px;
    color: var(--primary-soft);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.print-btn:hover {
    background: var(--primary-fill, #3A6FA8);
    color: white;
}

.print-btn i {
    font-size: 1.1rem;
}

[data-theme="dark"] .print-btn {
    background: rgba(90, 139, 196, 0.15);
    border-color: var(--primary-soft);
    color: var(--primary-soft);
}

[data-theme="dark"] .print-btn:hover {
    background: var(--primary-fill, #3A6FA8);
    color: white;
}

/* Constrain topic content images */
.section-content-inner img {
    max-width: 70% !important;
    width: auto !important;
    height: auto !important;
}

/* Light theme, on screen: topic images sit on a pale blue-grey mat inside
   a firmer border, so an illustration with a white or transparent
   background stands out from the white topic card as an image. A
   labelled image's frame draws the mat as a thick border instead of
   padding, so the frame's inside stays exactly the image and the labels
   keep their spots. HTML snippets keep their own look; dark theme and
   paper are unchanged. */
@media screen {
    html:not([data-theme="dark"]) .section-content-inner img:not(.html-snippet-embed img, .simg-frame > img) {
        padding: 10px !important;
        background: #E6EDF5;
        border-color: var(--border-medium, #B8CDE0);
    }
    html:not([data-theme="dark"]) .section-content-inner .simg-frame {
        border: 10px solid #E6EDF5;
        background: #E6EDF5;
        box-shadow: 0 0 0 2px var(--border-medium, #B8CDE0), 0 2px 8px var(--shadow-soft);
    }
    html:not([data-theme="dark"]) .section-content-inner .simg-frame > img { border-radius: 4px; }
}

/* Print Styles */
@media print {
    /* Kill all animations, transitions, transforms, shadows for print */
    * {
        transition: none !important;
        animation: none !important;
        box-shadow: none !important;
    }

    /* Hide non-content elements */
    .navbar, .toc-sidebar, .breadcrumb-nav,
    .action-buttons, .back-to-top, .celebration-banner,
    .obtain-ce-badge, .print-btn, .admin-topic-cog,
    .section-completion, .section-best-score, .coming-soon-box,
    #confettiCanvas, .admin-float-cog,
    [id^="video-"], [id^="quiz-"],
    .inline-quiz, .quiz-actions, .quiz-result,
    .section-video {
        display: none !important;
    }

    /* Allow content to flow naturally — avoid page-break-inside: avoid on tall elements */
    img {
        max-height: 80vh;
    }

    /* Reset backgrounds and colors for print */
    body, .container, .section-page-container, .content-layout, .content-main {
        background: white !important;
        color: black !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .container {
        max-width: 100% !important;
    }

    .content-layout {
        display: block !important;
    }

    .content-main {
        max-width: 100% !important;
        width: 100% !important;
    }
    /* THE print fix. On desktop .content-main is a sticky, viewport-height
       scroll box (overflow hidden, flex column) and the custom scrollbar
       wraps the topics in .fl-scroll, which does the actual scrolling. A
       scroll box prints only what is scrolled into view: the part above
       the current scroll position comes out blank and the rest is cut off,
       which looked like a "big empty space" on page 1. Full screen is the
       same story (.content-main is the scroller there). Unroll all of it. */
    .content-column,
    .content-main,
    .content-main.is-fs-content,
    .content-main > .fl-scroll,
    .content-main .fl-scroll {
        position: static !important;
        display: block !important;
        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
        overflow: visible !important;
        flex: none !important;
        top: auto !important;
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        transform: none !important;
        border: none !important;
    }
    .content-main.is-fs-content::after,
    .content-main .fl-scroll::after { content: none !important; display: none !important; }
    .fl-scrollbar-track, .fl-scrollbar-thumb, .content-nav-bar, .ie-toolbar { display: none !important; }
    body.ie-editing { padding-top: 0 !important; }
    /* Nothing in the topic column may be blurred, masked, transformed or
       partially transparent on paper: those are exactly the effects that
       print as faint, smeared or blank bands. The hero banner (white text
       on a gradient that is not printed) and the editorial notes panel
       have no place on paper either. */
    .content-column,
    .content-column * {
        opacity: 1 !important;
        filter: none !important;
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        -webkit-mask-image: none !important;
        mask-image: none !important;
        transform: none !important;
        animation: none !important;
        transition: none !important;
    }
    .page-hero,
    .topic-notes,
    .ce-enroll-banner,
    .engaged-mode-banner,
    .ce-earned-banner,
    .content-video-dock,
    .content-audio-dock,
    #topicNotes {
        display: none !important;
    }
    html::before, html::after, body::before, body::after { display: none !important; }

    /* Show only read-more content expanded, hide video/quiz */
    .section-content, .section-content[id^="content-"] {
        display: block !important;
        max-height: none !important;
        overflow: visible !important;
        opacity: 1 !important;
        height: auto !important;
        transition: none !important;
    }

    .section-content[id^="video-"],
    .section-content[id^="quiz-"] {
        display: none !important;
    }

    /* Card styling for print */
    .section-card {
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        margin-bottom: 0.5rem !important;
        padding: 0.5rem 0 !important;
        background: white !important;
        page-break-inside: auto !important;
    }

    /* ---- Pagination -------------------------------------------------
       Pure CSS: the print button only reveals the hidden topic cards and
       calls window.print(); nothing rewrites the page. */

    /* One topic per sheet. Every topic card after the first starts on a
       fresh page; the first follows the section heading. Exam cards are
       display:none, so a hidden one between two topics changes nothing. */
    .section-card[data-topic-index] ~ .section-card[data-topic-index] {
        break-before: page;
        page-break-before: always;
    }

    /* Anything that scrolls or clips (overflow other than visible) is
       "monolithic" to the print engine: it cannot be broken between lines,
       so once it is taller than a page it is sliced wherever the page ends,
       mid-line. The topic card and its content wrapper both clip on screen
       (rounded corners, mobile overflow guard), which is why text was being
       cut in half from one page to the next. On paper every wrapper in the
       topic column is a plain block, so breaks fall between lines. */
    .content-column *:not(img):not(video):not(iframe):not(svg):not(canvas) {
        overflow: visible !important;
    }
    .section-content-inner pre {
        white-space: pre-wrap !important;
        word-break: break-word;
    }

    /* Keep the things that read as one unit on one page: a callout, info
       card, image card, comparison, step, accordion item, key-points box,
       a table row, a list item, a quote. Plain paragraphs still flow across
       pages, but never leave a single line stranded, and a heading (or the
       topic's own header) never sits alone at the foot of a page. */
    .section-content-inner p { orphans: 3; widows: 3; }
    .section-card-header,
    .section-content-inner h2,
    .section-content-inner h3,
    .section-content-inner h4 {
        break-after: avoid;
        page-break-after: avoid;
        break-inside: avoid;
        page-break-inside: avoid;
    }
    .styled-callout, .callout-embed,
    .styled-info-card, .info-card-embed,
    .styled-image-card, .image-card-embed,
    .styled-comparison,
    .sstep,
    .sacc-item,
    .key-points-preview,
    .section-content-inner li,
    .section-content-inner tr,
    .section-content-inner blockquote,
    .section-content-inner figure {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    /* A table longer than a page repeats its header row on each page. */
    .section-content-inner thead { display: table-header-group; }

    .section-card-header {
        cursor: default !important;
        margin-bottom: 0.25rem !important;
        gap: 0.5rem !important;
    }

    .section-content-inner {
        padding-top: 0.25rem !important;
        margin-top: 0.15rem !important;
        border-top: none !important;
    }

    .topic-viewer-title {
        font-size: 1.1rem !important;
    }

    .section-preview {
        font-size: 0.85rem !important;
        margin: 0 !important;
    }

    .key-points-preview {
        padding: 0.75rem !important;
        margin-top: 0.75rem !important;
    }

    .topic-viewer-title {
        color: black !important;
    }

    .section-content-inner {
        color: #333 !important;
    }
    /* Dark theme on paper. The site's dark-mode rules colour paragraphs,
       list items, headings and bold DIRECTLY (not just the container), so
       "color: #333" on the container never reaches them and they print
       near-white on white: invisible paragraphs that read as a blank band,
       headings as faint grey. The html[data-theme] prefix outranks the
       [data-theme="dark"] rules in section.css, which loads after this
       file. Every theme prints black-on-white. */
    html[data-theme] body .section-content-inner,
    html[data-theme] body .section-content-inner p,
    html[data-theme] body .section-content-inner li,
    html[data-theme] body .section-content-inner h2,
    html[data-theme] body .section-content-inner h3,
    html[data-theme] body .section-content-inner h4,
    html[data-theme] body .section-content-inner strong,
    html[data-theme] body .section-content-inner blockquote,
    html[data-theme] body .section-content-inner td,
    html[data-theme] body .section-content-inner th,
    html[data-theme] body .section-content-inner .simg-text,
    html[data-theme] body .section-content-inner .sc-text,
    html[data-theme] body .section-content-inner .sc-label,
    html[data-theme] body .section-content-inner .key-points-preview li,
    html[data-theme] body .topic-viewer-title,
    html[data-theme] body .section-preview {
        color: #222 !important;
    }
    html[data-theme] body .section-content-inner a { color: #1a4d8f !important; }
    html[data-theme] body .section-content-inner code { color: #222 !important; background: #f0f0f0 !important; border-color: #ccc !important; }
    html[data-theme] body .section-content-inner .term { color: #fff !important; }
    html[data-theme] body .section-content-inner .simg-ref { color: #555 !important; }
    html[data-theme] body .section-content-inner h2 { border-bottom-color: #bbb !important; }
    html[data-theme] body .section-content-inner li::marker,
    html[data-theme] body .section-content-inner ol li[data-list]::before { color: #444 !important; }

    .section-content-inner img {
        max-width: 40% !important;
        width: auto !important;
        height: auto !important;
        page-break-inside: avoid;
    }

    /* Page header for print */
    .page-header {
        margin-bottom: 0.5rem !important;
        padding: 0 0 0.5rem 0 !important;
        border-bottom: 2px solid #333 !important;
    }

    .page-title {
        color: black !important;
        font-size: 1.8rem !important;
    }

    .page-subtitle {
        color: #555 !important;
    }

    /* Remove animations */
    .fade-in {
        opacity: 1 !important;
        transform: none !important;
    }

    /* Page margins */
    @page {
        margin: 1.5cm;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
    }

    .page-title {
        font-size: 1.75rem;
    }

    .section-card {
        padding: 1.25rem;
    }

    /* Stack buttons vertically on mobile */
    .action-buttons {
        flex-direction: column;
    }

    /* Cards and callouts mobile sizing */
    .styled-info-card {
        margin: 1rem 0;
    }

    .sic-header {
        padding: 0.75rem 1rem;
    }

    .sic-title {
        font-size: 1rem;
    }

    .sic-body {
        padding: 0.85rem;
    }

    .sic-example {
        padding: 0.65rem 0.85rem;
        font-size: 0.85rem;
    }

    .key-points-preview {
        padding: 0.85rem 1rem;
    }

    .callout-box {
        padding: 0.85rem;
    }
}

/* Collapsible group blocks — used by /learn/ (category groups) and
   /learn/<category>/ (section groups). Clicking the header toggles .collapsed
   on the block (state persisted via localStorage by the page's inline script). */
.section-groups-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.section-group-block {
    display: flex;
    flex-direction: column;
}
.section-group-block + .section-group-block {
    margin-top: 1.25rem;
}
.section-group-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    margin: 0 0 1rem;
    padding: 0.4rem 0.5rem 0.6rem;
    background: none;
    border: none;
    border-bottom: 2px solid color-mix(in srgb, var(--site-color) 30%, transparent);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--site-color) 75%, var(--text-primary));
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s ease, color 0.2s ease;
}
.section-group-title:hover {
    color: var(--site-color);
    border-bottom-color: var(--site-color);
}
.section-group-title .section-group-title-text {
    flex: 1;
}
.section-group-title i:first-child {
    font-size: 1.1rem;
}
.section-group-chevron {
    font-size: 1.1rem;
    transition: transform 0.2s ease;
}
.section-group-block.collapsed .section-group-chevron {
    transform: rotate(-90deg);
}
.section-group-body {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease, margin 0.2s ease;
    max-height: 6000px;
}
.section-group-block.collapsed .section-group-body {
    max-height: 0;
    opacity: 0;
    margin: 0 !important;
}

/* Hidden indicator (visible to creator+ on hidden categories/sections/topics) */
.hidden-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    background: color-mix(in srgb, #b45309 14%, transparent);
    color: #b45309;
    border: 1px solid color-mix(in srgb, #b45309 35%, transparent);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* (Blue-chrome frame, tactile borders, and the surface sheen moved to
   the shared "Tactile listing dialect" block in /includes/styles.css —
   they now apply to every listing card site-wide.) */

/* Restricted-visibility badge — shown on category cards whose access is
   limited to selected roles/user groups. Slate-blue lock pill, same
   anatomy as .hidden-badge so the two stack cleanly side by side. */
.restricted-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    background: color-mix(in srgb, #1e3a5f 12%, transparent);
    color: #3a6299;
    border: 1px solid color-mix(in srgb, #1e3a5f 35%, transparent);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
[data-theme="dark"] .restricted-badge {
    background: color-mix(in srgb, #8db9e8 14%, transparent);
    color: #8db9e8;
    border-color: color-mix(in srgb, #8db9e8 35%, transparent);
}
/* Dark Hidden pill, mirroring the restricted pill above: a light amber of
   the same weight as #8db9e8 (#b45309 was ~1.5:1 on the dark hero). */
[data-theme="dark"] .hidden-badge {
    background: color-mix(in srgb, #E0A96D 14%, transparent);
    color: #E0A96D;
    border-color: color-mix(in srgb, #E0A96D 35%, transparent);
}

/* On category cards, status pills anchor to the top-right corner so they
   never collide with the icon (top-left). When both are present the
   second stacks below the first. Scoped to .category-card — other card
   types keep their own badge placement. */
.category-card .hidden-badge {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
}
/* The restriction pill flows inline in the badge row next to the
   section/CE counts (it used to be pinned absolute up here too). */

/* Locked category card: visible on the shelf but not enterable — the
   user is outside the allowed roles/groups. Softly dimmed, no hover
   lift, and the lock pill (naming who has access) does the explaining. */
.category-card.is-locked-card {
    cursor: not-allowed;
    filter: grayscale(0.25) brightness(0.96);
}
.category-card.is-locked-card:hover {
    transform: none;
}

/* ---------- Card cover banners ----------
   Optional cover image on category/section cards (uploaded in the admin
   category/section modals). Framed like a photo inside the card — inset
   from the padding with a dark border and rounded corners — rather than
   bleeding to the card edges (full-bleed cropped medical images badly
   and the accent stripe fought with the imagery). */
.learn-card-cover {
    margin: -0.75rem -0.75rem 1.1rem;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: var(--neutral-bg);
    border: 1px solid #0c1929;
}

[data-theme="dark"] .learn-card-cover {
    border-color: rgba(150, 170, 210, 0.5);
}

.learn-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.category-card:hover .learn-card-cover img,
.topic-card:hover .learn-card-cover img {
    transform: scale(1.03);
}

/* "Enter Here" CTA pinned to the bottom-center of category/section
   cards. The cards become flex columns so the button rides margin-top:
   auto and every card bottom lines up across a grid row. The .fade-in
   compound selector out-ranks the display:block declarations in
   index.css / category.css, which load after this sheet. */
.category-card.fade-in,
.topic-card.fade-in {
    display: flex;
    flex-direction: column;
}

.card-enter-btn {
    /* auto top margin pins the button to the card bottom. */
    margin: auto auto 0;
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.5rem;
    border-radius: 8px;
    background-color: var(--primary-fill, #3A6FA8);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.category-card:hover .card-enter-btn,
.topic-card:hover .card-enter-btn {
    /* Green hover kept, on the fill token (white was 2.75:1 on dark --secondary-soft). */
    background-color: var(--success-fill, #1E7345);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-medium);
}

/* Guaranteed breathing room between the last content row (badge pills,
   progress bars) and the Enter button, even when the card is full. */
.category-card.fade-in:has(.card-enter-btn) > :nth-last-child(2),
.topic-card.fade-in:has(.card-enter-btn) > :nth-last-child(2) {
    margin-bottom: 1.1rem;
}
