/**
 * PathwayAI Pro — Global Cinematic Unifier
 * Propagates index.php (home-cinematic) visual DNA sitewide via CSS only.
 * Loads LAST. Does not touch PHP page files.
 *
 * Excluded: index (home_cinematic.css), Learning World HUD, auth pages, Tailwind login.
 */

/* ═══ STEP 1 DNA — design tokens (from home_cinematic.css) ═══ */
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.page-learning-world):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) {
    --cin-body-dark: #070b14;
    --cin-body-mid: #0a1020;
    --cin-body-light: #2d4f7c;
    --cin-text-shine: #ffffff;
    --cin-text-soft: rgba(255, 255, 255, 0.92);
    --cin-text-muted: rgba(186, 230, 253, 0.82);
    --cin-text-glow:
        0 0 28px rgba(255, 255, 255, 0.45),
        0 0 56px rgba(59, 130, 246, 0.28),
        0 2px 6px rgba(15, 23, 42, 0.45);
    --cin-heading-glow:
        0 0 32px rgba(255, 255, 255, 0.55),
        0 0 64px rgba(96, 165, 250, 0.35),
        0 0 96px rgba(59, 130, 246, 0.18),
        0 2px 8px rgba(15, 23, 42, 0.5);
    --cin-glass-bg: rgba(14, 22, 44, 0.14);
    --cin-glass-bg-strong: rgba(22, 34, 68, 0.18);
    --cin-glass-border: rgba(255, 255, 255, 0.12);
    --cin-glass-blur: blur(12px) saturate(140%);
    --cin-nav-bg: rgba(5, 8, 16, 0.72);
    --cin-nav-border: rgba(59, 130, 246, 0.22);
    --cin-btn-primary: linear-gradient(135deg, #3b82f6 0%, #2563eb 48%, #1e40af 100%);
    --cin-btn-primary-hover: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
    --cin-btn-outline-bg: rgba(15, 23, 42, 0.45);
    --cin-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --cin-dur: 0.28s;

    color: var(--cin-text-soft);
    color-scheme: dark;
    background: var(--cin-body-dark);
    background-color: var(--cin-body-dark);
    position: relative;
    isolation: isolate;
    overflow-x: hidden;
}

/* Student MORE rail is position:fixed — overflow-x:hidden on body clips it in Chromium */
body.pathway-dark-global.page-os-shell:has(.student-tools-sidebar):not(.learning-world-page):not(.page-learning-world):not(.pathway-login-page):not(.pathway-auth-page),
body.pathway-dark-global.page-os-shell.has-student-tools-sidebar:not(.learning-world-page):not(.page-learning-world):not(.pathway-login-page):not(.pathway-auth-page) {
    overflow-x: visible;
}

html:has(body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic)) {
    background: var(--cin-body-dark, #070b14);
}

/* Ambient mesh layers (pseudo — no DOM needed) */
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.page-learning-world):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic)::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 90% 55% at 50% 15%, rgba(37, 99, 235, 0.28), transparent 55%),
        radial-gradient(ellipse 80% 60% at 50% 100%, rgba(15, 23, 42, 0.9), transparent 70%),
        radial-gradient(ellipse 100% 70% at 50% 20%, rgba(86, 204, 242, 0.12), transparent 58%),
        var(--cin-body-dark);
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic)::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 70% 55% at 50% 45%, rgba(59, 130, 246, 0.14), transparent 62%),
        radial-gradient(ellipse 55% 45% at 50% 50%, rgba(37, 99, 235, 0.1), transparent 72%);
    animation: cinAmbientDrift 28s ease-in-out infinite alternate;
}

@keyframes cinAmbientDrift {
    0% { opacity: 0.85; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.03); }
}

@keyframes cinPageFadeIn {
    from {
        opacity: 0;
        transform: translateY(14px);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* Stack page content above ambient (keep student tools rail + topbar above content) */
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) > :not(script):not(style):not(link):not(.student-tools-sidebar):not(.topbar):not(.topbar-pro) {
    position: relative;
    z-index: 1;
}

/*
 * Topbar must sit ABOVE page-context / cards (they use backdrop-filter).
 * Equal z-index:1 on siblings made Admin dropdown render behind + look blurred.
 */
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-auth-page) > .topbar,
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-auth-page) > .topbar-pro,
body.pathway-cinematic-theme.pathway-dark-global > .topbar,
body.pathway-cinematic-theme.pathway-dark-global > .topbar-pro,
body.page-os-shell > .topbar,
body.page-os-shell > .topbar-pro,
body.page-dashboard > .topbar,
body.page-dashboard > .topbar-pro {
    position: sticky !important;
    top: 0 !important;
    z-index: 400 !important;
    isolation: isolate;
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page) > .page-context-wrap,
body.pathway-dark-global.page-os-shell:not(.learning-world-page) > .pwa-install-banner,
body.pathway-dark-global.page-os-shell:not(.learning-world-page) > main,
body.pathway-dark-global.page-os-shell:not(.learning-world-page) > header.hero,
body.pathway-dark-global.page-os-shell:not(.learning-world-page) > .hero {
    z-index: 1 !important;
}

/* ═══ TYPOGRAPHY ═══ */
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) :is(h1, h2, h3, h4, .os-page-header__title, .admin-title, .hero h1) {
    font-family: "Inter", "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
    color: var(--cin-text-shine);
    -webkit-text-fill-color: var(--cin-text-shine);
    text-shadow: var(--cin-heading-glow);
    font-weight: 700;
    letter-spacing: -0.02em;
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) h1,
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) .hero h1 {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.03em;
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) h2,
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) .os-page-header__title {
    font-size: clamp(1.35rem, 2.8vw, 1.85rem);
    line-height: 1.2;
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) :is(p, li, span, td, label, .small-muted, .subtitle, .os-page-lead) {
    color: var(--cin-text-soft);
    -webkit-text-fill-color: var(--cin-text-soft);
    text-shadow: none;
}

/* Product tour card is a light surface — never inherit cinematic light text */
body.pathway-dark-global .pathway-product-tour-card,
body.pathway-dark-global .pathway-product-tour-card :is(h1, h2, h3, h4, p, label) {
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
    text-shadow: none !important;
}

body.pathway-dark-global .pathway-product-tour-card .pathway-product-tour-body {
    color: #334155 !important;
    -webkit-text-fill-color: #334155 !important;
}

body.pathway-dark-global .pathway-product-tour-card .pathway-product-tour-next {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

body.pathway-dark-global .pathway-product-tour-card .pathway-product-tour-skip {
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) .small-muted,
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) .os-page-lead {
    color: var(--cin-text-muted);
    -webkit-text-fill-color: var(--cin-text-muted);
    opacity: 1;
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) a:not(.btn):not(.nav-link):not(.nav-cta) {
    color: #93c5fd;
    text-shadow: 0 0 12px rgba(59, 130, 246, 0.35);
}

/* Student MORE rail — never inherit legacy gold / sky link tint */
body.pathway-dark-global.page-os-shell .student-tools-sidebar__nav a,
body.dark.page-os-shell .student-tools-sidebar__nav a,
body.page-career .student-tools-sidebar__nav a {
    color: #dbe7f5 !important;
    -webkit-text-fill-color: #dbe7f5 !important;
    text-shadow: none !important;
}

body.pathway-dark-global.page-os-shell .student-tools-sidebar__nav a.is-active,
body.pathway-dark-global.page-os-shell .student-tools-sidebar__nav a.active,
body.dark.page-os-shell .student-tools-sidebar__nav a.is-active,
body.dark.page-os-shell .student-tools-sidebar__nav a.active,
body.page-career .student-tools-sidebar__nav a.is-active,
body.page-career .student-tools-sidebar__nav a.active {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* ═══ CARDS & PANELS (glass — override site_unified flat surfaces) ═══ */
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) :is(
    .card,
    .form-card,
    .living-card,
    .command-center,
    .pathway-os-panel,
    .page-context,
    .admin-main .card,
    .admin-sidebar,
    .student-tools-sidebar,
    .portal-tab-nav,
    .mc-viz-row,
    .mentor-shell .card,
    .alert:not(.pathway-auth-alert)
) {
    background: var(--cin-glass-bg-strong);
    background-color: var(--cin-glass-bg-strong);
    border: 1px solid var(--cin-glass-border);
    backdrop-filter: var(--cin-glass-blur);
    -webkit-backdrop-filter: var(--cin-glass-blur);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
    border-radius: 16px;
    transition:
        border-color var(--cin-dur) var(--cin-ease),
        box-shadow var(--cin-dur) var(--cin-ease),
        transform var(--cin-dur) var(--cin-ease);
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) .card::before {
    display: none;
}

/* Wave is JS fixed-overlay (pm-wave-*) — keep card ::after off to avoid double shimmer */
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) .card::after {
    display: none;
}

/* Nested div hover glow was painting only 1 column (looked like half-wave) */
body.page-os-shell #mainContent .card div:hover,
body.page-os-shell .admin-main .card div:hover,
body.page-os-shell #mainContent .form-card div:hover,
body.page-os-shell #mainContent .card .dashboard-learning-loop-grid > div:hover,
body.page-os-shell #mainContent .card .dashboard-snapshot-cell:hover,
body.page-os-shell #mainContent .card .dashboard-cmd-tile:hover,
body.page-os-shell #mainContent .card .feature-box:hover,
body.page-os-shell #mainContent .card .outcome-stat:hover,
body.page-os-shell #mainContent .card .hero-journey-metrics article:hover {
    transform: none !important;
    box-shadow: none !important;
    border-color: inherit !important;
    border-radius: inherit !important;
    filter: none !important;
    background-image: none !important;
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) :is(
    .card,
    .form-card,
    .living-card
):hover {
    border-color: rgba(147, 197, 253, 0.34);
    box-shadow:
        0 16px 42px rgba(15, 23, 42, 0.35),
        0 0 0 1px rgba(147, 197, 253, 0.1),
        0 8px 28px rgba(37, 99, 235, 0.14);
    transform: translate3d(0, -3px, 0);
}

/* Dashboard command blocks */
body.pathway-dark-global.page-dashboard:not(.pathway-login-page) :is(
    .living-card,
    .command-center,
    .pathway-os-mission,
    .dashboard-intel-card
) {
    background: linear-gradient(165deg, rgba(14, 22, 44, 0.16), rgba(22, 34, 68, 0.14));
    border-color: rgba(96, 165, 250, 0.18);
}

/* Tables inside glass panels */
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) table {
    background: transparent;
    border-color: var(--cin-glass-border);
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) table th {
    color: var(--cin-text-muted);
    border-color: var(--cin-glass-border);
    text-shadow: none;
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) table td {
    color: var(--cin-text-soft);
    border-color: rgba(255, 255, 255, 0.06);
}

/* ═══ NAVBAR (dark cinematic glass) ═══ */
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) :is(.topbar, .topbar-pro, .admin-topbar) {
    background: var(--cin-nav-bg);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border-bottom: 1px solid var(--cin-nav-border);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.42);
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) .topbar :is(.nav-link, .brand, .nav-cta--ghost) {
    color: rgba(248, 250, 252, 0.92);
    -webkit-text-fill-color: rgba(248, 250, 252, 0.92);
    text-shadow: none;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: background var(--cin-dur) ease, color var(--cin-dur) ease, box-shadow var(--cin-dur) ease, border-color var(--cin-dur) ease;
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) .topbar :is(.nav-lang-wrap label, .nav-lang-select, .nav-actions .btn) {
    color: rgba(248, 250, 252, 0.92);
    -webkit-text-fill-color: rgba(248, 250, 252, 0.92);
    text-shadow: none;
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) .admin-topbar :is(.admin-topbar-nav a, .admin-topbar-nav button, .admin-topbar-badge) {
    text-shadow: none;
    -webkit-text-fill-color: currentColor;
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) .admin-topbar-badge {
    color: #e8efff;
    -webkit-text-fill-color: #e8efff;
    background: rgba(37, 99, 235, 0.32);
    border-color: rgba(147, 197, 253, 0.5);
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) .topbar .nav-link:hover {
    color: #ffffff;
    background: rgba(37, 99, 235, 0.22);
    border-color: rgba(96, 165, 250, 0.35);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.32);
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) .topbar .nav-link.active {
    color: #ffffff;
    background: rgba(37, 99, 235, 0.42);
    border-color: rgba(96, 165, 250, 0.5);
    box-shadow: 0 0 26px rgba(59, 130, 246, 0.52);
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) .topbar .nav-cta:not(.nav-cta--ghost) {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 55%, #1e3a8a 100%);
    color: #ffffff;
    border: 1px solid rgba(96, 165, 250, 0.45);
    box-shadow: 0 8px 26px rgba(37, 99, 235, 0.52);
    text-shadow: none;
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) .nav-lang-select {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(96, 165, 250, 0.3);
    color: #f1f5f9;
}

/* Portal tabs */
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page) .portal-tab-nav__link {
    color: var(--cin-text-muted);
    border-color: transparent;
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page) .portal-tab-nav__link.is-active {
    color: #ffffff;
    background: rgba(37, 99, 235, 0.35);
    border-color: rgba(96, 165, 250, 0.45);
    box-shadow: 0 0 18px rgba(59, 130, 246, 0.35);
}

/* ═══ BUTTONS ═══ */
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) :is(
    .btn.btn-primary,
    a.btn.btn-primary
) {
    background: var(--cin-btn-primary);
    color: #ffffff;
    -webkit-text-fill-color: #ffffff;
    border: 1px solid rgba(96, 165, 250, 0.5);
    box-shadow: 0 12px 32px rgba(37, 99, 235, 0.52), 0 0 22px rgba(59, 130, 246, 0.32);
    text-shadow: none;
    border-radius: 12px;
    font-weight: 600;
    transition: background var(--cin-dur) ease, box-shadow var(--cin-dur) ease, transform var(--cin-dur) var(--cin-ease);
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) :is(.btn.btn-primary, a.btn.btn-primary):hover {
    background: var(--cin-btn-primary-hover);
    box-shadow: 0 16px 38px rgba(37, 99, 235, 0.58), 0 0 28px rgba(96, 165, 250, 0.42);
    transform: translateY(-1px);
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) :is(.btn.btn-outline, a.btn.btn-outline) {
    background: var(--cin-btn-outline-bg);
    color: #f8fafc;
    border: 1px solid rgba(148, 163, 184, 0.45);
    box-shadow: 0 0 18px rgba(59, 130, 246, 0.18);
    text-shadow: none;
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) :is(.btn.btn-outline, a.btn.btn-outline):hover {
    background: rgba(37, 99, 235, 0.28);
    border-color: rgba(96, 165, 250, 0.55);
    color: #ffffff;
    box-shadow: 0 0 24px rgba(59, 130, 246, 0.38);
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) :is(.btn.btn-secondary, a.btn.btn-secondary) {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #4338ca 100%);
    color: #ffffff;
    border: 1px solid rgba(129, 140, 248, 0.45);
    box-shadow: 0 10px 28px rgba(79, 70, 229, 0.42);
    text-shadow: none;
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) :is(.btn.btn-ghost, a.btn.btn-ghost) {
    background: transparent;
    color: rgba(248, 250, 252, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.35);
    text-shadow: none;
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) :is(.btn.btn-ghost, a.btn.btn-ghost):hover {
    background: rgba(37, 99, 235, 0.2);
    border-color: rgba(96, 165, 250, 0.45);
    color: #ffffff;
}

/* ═══ FORMS / INPUTS ═══ */
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
    select,
    textarea
) {
    background: rgba(6, 10, 18, 0.72);
    border: 1px solid rgba(80, 150, 255, 0.28);
    color: #f8fafc;
    border-radius: 12px;
    text-shadow: none;
    transition: border-color var(--cin-dur) ease, box-shadow var(--cin-dur) ease;
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) :is(input, select, textarea):focus {
    border-color: rgba(96, 165, 250, 0.65);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35), 0 0 18px rgba(59, 130, 246, 0.25);
    outline: none;
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) label {
    color: var(--cin-text-muted);
    text-shadow: none;
}

/* ═══ FOOTER ═══ */
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) .footer {
    background: transparent;
    border-top: 1px solid var(--cin-glass-border);
    color: var(--cin-text-muted);
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) .footer a {
    color: var(--cin-text-soft);
    text-shadow: var(--cin-text-glow);
}

/* ═══ PAGE ENTRANCE ANIMATION ═══ */
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) :is(
    main,
    #mainContent,
    .admin-main
) {
    animation: cinPageFadeIn 0.65s var(--cin-ease) both;
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic).page-enter {
    animation: none;
}

/* ═══ ALERTS ═══ */
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) .alert.success {
    background: rgba(22, 163, 74, 0.16);
    border-color: rgba(74, 222, 128, 0.35);
    color: #bbf7d0;
    text-shadow: none;
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) .alert.error {
    background: rgba(220, 38, 38, 0.14);
    border-color: rgba(248, 113, 113, 0.35);
    color: #fecaca;
    text-shadow: none;
}

/* ═══ OVERRIDE legacy gold / flat site_unified conflicts ═══ */
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) .btn-primary {
    background-image: none;
}

body.pathway-dark-global.page-dashboard:not(.pathway-login-page) .card,
body.pathway-dark-global.page-dashboard:not(.pathway-login-page) .living-card {
    background: linear-gradient(165deg, rgba(14, 22, 44, 0.16), rgba(22, 34, 68, 0.14));
    color: var(--cin-text-soft);
}

body.pathway-dark-global.page-dashboard:not(.pathway-login-page) #mainContent .card :is(h1, h2, h3) {
    color: var(--cin-text-shine);
    -webkit-text-fill-color: var(--cin-text-shine);
    text-shadow: var(--cin-heading-glow);
}

/* ═══ READABILITY — crisp UI chrome (headings keep cinematic glow) ═══ */
body.pathway-dark-global.page-os-shell:not(.page-public-home.home-cinematic) :is(
    .topbar,
    .topbar-pro,
    .admin-topbar,
    .mobile-tabbar
) :is(
    .nav-link,
    .nav-cta,
    .mobile-tabbar-label,
    label,
    .nav-lang-wrap label
) {
    text-shadow: none;
}

body.pathway-dark-global.page-os-shell:not(.page-public-home.home-cinematic) .hero .meta span {
    color: #f8fafc;
    -webkit-text-fill-color: #f8fafc;
}

body.pathway-dark-global.page-os-shell:not(.page-public-home.home-cinematic) .page-context-title {
    color: #f8fafc;
    -webkit-text-fill-color: #f8fafc;
}

body.pathway-dark-global.page-os-shell:not(.page-public-home.home-cinematic) .page-context-hint,
body.pathway-dark-global.page-os-shell:not(.page-public-home.home-cinematic) .small-muted {
    color: #cbd5e1;
    -webkit-text-fill-color: #cbd5e1;
    opacity: 1;
}

body.pathway-dark-global.page-os-shell:not(.page-public-home.home-cinematic) a.page-context-action.nav-cta--soft {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 55%, #1d4ed8 100%);
    color: #ffffff;
    -webkit-text-fill-color: #ffffff;
    border: 1px solid rgba(147, 197, 253, 0.45);
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.35);
    text-shadow: none;
    width: auto;
    max-width: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1.1rem;
    white-space: nowrap;
}

body.pathway-dark-global.page-os-shell:not(.page-public-home.home-cinematic) a.page-context-action.nav-cta--soft:hover {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
    color: #ffffff;
    -webkit-text-fill-color: #ffffff;
}

/* Mobile tabbar */
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page) .mobile-tabbar {
    background: rgba(5, 8, 16, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--cin-nav-border);
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page) .mobile-tabbar-link {
    color: rgba(248, 250, 252, 0.75);
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page) .mobile-tabbar-link.active {
    color: #ffffff;
    text-shadow: none;
}

/* Hero sections on inner pages */
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) .hero {
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page):not(.page-public-home.home-cinematic) .hero-badge {
    background: rgba(37, 99, 235, 0.22);
    border-color: rgba(96, 165, 250, 0.38);
    color: var(--cin-text-shine);
    text-shadow: var(--cin-text-glow);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page)::after,

    body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page) :is(main, #mainContent, .admin-main) {
        animation: none;
    }

    body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page) :is(.card, .btn):hover {
        transform: none;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   GLOBAL HOMEPAGE CINEMATIC DNA — every page & panel (pathway-cinematic-theme)
   Wins over site_unified flat surfaces via !important
   ═══════════════════════════════════════════════════════════════════════════ */

body.pathway-cinematic-theme.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page) {
    background: var(--cin-body-dark, #070b14) !important;
    background-color: var(--cin-body-dark, #070b14) !important;
}

body.pathway-cinematic-theme.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page):not(.pathway-auth-page) :is(
    .card,
    .form-card,
    .living-card,
    .command-center,
    .pathway-os-panel,
    .page-context,
    .page-context.card,
    .os-mission-hub,
    .dashboard-daily-mission,
    .dashboard-command-center,
    .dashboard-intel-card,
    .dashboard-cmd-tile,
    .dashboard-snapshot-cell,
    .dashboard-academic-twin-wow,
    .dashboard-mission-steps li,
    .page-portal-hero-card,
    .admin-main .card,
    .admin-sidebar,
    .admin-sidebar-head,
    .comp-shell .card,
    .mentor-shell .card,
    .pub-honest-strip,
    .engineering-trust-card,
    .trust-institute-grid article,
    .pilot-schools-metrics article,
    .pilot-school-card,
    .step-item,
    .hero.hero--winning .stat,
    .alert:not(.pathway-auth-alert),
    details.os-collapsed-insights,
    .stack-form.card,
    .mc-viz-row,
    .lw-gate-card
) {
    background: rgba(22, 34, 68, 0.14) !important;
    background-color: rgba(22, 34, 68, 0.14) !important;
    background-image: none !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    backdrop-filter: blur(12px) saturate(140%) !important;
    -webkit-backdrop-filter: blur(12px) saturate(140%) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28) !important;
    border-radius: 16px !important;
}

body.pathway-cinematic-theme.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page) :is(
    .os-mission-hub,
    .dashboard-command-center,
    .dashboard-daily-mission,
    section.card.pilot-schools-section
) {
    background: linear-gradient(165deg, rgba(14, 22, 44, 0.16), rgba(22, 34, 68, 0.14)) !important;
}

body.pathway-cinematic-theme.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-login-page) :is(
    .card,
    .dashboard-cmd-tile,
    .trust-institute-grid article,
    .dashboard-snapshot-cell
):hover {
    border-color: rgba(147, 197, 253, 0.28) !important;
    box-shadow: 0 12px 36px rgba(37, 99, 235, 0.18) !important;
}

/* Trust / metrics strip — homepage style */
body.pathway-cinematic-theme .trust-institute-strip {
    position: relative;
    z-index: 2;
    padding: 12px 0 4px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

body.pathway-cinematic-theme .trust-institute-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

body.pathway-cinematic-theme .trust-institute-grid article strong {
    display: block;
    font-size: clamp(1.25rem, 3vw, 1.55rem);
    font-weight: 800;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    text-shadow: var(--cin-heading-glow, 0 0 24px rgba(96, 165, 250, 0.35));
    line-height: 1.15;
}

body.pathway-cinematic-theme .trust-institute-grid article span {
    display: block;
    margin-top: 4px;
    font-size: 0.82rem;
    color: rgba(186, 230, 253, 0.82) !important;
    -webkit-text-fill-color: rgba(186, 230, 253, 0.82) !important;
}

body.pathway-cinematic-theme .trust-institute-note {
    color: rgba(186, 230, 253, 0.72) !important;
    font-size: 0.78rem;
    margin-top: 8px;
}

/* Navbar — home glass (no legacy gold accent line) */
body.pathway-cinematic-theme.pathway-dark-global :is(.topbar, .topbar-pro, .admin-topbar) {
    background: rgba(5, 8, 16, 0.72) !important;
    backdrop-filter: blur(16px) saturate(160%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(160%) !important;
    border-bottom: 1px solid rgba(59, 130, 246, 0.22) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45) !important;
}

body.pathway-cinematic-theme.pathway-dark-global .topbar .nav-link.active {
    color: #ffffff !important;
    background: rgba(37, 99, 235, 0.42) !important;
    border-color: rgba(96, 165, 250, 0.5) !important;
    box-shadow: 0 0 26px rgba(59, 130, 246, 0.52) !important;
}

/* Admin dropdown — above content, readable on every page */
body.pathway-cinematic-theme .nav-dropdown__panel,
body.pathway-dark-global .nav-dropdown__panel,
body.page-os-shell .nav-dropdown__panel,
.topbar .nav-dropdown__panel,
.topbar-pro .nav-dropdown__panel {
    background: rgba(8, 12, 24, 0.98) !important;
    background-color: rgba(8, 12, 24, 0.98) !important;
    border-color: rgba(96, 165, 250, 0.32) !important;
    z-index: 500 !important;
    position: absolute !important;
    pointer-events: auto !important;
    filter: none !important;
    opacity: 1 !important;
}

body.pathway-cinematic-theme .nav-dropdown__panel .nav-link,
body.pathway-cinematic-theme .nav-dropdown__panel .nav-link--drawer,
body.pathway-dark-global .nav-dropdown__panel .nav-link,
body.pathway-dark-global .nav-dropdown__panel .nav-link--drawer,
body.page-os-shell .nav-dropdown__panel .nav-link,
body.page-os-shell .nav-dropdown__panel .nav-link--drawer {
    color: #f1f5f9 !important;
    -webkit-text-fill-color: #f1f5f9 !important;
    text-shadow: none !important;
    opacity: 1 !important;
    filter: none !important;
}

/* Context strip — glass panel like homepage */
body.pathway-cinematic-theme .page-context-title {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    text-shadow: var(--cin-text-glow, 0 0 20px rgba(59, 130, 246, 0.28));
    font-weight: 700;
}

body.pathway-cinematic-theme .page-context-hint {
    color: rgba(186, 230, 253, 0.88) !important;
    -webkit-text-fill-color: rgba(186, 230, 253, 0.88) !important;
}

/* Hero headings — winning glow */
body.pathway-cinematic-theme .hero h1,
body.pathway-cinematic-theme .os-page-header__title,
body.pathway-cinematic-theme #mainContent .card > h1,
body.pathway-cinematic-theme #mainContent .card > h2 {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    text-shadow: var(--cin-heading-glow) !important;
}

body.pathway-cinematic-theme .hero {
    background: transparent !important;
    border-bottom: none !important;
}

body.pathway-cinematic-theme .hero-badge {
    background: rgba(37, 99, 235, 0.22) !important;
    border: 1px solid rgba(96, 165, 250, 0.38) !important;
    color: #ffffff !important;
    text-shadow: var(--cin-text-glow) !important;
}

/* Portal tabs — glass pills */
body.pathway-cinematic-theme .portal-tab-nav__link {
    background: rgba(14, 22, 44, 0.35) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: rgba(186, 230, 253, 0.88) !important;
    backdrop-filter: blur(8px) !important;
}

body.pathway-cinematic-theme .portal-tab-nav__link.is-active {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.55), rgba(29, 78, 216, 0.45)) !important;
    border-color: rgba(96, 165, 250, 0.45) !important;
    color: #ffffff !important;
    box-shadow: 0 0 18px rgba(59, 130, 246, 0.35) !important;
}

/* Footer */
body.pathway-cinematic-theme .footer {
    background: transparent !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: rgba(186, 230, 253, 0.75) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   GLOBAL READABILITY LOCK — no hidden copy on dark glass (every page/panel)
   Wins over legacy light-mode body:not(.dark) leaks. Auth + LW excluded.
   ═══════════════════════════════════════════════════════════════════════════ */

html[data-pathway-theme-scope="global-dark"] body.page-os-shell:not(.learning-world-page):not(.page-learning-world):not(.pathway-auth-page):not(.pathway-login-page),
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-auth-page):not(.pathway-login-page),
body.dark.page-os-shell.pathway-cinematic-theme:not(.learning-world-page):not(.pathway-auth-page):not(.pathway-login-page) {
    color: #e2e8f0;
}

html[data-pathway-theme-scope="global-dark"] body.page-os-shell:not(.learning-world-page):not(.pathway-auth-page):not(.pathway-login-page) :is(
    #mainContent,
    .hero,
    .admin-main,
    .page-context,
    .comp-shell,
    .page-portal-main,
    main.container,
    .card,
    section.card,
    .alert:not(.pathway-auth-alert)
) :is(
    p,
    li,
    span:not(.btn):not(.nav-link):not(.nav-cta):not(.mobile-tabbar-icon):not(.mobile-tabbar-label),
    label,
    td,
    th,
    dt,
    dd,
    .small-muted,
    .subtitle,
    .os-page-lead,
    .page-context-hint,
    .os-mission-context,
    .hero-primary-caption,
    .dashboard-cmd-tile-sub,
    .feature-box p,
    .today-task-card p
),
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-auth-page):not(.pathway-login-page) :is(
    #mainContent,
    .hero,
    .admin-main,
    .page-context,
    .card,
    section.card
) :is(
    p,
    li,
    span:not(.btn):not(.nav-link):not(.nav-cta),
    label,
    td,
    th,
    dt,
    dd,
    .small-muted,
    .subtitle,
    .os-page-lead,
    .page-context-hint
),
body.dark.page-os-shell:not(.learning-world-page):not(.pathway-auth-page):not(.pathway-login-page) :is(
    #mainContent,
    .hero,
    .admin-main,
    .card
) :is(
    p,
    li,
    label,
    td,
    th,
    .small-muted,
    .subtitle,
    .os-page-lead
) {
    color: #e2e8f0 !important;
    -webkit-text-fill-color: #e2e8f0 !important;
    text-shadow: none !important;
    opacity: 1 !important;
}

html[data-pathway-theme-scope="global-dark"] body.page-os-shell:not(.learning-world-page):not(.pathway-auth-page):not(.pathway-login-page) :is(
    .small-muted,
    .subtitle,
    .os-page-lead,
    .page-context-hint,
    .hero-primary-caption,
    .dashboard-cmd-tile-sub,
    .os-mission-context
),
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-auth-page):not(.pathway-login-page) :is(
    .small-muted,
    .subtitle,
    .os-page-lead,
    .page-context-hint
),
body.dark.page-os-shell:not(.learning-world-page):not(.pathway-auth-page):not(.pathway-login-page) :is(
    .small-muted,
    .subtitle,
    .os-page-lead
) {
    color: #cbd5e1 !important;
    -webkit-text-fill-color: #cbd5e1 !important;
    text-shadow: none !important;
    opacity: 1 !important;
}

html[data-pathway-theme-scope="global-dark"] body.page-os-shell:not(.learning-world-page):not(.pathway-auth-page):not(.pathway-login-page) :is(
    h1,
    h2,
    h3,
    h4,
    .os-page-header__title,
    .admin-title,
    .page-context-title
),
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-auth-page):not(.pathway-login-page) :is(
    h1,
    h2,
    h3,
    h4,
    .os-page-header__title,
    .admin-title,
    .page-context-title
),
body.dark.page-os-shell.pathway-cinematic-theme:not(.learning-world-page):not(.pathway-auth-page) :is(
    #mainContent .card > h1,
    #mainContent .card > h2,
    #mainContent .card > h3,
    .hero h1,
    .hero h2
) {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    text-shadow: 0 0 20px rgba(96, 165, 250, 0.2) !important;
}

html[data-pathway-theme-scope="global-dark"] body.page-os-shell:not(.learning-world-page):not(.pathway-auth-page):not(.pathway-login-page) :is(
    #mainContent,
    .hero,
    .admin-main,
    .card
) a:not(.btn):not(.nav-link):not(.nav-cta):not(.portal-tab-nav__link),
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-auth-page):not(.pathway-login-page) :is(
    #mainContent,
    .hero,
    .admin-main
) a:not(.btn):not(.nav-link):not(.nav-cta),
body.dark.page-os-shell:not(.learning-world-page):not(.pathway-auth-page) :is(
    #mainContent,
    .hero
) a:not(.btn):not(.nav-link):not(.nav-cta) {
    color: #93c5fd !important;
    -webkit-text-fill-color: #93c5fd !important;
    text-shadow: none !important;
}

html[data-pathway-theme-scope="global-dark"] body.page-os-shell:not(.learning-world-page):not(.pathway-auth-page) .alert:not(.pathway-auth-alert),
body.pathway-dark-global.page-os-shell:not(.learning-world-page):not(.pathway-auth-page) .alert:not(.pathway-auth-alert) {
    color: #e2e8f0 !important;
    -webkit-text-fill-color: #e2e8f0 !important;
    text-shadow: none !important;
}

/* ═══ HOME DNA on dashboard + OS panels — same white contrast as index.php ═══ */

body.pathway-cinematic-theme.pathway-dark-global.page-dashboard:not(.pathway-auth-page) :is(
    #mainContent,
    .hero,
    .page-context,
    .page-context-wrap
) :is(
    p,
    li,
    span:not(.btn):not(.nav-link):not(.nav-cta):not(.mobile-tabbar-icon),
    label,
    dt,
    dd,
    .small-muted,
    .subtitle,
    .os-page-lead,
    .page-context-hint,
    .hero-primary-caption,
    .dashboard-cmd-tile-sub,
    .os-mission-context,
    .feature-box p,
    .today-task-card p,
    .dashboard-os-label,
    .logged-in-email
),
body.pathway-cinematic-theme.pathway-dark-global.page-os-shell:not(.page-public-home):not(.pathway-auth-page):not(.learning-world-page) :is(
    .trust-institute-grid article span,
    .trust-institute-note,
    .pub-honest-strip p,
    .pub-honest-strip .small-muted,
    .engineering-trust-card p,
    .engineering-trust-card li,
    .engineering-trust-card .small-muted
) {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    text-shadow: none !important;
    opacity: 1 !important;
}

body.pathway-cinematic-theme.pathway-dark-global.page-dashboard:not(.pathway-auth-page) :is(
    .card,
    section.card,
    .dashboard-command-center,
    .dashboard-cmd-tile,
    .feature-box,
    .today-task-card
) {
    color: #ffffff !important;
}

body.pathway-cinematic-theme.pathway-dark-global.page-dashboard:not(.pathway-auth-page) :is(
    .btn.btn-outline,
    a.btn.btn-outline
) {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.42) !important;
    background: rgba(15, 23, 42, 0.55) !important;
    text-shadow: none !important;
}

body.pathway-cinematic-theme.pathway-dark-global.page-dashboard:not(.pathway-auth-page) :is(
    .btn.btn-outline,
    a.btn.btn-outline
):hover {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    background: rgba(37, 99, 235, 0.38) !important;
    border-color: rgba(147, 197, 253, 0.55) !important;
}
