/* =============================================
   RotaryXC — Global Stylesheet
   Palette:
     Background:   #1a1a1a
     Surface:      #2c2c2c
     Nav/Footer:   #121212
     Accent green: #1db954  hover: #1ed760
     Gold:         #c9a66b
     Text:         #dcdcdc  muted: #cccccc
============================================= */

/* === RESET & BASE === */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #1a1a1a;
    color: #dcdcdc;
    margin: 0;
    padding: 0;
}

/* === TYPOGRAPHY === */
h1 { color: #1db954; margin-top: 0; }
h2 { color: #c9a66b; }
h3 { color: #c9a66b; }

a {
    color: #1db954;
    text-decoration: none;
}

a:hover {
    color: #1ed760;
}

p, ul li {
    color: #cccccc;
    line-height: 1.6;
}

/* === TOPBAR === */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: #1a1a1a;
    border-bottom: 1px solid #2c2c2c;
    z-index: 90;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
}
.topbar .logo {
    color: #1db954;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.15em;
    letter-spacing: -0.01em;
    flex-shrink: 0;
    margin-left: 240px;
}
.topbar .logo:hover { color: #1ed760; }
.topbar-search {
    flex: 1;
    max-width: 600px;
}
.topbar-search input {
    width: 100%;
    background-color: #2c2c2c;
    border: 1px solid #3a3b58;
    border-radius: 8px;
    color: #dcdcdc;
    font-family: 'Poppins', sans-serif;
    font-size: 0.92em;
    padding: 8px 14px;
    box-sizing: border-box;
}
.topbar-search input:focus {
    outline: none;
    border-color: #1db954;
}
.topbar-search input::placeholder { color: #888; }

/* Support button in topbar */
.topbar-support {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, #c9a66b 0%, #b89656 100%);
    color: #1a1a1a !important;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 700;
    text-decoration: none;
    flex-shrink: 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    white-space: nowrap;
}
.topbar-support:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
    color: #1a1a1a !important;
}

/* === SIDEBAR === */
.sidebar {
    width: 240px;
    background-color: #121212;
    height: calc(100vh - 56px);
    position: fixed;
    top: 56px;
    left: 0;
    padding: 16px 0 60px;
    overflow-y: auto;
    border-right: 1px solid #2c2c2c;
}

.sidebar .nav-section {
    margin-bottom: 18px;
}
.sidebar .nav-section h3 {
    color: #888;
    text-transform: uppercase;
    font-size: 0.72em;
    letter-spacing: 0.08em;
    font-weight: 700;
    padding: 0 20px;
    margin: 12px 0 4px;
}

.sidebar ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.sidebar ul li {
    margin: 0;
}

.sidebar ul li a {
    color: #dcdcdc;
    text-decoration: none;
    padding: 7px 20px 7px 24px;
    display: block;
    font-size: 0.95em;
    border-left: 2px solid transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sidebar ul li a:hover {
    background-color: #1a2a1a;
    color: #1db954;
}
.sidebar ul li a.active {
    color: #1db954;
    background-color: #1a2a1a;
    border-left-color: #1db954;
    font-weight: 700;
}

/* Tools section: highlight Logbook as the most-used tool */
.sidebar .nav-emphasis {
    color: #c9a66b !important;
    font-weight: 700;
}
.sidebar .nav-emphasis::before {
    content: "✱ ";
    color: #c9a66b;
}
.sidebar .nav-emphasis:hover {
    color: #1db954 !important;
}

/* === CONTEXTUAL SIDEBAR ===
   Injected by site.js when the user is on a course track / topic / wiki sub-page.
   Surfaces peer pages so the user can navigate without leaving the page.
*/
.sidebar .nav-context {
    /* Hidden by default; .has-context class added by JS once populated */
    display: none;
}
.sidebar .nav-context.has-context {
    display: block;
    margin: 4px 0 22px;
    padding-bottom: 18px;
    border-bottom: 1px solid #2c2c2c;
}

.sidebar .nav-context-track {
    color: #1db954;
    font-size: 0.92em;
    font-weight: 700;
    padding: 0 20px;
    margin: 4px 0 8px;
    text-transform: none;
    letter-spacing: 0;
}
.sidebar .nav-context-track a {
    color: #1db954;
    text-decoration: none;
}
.sidebar .nav-context-track a:hover {
    text-decoration: underline;
}

.sidebar .nav-context-topics {
    /* Inherits .sidebar ul, but tighter spacing for the dense list */
}
.sidebar .nav-context-topics > li > a {
    padding: 5px 20px 5px 24px;
    font-size: 0.9em;
}

.sidebar .nav-context-subs {
    background-color: #0e0e0e;
    border-left: 2px solid #2c2c2c;
    margin: 2px 0 6px 18px;
    padding: 4px 0;
}
.sidebar .nav-context-subs li a {
    padding: 4px 16px 4px 18px;
    font-size: 0.84em;
    color: #b8b8b8;
    border-left: none;
}
.sidebar .nav-context-subs li a:hover {
    background-color: #1a2a1a;
    color: #1db954;
}
.sidebar .nav-context-subs li a.active {
    color: #1db954;
    background-color: #1a2a1a;
    border-left: none;
    font-weight: 700;
}

/* === LAYOUT === */
main {
    margin-left: 240px;
    margin-top: 56px;
    padding: 24px 32px;
    max-width: 1100px;
}

footer {
    background-color: #121212;
    padding: 20px;
    text-align: center;
    margin-left: 240px;
    border-top: 1px solid #2c2c2c;
}

footer p {
    color: #dcdcdc;
    margin: 0 0 8px;
}

footer a {
    color: #1db954;
    text-decoration: none;
    margin: 0 15px;
}

footer a:hover {
    color: #1ed760;
}

/* === HERO === */
.hero {
    background-size: cover;
    background-position: center;
    height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #ffffff;
}

/* Use on index landing page for full-viewport hero */
.hero--full {
    height: 100vh;
}

.hero h1 {
    font-size: 3em;
    font-weight: 700;
    margin-bottom: 20px;
    color: #ffffff;
}

.hero p {
    font-size: 1.2em;
    max-width: 800px;
    margin: 0 auto;
    color: #ffffff;
}

/* === BUTTONS === */
.cta-btn {
    display: inline-block;
    background-color: #1db954;
    color: #fff;
    padding: 15px 30px;
    font-size: 1.2em;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.cta-btn:hover {
    background-color: #1ed760;
    color: #fff;
}

.pilot-button {
    display: inline-block;
    background-color: #3a3b58;
    color: #dcdcdc;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

.pilot-button:hover {
    background-color: #c9a66b;
    color: #1a1a1a;
}

/* === CARDS === */
.course-card {
    background-color: #2c2c2c;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.course-card p,
.course-card ul li {
    color: #b0b0d0;
}

/* === HOME — SERVICES === */
.services {
    padding: 50px 20px;
    text-align: center;
    background-color: #121212;
}

.services h2 {
    font-size: 2.5em;
    margin-bottom: 40px;
    color: #1db954;
}

.service-item {
    display: inline-block;
    width: 30%;
    margin: 0 2%;
    background-color: #2c2c2c;
    padding: 20px;
    border-radius: 8px;
    vertical-align: top;
}

.service-item h3 {
    color: #c9a66b;
    margin-bottom: 15px;
}

.service-item p {
    color: #cccccc;
}

/* === HOME — TESTIMONIALS === */
.testimonials {
    padding: 50px 20px;
    background-color: #1e1e1e;
    text-align: center;
}

.testimonials h2 {
    color: #1db954;
    margin-bottom: 40px;
    font-size: 2.5em;
}

.testimonial {
    display: inline-block;
    width: 30%;
    margin: 0 2%;
    padding: 20px;
    background-color: #2c2c2c;
    border-radius: 8px;
    vertical-align: top;
}

.testimonial p {
    color: #cccccc;
    font-style: italic;
}

.testimonial h3 {
    margin-top: 10px;
    color: #c9a66b;
}

/* === BLOG === */
.featured {
    padding: 50px 20px;
    text-align: center;
    background-color: #121212;
}

.featured h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: #1db954;
}

.featured-posts {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.post-card {
    background-color: #2c2c2c;
    padding: 20px;
    border-radius: 8px;
    width: 300px;
    text-align: left;
}

.post-card img {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 15px;
}

.post-card h3 {
    color: #c9a66b;
    margin-bottom: 10px;
}

.post-card p {
    color: #cccccc;
}

.read-more {
    color: #1db954;
}

.read-more:hover {
    color: #1ed760;
}

.blog-grid {
    padding: 50px 20px;
    background-color: #1e1e1e;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.grid-item {
    background-color: #2c2c2c;
    padding: 20px;
    border-radius: 8px;
}

.grid-item img {
    width: 100%;
    border-radius: 8px;
    margin-bottom: 15px;
}

.grid-item h3 {
    color: #c9a66b;
    margin-bottom: 10px;
}

.grid-item p {
    color: #cccccc;
}

.search-bar {
    text-align: center;
    margin-bottom: 30px;
}

.search-bar input {
    padding: 10px;
    width: 80%;
    max-width: 400px;
    font-size: 1em;
    border: none;
    border-radius: 5px;
    background-color: #2c2c2c;
    color: #dcdcdc;
}

/* === GALLERY === */
.upload-section {
    background-color: #2c2c2c;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.upload-section h2 {
    color: #1db954;
}

.upload-input {
    margin-top: 10px;
    background-color: #333;
    color: #fff;
    padding: 10px;
    border-radius: 5px;
    width: 100%;
    border: none;
    font-size: 16px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.gallery-item {
    background-color: #333;
    padding: 15px;
    border-radius: 8px;
}

.gallery-item img,
.gallery-item iframe {
    width: 100%;
    border-radius: 8px;
}

.video-section {
    margin-bottom: 40px;
}

.video-section h2 {
    color: #1db954;
}

.video-container {
    margin-bottom: 20px;
}

.video-container iframe {
    width: 100%;
    height: 400px;
    border-radius: 8px;
}

.category {
    background-color: #2c2c2c;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.category h2 {
    color: #c9a66b;
}

.category p {
    color: #cccccc;
}

/* === CONTACT === */
.contact-info,
.socials,
.bio-section {
    margin-bottom: 40px;
}

.contact-info p,
.socials p {
    color: #cccccc;
    font-size: 1.2em;
}

.bio-section img {
    display: block;
    margin: 0 auto 20px;
    border-radius: 50%;
    width: 200px;
    height: 200px;
    object-fit: cover;
}

.bio-section h2 {
    text-align: center;
    margin-bottom: 20px;
}

.bio-section p {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.1em;
}

/* === DASHBOARD === */
.progress-bar {
    width: 100%;
    background-color: #2c2d44;
    border-radius: 8px;
    height: 20px;
    margin-bottom: 10px;
}

.progress {
    background-color: #c9a66b;
    height: 100%;
    border-radius: 8px;
    transition: width 0.5s ease-in-out;
}

.progress-item {
    margin-bottom: 30px;
}

.meter {
    background-color: #2c2d44;
    border-radius: 0.5rem;
    height: 1.25rem;
    width: 100%;
    overflow: hidden;
    position: relative;
    margin-bottom: 1rem;
}

.meter span {
    display: block;
    height: 100%;
    background-color: #c9a66b;
    transition: width 0.5s ease-in-out;
}

.meter span.progress {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a1a1a;
    font-weight: bold;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    font-size: 0.875rem;
}

/* === PILOT CARD === */
.pilot-card {
    background-color: #2c2d44;
    padding: 20px;
    margin: 20px 0;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    max-width: 400px;
}

.pilot-card-header h2 {
    color: #c9a66b;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
}

.pilot-card-body {
    display: flex;
    justify-content: center;
}

/* === SMART FEEDBACK (dashboard) === */
.smart-feedback {
    display: grid;
    gap: 14px;
    margin: 16px 0 30px;
}
.feedback-block {
    background-color: #2c2c2c;
    border-radius: 10px;
    padding: 18px 22px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    border-left: 3px solid #1db954;
}
.feedback-block.weak { border-left-color: #c9a66b; }
.feedback-block.strong { border-left-color: #1db954; }
.feedback-block .feedback-icon {
    font-size: 1.6em;
    flex-shrink: 0;
    line-height: 1;
}
.feedback-block .feedback-content { flex: 1; }
.feedback-block h4 {
    color: #c9a66b;
    margin: 0 0 6px;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.feedback-block.strong h4 { color: #1db954; }
.feedback-block p {
    color: #dcdcdc;
    margin: 4px 0;
    font-size: 0.92em;
    line-height: 1.5;
}
.feedback-list { list-style: none; padding: 0; margin: 8px 0 0; }
.feedback-list li {
    padding: 8px 0;
    border-bottom: 1px solid #1a1a1a;
}
.feedback-list li:last-child { border-bottom: none; }
.feedback-stat {
    color: #888;
    font-size: 0.85em;
    margin-left: 8px;
}
.feedback-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.feedback-cta {
    display: inline-block;
    padding: 4px 12px;
    background-color: #1a1a1a;
    border: 1px solid #3a3b58;
    border-radius: 6px;
    color: #1db954;
    text-decoration: none;
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.feedback-cta:hover { border-color: #1db954; background-color: #1a2a1a; }

/* === FURTHER READING (reusable component on course pages) === */
.further-reading {
    background: linear-gradient(135deg, #1a2a1a 0%, #2c2c2c 100%);
    border: 1px solid #3a3b58;
    border-radius: 12px;
    padding: 22px 26px;
    margin: 32px 0;
}
.further-reading h2,
.further-reading h3 {
    color: #c9a66b;
    margin: 0 0 8px;
    font-size: 0.92em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: none;
    padding-bottom: 0;
}
.further-reading .fr-intro {
    color: #b8b8b8;
    font-size: 0.92em;
    margin: 4px 0 14px;
    line-height: 1.5;
}
.further-reading ul {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
}
.further-reading li {
    padding: 8px 0;
    color: #dcdcdc;
    font-size: 0.92em;
    border-bottom: 1px solid #1a1a1a;
}
.further-reading li:last-child { border-bottom: none; }
.further-reading li a {
    color: #1db954;
    text-decoration: none;
    font-weight: 700;
}
.further-reading li a:hover { text-decoration: underline; }
.further-reading li .fr-tag {
    display: inline-block;
    background-color: #1a1a1a;
    border: 1px solid #3a3b58;
    border-radius: 4px;
    color: #888;
    font-size: 0.7em;
    padding: 1px 6px;
    margin-right: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: middle;
}
.further-reading li .fr-tag.faa { color: #ff9f6b; border-color: #4a3a20; }
.further-reading li .fr-tag.ac { color: #d4b577; border-color: #3a3a20; }
.further-reading li .fr-tag.reg { color: #6dd4d4; border-color: #1a3a3a; }
.further-reading li .fr-tag.local { color: #1db954; border-color: #1a3a1a; }
.further-reading li .fr-desc {
    color: #888;
    font-size: 0.85em;
    margin-top: 2px;
    margin-left: 0;
}

/* === STUDY TOOL CALLOUT (on course pages) === */
.study-tools-callout {
    background-color: #2c2c2c;
    border: 1px solid #3a3b58;
    border-radius: 12px;
    padding: 18px 22px;
    margin: 24px 0;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}
.study-tools-callout .stc-label {
    color: #888;
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}
.study-tools-callout .stc-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.study-tools-callout a {
    display: inline-block;
    padding: 6px 14px;
    background-color: #1a1a1a;
    border: 1px solid #3a3b58;
    border-radius: 6px;
    color: #1db954;
    text-decoration: none;
    font-size: 0.85em;
    font-weight: 700;
}
.study-tools-callout a:hover { border-color: #1db954; background-color: #1a2a1a; }

/* === MOBILE NAV — HAMBURGER + DRAWER === */
.nav-toggle-checkbox { display: none; }
.hamburger { display: none; }
.sidebar-overlay { display: none; }

/* === RESPONSIVE === */
@media (max-width: 900px) {
    /* Topbar adjusts on mobile — logo no longer offset for sidebar */
    .topbar {
        padding: 0 12px 0 64px; /* leave room for hamburger */
    }
    .topbar .logo { margin-left: 0; }
    .topbar-search input { font-size: 0.85em; padding: 6px 12px; }

    /* Hamburger button — top-left, fixed */
    .hamburger {
        display: flex;
        position: fixed;
        top: 8px;
        left: 12px;
        z-index: 200;
        background-color: #2c2c2c;
        color: #1db954;
        border: 1px solid #3a3b58;
        border-radius: 8px;
        font-size: 1.3em;
        width: 40px;
        height: 40px;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        user-select: none;
        font-family: 'Poppins', sans-serif;
        line-height: 1;
        padding: 0;
    }
    .hamburger:active { background-color: #3a3b58; }

    /* Slide-in drawer */
    .sidebar {
        width: 280px;
        height: calc(100vh - 56px);
        position: fixed;
        top: 56px;
        left: 0;
        z-index: 150;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        padding-top: 16px;
        overflow-y: auto;
    }

    /* Overlay behind drawer when open */
    .sidebar-overlay {
        position: fixed;
        top: 56px;
        left: 0;
        width: 100vw;
        height: calc(100vh - 56px);
        background: rgba(0,0,0,0.6);
        z-index: 100;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s, visibility 0.2s;
        display: block;
    }

    /* When checkbox toggled: open drawer + show overlay */
    .nav-toggle-checkbox:checked ~ .sidebar {
        transform: translateX(0);
        box-shadow: 4px 0 16px rgba(0,0,0,0.5);
    }
    .nav-toggle-checkbox:checked ~ .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }

    main, footer {
        margin-left: 0;
        padding-left: 16px;
        padding-right: 16px;
    }

    .service-item,
    .testimonial {
        display: block;
        width: 90%;
        margin: 10px auto;
    }

    .hero { height: 40vh; }
    .hero--full { height: 60vh; }
    .hero h1 { font-size: 2.2em; }
    .meter { height: 1rem; }

    /* Tighten cards/grids on mobile */
    .course-card, .feature-card, .topic-card, .track-card, .syllabus-card,
    .area-section, .question-card, .cert-block {
        padding: 18px;
    }
    .course-card h2, .area-section h2 { font-size: 1.2em; }

    /* Topic page mnemonic cards — wider on mobile */
    .mnemonic-grid, .pill-grid, .topic-grid, .feature-grid,
    .course-track, .track-row, .syllabus-grid, .post-list {
        grid-template-columns: 1fr !important;
    }

    /* Quiz / search adjustments */
    .quiz-controls, .search-box {
        flex-direction: column;
        align-items: stretch;
    }
    .quiz-controls .score { margin-left: 0; }
    .alpha-nav .search-box { margin-left: 0; width: 100%; }
    .alpha-nav input { width: 100%; }

    /* Logbook two-column → one */
    .logbook-grid { grid-template-columns: 1fr !important; }

    /* ACS reference: stop sticky TOC from eating content */
    .area-toc { position: relative; }

    /* Smaller heading */
    h1 { font-size: 1.7em; }
    h2 { font-size: 1.3em; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 1.8em; }
    .hero p { font-size: 1em; }
    .meter { height: 0.875rem; }
    .stat-grid, .summary-grid { grid-template-columns: 1fr 1fr !important; }

    /* Tighten table on small screens */
    table { font-size: 0.85em; }
    table th, table td { padding: 4px !important; }
}

/* ===== Auto-glossary linker ===== */
.glossary-auto-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted #c9a66b;
    cursor: help;
    position: relative;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.glossary-auto-link:hover {
    color: #c9a66b;
    border-bottom-color: #1db954;
}
.glossary-auto-link::after {
    content: attr(data-glossary-def);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: max-content;
    max-width: 320px;
    background-color: #1a1a1a;
    border: 1px solid #c9a66b;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.85em;
    color: #dcdcdc;
    line-height: 1.5;
    white-space: normal;
    text-align: left;
    box-shadow: 0 6px 16px rgba(0,0,0,0.6);
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 1000;
}
.glossary-auto-link::before {
    content: attr(data-glossary-term);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 14px;
    background-color: transparent;
    color: #1db954;
    font-weight: 700;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 1001;
    /* Sits above the tooltip box's top padding so it visually labels the tooltip */
    padding-top: 10px;
}
.glossary-auto-link:hover::after,
.glossary-auto-link:hover::before {
    opacity: 1;
    transform: translateY(0);
}
/* On narrow screens, anchor the tooltip to the right edge of viewport */
@media (max-width: 600px) {
    .glossary-auto-link::after { max-width: min(320px, calc(100vw - 40px)); }
}

/* ===== Wiki sub-page layout ===== */
.breadcrumb {
    color: #888;
    font-size: 0.85em;
    margin: 0 0 6px;
}
.breadcrumb a {
    color: #c9a66b;
    text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: #555; margin: 0 6px; }

.concept-hero {
    background-color: #2c2c2c;
    border-left: 4px solid #1db954;
    border-radius: 8px;
    padding: 22px 26px;
    margin: 14px 0 28px;
}
figure.diagram {
    margin: 24px 0;
    padding: 16px;
    background-color: #f4f4f4;
    border-radius: 8px;
    text-align: center;
}
figure.diagram img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 4px;
}
figure.diagram figcaption {
    margin-top: 12px;
    color: #555;
    font-size: 0.9em;
    font-style: italic;
    line-height: 1.4;
}
.concept-hero h1 {
    color: #1db954;
    margin: 0 0 10px;
    font-size: 1.7em;
}
.concept-hero .summary {
    color: #dcdcdc;
    font-size: 1.02em;
    line-height: 1.6;
    margin: 0;
}
.concept-hero .also-known {
    color: #888;
    font-size: 0.85em;
    margin-top: 10px;
    font-style: italic;
}

.concept-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    margin: 18px 0 30px;
}
.concept-tile {
    background-color: #2c2c2c;
    border-radius: 8px;
    padding: 18px 20px;
    text-decoration: none;
    color: inherit;
    border-left: 3px solid #c9a66b;
    transition: transform 0.15s ease, border-left-color 0.15s ease;
    display: block;
}
.concept-tile:hover {
    transform: translateY(-2px);
    border-left-color: #1db954;
}
.concept-tile h4 {
    color: #1db954;
    margin: 0 0 6px;
    font-size: 1em;
}
.concept-tile p {
    color: #b8b8b8;
    font-size: 0.88em;
    margin: 0;
    line-height: 1.5;
}
.concept-section-label {
    color: #c9a66b;
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 24px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #2c2c2c;
}

.concept-nav {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin: 32px 0 20px;
    padding-top: 22px;
    border-top: 1px solid #2c2c2c;
}
.concept-nav a {
    background-color: #2c2c2c;
    border-radius: 8px;
    padding: 12px 16px;
    text-decoration: none;
    color: #dcdcdc;
    font-size: 0.92em;
    display: block;
    text-align: center;
    transition: transform 0.15s ease, border-color 0.15s ease;
    border: 1px solid transparent;
}
.concept-nav a:hover {
    border-color: #1db954;
    transform: translateY(-1px);
}
.concept-nav .label {
    display: block;
    color: #888;
    font-size: 0.72em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 3px;
}
.concept-nav .center { background-color: #1a2a1a; border-color: #1db954; }
.concept-nav .center .label { color: #1db954; }
.concept-nav .disabled {
    opacity: 0.4;
    pointer-events: none;
}
@media (max-width: 600px) {
    .concept-nav { grid-template-columns: 1fr; }
}

.related-concepts {
    background-color: #2c2c2c;
    border-left: 4px solid #c9a66b;
    border-radius: 8px;
    padding: 16px 22px;
    margin: 24px 0;
}
.related-concepts h3 {
    color: #c9a66b;
    margin: 0 0 10px;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.related-concepts ul { margin: 0; padding-left: 18px; }
.related-concepts li { color: #dcdcdc; font-size: 0.92em; margin-bottom: 6px; line-height: 1.5; }
.related-concepts a { color: #1db954; text-decoration: none; }
.related-concepts a:hover { text-decoration: underline; }
.related-concepts .blurb { color: #888; }

/* ==========================================================================
   Figures — diagrams and photos integrated into content pages.
   Use <figure class="diagram"> for FAA-style line drawings, scans, and
   technical illustrations (white-bg padding helps transparent PNGs read on
   the dark theme). Use <figure class="photo"> for full-bleed photography.
   Captions get italic muted text; .src spans render attribution muted further.
   ========================================================================== */
figure.diagram,
figure.photo {
    margin: 22px auto;
    max-width: 900px;
    text-align: center;
}
figure.diagram img,
figure.photo img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: 8px;
}
figure.diagram img {
    background: #fafafa;
    padding: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
figure.diagram figcaption,
figure.photo figcaption {
    margin-top: 10px;
    color: #b8b8b8;
    font-size: 0.88em;
    font-style: italic;
    line-height: 1.5;
}
figure.diagram .src,
figure.photo .src {
    display: block;
    margin-top: 4px;
    color: #888;
    font-size: 0.85em;
    font-style: normal;
}
@media (max-width: 600px) {
    figure.diagram img { padding: 8px; }
    figure.diagram, figure.photo { margin: 16px auto; }
}

/* ==========================================================================
   Print stylesheet — turn any content page into a clean study packet.
   Hides site chrome (topbar, sidebar, notes widget, footer, study-tools
   callouts, prev/next nav). Resets dark theme to ink-on-paper. Adds page-
   break hints so course-cards and concept-heros don't split mid-block.
   ========================================================================== */

@media print {
    @page { margin: 0.6in 0.7in; }

    html, body {
        background: #fff !important;
        color: #000 !important;
        font-family: Georgia, "Times New Roman", serif;
        font-size: 11pt;
        line-height: 1.45;
    }

    /* Hide every element that's only useful on screen. */
    .topbar, .sidebar, .nav-toggle-checkbox, .hamburger,
    .sidebar-overlay, footer, .breadcrumb,
    .study-tools-callout, .concept-nav, .nav-context,
    .topbar-search, .topbar-support,
    #notes-widget, #notes-fab, #notes-panel { display: none !important; }

    /* Full-width main; no chrome offsets. */
    main {
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
    }

    /* Headings: serif body, sans headings, avoid orphan headings. */
    h1, h2, h3, h4, h5 {
        font-family: "Helvetica Neue", Arial, sans-serif;
        color: #000 !important;
        page-break-after: avoid;
        page-break-inside: avoid;
    }
    h1 { font-size: 22pt; margin: 0 0 12pt; }
    h2 { font-size: 15pt; margin: 16pt 0 6pt; }
    h3 { font-size: 12pt; margin: 12pt 0 4pt; }

    p, li { orphans: 3; widows: 3; }

    /* Links: black underlined. External URLs printed in parens; internal
       links keep just the underline so the page doesn't fill with /courses/... */
    a, a:visited { color: #000 !important; text-decoration: underline; }
    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 8.5pt;
        color: #555;
        word-break: break-all;
    }

    /* Content blocks: light borders, no fills. */
    .course-card {
        background: transparent !important;
        border: 0.5pt solid #888 !important;
        border-radius: 0 !important;
        padding: 8pt 12pt !important;
        margin: 0 0 10pt !important;
        page-break-inside: avoid;
    }
    .concept-hero {
        background: transparent !important;
        border: none !important;
        border-left: 3pt solid #000 !important;
        padding: 0 0 0 12pt !important;
        margin: 0 0 14pt !important;
        page-break-inside: avoid;
    }
    .concept-hero h1 { color: #000 !important; }
    .concept-hero .summary { color: #000 !important; font-size: 11pt; }
    .related-concepts {
        background: transparent !important;
        border: none !important;
        border-top: 1pt solid #000 !important;
        padding: 8pt 0 0 !important;
        margin-top: 14pt;
        page-break-inside: avoid;
    }
    .related-concepts h3 { color: #000 !important; }
    .related-concepts a { color: #000 !important; }
    .related-concepts .blurb { color: #444 !important; }

    /* Warning boxes: keep distinct as a "callout" but greyscale. */
    .warning-box {
        background: #f3f3f3 !important;
        border-left: 3pt solid #000 !important;
        color: #000 !important;
        padding: 6pt 10pt !important;
        page-break-inside: avoid;
    }
    .warning-box p { color: #000 !important; }

    /* Concept tile grids print as a vertical list. */
    .concept-grid { display: block !important; gap: 0 !important; }
    .concept-tile {
        background: transparent !important;
        border: 0.5pt solid #aaa !important;
        padding: 5pt 10pt !important;
        margin: 3pt 0 !important;
        display: block !important;
        page-break-inside: avoid;
    }
    .concept-tile h4 { color: #000 !important; margin: 0 0 2pt !important; font-size: 11pt; }
    .concept-tile p { color: #000 !important; margin: 0 !important; font-size: 10pt; }
    .concept-section-label { color: #000 !important; font-size: 12pt; margin-top: 14pt; }

    /* Code + pre: greyscale-friendly. */
    code, pre {
        background: #f3f3f3 !important;
        color: #000 !important;
        font-family: "Courier New", monospace;
        font-size: 9pt;
    }
    pre {
        border: 0.5pt solid #aaa !important;
        padding: 6pt 8pt !important;
        page-break-inside: avoid;
        white-space: pre-wrap;
    }

    /* Tables — keep gridlines, force visible borders. */
    table { border-collapse: collapse; page-break-inside: avoid; }
    th, td { border: 0.5pt solid #888 !important; padding: 4pt 6pt; color: #000 !important; }

    /* Images — never overflow the page; never split. */
    img { max-width: 100% !important; height: auto !important; page-break-inside: avoid; }

    /* Glossary auto-links: drop the dotted underline + tooltip pseudo-content. */
    .glossary-auto-link {
        color: #000 !important;
        text-decoration: none !important;
        border-bottom: none !important;
    }
    .glossary-auto-link::before, .glossary-auto-link::after { display: none !important; }

    /* Further-reading aside: keep, simplified. */
    .further-reading {
        background: transparent !important;
        border: none !important;
        border-top: 1pt solid #000 !important;
        padding: 8pt 0 0 !important;
        page-break-inside: avoid;
    }
    .further-reading h3 { color: #000 !important; }
    .fr-tag { background: #eee !important; color: #000 !important; border: 0.5pt solid #888 !important; }

    /* Figures — keep visible; drop dark-theme padding/shadow. */
    figure.diagram, figure.photo {
        margin: 12pt auto !important;
        page-break-inside: avoid;
    }
    figure.diagram img {
        background: transparent !important;
        padding: 0 !important;
        border: 0.5pt solid #888 !important;
        box-shadow: none !important;
    }
    figure.diagram figcaption,
    figure.photo figcaption {
        color: #000 !important;
        font-size: 9.5pt !important;
        font-style: italic;
    }
    figure.diagram .src,
    figure.photo .src { color: #444 !important; }
}
