/*
 * theme.css
 * ==========================================================================
 * Custom theme layer for the public-facing website.
 * Sits ON TOP of styles.css (which contains Bootstrap 5.2.3 + Simple Sidebar).
 *
 * TABLE OF CONTENTS:
 *   1.  CSS Variables — Dark Theme (default)
 *   2.  CSS Variables — Light Theme (.light-theme)
 *   3.  Font Size Scaling (.font-small, .font-large)
 *   4.  Global Resets & Base Styles
 *   5.  Skip-to-Content Link (accessibility)
 *   6.  Reading Progress Bar
 *   7.  Scrollbar
 *   8.  Layout — Wrapper
 *   9.  Sidebar (V-Nav)
 *  10.  Top Nav (H-Nav)
 *  11.  H-Nav Tool Buttons (search, theme toggle, font controls)
 *  12.  Page Title / Brand Header
 *  13.  Hero Section (home page)
 *  14.  Navigation Pathway Cards (home page)
 *  15.  Reading Time Estimate
 *  16.  Breadcrumb Navigation
 *  17.  Main Content Area
 *  18.  Video Responsive Wrapper
 *  19.  Full-Width Sections
 *  20.  Intro Block (hero / abstract area)
 *  21.  Content Rows (two-column text + media sections)
 *  22.  Topic-Specific Colour Accents
 *  23.  Pull Quotes
 *  24.  Callout Boxes (Key Insight, Common Question, Caution)
 *  25.  Confidence Level Badges
 *  26.  Glossary Tooltips
 *  27.  Go Deeper Expandable Sections
 *  28.  Footnotes / Source Citations
 *  29.  Social Sharing Buttons
 *  30.  Interactive Diagram Placeholders
 *  31.  Image Lightbox
 *  32.  Table of Contents Flyout (Option C toggle)
 *  33.  Previous / Next Navigation
 *  34.  Search Overlay
 *  35.  Footer & Newsletter
 *  36.  Ambient Floating Particles
 *  37.  Scroll-Triggered Fade-In Animation
 *  38.  Scroll-Spy Active Highlight
 *  39.  Bootstrap Overrides
 *  40.  Visible Focus Indicators (accessibility)
 *  41.  Reduced Motion (accessibility)
 * ==========================================================================
 */


/* ==========================================================================
   1. CSS VARIABLES — DARK THEME (default)
   ==========================================================================
   Every colour on the site is defined here as a CSS custom property.
   Components reference these via var(--name) so changing a value here
   repaints every element that uses it.
   ========================================================================== */

:root {
    --bg-deep:       #29446b;
    --bg-surface:    #0f1425;
    --bg-card:       #141a2e;
    --bg-sidebar:    #0a2245;
    --bg-elevated:   #1a2140;

    --text-primary:   #e8eaf0;
    --text-secondary: #ffffff;
    --text-muted:     #5c6480;  /* boosted from #7a82a0 for WCAG AA+ (6.5:1) */

    --accent:           #3b82f6;
    --accent-glow:      rgba(59, 130, 246, 0.35);
    --accent-soft:      rgba(59, 130, 246, 0.12);
    --accent-secondary: #06b6d4;

    --border-color: rgba(255, 255, 255, 0.06);
    --border-glow:  rgba(59, 130, 246, 0.2);

    --font-display: 'Syne', sans-serif;
    --font-body:    'Verdana', sans-serif;
}


/* ==========================================================================
   2. CSS VARIABLES — LIGHT THEME
   ==========================================================================
   Applied when .light-theme is present on <html>. Overrides the same
   variable names so every element switches instantly.
   ========================================================================== */

.light-theme {
    --bg-deep:       #f5f7fa;
    --bg-surface:    #edf0f5;
    --bg-card:       #ffffff;
    --bg-sidebar:    #f0f2f7;
    --bg-elevated:   #e2e6ee;

    --text-primary:   #1a1f2e;
    --text-secondary: #3a4050;
    --text-muted:     #5c6370;  /* boosted from #6b7280 for WCAG AA+ (5.6:1) */

    --accent:           #2563eb;
    --accent-glow:      rgba(37, 99, 235, 0.20);
    --accent-soft:      rgba(37, 99, 235, 0.08);
    --accent-secondary: #0891b2;

    --border-color: rgba(0, 0, 0, 0.08);
    --border-glow:  rgba(37, 99, 235, 0.15);
}


/* ==========================================================================
   3. FONT SIZE SCALING
   ==========================================================================
   Applied to <html> so rem-based sizes scale uniformly.
   ========================================================================== */

html.font-small  { font-size: 87.5%;  }
html.font-large  { font-size: 118.75%; }


/* ==========================================================================
   4. GLOBAL RESETS & BASE STYLES
   ========================================================================== */

body {
    background-color: var(--bg-deep) !important;
    color: var(--text-primary) !important;
    font-family: var(--font-body) !important;
    font-weight: 300;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display) !important;
    font-weight: 700;
    color: var(--text-primary);
}

p {
    color: var(--text-secondary);
    line-height: 1.75;
}

a { text-decoration: none; }


/* ==========================================================================
   5. SKIP-TO-CONTENT LINK (accessibility)
   ==========================================================================
   Hidden above viewport; slides into view on keyboard focus (Tab).
   ========================================================================== */

.skip-to-content {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: var(--accent);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 0 0 0.5rem 0.5rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    transition: top 0.2s ease;
}
.skip-to-content:focus {
    top: 0;
    outline: 2px solid #fff;
    outline-offset: 2px;
    color: #fff;
}


/* ==========================================================================
   6. READING PROGRESS BAR
   ==========================================================================
   Fixed to the absolute top of the viewport. Width is set by JS on scroll.
   ========================================================================== */

.progress-bar-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 3px;
    background: transparent;
    z-index: 9998;
    pointer-events: none;
}
.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    transition: width 0.1s ease-out;
    border-radius: 0 1px 1px 0;
}


/* ==========================================================================
   7. SCROLLBAR
   ========================================================================== */

::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.light-theme ::-webkit-scrollbar-track { background: #f0f2f7; }
.light-theme ::-webkit-scrollbar-thumb { background: #d1d5db; }


/* ==========================================================================
   8. LAYOUT — WRAPPER
   ========================================================================== */

#wrapper { overflow-x: hidden; }


/* ==========================================================================
   9. SIDEBAR (V-NAV)
   ==========================================================================
   Fixed 15rem sidebar. Mobile: hidden, slides in on toggle.
   Desktop: visible by default, slides out on toggle.
   ========================================================================== */

#sidebar-wrapper {
    background: var(--bg-sidebar) !important;
    border-right: 1px solid var(--border-color) !important;
    height: 100vh;
    position: fixed;
    top: 0; left: 0;
    z-index: 1030;
    overflow-y: auto;
    margin-left: -15rem;
    transition: margin 0.25s ease-out;
}
#sidebar-wrapper .sidebar-heading { padding: 0.875rem 1.25rem; font-size: 1.2rem; }
#sidebar-wrapper .list-group { width: 15rem; }

#page-content-wrapper {
    min-width: 100vw;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

body.sb-sidenav-toggled #wrapper #sidebar-wrapper { margin-left: 0; }

@media (min-width: 768px) {
    #sidebar-wrapper { margin-left: 0; }
    #page-content-wrapper { min-width: 0; width: 100%; margin-left: 15rem; }
    body.sb-sidenav-toggled #wrapper #sidebar-wrapper { margin-left: -15rem; }
    body.sb-sidenav-toggled #page-content-wrapper { margin-left: 0; }
}

.sidebar-heading {
    background: var(--bg-card) !important;
    border-bottom: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    font-family: var(--font-display) !important;
    font-weight: 600;
}

.sidebar-toggle-btn {
    background: none; border: none;
    color: var(--text-muted); cursor: pointer;
    padding: 4px; border-radius: 4px;
    transition: all 0.2s ease;
    display: flex; align-items: center;
}
.sidebar-toggle-btn:hover { color: var(--accent); background: var(--accent-soft); }

.sidebar-restore-btn { display: none; }
@media (max-width: 767.98px) { .sidebar-restore-btn { display: inline-flex; } }
body.sb-sidenav-toggled .sidebar-restore-btn { display: inline-flex; }

.list-group-item {
    background: transparent !important;
    border-color: var(--border-color) !important;
    color: var(--text-secondary) !important;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}
.list-group-item:hover {
    background: var(--accent-soft) !important;
    color: var(--text-primary) !important;
}

.v-nav-active {
    background: linear-gradient(135deg, var(--accent), #2563eb) !important;
    color: #fff !important; font-weight: 500;
    border-left: 3px solid var(--accent-secondary) !important;
    box-shadow: 0 0 20px var(--accent-glow);
}
.v-nav-active:hover {
    background: linear-gradient(135deg, #4b8ff7, #2563eb) !important;
    color: #fff !important;
}

.v-nav-child {
    font-size: 0.85rem;
    opacity: 0.8;
    transition: background 0.25s ease, color 0.25s ease, border-left-color 0.25s ease, opacity 0.2s ease;
}
.v-nav-child:hover { opacity: 1; }
.v-nav-child.v-nav-active,
.v-nav-parent.v-nav-active {
    opacity: 1;
    background: linear-gradient(135deg, var(--accent), #2563eb) !important;
    color: #fff !important; font-weight: 500;
    border-left: 3px solid var(--accent-secondary) !important;
    box-shadow: 0 0 15px var(--accent-glow);
}

.v-nav-arrow { transition: transform 0.2s ease; color: var(--text-muted); }
.v-nav-parent[aria-expanded="true"] .v-nav-arrow {
    transform: rotate(180deg); color: var(--accent);
}

.v-nav-section-label {
    background: linear-gradient(135deg, #1a5c3a, #0e7a46) !important;
    color: #fff !important; font-weight: 500;
    border-left: 3px solid #34d399 !important;
    box-shadow: 0 0 15px rgba(52, 211, 153, 0.25);
    margin-top: 0.5rem;
}
.v-nav-section-label:hover {
    background: linear-gradient(135deg, #1f6b44, #0e7a46) !important;
    color: #fff !important;
}

.light-theme .v-nav-active { box-shadow: 0 0 12px rgba(37, 99, 235, 0.15); }


/* ==========================================================================
   10. TOP NAV (H-NAV)
   ========================================================================== */

.navbar {
    background: var(--bg-surface) !important;
    border-bottom: 1px solid var(--border-color) !important;
    backdrop-filter: blur(12px);
    position: sticky; top: 0; z-index: 1020;
}

.navbar-brand-custom {
    position: absolute; left: 50%; transform: translateX(-50%);
    font-family: var(--font-display); font-weight: 700;
    font-size: 1.15rem; color: var(--text-primary) !important;
    text-decoration: none; letter-spacing: 0.5px;
    text-shadow: 0 0 20px var(--accent-glow);
    transition: color 0.2s ease, text-shadow 0.2s ease;
}
.navbar-brand-custom:hover {
    color: var(--accent) !important;
    text-shadow: 0 0 28px var(--accent-glow);
}
.light-theme .navbar-brand-custom { text-shadow: none; }

.navbar .btn-primary {
    background: var(--accent-soft) !important;
    border: 1px solid var(--border-glow) !important;
    color: var(--accent) !important;
    font-size: 0.85rem; font-weight: 500;
    letter-spacing: 0.03em; transition: all 0.2s ease;
}
.navbar .btn-primary:hover {
    background: var(--accent) !important;
    color: #fff !important;
    box-shadow: 0 0 15px var(--accent-glow);
}

.navbar .nav-link {
    color: var(--text-secondary) !important;
    font-size: 0.9rem; letter-spacing: 0.03em;
    transition: color 0.2s ease;
}
.navbar .nav-link:hover { color: var(--text-primary) !important; }

.h-nav-active {
    font-weight: 600 !important;
    color: var(--accent) !important;
    border-bottom: 2px solid var(--accent) !important;
    text-shadow: 0 0 12px var(--accent-glow);
}
.light-theme .h-nav-active { text-shadow: none; }

.navbar-toggler { border-color: var(--border-color) !important; }
.navbar-toggler-icon { filter: invert(1) brightness(0.7); }
.light-theme .navbar-toggler-icon { filter: none; }

.dropdown-menu {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
}
.dropdown-item { color: var(--text-secondary) !important; }
.dropdown-item:hover {
    background: var(--accent-soft) !important;
    color: var(--text-primary) !important;
}
.dropdown-divider { border-color: var(--border-color) !important; }


/* ==========================================================================
   11. H-NAV TOOL BUTTONS (search, theme toggle, font controls)
   ========================================================================== */

.h-nav-tool-btn {
    background: none; border: none; cursor: pointer;
    font-size: 1.1rem; padding: 0.5rem 0.6rem; line-height: 1;
    color: var(--text-secondary) !important;
    transition: color 0.2s ease;
}
.h-nav-tool-btn:hover { color: var(--accent) !important; }

.font-size-controls {
    display: inline-flex; align-items: center; gap: 2px;
    margin: 0 0.4rem;
    background: var(--accent-soft);
    border-radius: 4px; padding: 2px;
}
.font-size-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted);
    font-family: var(--font-body); font-weight: 500;
    padding: 0.2rem 0.5rem; border-radius: 3px;
    font-size: 0.8rem; line-height: 1.2;
    transition: all 0.2s ease;
}
.font-size-btn:hover { color: var(--text-primary); }
.font-size-btn.font-size-active { background: var(--accent); color: #fff; }


/* ==========================================================================
   12. PAGE TITLE / BRAND HEADER
   ========================================================================== */

.site-brand {
    text-align: center;
    padding: 2.5rem 1rem 2rem;
    position: relative; overflow: hidden; z-index: 2;
    margin-bottom: 0.5rem;
}
.site-brand::before {
    content: '';
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 250px; height: 150px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    border-radius: 50%; pointer-events: none;
    animation: brandPulse 4s ease-in-out infinite;
}
@keyframes brandPulse {
    0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
    50%      { opacity: 0.6; transform: translate(-50%, -50%) scale(1.15); }
}
.site-brand-text {
    position: relative;
    font-family: var(--font-display);
    font-weight: 700; font-size: 1.6rem;
    letter-spacing: 0.15em; text-transform: uppercase;
    color: var(--text-primary);
    text-shadow: 0 0 30px var(--accent-glow), 0 0 60px rgba(59, 130, 246, 0.15);
}
.light-theme .site-brand-text { text-shadow: none; }

.site-brand-dot {
    display: inline-block; width: 6px; height: 6px;
    background: var(--accent); border-radius: 50%;
    vertical-align: middle; margin: 0 2px;
    box-shadow: 0 0 8px var(--accent-glow);
    animation: dotFlicker 3s ease-in-out infinite;
}
@keyframes dotFlicker {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--accent-glow); }
    50%      { opacity: 0.5; box-shadow: 0 0 16px var(--accent-glow), 0 0 30px rgba(59, 130, 246, 0.2); }
}
.site-brand-sub {
    position: relative;
    font-family: var(--font-body); font-weight: 300;
    font-size: 0.75rem; letter-spacing: 0.35em;
    color: var(--text-muted); text-transform: uppercase;
    margin-top: 0.3rem;
}


/* ==========================================================================
   13. HERO SECTION (home page — item #17)
   ==========================================================================
   Full-viewport landing area. Gradient background, large headline, two
   CTA buttons. The .hero-bg div provides a radial glow effect behind
   the content. Only used on index.html.
   ========================================================================== */

.hero-section {
    position: relative;
    min-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 1.5rem;
    overflow: hidden;
}

/* Radial glow effect behind the hero text */
.hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(59, 130, 246, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(6, 182, 212, 0.06) 0%, transparent 50%);
    pointer-events: none;
}
.light-theme .hero-bg {
    background:
        radial-gradient(ellipse at 30% 40%, rgba(37, 99, 235, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(8, 145, 178, 0.04) 0%, transparent 50%);
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 720px;
}

/* Small caps label above the headline */
.hero-eyebrow {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1rem;
}

/* Main headline — scales with viewport width */
.hero-headline {
    font-family: var(--font-display) !important;
    font-weight: 800;
    font-size: clamp(2rem, 5.5vw, 3.5rem);
    line-height: 1.15;
    color: var(--text-primary);
    margin-bottom: 1rem;
    text-shadow: 0 0 40px var(--accent-glow);
}
.light-theme .hero-headline { text-shadow: none; }

.hero-sub {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 2rem;
    line-height: 1.7;
}

/* CTA button pair */
.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-btn {
    display: inline-block;
    padding: 0.75rem 1.75rem;
    border-radius: 0.4rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    transition: all 0.25s ease;
    text-decoration: none;
}

/* Primary CTA — filled accent blue */
.hero-btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 20px var(--accent-glow);
}
.hero-btn-primary:hover {
    background: #2563eb;
    color: #fff;
    box-shadow: 0 6px 30px var(--accent-glow);
    transform: translateY(-2px);
}

/* Secondary CTA — outlined / ghost button */
.hero-btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.hero-btn-secondary:hover {
    background: var(--accent-soft);
    color: var(--text-primary);
    border-color: var(--border-glow);
}


/* ==========================================================================
   14. NAVIGATION PATHWAY CARDS (home page — item #16)
   ==========================================================================
   A 2×2 grid of clickable cards on the home page ("Choose Your Journey").
   Each card has a data-accent attribute for subtle colour variation:
   blue, amber, cyan, green.
   ========================================================================== */

.pathways-section {
    padding: 3rem 0 4rem;
}

.pathways-title {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.pathways-sub {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.pathways-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    max-width: 800px;
    margin: 0 auto;
}

@media (max-width: 575.98px) {
    .pathways-grid { grid-template-columns: 1fr; }
}

.pathway-card {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.25s ease;
}
.pathway-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 0 20px var(--accent-glow);
    border-color: var(--border-glow);
    color: var(--text-primary);
}
.light-theme .pathway-card:hover {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08), 0 0 12px var(--accent-glow);
}

/* Icon (Unicode character or SVG) */
.pathway-icon {
    font-size: 1.6rem;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

/* Colour variations via data-accent */
.pathway-card[data-accent="amber"]  .pathway-icon { color: #f59e0b; }
.pathway-card[data-accent="cyan"]   .pathway-icon { color: #06b6d4; }
.pathway-card[data-accent="green"]  .pathway-icon { color: #10b981; }

.pathway-card[data-accent="amber"]:hover  { border-color: rgba(245, 158, 11, 0.3); }
.pathway-card[data-accent="cyan"]:hover   { border-color: rgba(6, 182, 212, 0.3); }
.pathway-card[data-accent="green"]:hover  { border-color: rgba(16, 185, 129, 0.3); }

.pathway-card-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.pathway-card-desc {
    font-size: 0.85rem;
    line-height: 1.6;
}


/* ==========================================================================
   15. READING TIME ESTIMATE
   ========================================================================== */

.reading-time {
    text-align: center;
    font-family: var(--font-body);
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0 1rem 1.5rem;
    position: relative; z-index: 2;
}


/* ==========================================================================
   16. BREADCRUMB NAVIGATION
   ==========================================================================
   Horizontal bar below the h-nav showing position in site hierarchy.
   Uses › as the separator, inserted via CSS ::before.
   ========================================================================== */

.breadcrumb-bar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    position: sticky;
    top: var(--navbar-height, 56px);   /* JS sets --navbar-height; 56px is Bootstrap default */
    z-index: 1019;                     /* just below navbar (1020) */
    backdrop-filter: blur(12px);
}
.breadcrumb-list {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-wrap: wrap; align-items: center;
    font-family: var(--font-body); font-size: 0.8rem;
}
.breadcrumb-item { color: var(--text-muted); }
.breadcrumb-item + .breadcrumb-item::before {
    content: '›'; padding: 0 0.5rem; color: var(--text-muted);
}
.breadcrumb-item a {
    color: var(--accent); text-decoration: none;
    transition: color 0.2s ease;
}
.breadcrumb-item a:hover { color: var(--text-primary); }
.breadcrumb-item.active { color: var(--text-secondary); }

/* Subtopic crumb — slightly brighter to show it's the current position */
.breadcrumb-subtopic {
    color: var(--accent) !important;
    font-weight: 500;
    transition: opacity 0.2s ease;
}
.breadcrumb-subtopic:empty { display: none; }


/* ==========================================================================
   17. MAIN CONTENT AREA
   ========================================================================== */

.main-content { flex-grow: 1; background: var(--bg-deep); }


/* ==========================================================================
   18. VIDEO RESPONSIVE WRAPPER
   ========================================================================== */

.video-wrapper {
    width: 100%; border-radius: 0.5rem;
    overflow: hidden; background: #000;
}
.video-wrapper video,
.video-wrapper iframe {
    display: block; width: 100%; aspect-ratio: 16 / 9;
}


/* ==========================================================================
   19. FULL-WIDTH SECTIONS
   ========================================================================== */

.full-width-section {
    width: 100%; padding: 2rem 0; margin-top: 0;
    position: relative; z-index: 1;
}
.full-width-section:first-child { margin-top: 0; }
.full-width-section img { border-radius: 0; }


/* ==========================================================================
   20. INTRO BLOCK
   ========================================================================== */

.intro-block {
    text-align: center; padding: 4rem 1rem;
    position: relative; overflow: hidden;
}
.intro-block::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 50%, rgba(6, 182, 212, 0.04) 0%, transparent 60%);
    pointer-events: none;
}
.intro-label {
    font-family: var(--font-body); font-weight: 500;
    font-size: 0.8rem; letter-spacing: 0.25em;
    text-transform: uppercase; color: var(--accent);
    margin-bottom: 0.75rem; position: relative;
}
.intro-headline {
    font-family: var(--font-display) !important;
    font-weight: 800;
    font-size: clamp(1.6rem, 4vw, 2.6rem);
    line-height: 1.2; color: var(--text-primary);
    margin-bottom: 1rem; position: relative;
}
.intro-desc {
    font-size: 1rem; color: var(--text-secondary);
    max-width: 680px; margin: 0 auto;
    line-height: 1.8; position: relative;
}


/* ==========================================================================
   21. CONTENT ROWS
   ========================================================================== */

.content-row { padding: 3rem 0; position: relative; }

.content-row img {
    width: 100%; height: auto;
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.content-row img:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 20px var(--accent-glow);
}
.light-theme .content-row img { border-color: rgba(0, 0, 0, 0.10); }
.light-theme .content-row img:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.10), 0 0 12px var(--accent-glow);
}

.content-row h2 {
    font-size: 1.6rem; margin-bottom: 1rem;
    position: relative; display: inline-block;
}
.content-row h2::after {
    content: ''; display: block;
    width: 40px; height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    margin-top: 0.5rem; border-radius: 2px;
}

.content-row .video-wrapper {
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}
.light-theme .content-row .video-wrapper { box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08); }

.row-alt { background: var(--bg-surface); }

/* Cursor hint for lightbox-enabled images */
.lightbox-img { cursor: zoom-in; }


/* ==========================================================================
   22. TOPIC-SPECIFIC COLOUR ACCENTS (item #26)
   ==========================================================================
   Each topic page sets data-topic-accent on <html> via a <meta> tag and
   the flash-prevention script. This subtly recolours the content-row h2
   underline and a few decorative elements per topic, creating visual
   identity without changing the overall palette.
   ========================================================================== */

[data-topic-accent="amber"] .content-row h2::after {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}
[data-topic-accent="cyan"] .content-row h2::after {
    background: linear-gradient(90deg, #06b6d4, #0891b2);
}
[data-topic-accent="green"] .content-row h2::after {
    background: linear-gradient(90deg, #10b981, #059669);
}
[data-topic-accent="earth"] .content-row h2::after {
    background: linear-gradient(90deg, #a16207, #92400e);
}
[data-topic-accent="silver"] .content-row h2::after {
    background: linear-gradient(90deg, #94a3b8, #64748b);
}


/* ==========================================================================
   23. PULL QUOTES (item #12)
   ==========================================================================
   Large, visually distinct blockquote used for key quotations. Features
   a left border accent, larger italic text, and a cite element below.
   ========================================================================== */

.pull-quote {
    margin: 2rem 0;
    padding: 1.5rem 1.5rem 1.5rem 2rem;
    border-left: 3px solid var(--accent);
    background: var(--accent-soft);
    border-radius: 0 0.5rem 0.5rem 0;
    position: relative;
}
.pull-quote p {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 500;
    font-style: italic;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.pull-quote-cite {
    display: block;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-style: normal;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}


/* ==========================================================================
   24. CALLOUT BOXES (item #12)
   ==========================================================================
   Three types: Key Insight (blue), Common Question (cyan), Caution (amber).
   Each has a coloured left border, tinted background, and a label badge.
   ========================================================================== */

.callout {
    margin: 1.5rem 0;
    padding: 1.25rem 1.25rem 1.25rem 1.5rem;
    border-radius: 0 0.5rem 0.5rem 0;
    border-left: 3px solid var(--accent);
    background: var(--accent-soft);
}
.callout p { margin-bottom: 0.5rem; }
.callout p:last-child { margin-bottom: 0; }

/* Label badge at the top of each callout */
.callout-label {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    border-radius: 3px;
    margin-bottom: 0.75rem;
}

/* Key Insight — blue (default) */
.callout-insight {
    border-left-color: var(--accent);
    background: var(--accent-soft);
}
.callout-insight .callout-label {
    background: var(--accent);
    color: #fff;
}

/* Common Question — cyan */
.callout-question {
    border-left-color: var(--accent-secondary);
    background: rgba(6, 182, 212, 0.08);
}
.callout-question .callout-label {
    background: var(--accent-secondary);
    color: #fff;
}

/* Caution — amber (warns about speculative content) */
.callout-caution {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
}
.callout-caution .callout-label {
    background: #f59e0b;
    color: #1a1f2e;
}


/* ==========================================================================
   25. CONFIDENCE LEVEL BADGES (item #12)
   ==========================================================================
   Small inline badges that visually communicate the evidence level of
   a claim. Four levels with colour-coded backgrounds:
     Established (green) — consensus science
     Strong Evidence (blue) — well-supported but not consensus
     Emerging (amber) — plausible, under investigation
     Speculative (red) — logically coherent but unproven
   ========================================================================== */

.confidence-badge {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.25rem 0.75rem;
    border-radius: 3px;
    margin-bottom: 0.75rem;
}
.confidence-established { background: #059669; color: #fff; }
.confidence-strong      { background: var(--accent); color: #fff; }
.confidence-emerging    { background: #f59e0b; color: #1a1f2e; }
.confidence-speculative { background: #dc2626; color: #fff; }


/* ==========================================================================
   26. GLOSSARY TOOLTIPS (item #13)
   ==========================================================================
   Terms wrapped in <span class="glossary-term" data-definition="...">
   get a dotted underline. On hover (desktop) or tap (mobile), a tooltip
   appears below the term showing the definition. The tooltip is positioned
   by JavaScript to avoid overflowing the viewport.
   ========================================================================== */

.glossary-term {
    border-bottom: 1px dotted var(--accent);
    cursor: help;
    position: relative;
    color: var(--text-primary);
}

/* The tooltip is a child <span> injected by JavaScript on hover */
.glossary-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.4rem;
    padding: 0.6rem 0.8rem;
    font-family: var(--font-body);
    font-size: 0.8rem;
    line-height: 1.5;
    width: max-content;
    max-width: 280px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.glossary-tooltip.visible { opacity: 1; }

/* Small arrow pointing down from tooltip to term */
.glossary-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--bg-card);
}

.light-theme .glossary-tooltip {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}


/* ==========================================================================
   27. GO DEEPER EXPANDABLE SECTIONS (item #25)
   ==========================================================================
   Accordion-style progressive disclosure. The toggle button shows a +/-
   icon and a descriptive label. Clicking it expands the hidden content
   below. Multiple Go Deeper sections can exist on the same page.
   ========================================================================== */

.go-deeper {
    margin: 1.5rem 0;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
}

.go-deeper-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.9rem 1.25rem;
    background: var(--bg-card);
    border: none;
    color: var(--accent);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s ease;
}
.go-deeper-toggle:hover { background: var(--accent-soft); }

/* The +/- icon rotates on expand */
.go-deeper-icon {
    font-size: 1.1rem;
    font-weight: 700;
    transition: transform 0.2s ease;
    flex-shrink: 0;
    width: 1.2rem;
    text-align: center;
}

/* Content is hidden by default; JS toggles max-height and aria-hidden */
.go-deeper-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 1.25rem;
    background: var(--bg-surface);
}
.go-deeper-content.expanded {
    max-height: 2000px;  /* large enough for any content */
    padding: 1rem 1.25rem 1.25rem;
}


/* ==========================================================================
   28. FOOTNOTES / SOURCE CITATIONS (item #30)
   ==========================================================================
   Inline footnote references are superscript numbers ([1], [2]).
   Hovering shows a tooltip with the full citation. The footnotes
   section at the bottom lists all citations collected by JavaScript.
   ========================================================================== */

/* Inline superscript reference */
.footnote-ref {
    font-size: 0.7rem;
    color: var(--accent);
    cursor: help;
    position: relative;
    vertical-align: super;
    font-weight: 500;
    margin-left: 1px;
}
.footnote-ref:hover { color: var(--text-primary); }

/* Footnote tooltip (shown on hover, positioned by JS) */
.footnote-tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.4rem;
    padding: 0.6rem 0.8rem;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-style: normal;
    line-height: 1.5;
    width: max-content;
    max-width: 320px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.footnote-tooltip.visible { opacity: 1; }

/* Bottom-of-page footnotes list */
.footnotes-section {
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
}
.footnotes-heading {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}
.footnotes-list {
    padding-left: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.8;
}
.footnotes-list li {
    margin-bottom: 0.5rem;
}


/* ==========================================================================
   29. SOCIAL SHARING BUTTONS (item #14)
   ==========================================================================
   Small row of share buttons that appear below section headings.
   Each button triggers a JS action (copy URL, open share popup, etc.).
   ========================================================================== */

.share-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
    cursor: pointer;
    transition: all 0.2s ease;
}
.share-btn:hover {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--border-glow);
}

/* "Copied!" confirmation state */
.share-btn.copied {
    background: #059669;
    color: #fff;
    border-color: #059669;
}


/* ==========================================================================
   30. INTERACTIVE DIAGRAM PLACEHOLDERS (item #31)
   ==========================================================================
   Structured placeholder boxes for future WebGL / D3.js / p5.js
   interactive visualisations. Shows an icon, title, description,
   and the technology required. Replaced with actual embeds later.
   ========================================================================== */

.interactive-placeholder {
    margin: 1.5rem 0;
    border: 2px dashed var(--border-color);
    border-radius: 0.75rem;
    background: var(--bg-card);
    text-align: center;
    padding: 3rem 2rem;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.interactive-placeholder-inner svg {
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.interactive-placeholder-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}
.interactive-placeholder-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}
.interactive-placeholder-tech {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    font-family: var(--font-body);
}


/* ==========================================================================
   31. IMAGE LIGHTBOX (item #21)
   ==========================================================================
   Full-screen overlay that shows a clicked image at full size.
   Images with .lightbox-img class are clickable. Overlay fades in/out.
   Close via the × button, clicking the backdrop, or pressing Escape.
   ========================================================================== */

.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 9995;
    background: rgba(0, 0, 0, 0.90);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    cursor: zoom-out;
}
.lightbox-overlay.lightbox-open {
    opacity: 1;
    visibility: visible;
}

.lightbox-close {
    position: absolute;
    top: 1rem; right: 1.5rem;
    background: none; border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    z-index: 10;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}
.lightbox-close:hover { opacity: 1; }

.lightbox-image {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 0.5rem;
    cursor: default;
}


/* ==========================================================================
   32. TABLE OF CONTENTS FLYOUT (item #32 — Option C: toggle button)
   ==========================================================================
   A small "Contents" button fixed to the right edge of the content area.
   Clicking it opens/closes a floating TOC panel that lists in-page section
   headings. The list is auto-generated by JavaScript. The currently visible
   section is highlighted via scroll-spy integration.

   Mobile: button sits at bottom-right; panel floats above it.
   Desktop: button sits at right edge; panel expands to the left.
   ========================================================================== */

/* Toggle button — always visible, anchored to right edge */
.toc-toggle-btn {
    position: fixed;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1010;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.4rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    writing-mode: vertical-lr;
}
.toc-toggle-btn:hover {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--border-glow);
}
.toc-toggle-btn[aria-expanded="true"] {
    color: var(--accent);
    border-color: var(--border-glow);
}

.toc-toggle-label {
    writing-mode: vertical-lr;
    letter-spacing: 0.08em;
}

/* TOC panel — floats next to the toggle button */
.page-toc {
    position: fixed;
    right: 3.5rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1009;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
    width: 220px;
    max-height: 60vh;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.page-toc.toc-open {
    opacity: 1;
    visibility: visible;
}

.light-theme .page-toc {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.page-toc-heading {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.page-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.page-toc-item {
    margin-bottom: 0.25rem;
}

.page-toc-link {
    display: block;
    padding: 0.3rem 0.5rem;
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 3px;
    border-left: 2px solid transparent;
    transition: all 0.15s ease;
}
.page-toc-link:hover {
    color: var(--text-primary);
    background: var(--accent-soft);
}

/* Active state — synced with scroll-spy */
.page-toc-link.toc-active {
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 500;
}

/* Mobile adjustments */
@media (max-width: 991.98px) {
    .toc-toggle-btn {
        top: auto;
        bottom: 1.5rem;
        right: 1rem;
        transform: none;
        writing-mode: horizontal-tb;
    }
    .toc-toggle-label { writing-mode: horizontal-tb; }
    .page-toc {
        right: 1rem;
        top: auto;
        bottom: 4.5rem;
        transform: none;
    }
}


/* ==========================================================================
   33. PREVIOUS / NEXT NAVIGATION
   ========================================================================== */

.prev-next-nav {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface);
}
.prev-next-link {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    color: var(--text-secondary); text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
    flex: 1;
}
.next-link { justify-content: flex-end; text-align: right; }
.prev-next-link:hover {
    background: var(--accent-soft); color: var(--text-primary);
}
.prev-next-arrow { font-size: 1.4rem; color: var(--accent); flex-shrink: 0; }
.prev-next-text { display: flex; flex-direction: column; }
.prev-next-label {
    font-size: 0.7rem; letter-spacing: 0.15em;
    text-transform: uppercase; color: var(--text-muted);
    font-family: var(--font-body);
}
.prev-next-title {
    font-family: var(--font-display); font-weight: 600;
    font-size: 0.95rem; color: var(--text-primary);
}
@media (max-width: 575.98px) {
    .prev-next-nav { flex-direction: column; }
    .next-link { border-top: 1px solid var(--border-color); }
}


/* ==========================================================================
   34. SEARCH OVERLAY
   ========================================================================== */

.search-overlay {
    position: fixed; inset: 0;
    z-index: 9990;
    background: rgba(10, 14, 26, 0.92);
    backdrop-filter: blur(8px);
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 12vh;
    opacity: 0; visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.search-overlay.search-open { opacity: 1; visibility: visible; }
.light-theme .search-overlay { background: rgba(245, 247, 250, 0.92); }

.search-overlay-inner { width: 90%; max-width: 600px; position: relative; }

.search-close-btn {
    position: absolute; top: -3rem; right: 0;
    background: none; border: none;
    color: var(--text-muted); cursor: pointer;
    padding: 0.25rem; transition: color 0.2s ease;
}
.search-close-btn:hover { color: var(--text-primary); }

.search-input-wrapper { position: relative; margin-bottom: 1rem; }
.search-input-icon {
    position: absolute; left: 1rem; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted); pointer-events: none;
}
.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    font-family: var(--font-body); font-size: 1.1rem;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem; outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-input::placeholder { color: var(--text-muted); }

.search-results { max-height: 40vh; overflow-y: auto; }

.search-result-item {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-top: none;
    text-decoration: none;
    transition: background 0.15s ease;
    font-size: 0.9rem;
}
.search-result-item:first-child {
    border-top: 1px solid var(--border-color);
    border-radius: 0.5rem 0.5rem 0 0;
}
.search-result-item:last-child { border-radius: 0 0 0.5rem 0.5rem; }
.search-result-item:hover {
    background: var(--accent-soft); color: var(--text-primary);
}
.search-result-title {
    font-family: var(--font-display); font-weight: 600;
    font-size: 0.95rem; color: var(--text-primary);
}
.search-result-path {
    font-size: 0.75rem; color: var(--text-muted); margin-top: 0.15rem;
}
.search-no-results {
    text-align: center; padding: 2rem 1rem;
    color: var(--text-muted); font-size: 0.9rem;
}
.search-hint {
    text-align: center; font-size: 0.75rem;
    color: var(--text-muted); margin-top: 1rem;
}
.search-hint kbd {
    background: var(--bg-elevated); color: var(--text-secondary);
    padding: 0.15rem 0.4rem; border-radius: 3px;
    font-family: var(--font-body); font-size: 0.7rem;
    border: 1px solid var(--border-color);
}


/* ==========================================================================
   35. FOOTER & NEWSLETTER (item #28)
   ========================================================================== */

.site-footer {
    background: var(--bg-sidebar) !important;
    border-top: 1px solid var(--border-color) !important;
    color: var(--text-muted) !important;
}

/* Newsletter signup bar */
.footer-newsletter {
    text-align: center;
    padding: 2.5rem 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
}
.footer-newsletter-label {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}
.footer-newsletter-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.footer-newsletter-form {
    display: flex;
    gap: 0.5rem;
    max-width: 400px;
    margin: 0 auto;
}
.footer-newsletter-input {
    flex: 1;
    padding: 0.6rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.4rem;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s ease;
}
.footer-newsletter-input:focus {
    border-color: var(--accent);
}
.footer-newsletter-input::placeholder { color: var(--text-muted); }

.footer-newsletter-btn {
    padding: 0.6rem 1.25rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 0.4rem;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}
.footer-newsletter-btn:hover { background: #2563eb; }

.footer-newsletter-note {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Bottom bar */
.footer-bottom {
    padding: 1.25rem 0;
}
.footer-copyright {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.footer-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}
.footer-links a {
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: color 0.2s ease;
}
.footer-links a:hover { color: var(--accent); }
.footer-tagline {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
}


/* ==========================================================================
   36. AMBIENT FLOATING PARTICLES
   ========================================================================== */

.ambient-particles {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none; z-index: 0; overflow: hidden;
}
.ambient-particles span {
    position: absolute; width: 2px; height: 2px;
    background: rgba(59, 130, 246, 0.3);
    border-radius: 50%;
    animation: float linear infinite;
}
.ambient-particles span:nth-child(1) { left: 10%; top: 20%; animation-duration: 18s; animation-delay: 0s; }
.ambient-particles span:nth-child(2) { left: 30%; top: 60%; animation-duration: 22s; animation-delay: -4s; width: 3px; height: 3px; }
.ambient-particles span:nth-child(3) { left: 55%; top: 10%; animation-duration: 20s; animation-delay: -8s; }
.ambient-particles span:nth-child(4) { left: 75%; top: 40%; animation-duration: 25s; animation-delay: -2s; width: 1.5px; height: 1.5px; background: rgba(6, 182, 212, 0.25); }
.ambient-particles span:nth-child(5) { left: 90%; top: 70%; animation-duration: 19s; animation-delay: -6s; }
.ambient-particles span:nth-child(6) { left: 45%; top: 85%; animation-duration: 24s; animation-delay: -10s; background: rgba(6, 182, 212, 0.2); }

@keyframes float {
    0%   { transform: translateY(0) translateX(0); opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { transform: translateY(-100vh) translateX(30px); opacity: 0; }
}

.light-theme .ambient-particles span { background: rgba(37, 99, 235, 0.15); }
.light-theme .ambient-particles span:nth-child(4) { background: rgba(8, 145, 178, 0.12); }
.light-theme .ambient-particles span:nth-child(6) { background: rgba(8, 145, 178, 0.10); }


/* ==========================================================================
   37. SCROLL-TRIGGERED FADE-IN ANIMATION
   ========================================================================== */

.fade-in-section {
    opacity: 0; transform: translateY(25px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}
.fade-in-section.visible { opacity: 1; transform: translateY(0); }


/* ==========================================================================
   38. SCROLL-SPY ACTIVE HIGHLIGHT
   ========================================================================== */

/* Base scroll-spy style (for any element that gets this class) */
.scroll-spy-active {
    background: var(--accent-soft) !important;
    color: var(--text-primary) !important;
    border-left: 3px solid var(--accent) !important;
    font-weight: 500;
}

/* Enhanced style specifically for sidebar subtopic links:
   combines accent bar + background glow + bold text */
.v-nav-child.scroll-spy-active {
    background: linear-gradient(90deg,
        rgba(59, 130, 246, 0.18),
        rgba(59, 130, 246, 0.06) 70%,
        transparent) !important;
    color: var(--accent) !important;
    font-weight: 600 !important;
    border-left: 3px solid var(--accent) !important;
    box-shadow: inset 0 0 12px rgba(59, 130, 246, 0.08),
                0 0 8px rgba(59, 130, 246, 0.05);
    display: flex !important;
    align-items: center;
    opacity: 1 !important;
    position: relative;
}

/* Small glowing dot indicator before the active subtopic text */
.v-nav-child.scroll-spy-active::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent-glow);
    margin-right: 8px;
    flex-shrink: 0;
    vertical-align: middle;
}

/* Light theme adjustments */
.light-theme .v-nav-child.scroll-spy-active {
    background: linear-gradient(90deg,
        rgba(37, 99, 235, 0.12),
        rgba(37, 99, 235, 0.04) 70%,
        transparent) !important;
    color: var(--accent) !important;
    box-shadow: inset 0 0 12px rgba(37, 99, 235, 0.06),
                0 0 8px rgba(37, 99, 235, 0.03);
}




/* ==========================================================================
   39. BOOTSTRAP OVERRIDES
   ========================================================================== */

.bg-light { background-color: var(--bg-surface) !important; }
.bg-dark  { background-color: var(--bg-deep) !important; }


/* ==========================================================================
   40. VISIBLE FOCUS INDICATORS (accessibility)
   ==========================================================================
   Uses :focus-visible so outlines only appear on keyboard navigation,
   not on mouse clicks.
   ========================================================================== */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.list-group-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}


/* ==========================================================================
   41. REDUCED MOTION (accessibility)
   ==========================================================================
   Respects OS-level prefers-reduced-motion setting. Disables all
   animations and transitions for users with vestibular disorders.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .fade-in-section { opacity: 1; transform: none; transition: none; }
    .ambient-particles span { animation: none; opacity: 0.4; }
    .site-brand::before { animation: none; opacity: 0.3; }
    .site-brand-dot { animation: none; opacity: 1; }
    .progress-bar-fill { transition: none; }
    .content-row img { transition: none; }
    .pathway-card { transition: none; }
    .hero-btn { transition: none; }
    .go-deeper-content { transition: none; }
    .lightbox-overlay { transition: none; }
    .search-overlay { transition: none; }
    .page-toc { transition: none; }
    .skip-to-content { transition: none; }
    .glossary-tooltip { transition: none; }

    .sidebar-toggle-btn,
    .navbar .btn-primary,
    .navbar .nav-link,
    .list-group-item,
    .v-nav-arrow,
    .navbar-brand-custom,
    .prev-next-link,
    .h-nav-tool-btn,
    .font-size-btn,
    .search-input,
    .breadcrumb-item a,
    .share-btn,
    .footer-newsletter-input,
    .footer-newsletter-btn,
    .footer-links a,
    .toc-toggle-btn,
    .page-toc-link,
    .go-deeper-toggle,
    .lightbox-close {
        transition: none;
    }
}
