/* ============================================================
 * Miami Gliders — instructor oral-prep shared stylesheet
 * Loaded by /private-instructor-prep.html, /commercial-instructor-prep.html,
 * /cfi-g-instructor-prep.html. Each page sets its own accent
 * color inline via :root variable overrides.
 *
 * Internal CFI reference companion to each rating's PTS. Same
 * "cozy" theme spirit as syllabus.css but kept on a tighter
 * chassis since these pages are dense Q&A reference docs that
 * may also be printed to letter paper.
 * ============================================================ */

:root {
    /* Per-rating accent — overridden on each page */
    --iop-accent:        #149dcc;
    --iop-accent-tint:   rgba(20, 157, 204, 0.10);
    --iop-accent-soft:   rgba(20, 157, 204, 0.18);

    /* Shared chrome */
    --iop-text:          #111;
    --iop-text-soft:     #4a4a4a;
    --iop-text-muted:    #555;
    --iop-card:          #fff;
    --iop-rule:          rgba(7, 59, 76, 0.14);
    --iop-rule-soft:     rgba(7, 59, 76, 0.10);
}

html { scroll-behavior: smooth; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    color: var(--iop-text);
}
body, p, li { overflow-wrap: break-word; word-wrap: break-word; }

/* === Cover === */
.iop-cover {
    display: block;
    border-top: 5px solid var(--iop-accent);
    border-bottom: 1px solid rgba(7,59,76,0.2);
    padding: 1.1rem 0 0.95rem;
    margin: 0 0 1.5rem;
}
.iop-cover-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--iop-text-soft);
    margin: 0 0 0.55rem;
    display: block;
}
.iop-cover-title {
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.1;
    margin: 0 0 0.4rem;
    color: #073b4c;
    letter-spacing: -0.3px;
}
.iop-cover-sub {
    font-size: 0.95rem;
    color: #2a2a2a;
    line-height: 1.45;
    margin: 0 0 0.75rem;
    max-width: 36rem;
}
.iop-cover-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    font-size: 0.8rem;
    color: #2a2a2a;
    line-height: 1.5;
    gap: 1rem;
    flex-wrap: wrap;
}
.iop-cover-meta-label {
    font-size: 0.66rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #6b7681;
    display: block;
    margin-bottom: 0.05rem;
}
.iop-cover-meta-value { color: #073b4c; font-weight: 600; }
.iop-cover-brand { text-align: right; font-size: 0.8rem; line-height: 1.5; color: #2a2a2a; }
.iop-cover-brand-name { font-size: 0.95rem; font-weight: 700; color: #073b4c; display: block; margin-bottom: 0.1rem; }

/* === Meta intro === */
.iop-meta {
    background: #f4f7f9;
    border: 1px solid rgba(7,59,76,0.18);
    border-left: 4px solid var(--iop-accent);
    padding: 0.85rem 1.1rem;
    border-radius: 6px;
    margin-bottom: 1.6rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--iop-text);
}
.iop-meta p { margin: 0 0 0.4rem; }
.iop-meta p:last-child { margin-bottom: 0; }
.iop-meta-title {
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #073b4c;
    margin: 0.65rem 0 0.3rem;
}
.iop-meta-title:first-child { margin-top: 0; }
.iop-meta ul { margin: 0.15rem 0 0.55rem; padding-left: 1.15rem; line-height: 1.5; }
.iop-meta ul li { padding: 0.07rem 0; }
.iop-meta ul:last-child { margin-bottom: 0; }

/* === Area === */
.iop-area {
    margin-top: 2.4rem;
    padding-top: 1rem;
    border-top: 2px solid var(--iop-rule);
    scroll-margin-top: 5rem;
}
.iop-area > h2 {
    font-size: 1.35rem;
    color: #073b4c;
    font-weight: 700;
    margin-bottom: 0.3rem;
    line-height: 1.25;
}
.iop-area-num { color: var(--iop-accent); font-weight: 700; margin-right: 0.4rem; }
.iop-area-note {
    font-size: 0.82rem;
    color: var(--iop-text-soft);
    font-weight: 400;
    font-style: italic;
    margin-left: 0.4rem;
}
.iop-area-refs { font-size: 0.82rem; color: var(--iop-text-soft); margin-bottom: 1rem; }

/* === Task cards === */
.iop-task {
    background: var(--iop-card);
    border: 1px solid var(--iop-rule);
    border-radius: 6px;
    padding: 0.85rem 1rem;
    margin-bottom: 0.7rem;
}
.iop-task-head {
    font-weight: 700;
    color: #073b4c;
    font-size: 1rem;
    border-bottom: 1px solid var(--iop-rule-soft);
    padding-bottom: 0.35rem;
    margin-bottom: 0.55rem;
}
.iop-task-letter { color: var(--iop-accent); font-weight: 700; margin-right: 0.25rem; }

/* === Sub-group divider (CFI-G launch groups) === */
.iop-launch-group {
    margin: 1.4rem 0 0.7rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #073b4c;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    border-bottom: 1px dashed rgba(7,59,76,0.25);
    padding-bottom: 0.2rem;
}

/* === Q&A blocks === */
.qa { margin: 0 0 0.65rem; }
.qa:last-child { margin-bottom: 0; }
.qa-q {
    margin: 0 0 0.25rem;
    font-weight: 600;
    color: var(--iop-text);
    line-height: 1.45;
    font-size: 0.93rem;
}
.qa-q::before { content: "Q."; color: var(--iop-accent); font-weight: 700; margin-right: 0.35rem; }
.qa-a {
    margin: 0;
    padding: 0.45rem 0.65rem 0.45rem 0.85rem;
    background: var(--iop-accent-tint);
    border-left: 3px solid var(--iop-accent);
    border-radius: 0 4px 4px 0;
    font-size: 0.9rem;
    color: var(--iop-text);
    line-height: 1.5;
}
.qa-a::before { content: "A."; color: var(--iop-accent); font-weight: 700; margin-right: 0.35rem; }
.qa-a ul { margin: 0.2rem 0 0; padding-left: 1.15rem; }
.qa-a ul li { padding: 0.05rem 0; }
.qa-cite {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.76rem;
    color: var(--iop-text-muted);
    font-style: italic;
}
.qa-callout {
    background: var(--iop-accent-tint);
    border-left: 4px solid var(--iop-accent);
    padding: 0.55rem 0.85rem;
    border-radius: 0 4px 4px 0;
    font-size: 0.86rem;
    color: var(--iop-text);
    margin: 0.7rem 0 0.3rem;
}

/* === Table of contents === */
.iop-toc {
    background: var(--iop-card);
    border: 1px solid var(--iop-rule);
    border-radius: 8px;
    padding: 0.95rem 1.15rem;
    margin: 0 0 1.6rem;
}
.iop-toc h2 {
    font-size: 0.86rem;
    margin: 0 0 0.55rem;
    color: #073b4c;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}
.iop-toc ol {
    list-style: none;
    padding: 0;
    margin: 0;
    columns: 2;
    column-gap: 1.4rem;
    font-size: 0.88rem;
}
.iop-toc ol li {
    padding: 0.13rem 0;
    display: flex;
    gap: 0.5rem;
    break-inside: avoid;
}
.iop-toc ol li a { color: #073b4c; text-decoration: none; }
.iop-toc ol li a:hover { color: var(--iop-accent); }
.iop-toc-num { color: var(--iop-accent); font-weight: 700; min-width: 1.6rem; }

/* === Floating back-to-top button === */
.iop-to-top {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 200;
    padding: 0.7rem 1.2rem;
    border-radius: 999px;
    border: none;
    background: var(--iop-accent);
    color: #fff;
    box-shadow: 0 6px 18px rgba(7, 59, 76, 0.32);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    opacity: 0;
    transform: translateY(0.5rem);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.18s ease;
}
.iop-to-top.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.iop-to-top:hover, .iop-to-top:focus-visible {
    background: #073b4c;
    color: #fff;
    text-decoration: none;
}
.iop-to-top:focus-visible {
    outline: 3px solid var(--iop-accent-soft);
    outline-offset: 2px;
}
.iop-to-top i.bi { font-size: 1.05em; line-height: 1; }

/* === Print: clean B&W on letter paper === */
@media print {
    @page { size: letter; margin: 0; }
    .navbar, .footer, .page-hero, .skip-link, .iop-print-hide { display: none !important; }
    html, body { margin: 0; padding: 0; }
    body {
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
        font-size: 9.5pt;
        line-height: 1.45;
        color: #111;
        background: #fff;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    main, .container, .row, .col-lg-10 {
        margin: 0 !important;
        padding: 0 !important;
        max-width: none !important;
        width: 100% !important;
        flex: 1 0 100% !important;
    }
    .content-section { padding: 0.5in 0.55in !important; box-sizing: border-box; }
    .iop-cover { padding: 0 0 9pt; margin-bottom: 12pt; }
    .iop-cover-eyebrow { font-size: 7.5pt; margin-bottom: 4pt; }
    .iop-cover-title { font-size: 22pt; margin-bottom: 4pt; }
    .iop-cover-sub { font-size: 10pt; margin-bottom: 6pt; }
    .iop-cover-bottom { font-size: 8pt; }
    .iop-cover-meta-label { font-size: 6.5pt; }
    .iop-cover-brand-name { font-size: 9.5pt; }
    h1.iop-doc-title { font-size: 15pt; }
    .iop-area { margin-top: 14pt; padding-top: 7pt; }
    .iop-area > h2 { font-size: 12.5pt; }
    .iop-task { padding: 7pt 9pt; margin-bottom: 6pt; }
    .iop-task-head { font-size: 10.5pt; padding-bottom: 3pt; margin-bottom: 4pt; }
    .qa { margin-bottom: 5pt; }
    .qa-q { font-size: 9.5pt; }
    .qa-a { font-size: 9pt; padding: 4pt 6pt 4pt 8pt; }
    .qa-cite { font-size: 7.5pt; }
    .iop-launch-group { font-size: 10pt; margin: 11pt 0 5pt; }
    .iop-area-refs { font-size: 8pt; }
    .iop-toc { padding: 8pt 11pt; }
    .iop-toc ol { font-size: 9pt; }
    .iop-meta { font-size: 9pt; padding: 7pt 10pt; }
    .iop-meta ul { font-size: 8.5pt; }
}


/* Top-bar 'Back to Manuals' pill — soft tint, brand teal text. */
.back-to-manuals {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.95rem;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 500;
    background: rgba(7, 59, 76, 0.10);
    color: #073b4c;
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease;
    line-height: 1.2;
}
.back-to-manuals:hover {
    background: rgba(7, 59, 76, 0.18);
    color: #042634;
    text-decoration: none;
}
.back-to-manuals i.bi { font-size: 0.95em; }


/* ============================================================
 * 2-column layout with sticky sidebar TOC (opt-in)
 * Activated on a page by wrapping cover + meta + areas in
 * <div class="iop-layout-2col"> with a sibling <aside class="iop-sidebar">.
 * Mobile keeps the in-flow .iop-toc; desktop hides it via .iop-toc-mobile.
 * ============================================================ */
.iop-layout-2col { display: block; }

@media (min-width: 1024px) {
    .iop-layout-2col {
        display: grid;
        grid-template-columns: 220px minmax(0, 1fr);
        gap: 2.5rem;
        align-items: start;
    }
    .iop-toc.iop-toc-mobile { display: none; }
}

.iop-sidebar { display: none; }

@media (min-width: 1024px) {
    .iop-sidebar {
        display: block;
        position: sticky;
        top: 5.25rem; /* clears fixed navbar */
        max-height: calc(100vh - 6rem);
        overflow-y: auto;
        padding: 0.25rem 0 1rem;
        font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    }
    .iop-sidebar h2 {
        font-size: 0.7rem;
        color: #6b7681;
        text-transform: uppercase;
        letter-spacing: 1.5px;
        font-weight: 700;
        margin: 0 0 0.85rem;
    }
    .iop-sidebar ol {
        list-style: none;
        padding: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        gap: 0.05rem;
    }
    .iop-sidebar ol li { font-size: 0.88rem; line-height: 1.3; }
    .iop-sidebar ol li a {
        display: flex;
        align-items: baseline;
        gap: 0.55rem;
        padding: 0.42rem 0.7rem;
        color: var(--iop-text-soft);
        text-decoration: none;
        border-left: 2px solid transparent;
        border-radius: 0 4px 4px 0;
        transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
        text-wrap: balance;
        line-height: 1.3;
    }
    .iop-sidebar ol li a:hover,
    .iop-sidebar ol li a:focus-visible {
        background: var(--iop-accent-tint);
        color: #073b4c;
    }
    .iop-sidebar ol li.is-active a {
        background: var(--iop-accent-tint);
        color: #073b4c;
        border-left-color: var(--iop-accent);
        /* No font-weight bump: bold widens the glyphs and reflows the
           label to a 2nd line. Background + border + color are enough. */
    }
    .iop-sidebar ol li a:focus-visible {
        outline: 2px solid var(--iop-accent-soft);
        outline-offset: 1px;
    }
    .iop-sidebar-num {
        color: var(--iop-accent);
        font-weight: 700;
        min-width: 1.7rem;
        font-size: 0.82rem;
    }
    .iop-sidebar-top {
        margin-top: 0.85rem;
        padding-top: 0.7rem;
        border-top: 1px dashed rgba(7,59,76,0.18);
    }
    .iop-sidebar-top a { color: #6b7681; font-size: 0.82rem; }
}

/* === Visual polish: gradient area banner (opt-in via .iop-area-banner) === */
.iop-area.iop-area-banner {
    margin-top: 2.6rem;
    padding-top: 0;
    border-top: none;
}
.iop-area.iop-area-banner > h2 {
    background: var(--iop-accent);
    background: var(--iop-accent-grad, linear-gradient(135deg, var(--iop-accent), #073b4c));
    color: #fff;
    padding: 0.85rem 1.15rem;
    border-radius: 6px;
    margin-bottom: 0.65rem;
    font-size: 1.25rem;
    box-shadow: 0 2px 8px rgba(7, 59, 76, 0.12);
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 600;
    letter-spacing: 0.1px;
}
.iop-area.iop-area-banner > h2 .iop-area-num { color: rgba(255,255,255,0.7); margin-right: 0.5rem; }
.iop-area.iop-area-banner > h2 .iop-area-note { color: rgba(255,255,255,0.85); }
.iop-area.iop-area-banner .iop-area-refs { padding: 0 0.15rem; }

/* === Task card hover lift (desktop only) === */
.iop-task { transition: box-shadow 0.18s ease, transform 0.18s ease; }
@media (hover: hover) and (min-width: 1024px) {
    .iop-task:hover {
        box-shadow: 0 4px 14px rgba(7, 59, 76, 0.10);
        transform: translateY(-1px);
    }
}

/* === Rubik for headings (Rubik is preloaded on each consumer page) === */
.iop-cover-title,
.iop-cover-brand-name,
.iop-task-head,
.iop-meta-title,
.iop-toc h2,
.iop-launch-group {
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* === Kill the orphan section bottom-fade gradient on no-footer pages === */
.content-section:has(.iop-layout-2col)::after { display: none; }

/* === Study mode toolbar (lives in the page navbar) === */
.iop-study-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    position: static;
    z-index: auto;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.iop-study-toggle,
.iop-study-controls button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.95rem;
    border-radius: 999px;
    border: 1px solid rgba(7, 59, 76, 0.16);
    background: rgba(7, 59, 76, 0.06);
    color: #073b4c;
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    line-height: 1.2;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.iop-study-toggle:hover,
.iop-study-controls button:hover {
    background: rgba(7, 59, 76, 0.18);
    border-color: rgba(7, 59, 76, 0.28);
    color: #042634;
}
.iop-study-toggle:focus-visible,
.iop-study-controls button:focus-visible {
    outline: 2px solid var(--iop-accent-soft);
    outline-offset: 2px;
}
.iop-study-toggle[aria-pressed="true"] {
    background: var(--iop-accent);
    color: #fff;
    border-color: var(--iop-accent);
}
.iop-study-toggle[aria-pressed="true"]:hover {
    background: var(--iop-accent);
    color: #fff;
    filter: brightness(0.92);
}
.iop-study-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.iop-study-hint { display: none; } /* hidden in navbar context */

@media (max-width: 720px) {
    .iop-study-toggle .iop-study-label { display: none; }
    .iop-study-controls button .iop-study-label { display: none; }
    .iop-study-toggle, .iop-study-controls button { padding: 0.4rem 0.65rem; }
}
@media (max-width: 480px) {
    /* On phones the navbar is tight; hide the secondary Reveal/Collapse
       controls. Toggle stays. */
    .iop-study-controls { display: none; }
}

/* === Study mode behavior: collapse answers, click question to reveal === */
body.study-mode .qa-a { display: none; }
body.study-mode .qa.is-revealed .qa-a { display: block; }
body.study-mode .qa-q {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.6rem;
}
body.study-mode .qa-q:focus-visible {
    outline: 2px solid var(--iop-accent-soft);
    outline-offset: 2px;
    border-radius: 4px;
}
body.study-mode .qa-q::after {
    content: '\203A'; /* › */
    position: absolute;
    right: 0.4rem;
    top: -0.05rem;
    color: var(--iop-accent);
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1.4;
    transition: transform 0.15s ease;
    display: inline-block;
}
body.study-mode .qa.is-revealed .qa-q::after {
    transform: rotate(90deg);
}

/* === Print: keep banner/sidebar/study UI from leaking into paper output === */
@media print {
    .iop-sidebar, .iop-toc-mobile, .iop-study-toolbar { display: none !important; }
    .iop-layout-2col {
        display: block !important;
        grid-template-columns: none !important;
        gap: 0 !important;
    }
    body.study-mode .qa-a { display: block !important; }
    body.study-mode .qa-q::after { display: none !important; }
    body.study-mode .qa-q { padding-right: 0 !important; }
    .iop-area.iop-area-banner > h2 {
        background: none !important;
        color: #073b4c !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin-bottom: 5pt !important;
        border-bottom: 1pt solid #073b4c !important;
        padding-bottom: 3pt !important;
    }
    .iop-area.iop-area-banner > h2 .iop-area-num { color: #073b4c !important; }
    .iop-area.iop-area-banner > h2 .iop-area-note { color: #4a4a4a !important; }
}


/* ============================================================
 * Theme toggle pill (navbar)
 * ============================================================ */
.iop-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin-left: 0.4rem;
    border-radius: 999px;
    border: 1px solid rgba(7, 59, 76, 0.16);
    background: rgba(7, 59, 76, 0.06);
    color: #073b4c;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.iop-theme-toggle:hover {
    background: rgba(7, 59, 76, 0.18);
    border-color: rgba(7, 59, 76, 0.28);
    color: #042634;
}
.iop-theme-toggle:focus-visible {
    outline: 2px solid var(--iop-accent-soft);
    outline-offset: 2px;
}
.iop-theme-toggle .bi-sun-fill { display: none; }
.iop-theme-toggle .bi-moon-stars-fill { display: inline-block; }


/* ============================================================
 * Dark mode (toggleable; on first visit follows OS preference)
 * Activated by inline <head> script setting html.theme-dark
 * before paint, so there is no flash of unstyled content.
 * ============================================================ */
html.theme-dark body {
    --iop-text:        #e8edf2;
    --iop-text-soft:   #b3bcc7;
    --iop-text-muted:  #98a2ad;
    --iop-card:        #1a232e;
    --iop-rule:        rgba(255, 255, 255, 0.10);
    --iop-rule-soft:   rgba(255, 255, 255, 0.06);
    background: #0e1620;
    color: var(--iop-text);
}

/* Body uses display:flex so .content-section grows to fill the viewport.
   Without this override the wrapper's --mg-white from miami-gliders.css
   sits on top of the dark body and dark mode looks like it's only on
   the cards. */
html.theme-dark .content-section,
html.theme-dark .has-footer-shadow {
    background: transparent !important;
}

/* Site navbar overrides for dark mode (.mg-navbar lives in miami-gliders.css) */
html.theme-dark .mg-navbar {
    background: #1a232e !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45) !important;
}
html.theme-dark .navbar-brand img { filter: brightness(0.97) contrast(1.04); }

/* Hardcoded navy heading + label colors that need to flip light */
html.theme-dark .iop-cover-title,
html.theme-dark .iop-cover-meta-value,
html.theme-dark .iop-cover-brand-name,
html.theme-dark .iop-meta-title,
html.theme-dark .iop-task-head,
html.theme-dark .iop-launch-group,
html.theme-dark .iop-toc h2,
html.theme-dark .iop-toc ol li a,
html.theme-dark .iop-area:not(.iop-area-banner) > h2,
html.theme-dark .qa-q { color: var(--iop-text); }

html.theme-dark .iop-cover-eyebrow,
html.theme-dark .iop-cover-meta-label,
html.theme-dark .iop-cover-bottom,
html.theme-dark .iop-cover-brand,
html.theme-dark .iop-cover-sub,
html.theme-dark .iop-area-refs,
html.theme-dark .iop-area-note,
html.theme-dark .qa-cite { color: var(--iop-text-soft); }

/* Cover bottom rule */
html.theme-dark .iop-cover { border-bottom-color: rgba(255, 255, 255, 0.18); }

/* Meta intro card — match the task-card surface so it reads as elevated */
html.theme-dark .iop-meta {
    background: var(--iop-card);
    border-color: var(--iop-rule);
    color: var(--iop-text);
}
html.theme-dark .iop-meta p,
html.theme-dark .iop-meta li,
html.theme-dark .iop-meta strong { color: var(--iop-text); }

/* Mobile TOC card */
html.theme-dark .iop-toc {
    background: var(--iop-card);
    border-color: var(--iop-rule);
}
html.theme-dark .iop-toc ol li a:hover { color: var(--iop-accent); }

/* Sidebar TOC */
html.theme-dark .iop-sidebar h2      { color: var(--iop-text-muted); }
html.theme-dark .iop-sidebar ol li a { color: var(--iop-text-soft); }
html.theme-dark .iop-sidebar ol li a:hover,
html.theme-dark .iop-sidebar ol li.is-active a { color: var(--iop-text); }
html.theme-dark .iop-sidebar-top { border-top-color: rgba(255, 255, 255, 0.10); }
html.theme-dark .iop-sidebar-top a { color: var(--iop-text-muted); }

/* Task cards */
html.theme-dark .iop-task {
    background: var(--iop-card);
    border-color: var(--iop-rule);
}
html.theme-dark .iop-task-head { border-bottom-color: var(--iop-rule-soft); }
@media (hover: hover) and (min-width: 1024px) {
    html.theme-dark .iop-task:hover { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); }
}

/* Area top divider */
html.theme-dark .iop-area { border-top-color: rgba(255, 255, 255, 0.14); }

/* Launch group dashed divider (CFI-G) */
html.theme-dark .iop-launch-group { border-bottom-color: rgba(255, 255, 255, 0.20); }

/* Back to Manuals pill */
html.theme-dark .back-to-manuals {
    background: rgba(255, 255, 255, 0.08);
    color: var(--iop-text);
}
html.theme-dark .back-to-manuals:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

/* Study mode + theme toggle pills */
html.theme-dark .iop-study-toggle,
html.theme-dark .iop-study-controls button,
html.theme-dark .iop-theme-toggle {
    background: rgba(255, 255, 255, 0.08);
    color: var(--iop-text);
    border-color: rgba(255, 255, 255, 0.14);
}
html.theme-dark .iop-study-toggle:hover,
html.theme-dark .iop-study-controls button:hover,
html.theme-dark .iop-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.24);
}
/* When study mode is engaged, keep the accent fill on the toggle */
html.theme-dark .iop-study-toggle[aria-pressed="true"] {
    background: var(--iop-accent);
    color: #fff;
    border-color: var(--iop-accent);
}

/* Sun/moon swap on the theme toggle */
html.theme-dark .iop-theme-toggle .bi-sun-fill { display: inline-block; }
html.theme-dark .iop-theme-toggle .bi-moon-stars-fill { display: none; }

/* Print: force light because dark mode prints poorly on B&W */
@media print {
    html.theme-dark body {
        background: #fff !important;
        color: #111 !important;
    }
    html.theme-dark .iop-task,
    html.theme-dark .iop-toc,
    html.theme-dark .iop-meta { background: #fff !important; color: #111 !important; }
}
