* {
    box-sizing: border-box;
}

html {
    font-size: 100%; /* Explicitly 16px baseline — overrides user-agent quirks safely */
    scrollbar-gutter: stable; /* Reserve scrollbar space at all times — prevents layout shift when Fancybox toggles overflow:hidden */
}

html,
body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    scrollbar-gutter: stable; /* Reserve scrollbar gutter on both — Fancybox locks overflow on body, not html */
}

/* --- FANCYBOX SCROLL-LOCK COMPENSATION ---
   The visible scrollbar belongs to #scrollContainer (<main>), not body.
   scrollbar-gutter:stable reserves the gutter permanently so FancyBox hiding
   the #scrollContainer scrollbar causes zero layout shift. */
#scrollContainer {
    scrollbar-gutter: stable;
}
/* Zero out FancyBox's own margin-right compensation (applied to body/html)
   since we handle the gutter ourselves on #scrollContainer. */
html.with-fancybox body.hide-scrollbar {
    margin-right: 0 !important;
}
html.with-fancybox #scrollContainer {
    margin-right: 0 !important;
}

/* --- INTER VARIABLE FONT (SELF-HOSTED) --- */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('assets/fonts/Inter-Variable.woff2') format('woff2');
}

/* --- CORE VARIABLES --- */
:root {
    /* KEYBOARD ACCESSIBILITY */
    --font-stack: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --focus-ring: 2px solid var(--plasma);
    --focus-offset: 4px;
    --scrollbar-w: 10px;

    --accent: #3498db;
    --plasma: #00e5ff;
    --bg: #0b1116;
    --card-bg: rgba(255, 255, 255, 0.05);
    --text: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.88);
    --nav: rgba(11, 17, 22, 0.90);
    --row-hover: rgba(0, 229, 255, 0.08);
    --border: rgba(255, 255, 255, 0.12);
    --tab-inactive: rgba(255, 255, 255, 0.07);
    --track-bg: rgba(255, 255, 255, 0.1);
    --on-plasma: #060A0D;
    --hud-bg: rgba(10, 15, 20, 0.95);

    /* SPACING SCALE — 4px base grid */
    --space-1: 0.25rem;  /*  4px */
    --space-2: 0.5rem;   /*  8px */
    --space-3: 0.75rem;  /* 12px */
    --space-4: 1rem;     /* 16px */
    --space-5: 1.25rem;  /* 20px */
    --space-6: 1.5rem;   /* 24px */
    --space-8: 2rem;     /* 32px */
    --space-10: 2.5rem;  /* 40px */
    --space-12: 3rem;    /* 48px */
    --space-16: 4rem;    /* 64px */
    --space-20: 5rem;    /* 80px */
    --space-24: 6rem;    /* 96px */

    /* LAYOUT */
    color-scheme: dark light;
    --nav-height: 55px;
    --spacing-mobile-overlay-bottom: 80px;
    --spacing-mobile-card-bottom: 60px;
    --spacing-project-top: 75px;
}



/* REDUCED MOTION (A11Y) */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* HIGH CONTRAST (A11Y) */
@media (prefers-contrast: high) {
    :root {
        --border: rgba(255, 255, 255, 0.5);
        --card-bg: rgba(255, 255, 255, 0.12);
        --text-muted: rgba(255, 255, 255, 0.95);
    }

    [data-theme="light"] {
        --border: rgba(0, 0, 0, 0.5);
        --card-bg: rgba(255, 255, 255, 0.95);
        --text-muted: #000000;
    }
}

/* FORCED COLORS / Windows High Contrast (A11Y) */
@media (forced-colors: active) {
    * {
        border-color: CanvasText !important;
    }

    a,
    .text-accent,
    .text-plasma {
        color: LinkText !important;
    }
}




[data-theme="light"] {
    --bg: #f1f5f9;
    --card-bg: rgba(255, 255, 255, 0.85);
    --text: #000000;
    --text-main: #000000;
    --text-muted: #111111;
    --accent: #1a6dab;
    --nav: rgba(255, 255, 255, 0.98);
    --plasma: #1a3591;
    --row-hover: rgba(26, 53, 145, 0.05);
    --border: rgba(0, 0, 0, 0.25);
    --tab-inactive: rgba(0, 0, 0, 0.06);
    --track-bg: rgba(0, 0, 0, 0.10);
    --on-plasma: #ffffff;
    --hud-bg: rgba(245, 245, 250, 0.95);
}

/* --- KEYBOARD ACCESSIBILITY: FOCUS INDICATORS --- */
/* Remove default outline to use custom focus styles */
*:focus {
    outline: none;
}

/* Modern focus-visible (only shows on keyboard navigation, not mouse clicks) */
*:focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-offset);
    border-radius: 4px;
}

/* Specific focus styles for interactive elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--plasma);
    outline-offset: 2px;
}

/* Focus for cards and clickable containers */
.chaos-img:focus-visible,
.project-card:focus-visible,
.tab-btn:focus-visible,
.docs-tab:focus-visible {
    outline: 3px solid var(--plasma);
    outline-offset: 4px;
    box-shadow: 0 0 0 4px rgba(0, 229, 255, 0.2);
}

/* Skip link (will be added to header.php) */
.skip-link {
    position: absolute;
    top: -100px;
    left: 20px;
    background: var(--plasma);
    color: var(--on-plasma);
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    z-index: 100000;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 20px;
    outline: 3px solid var(--text);
    outline-offset: 2px;
}

/* Screen-reader only (visually hidden, accessible to AT) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ov-error-detail {
    font-size: 0.8em;
    opacity: 0.7;
}


/* SKELETON LOADERS */
/* Unified rhythm: Remove conflicting main class padding */
.skeleton-loader {
    padding: 40px;
    min-height: 400px;
    max-width: 800px;
    margin: 0 auto;
    animation: fadeIn 0.3s ease;
}

.skeleton-header {
    height: 32px;
    width: 60%;
    margin: 0 auto 20px;
    background: linear-gradient(90deg,
            var(--card-bg) 0%,
            rgba(255, 255, 255, 0.1) 50%,
            var(--card-bg) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-badges {
    height: 24px;
    width: 40%;
    margin: 0 auto 30px;
    background: linear-gradient(90deg,
            var(--card-bg) 0%,
            rgba(255, 255, 255, 0.1) 50%,
            var(--card-bg) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite 0.2s;
    border-radius: 12px;
}

.skeleton-text {
    height: 16px;
    width: 100%;
    margin-bottom: 12px;
    background: linear-gradient(90deg,
            var(--card-bg) 0%,
            rgba(255, 255, 255, 0.1) 50%,
            var(--card-bg) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite 0.4s;
    border-radius: 4px;
}

.skeleton-text.short {
    width: 70%;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* --- ENHANCED CARD ANIMATIONS --- */
.project-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.3s ease;
}

/* top-edge light beam that sweeps in on hover */
.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--plasma), transparent);
    transition: left 0.55s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 1;
}

@media (hover: hover) {
    .project-card:hover {
        transform: translateY(-6px) scale(1.015);
        box-shadow:
            0 20px 50px rgba(0, 229, 255, 0.18),
            0 4px 16px rgba(0, 0, 0, 0.4),
            inset 0 0 0 1px rgba(0, 229, 255, 0.25);
        border-color: rgba(0, 229, 255, 0.45);
    }
}

.project-card:hover::before {
    left: 140%;
}

.script-item {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (hover: hover) {
    .script-item:hover {
        transform: translateX(4px);
        box-shadow: -4px 0 0 var(--plasma);
    }
}

.script-item.loading {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 0.8;
    }
}

/* Accessibility: Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {

    .skeleton-header,
    .skeleton-badges,
    .skeleton-text {
        animation: none !important;
        background: var(--card-bg) !important;
    }

    .project-card:hover,
    .script-item:hover {
        transform: none !important;
    }

    .script-item.loading {
        animation: none !important;
    }
}


/* --- UNIFIED DOCS STYLING --- */
.project-docs-container {
    padding: 20px;
    color: var(--text);
}

.project-docs-container .header-section {
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.project-docs-container h1 {
    font-size: 2.2rem;
    color: var(--text);
    margin: 0;
}

.project-docs-container .status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    background: rgba(0, 229, 255, 0.1);
    color: var(--plasma);
    border: 1px solid var(--plasma);
    margin: 10px 0;
    text-align: center;
}

/* This ensures the HTML from chaos.html looks the same everywhere */
.project-ai-summary {
    box-sizing: border-box;
    width: 100%;
    margin: 20px 0 30px;
}

/* Accordion Specific Styling */
.summary-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    text-align: left;
    transition: opacity 0.2s ease;
}

.summary-toggle-btn:hover {
    opacity: 0.8;
}

.summary-toggle-btn h2 {
    margin: 0 !important; /* Override standard heading margin for the flex box */
    padding-bottom: 0 !important;
}

.summary-chevron {
    width: 24px;
    height: 24px;
    color: var(--plasma);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    transform: rotate(0deg); /* Default: pointing DOWN (closed) */
}

.summary-collapse-wrapper:not(.collapsed) ~ .summary-toggle-btn .summary-chevron,
.summary-toggle-btn[aria-expanded="true"] .summary-chevron {
    transform: rotate(-180deg); /* Open: pointing UP */
}

/* Buttery smooth grid transition layout */
.summary-collapse-wrapper {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.summary-collapse-wrapper.collapsed {
    grid-template-rows: 0fr;
}

.summary-collapse-inner {
    overflow: hidden;
    padding-top: 5px; /* Halved spacing since title is now outside */
}

.summary-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 5px; /* Halved spacing */
    width: 100%;
}

.summary-item {
    flex: 1 1 200px;
    background: rgba(0, 0, 0, 0.15);
    padding: 16px 20px;
    border-radius: 4px;
    border-left: 2px solid var(--plasma);
    color: var(--text-color);
}

.summary-item strong {
    display: block;
    color: var(--plasma);
    margin-bottom: 6px;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-item span,
.summary-item li {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
}

.summary-item span {
    display: block;
}

.summary-list {
    margin: 0;
    padding-left: 20px;
    list-style-type: disc;
}

.summary-list li {
    margin-bottom: 2px;
}

/* Light Theme overrides for Summary Items */
[data-theme="light"] .summary-item {
    background: rgba(0, 0, 0, 0.03);
    border-left-color: var(--plasma);
}

[data-theme="light"] .summary-item span,
[data-theme="light"] .summary-item li {
    color: rgba(0, 0, 0, 0.85);
}

.project-content h2 {
    font-size: 1.5rem;
    color: var(--plasma);
    border-left: 4px solid var(--plasma);
    padding-left: 15px;
    margin-top: 30px;
}

/* ACCESSIBILITY FOCUS RING (Enhanced Visibility) */
:focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-offset);
    border-radius: 4px;
    box-shadow: 0 0 0 4px rgba(0, 229, 255, 0.25);
}

/* APP SHELL SCROLLING (Fixed Nav, Scrolled Content) */
html {
    overflow: hidden;
    height: 100%;
    width: 100%;
}

/* --- SCROLLBAR STYLING --- */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--track-bg);
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 5px;
    border: 2px solid var(--track-bg);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--plasma);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: #444 var(--track-bg);
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    overflow-y: auto;
    /* Reserve scrollbar gutter always — prevents 10px layout shift when
       Fancybox closes and the scrollbar reappears on body.
       scrollbar-gutter: stable keeps the gutter reserved even when
       overflow switches between auto↔hidden. */
    scrollbar-gutter: stable;
    /* Enable body scroll */
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-stack);
    /* STICKY FOOTER: Flex column pushes footer to bottom */
    display: flex;
    flex-direction: column;
}



/* Theme crossfade transition (respects reduced motion) */
@media (prefers-reduced-motion: no-preference) {

    body,
    nav,
    header,
    footer,
    .glass-card,
    .overlay-glass-card,
    .tab-btn,
    .project-card,
    .script-item,
    .hud-overlay,
        .hamburger,
        .cleanview-btn,
        .theme-btn {
        transition: background-color 0.4s cubic-bezier(0.25, 0.1, 0.25, 1), 
                    color 0.35s cubic-bezier(0.25, 0.1, 0.25, 1), 
                    border-color 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
    }
}

/* BACKGROUND CANVAS */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease-in;
    object-fit: cover;
}

#bg-canvas.loaded {
    opacity: 1;
}

/* HUD ELEMENT: Must be out of document flow to prevent layout gap */
#sim-hud {
    position: fixed;
    z-index: 10000;
    pointer-events: none;
}

#home,
#about,
#legal {
    scroll-margin-top: 55px;
}

#home {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 55px !important;
}


/* Force children to center */
#home .home-intro,
#home h1,
#home h2,
#home p,
#home .glass-card {
    text-align: center;
    width: 100%;
    max-width: 900px !important;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

/* Specific adjustment for Home Card spacing */
#home .glass-card {
    padding-bottom: 20px !important;
}

#home p {
    text-align: center;
    margin-bottom: 0px !important;
}

/* --- MOBILE OVERRIDES (max-width: 768px) --- */
@media (max-width: 768px) {

    #home h1,
    #home h2,
    #home p,
    #home .glass-card {
        text-align: center !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-sizing: border-box;
    }

    #home .glass-card {
        padding: 20px 10px !important;
    }

    #home .glass-card {
        max-width: 100% !important;
    }
}

#hud-wrapper {
    position: fixed;
    z-index: 10000;
    bottom: 55px;
    right: 20px;
    width: 390px;
    display: flex;
    flex-direction: column;
    pointer-events: none;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), clip-path 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    clip-path: polygon(0 50%, 100% 50%, 100% 50%, 0 50%);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    backdrop-filter: blur(12px);
    color: var(--hud-text);
    background: var(--hud-bg);
    border: 1px solid var(--border);
    box-sizing: border-box;
    will-change: transform, opacity, clip-path;
}

#hud-wrapper.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    pointer-events: all;
}

.hud-header:hover {
    filter: brightness(1.2);
}

.hud-container {
    max-height: 70vh;
    overflow-y: auto;
    border-radius: 0 0 8px 8px;
    scrollbar-width: thin;
    scrollbar-color: #444 #111;
}

.hud-grid {
    display: grid;
    grid-template-columns: 110px 1fr 45px;
    gap: 6px 10px;
    align-items: center;
    padding: 15px;
}

.hud-group {
    grid-column: 1 / -1;
    font-size: 12px;
    font-weight: 800;
    color: var(--label-color);
    opacity: 0.8;
    border-bottom: 1px solid var(--border);
    margin-top: 15px;
    padding-bottom: 4px;
    text-transform: uppercase;
}

.hud-group.first {
    margin-top: 0;
}

.hud-grid label {
    font-size: 13px;
    color: var(--label-color);
    text-align: left;
    white-space: nowrap;
    font-weight: 600;
}

.hud-grid span {
    font-family: monospace;
    font-size: 12px;
    color: var(--plasma);
    text-align: right;
}

/* Control the height of the Options List */
.hud-grid {
    /* 1. Set the maximum height you want */
    max-height: 600px;

    /* 2. Enable scrolling if the list is longer than the height */
    overflow-y: auto;

    /* Optional: Add padding so scrollbar doesn't overlap text */
    padding-right: 5px;
}

.hud-select {
    width: 100%;
    background: var(--btn-bg);
    color: var(--hud-text);
    border: 1px solid var(--track-bg);
    padding: 6px;
    border-radius: 4px;
    font-size: 13px;
}

.btn-row {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.chaos-btn {
    flex: 1;
    padding: 12px;
    background: var(--btn-bg);
    color: var(--hud-text);
    border: 1px solid var(--track-bg);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.2s;
    text-align: center;
    user-select: none;
}

.chaos-btn:hover {
    background: var(--btn-hover);
    border-color: var(--label-color);
}

.chaos-btn.active {
    background: rgba(0, 100, 255, 0.3);
    border-color: #0088ff;
    color: #00ffff;
}

/* --- CUSTOM SLIDERS --- */
input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
    margin: 0;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: var(--plasma);
    margin-top: -5px;
    cursor: pointer;
    box-shadow: 0 0 6px var(--plasma);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: var(--track-bg);
    border-radius: 2px;
}

input[type=range]::-moz-range-thumb {
    height: 14px;
    width: 14px;
    border: none;
    border-radius: 50%;
    background: var(--plasma);
    cursor: pointer;
    box-shadow: 0 0 6px var(--plasma);
}

input[type=range]::-moz-range-track {
    width: 100%;
    height: 4px;
    background: var(--track-bg);
    border-radius: 2px;
}

/* --- TOGGLE SWITCHES --- */
.debug-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}

.debug-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.1);
    padding: 6px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.debug-item span {
    font-size: 13px;
    color: var(--label-color);
    font-weight: 600;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
    vertical-align: middle;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--track-bg);
    border-radius: 18px;
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: .3s;
}

input:checked+.slider {
    background-color: var(--plasma);
}

input:checked+.slider:before {
    transform: translateX(16px);
}

/* --- FPS STATS BOX --- */
#chaos-stats {
    position: fixed;
    z-index: 100001;
    font-family: 'Consolas', monospace;
    font-weight: bold;
    background: var(--hud-bg);
    color: var(--plasma);
    padding: 12px 15px;
    display: none;
    cursor: pointer;
    user-select: none;
    box-shadow: -2px 2px 15px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    box-sizing: border-box;

    /* Desktop: 1px below 56px navbar (55px + 1px border) */
    top: 57px !important;
    right: calc(22px + var(--scrollbar-w, 0px));
    width: min(358px, calc(100vw - 34px)) !important;
    text-align: left;
    border-radius: 8px;
    border-left: 3px solid var(--plasma);
    transition: width 0.3s ease;
}

/* When JS toggles FPS on, this class activates visibility.
   Desktop: block layout (full stats card below navbar)
*/
#chaos-stats.stats-active {
    display: block;
}

/* Prevent histogram canvas from floating over FPS text */
#chaos-stats #stats-hist {
    position: static !important;
}

/* COMPACT: Place FPS inside navbar on narrow/short viewports */
@media (max-width: 1800px),
(max-height: 800px) {
    #chaos-stats.stats-active {
        display: flex !important;
    }

    #chaos-stats {
        top: 0 !important;
        right: 55px !important;
        left: auto !important;
        width: auto !important;
        min-width: 0;
        height: 55px;
        align-items: center;
        padding: 0 12px;
        margin: 0;
        background: transparent !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border: none !important;
        border-radius: 0 !important;
        border-left: none !important;
    }

    #chaos-stats #stats-hist {
        display: none !important;
    }

    #chaos-stats #stats-diag {
        display: none !important;
    }

    #chaos-stats #stats-details {
        display: none !important;
    }

    #chaos-stats .stats-row-header {
        margin: 0;
    }

    #chaos-stats #stats-fps {
        font-size: 14px;
        letter-spacing: 0.5px;
    }
}

/* Desktop-only: guarantee all stats elements are visible (only applies ABOVE compact breakpoints) */
@media (min-width: 1801px) and (min-height: 801px) {
    #chaos-stats .stats-row-header {
        display: flex !important;
    }

    #chaos-stats #stats-fps {
        display: inline !important;
    }

    #chaos-stats #stats-details {
        display: block !important;
    }

    #chaos-stats #stats-hist {
        display: block !important;
        position: static !important;
    }

    #chaos-stats #stats-diag {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
    }
}

/* Ensure the internal graph also fills the new width */
#stats-hist {
    display: block;
    background: var(--stats-graph-bg);
    margin-bottom: 8px;
    width: 100% !important;
    height: 40px;
    border-radius: 4px;
}

.stats-row-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}

#stats-fps {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 1px;
}

#stats-details {
    font-size: 13px;
    font-weight: bold;
    color: var(--label-color);
}

#stats-details span {
    color: var(--stats-val-norm);
}

#stats-details .sep {
    color: var(--stats-sep);
    margin: 0 4px;
}

#stats-hist {
    display: block;
    background: var(--stats-graph-bg);
    margin-bottom: 6px;
    width: 100%;
    border-radius: 2px;
}

#stats-diag {
    font-size: 12px;
    color: var(--label-color);
    border-top: 1px solid var(--border);
    padding-top: 6px;
    line-height: 1.6;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 15px;
}

.val-norm {
    color: var(--stats-val-norm);
}

.val-accent1 {
    color: var(--stats-val-1);
}

.val-accent2 {
    color: var(--stats-val-2);
}

/* --- FLOATING ACTION BUTTONS (Shared Styles) --- */
.settings-btn,
#docs-toggle {
    --btn-accent: #00ffff;
    --btn-hover-bg: rgba(0, 255, 255, 0.1);
    position: fixed;
    bottom: 14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--hud-bg);
    border: 2px solid var(--btn-accent);
    color: var(--btn-accent);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    cursor: pointer;
    z-index: 10001;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    user-select: none;
    font-weight: bold;
    font-family: 'Consolas', monospace;
    padding: 0;
    margin: 0;
    box-sizing: content-box;
}

[data-theme="light"] .settings-btn,
[data-theme="light"] #docs-toggle {
    --btn-accent: #0044ff;
    --btn-hover-bg: rgba(0, 68, 255, 0.1);
}

/* Specific Positioning */
#docs-toggle {
    left: 20px;
    bottom: 14px;
}

.settings-btn {
    right: 20px;
    left: auto;
}

/* Hover Effects */
.settings-btn:hover,
#docs-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--btn-accent);
    background: var(--btn-hover-bg);
}

.settings-btn:hover {
    transform: rotate(90deg) scale(1.1);
}


.pulse-anim {
    animation: chaos-pulse 0.6s ease-in-out 3;
}

@keyframes chaos-pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 10px var(--plasma);
    }

    50% {
        transform: scale(1.3);
        box-shadow: 0 0 25px var(--plasma);
    }
}

/* --- TOOLTIP --- */
.chaos-tooltip {
    position: fixed;
    background: var(--hud-bg);
    color: var(--plasma);
    border: 1px solid var(--plasma);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    pointer-events: none;
    z-index: 999999;
    display: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    max-width: 200px;
}

/* --- MOBILE OVERRIDES (UI SPECIFIC) --- */
@media (max-width: 768px) {
    #hud-wrapper {
        width: 96vw;
        max-width: 420px;
        left: 50%;
        right: auto;
        bottom: 15px;
        transform: translateX(-50%) translateY(110%);
        border-radius: 12px 12px 0 0;
    }

    #hud-wrapper.visible {
        transform: translateX(-50%) translateY(0);
    }

    .hud-container {
        max-height: 42vh;
    }

    .hud-grid {
        padding: 10px;
        gap: 8px 5px;
    }

    .hud-group {
        font-size: 10px;
        margin-top: 10px;
    }

    .hud-grid label {
        font-size: 11px;
    }

    .hud-grid span {
        font-size: 10px;
    }

    .hud-select {
        font-size: 11px;
    }

    .debug-item span {
        font-size: 11px;
    }

    .chaos-btn {
        font-size: 11px;
        padding: 10px;
    }

    .hud-header {
        padding: 20px;
        font-size: 16px;
    }

    /* Shared Mobile Styles for Floating Buttons */
    .settings-btn,
    #docs-toggle {
        width: 30px !important;
        height: 30px !important;
        font-size: 20px !important;
        bottom: 39px !important;
    }

    .settings-btn {
        right: 20px !important;
        left: auto !important;
    }

    #docs-toggle {
        left: 20px !important;
        bottom: 39px !important;
    }

    input[type=range] {
        height: 30px;
    }

    input[type=range]::-webkit-slider-thumb {
        width: 22px;
        height: 22px;
        margin-top: -9px;
    }

    /* Hide Diagnostics on Mobile */
    #stats-diag {
        display: none !important;
    }

    /* Show Graph on Mobile */
    #stats-hist,
    #stats-details {
        display: block !important;
    }
}

/* NAVIGATION */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: max(var(--scrollbar-w, 10px), 10px);
    width: auto;
    z-index: 2000;
    /* Raised from 1000 to beat footer (1001) */
    background: var(--nav);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 0;
    /* Remove padding as we use flex align */
    height: 55px !important;
    /* Force standard height */
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    /* Exclude nav from page View Transition cross-fade */
    view-transition-name: nav-bar;
    contain: layout;
}

/* Keep nav crisp (no cross-fade) during View Transitions */
::view-transition-group(nav-bar) {
    animation-duration: 0s;
}

nav a {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 5px 8px;
    position: relative;
    transition: color 0.3s ease;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--plasma);
    transition: width 0.3s ease;
}

nav a:hover {
    color: var(--plasma);
}

nav a:hover::after,
nav a.active::after {
    width: 100%;
}

/* --- WCAG A11Y Touch Targets --- */
.theme-btn::after, .cleanview-btn::after, .hamburger::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 44px;
    min-height: 44px;
}

.theme-btn {
    border: 1px solid var(--plasma);
    background: transparent;
    color: var(--text);
    padding: 4px 12px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.3s ease;
    margin-left: 5px;
    position: relative;
}

.theme-btn svg {
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); /* playful spring rotation */
}

html[data-theme="light"] .theme-btn svg {
    transform: rotate(180deg) scale(1.1);
}

/* HAMBURGER MENU (Mobile Only) */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1002;
    position: relative;
}

.hamburger span {
    width: 22px;
    height: 2px;
    background: var(--text);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

@media (max-width: 768px) {
    .hamburger {
        display: flex;
        }

    .nav-links {
        position: fixed !important;
        top: 54px !important;
        left: 0;
        right: 0;
        bottom: auto !important;
        height: auto !important;
        z-index: 1999 !important;
        background: var(--nav);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 20px;
        gap: 15px;
        display: none;
        border-bottom: 1px solid var(--border);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
        text-align: center;
    }

    /* --- MOBILE SCROLL OFFSET TUNING --- */
    @media (max-width: 768px) {

        #home,
        #about,
        #legal,
        section {
            scroll-margin-top: 110px !important;
        }
    }

    .nav-links.active {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        pointer-events: all !important;
    }

    .nav-links a {
        padding: 12px 0;
        border-bottom: 1px solid var(--border);
        display: block;
        text-align: center;
    }

    .nav-links a:last-child {
        border-bottom: none;
    }
}

.theme-btn:hover {
    background: var(--plasma);
    color: var(--on-plasma);
    font-weight: bold;
}

/* --- CLEAN VIEW TOGGLE BUTTON --- */
.cleanview-btn {
    border: 1px solid var(--plasma);
    background: transparent;
    color: var(--text);
    padding: 4px 10px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.3s ease;
    margin-left: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.cleanview-btn svg {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.3s ease;
    flex-shrink: 0;
}

.cleanview-btn:hover {
    background: var(--plasma);
    color: var(--on-plasma);
}

.cleanview-btn:hover svg {
    stroke: var(--on-plasma);
}

/* Button click pop */
.cleanview-btn:active svg {
    transform: scale(0.85);
    transition: transform 0.1s ease;
}

/* Eye Slash Animation Setup */
.cleanview-btn .eye-slash {
    stroke-dasharray: 30;
    stroke-dashoffset: 30;
    transition: stroke-dashoffset 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cleanview-btn .eye-pupil {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
    transform-origin: center;
}


/* Active state: button filled with plasma to show it's ON — icon always visible */
.cleanview-btn:hover,
body.clean-view .cleanview-btn,
body.clean-view .theme-btn {
    background: var(--plasma) !important;
    color: var(--on-plasma) !important;
    border-color: var(--plasma) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

body.clean-view .cleanview-btn svg {
    stroke: var(--on-plasma);
    opacity: 1;
}

body.clean-view .cleanview-btn .eye-slash {
    stroke-dashoffset: 0;
    stroke: var(--on-plasma);
}

body.clean-view .cleanview-btn .eye-pupil {
    transform: scale(0.3);
    opacity: 0;
}

/* --- CLEAN VIEW MODE --- */
body.clean-view {
    overflow: hidden !important;
}

body.clean-view nav {
    background: transparent !important;
    border-bottom-color: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

body.clean-view .nav-links,
body.clean-view .hamburger,
body.clean-view #injected-back-btn {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease, visibility 0.3s ease !important;
}

body.clean-view .project-breadcrumb {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease, visibility 0.3s ease !important;
}

body.clean-view .glass-card,
body.clean-view .overlay-glass-card {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.4s ease !important;
}

body.clean-view footer {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease !important;
}

body.clean-view #sim-hud,
body.clean-view .home-intro,
body.clean-view section,
body.clean-view .footer-spacer {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease !important;
}

/* Keep simulation controls (cog + docs) interactive in clean view */
body.clean-view #docs-toggle,
body.clean-view .settings-btn {
    opacity: 1 !important;
    pointer-events: auto !important;
}

body.clean-view main {
    pointer-events: none !important;
}

/* Keep canvas and cleanview button interactive */
body.clean-view #bg-canvas {
    pointer-events: auto !important;
}

    body.clean-view .hud-overlay:hover .cleanview-btn,
    body.clean-view .hud-overlay:hover .theme-btn {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Mobile: Float both cleanview + theme buttons to top-right, above nav */
@media (max-width: 768px) {
    .cleanview-btn,
        .cleanview-btn,
        .theme-btn {
        position: fixed !important;
        top: 14px;
        z-index: 10002;
    }

    .cleanview-btn {
        right: 64px; /* Slightly wider spacing */
    }

        .theme-btn {
        right: 14px;
    }

    body.clean-view .cleanview-btn,
        body.clean-view .cleanview-btn,
        body.clean-view .theme-btn {
        /* Active button uses plasma fill (set globally above) — just keep interactive */
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        pointer-events: auto !important;
        opacity: 1 !important;
    }

    /* Move FPS counter to the very left side of nav on mobile */
    body #chaos-stats {
        left: 14px !important; /* Always far left */
        right: auto !important;
        width: max-content !important;
        max-width: 120px !important;
    }
}

/* --- CINEMATIC SYSTEM BOOT SEQUENCE: THE EYE OF CHAOS 4.1 --- */

:root {
    --shutter-bg: #0b1116;
    --shutter-glow: #00e5ff;
}
html[data-theme='light'] {
    --shutter-bg: #f1f5f9;
    --shutter-glow: #1a3591; /* matches --plasma in light mode */
}

/* ===================================================================
   APERTURE SYSTEM: Eye of Chaos 16.0 — Dynamic Blade Geometry
   
   JavaScript drives the animation (in header.php):
   1. DYNAMIC PATHS: Inner radius morphs r=3→r=90, swirl 42°→5°
      Blade paths recomputed at 60fps via requestAnimationFrame
   2. ZOOM-THROUGH: Container scales 1×→14× (fly through center hole)
   3. FOCUS PULL: Canvas blur/brightness synced via CSS
   
   CSS handles only: positioning, styling, backdrop fade, canvas focus
   =================================================================== */

/* Solid backdrop — only on home page, fades out with the iris sequence */
body.page-home::before {
    content: "";
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #000; /* always pure cinema black regardless of theme */
    z-index: 999990; /* above nav, HUD, corner buttons — full blackout during boot */
    pointer-events: none;
    animation: irisBackdrop 1.8s linear forwards;
}

@keyframes irisBackdrop {
    0%   { opacity: 1; }
    /* Start fade at 828ms — canvas visible through iris as a live frame */
    46%  { opacity: 1; }
    /* Fully faded by end — iris has zoomed off-screen */
    100% { opacity: 0; }
}

/* ─── Iris Overlay Container ─── */
#iris-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 999991; /* just above backdrop — iris is topmost element during boot */
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    /* transform driven by JS */
}

#iris-overlay svg {
    width: 75vmin;
    height: 75vmin;
    filter: drop-shadow(0 0 2px var(--shutter-glow)) drop-shadow(0 0 8px var(--shutter-glow));
    overflow: visible;
}

/* ─── Blade Styling (fill set by JS for alternating shingle visibility) ─── */
.iris-blade {
    stroke: var(--shutter-glow);
    stroke-width: 0.5;
    stroke-opacity: 0.4;
    stroke-linejoin: round;
}

/* 1. Canvas Focus Pull — defocused through lens, sharpens as we pass through */
/* Canvas focus-pull: only fires on the home page alongside the iris boot sequence */
body.page-home #bg-canvas {
    width: 100% !important;
    height: 100% !important;
    /* Duration matches iris DUR=1800ms: lens stopped-down+dark at start, sharpens as iris opens */
    animation: canvasFocusPull 1.8s linear forwards;
    /* No transform — canvas is stationary; iris zoom is the only spatial motion */
}

/* Non-home pages: canvas loads instantly, no animation */
body:not(.page-home) #bg-canvas {
    width: 100% !important;
    height: 100% !important;
}

@keyframes canvasFocusPull {
    /* Lens fully stopped-down: completely dark and blurred */
    0%   { filter: blur(40px) brightness(0)    contrast(1.5); }
    /* Iris begins to open — first light enters */
    20%  { filter: blur(28px) brightness(0.12) contrast(1.4); }
    /* Blades half-open — exposure and sharpness building */
    45%  { filter: blur(14px) brightness(0.5)  contrast(1.2); }
    /* Iris fully open — snapping to crisp as we fly through */
    70%  { filter: blur(4px)  brightness(0.88) contrast(1.05); }
    /* Settled: full clear exposure */
    100% { filter: blur(0px)  brightness(1)    contrast(1); }
}

/* Hero Title — only fires on home page with the iris sequence */
body.page-home #home .glass-card {
    animation: heroReveal 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) 0.35s backwards;
}

@keyframes heroReveal {
    0%   { opacity: 0; transform: scale(0.9) translateY(12px); filter: blur(8px); }
    100% { opacity: 1; transform: scale(1) translateY(0);     filter: blur(0);    }
}

/* Sub-page sections: no fly-up animation — loads instantly */
/* Home page sections: slide up with the boot sequence */
@keyframes glassCardLevitation {
    0%   { transform: translateY(100vh); }
    100% { transform: none; }
}

body.page-home main section:not(#home),
body.page-home main > div:not(#home) {
    animation: glassCardLevitation 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) 0.8s backwards;
}

body.page-home footer {
    animation: glassCardLevitation 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) 1.0s backwards;
}

/* MAIN LAYOUT */
main {
    position: relative;
    z-index: 10;
    width: 100%;
    margin-top: 60px;
    height: calc(100% - 60px);
    overflow-y: scroll;
    overflow-x: hidden;
    scroll-behavior: smooth;
    padding-top: 0;
}


section {
    padding: 60px 20px 0 20px !important;
    max-width: 900px;
    margin: 0 auto;
    scroll-margin-top: 20px;
}

#home,
#about,
#legal {
    scroll-margin-top: 20px;
}

#home {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#home .home-intro,
#home h1,
#home h2,
#home p,
#home .glass-card {
    text-align: center;
    width: 100%;
    max-width: 900px !important;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

#home p {
    text-align: center;
    margin-bottom: 0px !important;
}

@media (max-width: 768px) {

    #home h1,
    #home h2,
    #home p,
    #home .glass-card {
        text-align: center !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-sizing: border-box;
    }

    #home .glass-card {
        padding: 20px 10px !important;
        max-width: 100% !important;
    }
}


.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 35px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

/* TYPOGRAPHY */
h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
    line-height: 1.2;
    color: var(--text);
}

h1 span {
    display: block;
    font-size: 1.1rem;
    opacity: 0.8;
    font-weight: 400;
    color: var(--plasma);
    margin-top: 5px;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    border-left: 4px solid var(--plasma);
    padding-left: 15px;
    color: var(--text);
}

h3 {
    font-size: 1.1rem;
    margin-top: 20px;
    color: var(--plasma);
    margin-bottom: 10px;
}

p {
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 15px;
}

/* TABS */
.tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding: 10px 10px 15px 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab-btn {
    background: var(--tab-inactive);
    border: none;
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    /* Precise props only — avoids animating layout / text properties */
    transition:
        background 0.22s cubic-bezier(0.16, 1, 0.3, 1),
        color 0.18s ease,
        box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    color: var(--text);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tab-btn:hover {
    background: var(--row-hover);
    color: var(--text);
    transform: translateY(-1px);
}

.tab-btn.active {
    background: var(--plasma);
    color: var(--on-plasma);
    font-weight: 700;
    box-shadow:
        0 4px 14px rgba(0, 229, 255, 0.28),
        0 0 0 1px rgba(0, 229, 255, 0.18);
    transform: translateY(-1px);
}

.tab-content {
    display: none;
    content-visibility: hidden;
    contain-intrinsic-size: auto 500px;
    animation: tab-enter 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.tab-content.active {
    display: block;
    content-visibility: visible;
}

/* Blur-in slide: page content emerges from below with a soft focus pull */
@keyframes tab-enter {
    from {
        opacity: 0;
        transform: translateY(10px);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* Keep fadeIn for any legacy uses outside tabs */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0);   }
}

/* TABS: Mobile Small Screen Fix */
@media (max-width: 480px) {
    .tabs {
        gap: 4px;
        padding: 8px 5px 12px 5px;
    }

    .tab-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
        min-height: 38px;
    }
}

/* BUTTONS */
a[style*="background: var(--plasma)"] {
    background: var(--plasma) !important;
    color: var(--on-plasma) !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    border-radius: 8px;
    transition: filter 0.2s, transform 0.2s, box-shadow 0.2s;
    display: inline-block;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

a[style*="background: var(--plasma)"]:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

/* TABLES */
.table-container {
    margin-top: 10px;
    overflow-x: clip; /* clip stops translateX animations from creating a scrollbar */
}

.career-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    min-width: 600px;
}

.career-table th {
    text-align: left;
    padding: 12px;
    border-bottom: 2px solid var(--plasma);
    color: var(--plasma);
    font-weight: 600;
}

.career-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    vertical-align: top;
}

.career-table tr:hover td {
    background: var(--row-hover);
    color: var(--text);
    /* smooth all properties per-cell */
    transition:
        background 0.3s ease,
        color 0.2s ease,
        box-shadow 0.3s ease,
        padding-left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Full-row plasma left wall + ambient glow on hover */
.career-table tbody tr:hover td:first-child {
    box-shadow:
        inset 4px 0 0 var(--plasma),
        inset 12px 0 30px rgba(0, 229, 255, 0.1);
    padding-left: 18px;
}

/* subtle right-fade on last cell to convey depth */
.career-table tbody tr:hover td:last-child {
    background: linear-gradient(
        90deg,
        var(--row-hover) 70%,
        rgba(0, 229, 255, 0.03) 100%
    );
}

.career-table tbody tr td:first-child {
    transition: box-shadow 0.3s ease, padding-left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Also apply identical treatment to projects-table */
.projects-table tr:hover td {
    background: var(--row-hover);
    color: var(--text);
    transition:
        background 0.3s ease,
        color 0.2s ease,
        box-shadow 0.3s ease,
        padding-left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.projects-table tbody tr:hover td:first-child {
    box-shadow:
        inset 4px 0 0 var(--plasma),
        inset 12px 0 30px rgba(0, 229, 255, 0.1);
    padding-left: 18px;
}

.projects-table tbody tr td:first-child {
    transition: box-shadow 0.3s ease, padding-left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.career-table a {
    color: var(--plasma);
    text-decoration: none;
    border-bottom: 1px dotted var(--plasma);
    transition: opacity 0.2s;
}

.career-table a:hover {
    opacity: 0.8;
    border-bottom: 1px solid var(--plasma);
}

/* TABLE COLUMN ALIGNMENT */
.col-year {
    width: 15%;
}

.col-role {
    width: 15%;
}

.col-loc {
    width: 18%;
}

.col-35 {
    width: 52%;
}

.col-project {
    width: 35%;
}

.col-status-project {
    width: 15%;
}

.doc-spacer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* UTILITIES */
.clean-link {
    color: inherit;
    text-decoration: none !important;
}

.clean-link:hover {
    text-decoration: none !important;
}

.text-plasma {
    color: var(--plasma);
}

.text-main {
    color: var(--text);
}

.italic {
    font-style: italic;
}

.text-error {
    color: #ff4444;
}

.text-center {
    text-align: center;
}

.btn-plasma {
    padding: 12px 30px;
    background: var(--plasma);
    color: var(--on-plasma);
    text-decoration: none;
    border-radius: 30px;
    display: inline-block;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@media (hover: hover) {
    .btn-plasma:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 15px var(--plasma);
        filter: brightness(1.1);
    }
}

.btn-plasma:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px var(--plasma);
    filter: brightness(0.9);
}

/* SKILLS */
.skill-pct {
    font-size: 0.8rem;
    opacity: 0.8;
    font-weight: 700;
    color: var(--plasma);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.skill-item {
    background: rgba(0, 0, 0, 0.1);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.skill-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.skill-bar-bg {
    width: 100%;
    height: 8px;
    background: var(--track-bg);
    border-radius: 4px;
    overflow: hidden;
}

.skill-bar-fill {
    height: 100%;
    background: var(--plasma);
    width: 0;
    transition: width 1s ease-out;
    border-radius: 4px;
}

[data-theme="dark"] .skill-bar-fill {
    box-shadow: 0 0 12px var(--plasma);
}

/* DOWNLOADS */
.category-header {
    margin-top: 30px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
}

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

.script-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s ease;
}

.script-item:last-child {
    border-bottom: none;
}

.script-item:hover {
    background: var(--row-hover);
    border-radius: 8px;
    padding-left: 10px;
    padding-right: 10px;
}

@media (min-width: 769px) {
    .script-item:hover {
        margin: 0 -10px;
    }
}

.file-info {
    display: flex;
    flex-direction: column;
}

.file-link {
    color: var(--plasma);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    word-break: break-all;
    line-height: 1.3;
}

.file-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.dl-badge {
    background: rgba(128, 128, 128, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* GALLERY & LIGHTBOX */
.gallery-grid {
    column-count: 3;
    column-gap: 15px;
    margin-top: 15px;
}

.gallery-item {
    display: inline-block;
    width: 100%;
    margin-bottom: 15px;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: zoom-in;
    background: rgba(0, 0, 0, 0.1);
}

.gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.gallery-item::after {
    content: "©Felix Bourier";
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 0.6rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 8px;
    border-radius: 10px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.gallery-item:hover::after {
    opacity: 0.9;
}

.gallery-img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s ease;
    filter: brightness(0.95) contrast(1);
}

.gallery-item:hover .gallery-img {
    transform: scale(1.05);
    filter: brightness(1.05) contrast(1.05);
}

.gallery-desc {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0) 100%);
    color: #fff;
    font-size: 0.8rem;
    padding: 24px 12px 12px 12px;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2;
}

.gallery-item:hover .gallery-desc {
    opacity: 1;
    transform: translateY(0);
}

#lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#lightbox.open {
    display: flex;
    opacity: 1;
}

/* Main Visual Image */
.slide-visual img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    transition: transform 0.3s ease;
}

.slide-visual img:hover {
    transform: scale(1.02);
}

#lightbox img {
    max-width: 90%;
    max-height: 80vh;
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#lightbox.open img {
    transform: scale(1);
}

#lightbox p {
    color: #fff;
    margin-top: 15px;
    font-size: 1.1rem;
    text-align: center;
    max-width: 80%;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px;
    border-radius: 4px;
}

.lb-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 2.5rem;
    cursor: pointer;
    user-select: none;
    background: transparent;
    border: none;
    padding: 0;
}


/* --- HARMONIZED DOCUMENTATION OVERLAY --- */
:root {
    --ov-accent: var(--plasma);
    --ov-bg: var(--nav);
    --ov-card: var(--card-bg);
    --ov-border: var(--border);
    --ov-text: var(--text);
    --ov-text-dim: var(--text-muted);
    /* Default Dark Mode Backdrop */
    --ov-backdrop: rgba(0, 0, 0, 0.85);
}

/* Light Mode Override for Backdrop */
[data-theme="light"] {
    --ov-backdrop: rgba(255, 255, 255, 0.85);
}

/* Base IDs for both overlays (index and about) */
#chaos-docs,
#doc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    background: var(--ov-backdrop);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 10001;
    display: flex;
    justify-content: center;
    overflow-y: auto;
    transition: opacity 0.3s ease;
}

#chaos-docs.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

/* Override the docs-content padding when it contains docs-body */
#chaos-docs .docs-content {
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: none !important;
    overflow: visible !important;
    justify-content: flex-start !important;
    padding: 20px 20px !important;
}

#chaos-docs .overlay-footer-copyright {
    margin-top: 50px !important;
    padding-top: 20px !important;
    border-top: 1px solid var(--border) !important;
    color: var(--text-muted) !important;
    font-size: 0.75rem !important;
    text-align: center !important;
    letter-spacing: 0.5px !important;
    line-height: 1.5 !important;
    opacity: 0.8 !important;
}

#chaos-docs .overlay-footer-copyright p {
    margin: 0 !important;
    color: var(--text-muted) !important;
}


#chaos-docs #docs-body {
    background: var(--card-bg) !important;
    border: 2px solid var(--border) !important;
    border-radius: 20px !important;
    padding: 50px !important;
    width: 100% !important;
    max-width: 900px !important;
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5) !important;
    color: var(--text) !important;
    margin: 0 auto !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
}

/* Ensure the overlay container handles scrolling */
#chaos-docs {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
    padding: 20px 20px !important;
    scrollbar-color: var(--ov-accent, var(--plasma)) var(--ov-card, var(--bg));
}

#chaos-docs .docs-nav {
    margin-bottom: 0 !important;
}

#chaos-docs .docs-section {
    padding-top: 15px !important;
}

/* Content containers */
.docs-content,
.overlay-inner-container {
    position: relative;
    width: 100%;
    max-width: 900px;
    padding: 30px 40px;
}

/* The actual card inside */
#docs-body,
.overlay-glass-card {
    background: var(--ov-card);
    border: 2px solid var(--ov-border);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    color: var(--ov-text);
    will-change: transform, clip-path, opacity;
    transform: scale(1) translateY(0);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), clip-path 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
}
.hidden .overlay-glass-card {
    transform: scale(0.95) translateY(10px);
    clip-path: polygon(0 50%, 100% 50%, 100% 50%, 0 50%);
}

/* Remove will-change after transition for performance */
.overlay-glass-card:not(:hover) {
    will-change: auto;
}

/* 2. Center the Status Badge */
.status-badge {
    display: block !important;
    width: fit-content !important;
    margin: 0 auto 20px auto !important;
    /* Centers it horizontally */
    text-align: center;
}

/* 3. Center the Tech Badges / Stack Container */
.tech-stack-container,
.tech-badge-container {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 10px;
    width: 100% !important;
    margin: 20px auto !important;
}

/* 4. Ensure individual Tech Badges center themselves */
.tech-badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 5px !important;
    /* Prevents badges from sticking to edges */
}

/* THEME-AWARE TEXT LOGIC */
#docs-body h1,
#doc-render-target h1 {
    font-size: 2.5rem;
    margin: 0 0 10px 0;
    color: var(--ov-text);
}

#docs-body h2,
#doc-render-target h2 {
    color: var(--ov-accent) !important;
    margin-top: 30px;
    border-left: 4px solid var(--ov-accent);
    padding-left: 15px;
}

#docs-body h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--ov-text);
    text-align: center;
}

/* Normal Text Color for Documentation H3 */
#docs-body h3 {
    color: var(--ov-text) !important;
    margin-top: 20px;
    border: none;
}

/* Overlay Title (for documentation headers) */
.overlay-title {
    font-size: 2.5rem;
    margin: 0 0 10px 0;
    color: var(--ov-text);
    text-align: center;
    font-family: var(--font-stack);
    font-weight: 700;
    display: block;
}

/* Project Description Text */
.project-desc-text {
    color: var(--ov-text-dim) !important;
    line-height: 1.6;
    font-size: 1.1rem;
    margin-bottom: 30px;
    font-weight: 300;
    text-align: center;
}

/* Documentation Body Content */
.doc-body-content .param>strong,
.doc-body-content .parameter-item>strong {
    color: var(--ov-accent) !important;
    display: block;
    margin-bottom: 8px;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    font-weight: 800;
}

#docs-body p,
#docs-body li,
#doc-render-target p,
#doc-render-target li {
    color: var(--ov-text-dim) !important;
    line-height: 1.6;
}

/* Centering Stack Icons and Badge */
.tech-stack-container {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    margin: 20px auto !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Targeting common tag/icon classes from JSON renderers */
.tech-stack-container>* {
    display: inline-flex !important;
    margin: 0 !important;
    /* Removes potential left-side offset */
}

/* Ensure individual tags/icons behave as flex items */
.tech-stack-container span,
.tech-stack-container div,
.tech-stack-container .tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Nested Logic for Project HTML */
.doc-body-content .param>strong,
.doc-body-content .parameter-item>strong {
    color: var(--ov-accent) !important;
    display: block;
    margin-bottom: 8px;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    font-weight: 800;
}

#docs-body p,
#docs-body li,
.project-desc-text {
    color: var(--ov-text-dim) !important;
    line-height: 1.6;
}

/* Optional: Centering the Status Badge above the content */
.status-badge {
    display: block;
    width: fit-content;
    margin: 0 auto 20px auto;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--tab-inactive);
    color: var(--ov-accent) !important;
    border: 1px solid var(--ov-accent) !important;
    text-transform: uppercase;
    text-align: center;
}

.tech-badge,
.tag {
    background: var(--tab-inactive);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    color: var(--ov-text-dim) !important;
    border: 1px solid var(--ov-border);
    margin-right: 8px;
    margin-bottom: 8px;
    display: inline-block;
    font-weight: 600;
}

/* Close Buttons */
#docs-close,
.close-overlay-btn {
    position: fixed;
    top: 30px;
    right: 40px;
    font-size: 45px;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 10002;
    transition: color 0.3s;
}

#docs-close:hover,
.close-overlay-btn:hover {
    color: var(--ov-accent);
}

.param-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 15px;
    margin-top: 25px;
}

.param {
    background: rgba(255, 255, 255, 0.03);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--ov-border);
}

/* --- GLOBAL CARD STYLE (Ensures Centering) --- */
#docs-body,
.overlay-glass-card {
    background: var(--ov-card);
    border: 1px solid var(--ov-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 60px 40px;
    width: 95%;
    max-width: 900px;
    margin: 40px auto;
    /* CENTERS HORIZONTALLY */
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow-wrap: break-word;
}

/* --- STANDARD DOCUMENTATION UI COMPONENTS --- */
.docs-nav {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 0;
    flex-wrap: wrap;
    justify-content: center;
    padding-bottom: 0;
}

.docs-tab {
    padding: 10px 15px;
    cursor: pointer;
    color: var(--text-muted);
    font-weight: bold;
    font-size: 14px;
    transition: 0.2s;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    margin-bottom: -2px;
}

.docs-tab:hover {
    color: var(--text);
}

.docs-tab.active {
    color: var(--plasma);
    border-color: var(--plasma);
}

.docs-section {
    display: none;
    animation: fadeIn 0.3s;
    padding-top: 15px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.docs-section.active {
    display: block;
}

.feature-list {
    list-style: none;
    padding: 0;
}

.feature-list li {
    padding-left: 20px;
    position: relative;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.feature-list li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--plasma);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {

    /* Fix mobile overlay centering & scrolling */
    #chaos-docs {
        align-items: flex-start !important;
        /* Allow top-down scrolling */
        padding: 15px 0 var(--spacing-mobile-overlay-bottom) 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .docs-content,
    .overlay-inner-container {
        padding: 20px 10px !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    #chaos-docs .docs-content {
        padding: 20px 10px !important;
    }

    /* Glass card: Center horizontally with margins */
    #docs-body,
    #chaos-docs #docs-body,
    .overlay-glass-card {
        box-sizing: border-box !important;
        padding: 25px 20px !important;
        margin: 20px auto var(--spacing-mobile-card-bottom) auto !important;
        /* Top margin + Bottom margin + Auto Horizontal */
        width: calc(100% - 30px) !important;
        /* Not 100% - allows seeing the centering */
        max-width: 600px !important;
        position: relative;
        left: 0;
        right: 0;
    }

    #docs-close,
    .close-overlay-btn {
        top: 15px;
        right: 20px;
        font-size: 35px;
    }


}



/* --- OVERLAY FOOTER COPYRIGHT (UNIFIED) --- */
.doc-copyright {
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid var(--ov-border);
    text-align: center;
    font-size: 0.7rem;
    color: var(--ov-text-dim);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    opacity: 0.8;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block !important;
}

/* Ensure it stacks nicely on mobile */
@media (max-width: 600px) {
    .doc-copyright {
        font-size: 0.6rem;
        margin-top: 30px;
    }
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
    nav {
        padding: 8px 0;
        gap: 8px;
        justify-content: center;
    }

    nav a {
        font-size: 0.75rem;
        padding: 4px 6px;
    }

    section {
        padding: 30px 10px;
    }

    /* V24 - SOLID MOBILE MAT */
    :root {
        --card-bg: rgba(15, 20, 25, 0.95);
        /* Deep, near-solid base for dark mode */
        --tab-inactive: rgba(255, 255, 255, 0.15);
        /* More visible on mobile */
        --row-hover: rgba(0, 229, 255, 0.15);
        /* More solid hover/grid base */
    }

    [data-theme="light"] {
        --card-bg: rgba(255, 255, 255, 0.98);
        /* Fully solid feel for light mode */
        --tab-inactive: rgba(0, 0, 0, 0.08);
        --row-hover: rgba(0, 50, 200, 0.08);
    }

    .glass-card,
    .overlay-glass-card {
        padding: 20px 15px;
        background: var(--card-bg) !important;
        backdrop-filter: blur(25px) !important;
        -webkit-backdrop-filter: blur(25px) !important;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6) !important;
        border: 1px solid var(--border) !important;
    }

    /* Force active content to be fully opaque */
    .tab-content.active {
        opacity: 1 !important;
        display: block !important;
    }

    /* Remove transparency from nested utility on mobile */
    .bg-glass {
        background: var(--card-bg) !important;
    }

    .tech-badge,
    .tech-badge-mini,
    .status-pill,
    .status-live,
    .status-other,
    .tag {
        background: var(--tab-inactive) !important;
        border: 1px solid var(--border) !important;
        opacity: 1 !important;
    }

    h1 {
        font-size: 1.6rem;
    }

    h1 span {
        font-size: 0.85rem;
    }

    .tabs {
        flex-wrap: wrap;
        overflow-x: visible;
        justify-content: center;
        gap: 10px;
    }

    .tab-btn {
        flex-grow: 1;
        text-align: center;
        font-size: 0.8rem;
        padding: 8px 10px;
    }

    .career-table,
    .career-table tbody,
    .career-table tr,
    .career-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
        min-width: 0;
    }

    .career-table thead {
        display: none;
    }

    .career-table tr {
        margin-bottom: 20px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: var(--card-bg);
        padding: 15px;
    }

    .career-table td:nth-child(2) {
        font-size: 1rem;
        font-weight: bold;
        color: var(--text);
        padding: 0 0 5px 0;
        border: none;
    }

    .career-table td:nth-child(1),
    .career-table td:nth-child(3) {
        display: inline-block;
        width: auto;
        font-size: 0.75rem;
        color: var(--plasma);
        padding: 0;
        border: none;
        margin-right: 10px;
        font-weight: 600;
        opacity: 0.9;
    }

    .career-table td:nth-child(1)::after {
        content: " • ";
        color: var(--text-muted);
        margin-left: 10px;
    }

    .career-table td:nth-child(4) {
        margin-top: 10px;
        padding: 10px 0 0 0;
        border-top: 1px solid var(--border);
        color: var(--text-muted);
        line-height: 1.4;
        font-size: 0.85rem;
    }

    /* Projects Table Mobile Polish (Decoupled from CV) */
    .projects-table td:nth-child(1) {
        display: block !important;
        width: 100% !important;
        font-size: 1.1rem !important;
        font-weight: 700 !important;
        color: var(--text) !important;
        margin-bottom: 5px;
    }

    .projects-table td:nth-child(1)::after {
        content: none !important;
    }

    .projects-table td:nth-child(2) {
        display: inline-block !important;
        width: auto !important;
        font-size: 0.75rem !important;
        color: var(--plasma) !important;
        padding: 0 !important;
        font-weight: 600 !important;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    .projects-table td:nth-child(3) {
        display: block !important;
        width: 100% !important;
        margin-top: 12px;
        padding-top: 12px !important;
        border-top: 1px solid var(--border) !important;
        font-size: 0.85rem !important;
        color: var(--text-muted) !important;
    }

    .script-item {
        grid-template-columns: 1fr;
        align-items: flex-start;
        gap: 5px;
    }

    .dl-badge {
        margin-top: 5px;
        align-self: flex-start;
    }

    .gallery-grid {
        column-count: 2;
    }
}



/* CENTER TABS AND REMOVE ALL GAPS */
.docs-nav {
    justify-content: center !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.docs-tab {
    margin-bottom: -2px !important;
}

.docs-content {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.docs-section {
    padding-top: 15px !important;
    margin-top: 0 !important;
}

/* Target the first heading in the section to remove its top margin */
.docs-section>h2:first-child,
.docs-section>h3:first-child,
.docs-section>p:first-child,
.docs-section>*:first-child {
    margin-top: 0 !important;
    padding-top: 15px !important;
}

/* Constrain all docs content to card width */
.docs-content,
.docs-section {
    max-width: 100% !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
}

/* Make tables responsive */
.docs-section table,
.param-table {
    width: 100% !important;
    max-width: 100% !important;
}

@media (max-width: 1024px) {

    .docs-section table,
    .param-table {
        table-layout: fixed !important;
        word-wrap: break-word !important;
    }
}

.docs-section td,
.docs-section th {
    overflow-wrap: break-word !important;
    word-break: break-word !important;
}

/* Constrain grids */
.param-grid,
.docs-section .param-grid {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Architecture callouts need an explicit surface so contrast scanners do not
   evaluate white text against the animated background canvas. */
.decision-box,
.info-box,
.success-box,
.warning-box,
.tip-box {
    color: #ffffff;
    background: rgba(5, 12, 18, 0.94);
    border: 1px solid rgba(0, 229, 255, 0.34);
    border-left: 4px solid var(--plasma, #00e5ff);
    border-radius: 14px;
    padding: 16px 18px;
    margin: 18px 0;
    line-height: 1.55;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
}

.decision-box strong,
.info-box strong,
.success-box strong,
.warning-box strong,
.tip-box strong {
    color: #eaffff;
}

[data-theme="light"] .decision-box,
[data-theme="light"] .info-box,
[data-theme="light"] .success-box,
[data-theme="light"] .warning-box,
[data-theme="light"] .tip-box {
    color: #08111f;
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(26, 53, 145, 0.28);
    border-left-color: var(--plasma, #1a3591);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.10);
}

[data-theme="light"] .decision-box strong,
[data-theme="light"] .info-box strong,
[data-theme="light"] .success-box strong,
[data-theme="light"] .warning-box strong,
[data-theme="light"] .tip-box strong {
    color: #0f2e82;
}

/* --- GLOBAL OVERLAY STATE MANAGEMENT --- */
body.overlay-mode {
    overflow: hidden !important;
    height: 100vh;
    touch-action: none !important;
    /* FIX 3: Strict scroll trapping for mobile Safari/Chrome */
}

/* Hide elements when overlay is active */
body.overlay-mode footer,
body.overlay-mode nav,
body.overlay-mode #docs-toggle,
body.overlay-mode .settings-btn,
body.overlay-mode .theme-btn,
body.overlay-mode .cleanview-btn {
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Ensure the overlay itself remains visible and scrollable */
body.overlay-mode #chaos-docs,
body.overlay-mode #doc-overlay,
body.overlay-mode #architecture-overlay,
body.overlay-mode #orchestrator-overlay {
    visibility: visible !important;
    pointer-events: auto !important;
    touch-action: auto !important;
    /* Re-enable scrolling inside the modal */
    -webkit-overflow-scrolling: touch !important;
    /* Smooth scrolling on iOS */
}



/* For Firefox */
* {
    scrollbar-width: thin;
    /* 'auto' or 'thin' */
    scrollbar-color: var(--plasma) var(--bg);
    /* thumb color, track color */
}

/* Optional: Specific styling for overlay scrollbar */
#chaos-docs::-webkit-scrollbar-thumb {
    background: var(--ov-accent, var(--plasma));
    /* Use overlay accent if available */
}





/* Ensure all child elements respect container width */
.docs-section>* {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Specific fix for code blocks and pre elements */
.docs-section pre,
.docs-section code,
.equation-block {
    max-width: 100% !important;
    overflow-x: auto !important;
    box-sizing: border-box !important;
}

/* Fix for lists */
.docs-section ul,
.docs-section ol {
    padding-right: 20px !important;
    box-sizing: border-box !important;
}

#chaos-docs.hidden {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* Remove any lingering backdrop effects */
body:not(:has(#chaos-docs:not(.hidden))) {
    backdrop-filter: none !important;
}

/* Ensure body overflow is reset */
body {
    overflow: auto !important;
}

/* Only lock overflow when overlay is open */
body:has(#chaos-docs:not(.hidden)) {
    overflow: hidden !important;
}

/* GALLERY SAVE BUTTON — A11Y-safe: suppress mouse focus, keep keyboard ring */
.chaos-grid-dl:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
}
.chaos-grid-dl:focus-visible {
    outline: 2px solid var(--plasma);
    outline-offset: 2px;
}

/* --- SKELETON LOADING UI --- */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.05) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 4px;
    display: block;
}

[data-theme='light'] .skeleton {
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.05) 25%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.05) 75%);
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
    width: 100%;
}

.skeleton-title {
    height: 2.5rem;
    width: 60%;
    margin: 0 auto 20px auto;
}

.skeleton-badge {
    height: 1.5rem;
    width: 30%;
    margin: 0 auto 30px auto;
}


/* --- COMMAND PALETTE (CMD+K) --- */
#cmd-palette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 15vh;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    /* A11Y FIX */
    transition: opacity 0.2s ease, visibility 0.2s ease;
    font-family: "Inter", system-ui, sans-serif;
}

#cmd-palette.cmd-visible {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    /* A11Y FIX */
}

.cmd-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
}

.cmd-modal {
    position: relative;
    width: 600px;
    max-width: 90%;
    background: #1a1f24;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(-20px);
    transition: transform 0.2s ease;
}

#cmd-palette.cmd-visible .cmd-modal {
    transform: translateY(0);
}

.cmd-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    gap: 12px;
}

.cmd-icon {
    font-size: 1.2rem;
    filter: grayscale(1);
}

#cmd-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    font-family: inherit;
    color: #fff;
    font-size: 1.1rem;
    outline: none;
    caret-color: #00e5ff;
}

.cmd-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: #888;
    font-family: monospace;
}

.cmd-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
}

.cmd-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border-radius: 8px;
    cursor: pointer;
    color: #ccc;
    transition: all 0.1s;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.cmd-item.active,
.cmd-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-left-color: #00e5ff;
}

.cmd-item-type {
    font-size: 0.75rem;
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-left: auto;
}

.cmd-footer {
    padding: 8px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.75rem;
    color: #666;
    display: flex;
    gap: 15px;
}

.cmd-footer strong {
    color: #888;
}

/* --- SEO UTILITY CLASSES --- */

.mb-20 {
    margin-bottom: 20px !important;
}

.mb-15 {
    margin-bottom: 15px !important;
}

.mb-12 {
    margin-bottom: 12px !important;
}

.mb-6 {
    margin-bottom: 6px !important;
}

.mb-5 {
    margin-bottom: 5px !important;
}

.mb-2 {
    margin-bottom: 2px !important;
}

.mt-10 {
    margin-top: 10px !important;
}

.mt-15 {
    margin-top: 15px !important;
}

.mt-30 {
    margin-top: 30px !important;
}

.mt-35 {
    margin-top: 35px !important;
}

.mt-40 {
    margin-top: 40px !important;
}

.mt-50 {
    margin-top: 50px !important;
}

.gap-8 {
    gap: 8px !important;
}

.gap-10 {
    gap: 10px !important;
}

.gap-15 {
    gap: 15px !important;
}

.opacity-50 {
    opacity: 0.5 !important;
}

.opacity-70 {
    opacity: 0.7 !important;
}

.opacity-80 {
    opacity: 0.8 !important;
}

.opacity-85 {
    opacity: 0.85 !important;
}

.fw-600 {
    font-weight: 600 !important;
}

.fw-700 {
    font-weight: 700 !important;
}

.fw-bold {
    font-weight: bold !important;
}

.fs-small {
    font-size: 0.75rem !important;
}

.fs-xsmall {
    font-size: 0.65rem !important;
}

.fs-medium {
    font-size: 0.8rem !important;
}

.fs-large {
    font-size: 1rem !important;
}

.fs-h1 {
    font-size: 1.4rem !important;
}

.fs-h2 {
    font-size: 1.2rem !important;
}

.fs-36 {
    font-size: 36px !important;
}

.lh-1-2 {
    line-height: 1.2 !important;
}

.lh-1-4 {
    line-height: 1.4 !important;
}

.lh-1-5 {
    line-height: 1.5 !important;
}

.d-flex {
    display: flex !important;
}

.inline-flex {
    display: inline-flex !important;
}

.items-center {
    align-items: center !important;
}

.items-baseline {
    align-items: baseline !important;
}

.justify-between {
    justify-content: space-between !important;
}

.flex-wrap {
    flex-wrap: wrap !important;
}

.white-nowrap {
    white-space: nowrap !important;
}

.w-full {
    width: 100% !important;
}

.border-none {
    border: none !important;
}

.br-8 {
    border-radius: 8px !important;
}

.br-30 {
    border-radius: 30px !important;
}

.p-20 {
    padding: 20px !important;
}

.pt-15 {
    padding-top: 15px !important;
}

.pt-50 {
    padding-top: 50px !important;
}

.text-main {
    color: var(--text-main) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-dim {
    color: var(--ov-text-dim) !important;
}

.text-accent {
    color: var(--ov-accent) !important;
}

.text-plasma {
    color: var(--plasma) !important;
}

.bg-glass {
    background: rgba(255, 255, 255, 0.05) !important;
}

.border-main {
    border: 1px solid var(--border) !important;
}

.border-top-main {
    border-top: 1px solid var(--ov-border) !important;
}

.border-top-dashed {
    border-top: 1px dashed var(--ov-border) !important;
}

.transition-all {
    transition: all 0.2s ease !important;
}

.transition-transform {
    transition: transform 0.2s !important;
}

.no-underline {
    text-decoration: none !important;
}

/* --- HOME SECTION MOBILE OVERRIDES --- */
@media (max-width: 768px) {
    #home {
        padding-top: 20px !important;
    }

    .home-intro {
        font-size: 26px !important;
        margin-bottom: 5px !important;
    }

    #home h1 {
        font-size: 1.4rem !important;
    }

    #home h2 {
        font-size: 1rem !important;
        line-height: 1.4 !important;
        margin-bottom: 10px !important;
    }

    #home p {
        font-size: 0.75rem !important;
    }

    #home .glass-card {
        padding: 20px !important;
    }
}

/* --- MISSION SECTION (LLM/SEO) --- */
.social-btn:hover {
    border-color: var(--plasma) !important;
    color: var(--plasma) !important;
    background: rgba(0, 229, 255, 0.12) !important;
    transform: translateY(-3px) scale(1.03);
    box-shadow:
        0 8px 24px rgba(0, 229, 255, 0.2),
        0 3px 10px rgba(0, 0, 0, 0.35),
        inset 0 0 0 1px rgba(0, 229, 255, 0.3) !important;
}

.performance-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.desktop-stats {
    padding-right: 15px;
    border-right: 1px solid var(--ov-border);
}

/* --- MOBILE OVERRIDES (max-width: 768px) --- */
@media (max-width: 768px) {
    .performance-grid {
        grid-template-columns: 1fr;
    }

    .desktop-stats {
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid var(--ov-border);
        padding-bottom: 20px;
        margin-bottom: 5px;
    }


    .home-intro {
        font-size: 26px !important;
        margin-bottom: 5px !important;
    }

    #home h1 {
        font-size: 1.4rem !important;
    }

    #home h2 {
        font-size: 1rem !important;
        line-height: 1.4 !important;
        margin-bottom: 10px !important;
    }

    #home p {
        font-size: 0.75rem !important;
    }

    #home .glass-card {
        padding: 20px !important;
    }

    .fs-medium {
        font-size: 0.8rem !important;
    }

    .fs-large {
        font-size: 1rem !important;
    }
}

/* --- MISSION SECTION --- */
.social-btn:hover {
    border-color: var(--plasma) !important;
    color: var(--plasma) !important;
    background: rgba(0, 229, 255, 0.1) !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* --- FOOTER & SLIDESHOW STYLES --- */
.overlay-footer-copyright {
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid var(--ov-border);
    color: var(--ov-text-dim);
    font-size: 0.75rem;
    text-align: center;
    letter-spacing: 0.5px;
    line-height: 1.5;
    opacity: 0.8;
}

@media (max-width: 600px) {
    .overlay-footer-copyright {
        font-size: 0.65rem;
        margin-top: 30px;
    }
}

.hero-slideshow-container {
    position: relative;
    margin: 30px 0;
    z-index: 5;
}

.hero-slideshow {
    display: grid;
    grid-template-areas: 'stack';
    min-height: 250px;
    align-items: center;
}

.hero-slide {
    grid-area: stack;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s cubic-bezier(0.19, 1, 0.22, 1), transform 0.8s cubic-bezier(0.19, 1, 0.22, 1), filter 0.8s ease;
    transform: scale(1.02) translateY(10px);
    filter: blur(4px) saturate(0.8);
    width: 100%;
}

.hero-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 3;
    transform: scale(1) translateY(0);
    filter: blur(0) saturate(1);
}

.hero-slide.leaving {
    opacity: 0;
    z-index: 1;
    transform: scale(0.98) translateY(-5px);
    filter: blur(2px);
    visibility: visible;
}

/* Slide Content Layout */
.hero-slide-content {
    display: flex;
    flex-direction: row;
    gap: 30px;
    align-items: center;
    text-align: left;
}

.slide-text {
    flex: 1;
}

.text-plasma-color {
    color: var(--plasma) !important;
}


/* --- MOBILE OVERRIDES (max-width: 768px) --- */
@media (max-width: 768px) {
    .performance-grid {
        grid-template-columns: 1fr;
    }

    .desktop-stats {
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid var(--ov-border);
        padding-bottom: 20px;
        margin-bottom: 5px;
    }

    #home {
        padding-top: 20px !important;
    }

    .home-intro {
        font-size: 26px !important;
        margin-bottom: 5px !important;
    }

    #home h1 {
        font-size: 1.4rem !important;
    }

    #home h2 {
        font-size: 1rem !important;
        line-height: 1.4 !important;
        margin-bottom: 10px !important;
    }

    #home p {
        font-size: 0.75rem !important;
    }

    #home .glass-card {
        padding: 20px !important;
    }

    .fs-medium {
        font-size: 0.8rem !important;
    }

    .fs-large {
        font-size: 1rem !important;
    }
}

/* --- MISSION SECTION --- */
.social-btn:hover {
    border-color: var(--plasma) !important;
    color: var(--plasma) !important;
    background: rgba(0, 229, 255, 0.1) !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}


/* Slide Content Layout */
.hero-slide-content {
    display: flex;
    flex-direction: row;
    gap: 30px;
    align-items: center;
    text-align: left;
}

.slide-text {
    flex: 1;
}

.slide-visual {
    flex: 0 0 320px;
    text-align: center;
}

@media (max-width: 900px) {
    .hero-slide-content {
        flex-direction: column;
        text-align: left !important;
        align-items: flex-start !important;
    }

    .slide-visual {
        flex: 0 0 auto;
    }
}

.slideshow-dots {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 25px;
}

.slideshow-dots .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(127, 127, 127, 0.2);
    border: 2px solid rgba(127, 127, 127, 0.3);
    cursor: pointer;
    transition: all 0.4s;
}

.slideshow-dots .dot.active {
    width: 30px;
    border-radius: 6px;
    background: var(--plasma);
    border-color: var(--plasma);
    box-shadow: 0 0 15px var(--plasma);
}

/* --- LEGAL SECTION --- */
.legal-card {
    text-align: center;
}

.legal-muted {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.legal-btn {
    background: var(--plasma);
    color: var(--on-plasma);
    padding: 12px 30px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.95rem;
    display: inline-block;
    transition: transform 0.2s;
}

.legal-btn:hover {
    transform: scale(1.05);
}

.legal-err {
    color: #ff4444;
}

/* --- CRITICAL RESTORATION: Theme & Images --- */
html[data-theme='light'] .dark-mode-only {
    display: none !important;
}

html:not([data-theme='light']) .light-mode-only {
    display: none !important;
}

.theme-img {
    width: 100% !important;
    max-width: 320px !important;
    height: auto !important;
    object-fit: cover;
}

/* --- RESTORED SLIDESHOW STATUS --- */
.slideshow-status {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.7;
    padding: 5px 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

/* RESTORED SLIDESHOW STATUS WITH ICONS */
.slideshow-status::after {
    /* Default: Scrolling */
    content: '▶ Scrolling';
    font-weight: bold;
}

.hero-slideshow-container.paused .slideshow-status::after {
    content: '⏸ Pause';
}

.hero-slideshow-container.locked .slideshow-status::after {
    content: '🔒 Locked';
    color: var(--plasma);
    opacity: 1;
}

/* --- RESTORED AUDIT GRID --- */
.audit-grid-20 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px 10px;
    text-align: left;
    font-size: 0.65rem;
}

@media (min-width: 768px) {
    .audit-grid-20 {
        grid-template-columns: repeat(4, 1fr);
        font-size: 0.67rem;
    }
}


/* --- PROJECT PAGE SPECIFIC STYLES (Migrated from about.php) --- */
.tech-stack-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.tech-badge-mini {
    font-size: 0.65rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 6px;
    color: var(--text-muted);
    white-space: nowrap;
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* Status Pill - Unified Height */
.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    /* FIXED HEIGHT */
    min-width: 80px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    line-height: 1;
    /* Reset line-height */
}

.status-live {
    background: rgba(0, 229, 255, 0.1);
    color: var(--plasma);
    border: 1px solid rgba(0, 229, 255, 0.3);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.1);
}

.status-other,
.status-archive {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.status-dev {
    background: rgba(255, 171, 0, 0.1);
    color: #ffab00;
    border: 1px solid rgba(255, 171, 0, 0.3);
    box-shadow: 0 0 10px rgba(255, 171, 0, 0.1);
}

/* Light-mode: status pills need non-cyan backgrounds */
html[data-theme="light"] .status-live {
    background: rgba(26, 53, 145, 0.08);
    border-color: rgba(26, 53, 145, 0.3);
    box-shadow: 0 0 8px rgba(26, 53, 145, 0.08);
}

html[data-theme="light"] .status-dev {
    background: rgba(230, 81, 0, 0.08); /* Deep orange/amber for contrast */
    color: #e65100;
    border-color: rgba(230, 81, 0, 0.3);
    box-shadow: 0 0 8px rgba(230, 81, 0, 0.08);
}

html[data-theme="light"] .status-other,
html[data-theme="light"] .status-archive {
    background: rgba(0, 0, 0, 0.04);
    color: #555;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

/* Mobile Table Optimization */
@media (max-width: 768px) {
    .career-table thead {
        display: none;
        /* Hide headers on mobile */
    }

    .career-table tr {
        display: flex;
        flex-direction: column;
        background: var(--row-hover);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border: 1px solid var(--border);
        border-radius: 12px;
        margin-bottom: 15px;
        padding: 15px;
    }

    .career-table td {
        display: block;
        width: 100%;
        padding: 5px 0;
        border: none;
        text-align: left;
    }

    /* Adjust Status Alignment on Mobile */
    .career-table .text-center {
        text-align: left !important;
    }

    .career-table td center {
        display: none;
    }

    /* Kill any residual/injected centers */

    .status-pill {
        display: inline-flex;
        /* Maintain flex behavior */
        width: fit-content;
    }

    .chaos-item {
        background: var(--row-hover) !important;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    .skill-card {
        background: var(--row-hover) !important;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
}




/* --- FOOTER SPACER SYSTEM --- */
/* Always exactly 1 viewport height = full-screen simulation view */
.footer-spacer {
    display: block;
    width: 100%;
    height: 100vh;
    pointer-events: none;
}

/* --- DEFINITIVE CONSOLIDATED FOOTER & SOCIAL LINKS --- */
footer {
    text-align: center;
    padding: 8px 0 !important;
    margin-top: auto !important;
    /* STICKY FOOTER: Push to bottom of flex container */
    margin-bottom: 0px !important;
    color: var(--text) !important;
    font-size: 0.85rem;
    position: relative;
    z-index: 100;
    border-top: 1px solid var(--border);
    background: var(--bg) !important;
    width: 100%;
    box-sizing: border-box;
    display: block !important;
    flex-shrink: 0;
    /* Never shrink the footer */
}

.social-links {
    margin-bottom: 5px !important;
    display: flex;
    justify-content: center;
    gap: 20px !important;
}


.social-links a,
footer a {
    color: var(--text) !important;
    text-decoration: underline !important;
    font-weight: 600 !important;
    transition: all 0.2s ease;
    opacity: 0.8 !important;
    display: inline-block;
}

.social-links a:hover,
footer a:hover {
    color: var(--plasma) !important;
    opacity: 1 !important;
    transform: translateY(-2px);
}

/* A11y: Footer architecture button — native button semantics, visually matches social links */
.social-links-btn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-weight: 600 !important;
    color: var(--text) !important;
    text-decoration: underline;
    cursor: pointer;
    opacity: 0.8;
    display: inline-block;
    transition: all 0.2s ease;
}

.social-links-btn:hover {
    color: var(--plasma) !important;
    opacity: 1 !important;
    transform: translateY(-2px);
}

@media (max-width: 768px) {

    /* Removed conflicting 750px footer-spacer override (150px is handled earlier at L3909) */
    footer {
        padding: 11px 10px !important;
        margin-top: 2px !important;
        margin-bottom: 0px !important;
        font-size: 0.75rem;
        z-index: 50 !important;
        /* Keep footer below fixed engine controls. */
        position: relative !important;
        opacity: 1 !important;
        display: block !important;
    }

    .social-links {
        gap: 15px !important;
        margin-bottom: 15px !important;
    }
}

/* --- PHOTO TAB & UTILITY REFINEMENTS (CSP COMPLIANCE) --- */
.photo-tab-container .chaos-section-title {
    margin-top: 25px !important;
}

.gallery-doc-trigger {
    padding: 8px 18px !important;
}

.flex-center-gap-15 {
    margin-top: 20px !important;
    display: flex !important;
    gap: 15px !important;
    align-items: center !important;
}

.opacity-50 {
    opacity: 0.5 !important;
}

/* --- LAYOUT STABILITY FIXES (Scroll Offset Consistency) --- */
/* 1. Global Scroll Strategy (Standard Web Behavior) */
/* We scroll the WINDOW, not the container. This puts the scrollbar fully on the right. */
/* Prevents Double Scrollbars */
main {
    padding-top: 55px !important;
    /* Push internal content down */
    margin-top: 0 !important;
    /* Remove external push */
    height: auto !important;
    /* Let content grow */
    overflow: visible !important;
    /* No internal scrollbar */
    display: block !important;
    /* STICKY FOOTER: Grow to fill remaining body space (footer is now outside main) */
    flex: 1 0 auto;
}

/* 2. Standardize Section Spacing */
/* Ensures both 'Reload' and 'Nav Click' states have identical padding. */
section {
    padding-top: 20px !important;
    padding-left: 20px;
    padding-right: 20px;
    /* scroll-margin-top matches Header Height to ensure perfect scroll alignment */
    scroll-margin-top: 55px !important;
}

/* TAB CONTENT: Hide inactive tabs immediately on paint (prevents layout gap on force reload) */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* --- MOBILE SCROLL OFFSET TUNING --- */
@media (max-width: 768px) {

    #home,
    #about,
    #legal,
    section {
        scroll-margin-top: 75px !important;
        /* Header (55px) + 20px breathing room */
    }
}

/* --- PRINT STYLES (Audit Polish) --- */
@media print {

    /* Hide Navigation & Interactive Elements */
    nav,
    #docs-toggle,
    #themeToggle,
    .skip-link,
    #sim-hud,
    #chaos-stats,
    .hamburger,
    .doc-hint,
    .hero-slideshow-container,
    /* Slideshows don't print well */
    .theme-btn,
    .settings-btn,
    .cleanview-btn,
    /* settings button */
    #bg-canvas {
        display: none !important;
    }

    /* Reset Backgrounds & Colors for Paper */
    body,
    html,
    .glass-card,
    .tab-content,
    #about,
    #home,
    section {
        background: #ffffff !important;
        color: #000000 !important;
        box-shadow: none !important;
        border: none !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        /* Allow content to flow */
        height: auto !important;
    }

    /* Ensure Text is Readable */
    p,
    h1,
    h2,
    h3,
    li,
    td,
    th {
        color: #000000 !important;
        text-shadow: none !important;
        text-wrap: balance;
    }

    /* Expand Content */
    .project-card,
    .table-container {
        page-break-inside: avoid;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        margin-bottom: 20px !important;
    }

    /* Links: Underline for readability */
    a {
        text-decoration: underline !important;
        color: #000 !important;
    }
}

/* --- SEO OPTIMIZATION: UTILITY CLASSES (Cleaned) --- */
.noscript-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #ff4757;
    color: #fff;
    padding: 15px;
    text-align: center;
    font-family: sans-serif;
    font-weight: bold;
    z-index: 9999999;
}

#iris-vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    box-shadow: inset 0 0 20vmax rgba(0, 0, 0, 0.9);
    z-index: 999990;
    opacity: 1;
}

.overlay-spinner {
    text-align: center;
    padding: 50px;
    color: var(--plasma);
}

.text-error-centered {
    text-align: center;
    padding: 20px;
}

.cursor-pointer {
    cursor: pointer;
}

.border-none {
    border: none;
}

.system-msg-small {
    color: var(--plasma);
    font-size: 0.8rem;
}

/* =====================================================
   EXTRACTED: Legal Overlay (legal.php) & Architecture Overlay
   ===================================================== */
#legal-overlay,
#architecture-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--ov-backdrop, rgba(10, 10, 15, 0.85));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 20px 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#legal-overlay .overlay-inner-container,
#architecture-overlay .overlay-inner-container {
    width: 100%;
    max-width: 900px !important;
    padding: 30px 40px !important;
    position: relative;
}

#legal-overlay .overlay-glass-card,
#architecture-overlay .overlay-glass-card {
    border-radius: 20px !important;
    width: 100%;
    padding: 40px;
    box-sizing: border-box;
}

/* Match the project-docs overlay: the overlay frame owns the scrollbar, the card content scrolls with it. */
#architecture-overlay {
    height: 100dvh;
    inset: 0;
    width: auto;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--ov-accent, var(--plasma)) var(--ov-card, var(--bg));
}

#architecture-overlay::-webkit-scrollbar,
#orchestrator-overlay::-webkit-scrollbar {
    width: 6px;
}

#architecture-overlay::-webkit-scrollbar-track,
#orchestrator-overlay::-webkit-scrollbar-track {
    background: var(--ov-card, var(--bg));
}

#architecture-overlay::-webkit-scrollbar-thumb,
#orchestrator-overlay::-webkit-scrollbar-thumb {
    background: var(--ov-accent, var(--plasma));
    border-radius: 10px;
}

#architecture-overlay .overlay-inner-container {
    height: auto;
    max-height: none;
    display: block;
    overflow: visible;
    box-sizing: border-box;
}

#architecture-overlay .overlay-glass-card {
    max-height: none;
    overflow: visible;
}

@media (max-width: 800px) {

    #legal-overlay,
    #architecture-overlay {
        padding: 40px 0 80px 0;
    }

    #legal-overlay .overlay-inner-container,
    #architecture-overlay .overlay-inner-container {
        padding: 20px !important;
    }

    #architecture-overlay .overlay-glass-card {
        max-height: none;
    }
}

/* =====================================================
   EXTRACTED: About Section (about.php)
   ===================================================== */
.doc-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid var(--ov-border);
    color: var(--ov-text-dim);
    font-size: 12px;
    font-weight: 800;
    margin-left: 10px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    vertical-align: middle;
    background: var(--tab-inactive);
    -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
    .career-table tr:hover .doc-hint {
        border-color: var(--ov-accent);
        color: #fff;
        background: var(--ov-accent);
        transform: scale(1.25) rotate(360deg);
        box-shadow: 0 0 12px var(--ov-accent);
    }
}

.career-table tr,
.career-table a {
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.2s ease;
}

.career-table tr:active {
    background-color: rgba(255, 255, 255, 0.05);
}

.separator {
    border: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    margin: 25px 0;
}

.sec-subtitle {
    margin-top: 30px;
    color: var(--plasma);
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
}


/* =====================================================
   EXTRACTED: Skills Tab (skills.php)
   ===================================================== */
/* =====================================================
   SKILLS PAGE — Professional Animation Suite
   ===================================================== */

/* --- Keyframes --- */
@keyframes skill-bar-shimmer {
    0%   { background-position: -200% center; }
    100% { background-position:  200% center; }
}

@keyframes bar-lead-pulse {
    0%, 100% { box-shadow: 0 0 6px 2px rgba(0, 229, 255, 0.55); }
    50%       { box-shadow: 0 0 12px 4px rgba(0, 229, 255, 0.85); }
}

@keyframes category-slide-in {
    from {
        opacity: 0;
        transform: translateX(-18px);
        filter: blur(3px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
        filter: blur(0);
    }
}

@keyframes dot-pulse {
    0%, 100% { transform: scale(1);   opacity: 0.9; }
    50%       { transform: scale(1.4); opacity: 1;   }
}

/* Replaced by background-position variant below */

/* --- Layout --- */
.skills-wrapper {
    width: 100%;
    padding: 10px 0;
}

/* --- Category title: slide-in from left on .visible --- */
.category-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 25px 0 15px 0;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 2px;
    border-left: 3px solid var(--plasma);
    padding-left: 12px;
    opacity: 0;
    transform: translateX(-18px);
    filter: blur(3px);
    transition:
        opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
        filter 0.4s ease;
}

.category-title.visible {
    opacity: 1;
    transform: translateX(0);
    filter: blur(0);
}

/* --- Grid --- */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

/* --- Skill card base --- */
.skill-card {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--border);
    padding: 16px;
    border-radius: 12px;
    overflow: visible;   /* bubble floats above — must not be clipped */
    will-change: transform; /* GPU-promote for smooth lift */
    transition:
        transform 0.38s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.38s cubic-bezier(0.16, 1, 0.3, 1),
        border-color 0.25s ease,
        background 0.25s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    cursor: pointer;
}

/* Ultra-Premium Glass Sheen Ray (Dark Mode Base) */
.skill-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(
        110deg,
        transparent 25%,
        rgba(0, 229, 255, 0.02) 40%,
        rgba(0, 229, 255, 0.18) 48%,
        rgba(255, 255, 255, 0.45) 50%,      /* Intense bright core */
        rgba(0, 229, 255, 0.18) 52%,
        rgba(0, 229, 255, 0.02) 60%,
        transparent 75%
    );
    background-size: 300% 100%;
    background-position: -200% center;
    border-radius: inherit;
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: color-dodge;
}

/* Light Mode Override: High-end specular glare */
html[data-theme="light"] .skill-card::before {
    background-image: linear-gradient(
        110deg,
        transparent 35%,
        color-mix(in srgb, var(--plasma) 5%, transparent) 46%,
        rgba(255, 255, 255, 0.95) 50%,    /* Crisp, opaque white specular flash */
        color-mix(in srgb, var(--plasma) 5%, transparent) 54%,
        transparent 65%
    );
    mix-blend-mode: normal;
}

@keyframes card-ray {
    0%   { background-position: -200% center; opacity: 0; }
    5%   { opacity: 1; }
    95%  { opacity: 1; }
    100% { background-position: 200% center; opacity: 0; }
}

.skill-card:hover::before {
    animation: card-ray 3.5s ease-in-out forwards;
}

/* ── Thought-bubble — floats ABOVE the card, bottom edge = card top edge ── */
.skill-hover-label {
    position: absolute;
    bottom: calc(100% + 10px);   /* sit just above the card */
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    min-width: 140px;
    max-width: 240px;
    background: linear-gradient(
        140deg,
        color-mix(in srgb, var(--plasma, #00e5ff) 20%, #0a0a1a 80%),
        color-mix(in srgb, var(--plasma, #00e5ff) 8%, #111827 92%)
    );
    border: 1px solid rgba(0, 229, 255, 0.28);
    border-radius: 10px;
    padding: 9px 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    z-index: 100;
    box-shadow:
        0 6px 24px rgba(0, 0, 0, 0.45),
        0 0 14px rgba(0, 229, 255, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition:
        opacity 0.22s ease,
        transform 0.22s ease;
}

/* Downward pointing caret so the bubble "points" to the card */
.skill-hover-label::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 7px solid transparent;
    border-top-color: color-mix(in srgb, var(--plasma, #00e5ff) 20%, #0a0a1a 80%);
}

.skill-hover-label .hover-desc {
    font-size: 0.76rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.4;
    text-align: center;
    white-space: normal;
}

/* Hover state — card lifts, bubble fades in */
.skill-card:hover {
    transform: translateY(-7px) scale(1.022);
    border-color: var(--plasma);
    z-index: 10;
    box-shadow:
        0 20px 48px rgba(0, 229, 255, 0.22),
        0 6px 16px rgba(0, 0, 0, 0.35),
        inset 0 0 0 1px rgba(0, 229, 255, 0.3);
}

.skill-card:hover .skill-hover-label {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* grids need overflow:visible so the above-card bubble isn't clipped */
.skills-grid,
.skill-category {
    overflow: visible !important;
}



/* --- Proficiency tier dot (injected by JS) --- */
.skill-tier-dot {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    animation: dot-pulse 2.8s ease-in-out infinite;
}

.skill-tier-dot.tier-gold {
    background: #f5a623;
    box-shadow: 0 0 6px 2px rgba(245, 166, 35, 0.6);
}

.skill-tier-dot.tier-cyan {
    background: var(--plasma, #00e5ff);
    box-shadow: 0 0 6px 2px rgba(0, 229, 255, 0.55);
}

.skill-tier-dot.tier-muted {
    background: var(--muted, #666);
    box-shadow: none;
    animation: none;
    opacity: 0.5;
}

/* --- Row layout --- */
.skill-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-right: 18px; /* make room for dot */
}

.skill-label {
    font-weight: 600;
    font-size: 0.93rem;
    display: flex;
    align-items: center;
    color: var(--text);
}

.info-trigger {
    /* Reset button UA styles */
    appearance: none;
    -webkit-appearance: none;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    /* Minimum 32×32px touch target (WCAG 2.5.5) */
    min-width: 32px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* Visual styling */
    margin-left: 4px;
    font-size: 0.72rem;
    opacity: 0.55;
    cursor: help;
    color: var(--plasma);
    transition: opacity 0.2s;
    border-radius: 50%;
}
.info-trigger:focus-visible {
    outline: 2px solid var(--plasma);
    outline-offset: 2px;
    opacity: 1;
}
.skill-card:hover .info-trigger { opacity: 1; }

/* --- Percentage counter --- */
.skill-pct {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--plasma);
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.4s 0.6s ease, transform 0.4s 0.6s ease;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.skill-card.visible .skill-pct {
    opacity: 0.9;
    transform: translateY(0);
}

/* --- Bar track --- */
.bar-container {
    background: var(--track-bg);
    height: 5px;
    border-radius: 10px;
    overflow: visible;
    position: relative;
}

/* --- Bar fill: shimmer gradient + spring easing --- */
.bar-fill {
    height: 100%;
    border-radius: 10px;
    width: 0%;
    position: relative;
    background:
        linear-gradient(
            90deg,
            var(--plasma) 0%,
            color-mix(in srgb, var(--plasma) 60%, #fff) 30%,
            var(--plasma) 55%,
            color-mix(in srgb, var(--plasma) 75%, #7b2fff) 100%
        );
    background-size: 300% 100%;
    transition: width 1.1s cubic-bezier(0.34, 1.28, 0.64, 1);
    box-shadow: none;
}

/* Pulsing lead-edge glow — pseudo-element sits at the right end */
.bar-fill::after {
    content: '';
    position: absolute;
    top: -3px;
    right: -1px;
    width: 6px;
    height: 11px;
    border-radius: 50%;
    background: var(--plasma);
    box-shadow: 0 0 6px 2px rgba(0, 229, 255, 0.55);
    opacity: 0;
    transition: opacity 0.3s 0.9s;
}

.bar-fill.v-visible {
    width: var(--skill-width, var(--target-width, 0%));
    animation: skill-bar-shimmer 2.8s linear 1.2s infinite;
}

.bar-fill.v-visible::after {
    opacity: 1;
    animation: bar-lead-pulse 1.8s 1.2s ease-in-out infinite;
}

/* --- Tooltip --- */
.custom-tooltip {
    visibility: hidden;
    width: 230px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--plasma) 80%, #000), color-mix(in srgb, var(--plasma) 60%, #0a0a1a));
    color: #fff;
    text-align: left;
    border-radius: 8px;
    padding: 11px 13px;
    position: absolute;
    z-index: 99;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%) translateY(6px) scale(0.97);
    opacity: 0;
    transition:
        opacity 0.12s ease-in,
        transform 0.12s ease-in,
        visibility 0s 0.12s;
    font-size: 0.79rem;
    line-height: 1.45;
    pointer-events: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 229, 255, 0.25);
}

.custom-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: color-mix(in srgb, var(--plasma) 80%, #000) transparent transparent transparent;
}

.skill-card:hover .custom-tooltip {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
    transition:
        opacity 0.25s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
        visibility 0s 0s; /* enter: spring in, exit (above): snap out */
}

/* =====================================================
   EXTRACTED: Photography Tab (photo.php)
   ===================================================== */
.chaos-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.chaos-item {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: #111;
    border-radius: 4px;
    border: 1px solid #333;
    user-select: none;
}

html[data-theme="light"] .chaos-item {
    background: #e8e8e8;
    border-color: #ccc;
}

.gallery-hint {
    opacity: 0.7;
}

.chaos-item::after {
    content: "©Felix Bourier";
    position: absolute;
    bottom: 10px;
    left: 10px;
    font-size: 0.6rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 8px;
    border-radius: 10px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.chaos-item:hover::after {
    opacity: 0.9;
}

.chaos-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s ease;
    filter: brightness(0.95) contrast(1);
}

.chaos-item:hover .chaos-img {
    transform: scale(1.06);
    filter: brightness(1.05) contrast(1.05);
}

.chaos-desc-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    box-sizing: border-box;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0) 100%);
    color: #fff;
    padding: 20px 10px 12px 10px;
    font-size: 0.85rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 4;
    text-align: center;
    display: flex;
    justify-content: center;
}

.chaos-item:hover .chaos-desc-layer {
    opacity: 1;
    transform: translateY(0);
}

.chaos-grid-dl {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    border-radius: 50%;
    text-decoration: none;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease;
    z-index: 10;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.chaos-item:hover .chaos-grid-dl {
    opacity: 0.75;
    transform: scale(1);
}

.chaos-grid-dl:hover {
    opacity: 1 !important;
    background: rgba(0, 0, 0, 0.75);
}

/* Light mode: invert the button tint */
html[data-theme="light"] .chaos-grid-dl {
    background: rgba(255, 255, 255, 0.6);
    color: #222;
}

html[data-theme="light"] .chaos-grid-dl:hover {
    background: rgba(255, 255, 255, 0.85);
}

.fancybox__caption {
    text-align: center !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    z-index: 99999;
}

/* Lightbox toolbar download icon (.fb-wm-dl) */
.fb-wm-dl { color: var(--plasma, #00d4ff) !important; }
.fb-wm-dl:hover { background: rgba(0, 212, 255, 0.15) !important; }
html[data-theme="light"] .fb-wm-dl { color: #0044ff !important; }
html[data-theme="light"] .fb-wm-dl:hover { background: rgba(0, 68, 255, 0.10) !important; }

.fancy-dl-btn {
    display: inline-flex; align-items: center; margin: 10px auto 0;
    background: transparent; color: var(--plasma, #00d4ff);
    padding: 5px 14px; text-decoration: none; font-size: 0.78rem;
    font-weight: 600; border: 1px solid currentColor; border-radius: 20px;
    transition: all 0.2s; position: relative; z-index: 100000;
}
.fancy-dl-btn:hover {
    background: var(--plasma, #00d4ff) !important;
    color: #000 !important; transform: translateY(-1px);
}

.fancybox__content {
    position: relative;
}

.fancybox__content img {
    pointer-events: none !important;
    user-select: none !important;
}

.chaos-section-title {
    display: block;
    width: 100%;
    margin-top: 50px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
    color: var(--plasma);
    text-transform: uppercase;
    letter-spacing: 3px;
    font-size: 1.4rem;
    font-weight: bold;
    clear: both;
}

@media (max-width: 768px) {
    .fancybox__slide {
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 60px 0 !important;
    }

    .fancybox__caption {
        order: -1;
        position: relative !important;
        width: 100% !important;
        padding: 15px 10px !important;
        font-size: 0.85rem !important;
        max-height: 30vh;
        overflow-y: auto;
        background: linear-gradient(to bottom, rgba(0, 0, 0, 0.85) 0%, transparent 100%) !important;
        margin-bottom: 0px !important;
    }

    html[data-theme="light"] .fancybox__caption {
        background: linear-gradient(to bottom, rgba(255, 255, 255, 0.95) 0%, transparent 100%) !important;
    }

    .fancybox__content {
        margin-top: 0 !important;
    }

    .fancy-dl-btn {
        margin-top: 12px !important;
        padding: 8px 16px !important;
        font-size: 0.75rem !important;
    }

    .fancybox__footer {
        background: none !important;
    }
}

html[data-theme="light"] .fancybox__backdrop {
    background: rgba(255, 255, 255, 0.95) !important;
}

html[data-theme="light"] .fancybox__caption {
    color: #111 !important;
    text-shadow: none !important;
}

html[data-theme="light"] .fancybox__nav,
html[data-theme="light"] .fancybox__toolbar {
    --f-button-color: #000;
    --f-button-bg: rgba(0, 0, 0, 0.05);
    --f-button-hover-bg: rgba(0, 0, 0, 0.1);
    --f-button-svg-filter: none;
}

html[data-theme="light"] .fancybox__button {
    color: #000 !important;
}

html[data-theme="light"] .fancybox__thumbs {
    background: rgba(255, 255, 255, 0.95) !important;
    border-left: 1px solid #ddd !important;
}

html[data-theme="light"] .fancybox__thumb {
    border-color: rgba(0, 0, 0, 0.1) !important;
}

html[data-theme="light"] .is-nav-selected .fancybox__thumb {
    border-color: #0044ff !important;
    box-shadow: 0 0 10px rgba(0, 68, 255, 0.2);
}

html[data-theme="light"] .fancybox__progress {
    background: #0044ff !important;
}

html[data-theme="light"] .fancybox__counter {
    color: #000 !important;
}

html[data-theme="light"] .fancy-dl-btn {
    color: #0044ff !important; border-color: #0044ff !important;
}
@media (max-width: 768px) {
    .fancybox__slide { display: flex; flex-direction: column; justify-content: center; padding: 50px 0 0 !important; }
    .fancybox__caption {
        order: -1; position: relative !important; width: 100% !important;
        padding: 10px 12px !important; font-size: 0.82rem !important;
        max-height: 25vh; overflow-y: auto; margin-bottom: 0 !important; text-align: center;
        background: linear-gradient(to bottom, rgba(0,0,0,0.85) 0%, transparent 100%) !important;
    }
    html[data-theme="light"] .fancybox__caption { background: linear-gradient(to bottom, rgba(255,255,255,0.95) 0%, transparent 100%) !important; }
    .fancybox__content { margin-top: 0 !important; }
    .fancybox__footer { background: none !important; }
    .fancybox__toolbar .f-button { min-width: 36px !important; min-height: 36px !important; padding: 0 4px !important; }
    .fancybox__toolbar .f-button svg { width: 18px !important; height: 18px !important; }
    .fancybox__toolbar .f-button--fullscreen,
    .fancybox__toolbar .f-button--slideshow { display: none !important; }
    .fancybox__thumbs { max-height: 62px !important; }
    .fancybox__thumb { height: 54px !important; width: 54px !important; }
    .chaos-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
    .chaos-section-title { font-size: 1.1rem !important; letter-spacing: 2px !important; }
    .fancy-dl-btn { margin-top: 10px !important; padding: 5px 12px !important; font-size: 0.73rem !important; }
}



/* =====================================================
   GALLERY SKELETON LOADING
   ===================================================== */
.gallery-skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, #1a1a2e 8%, #16213e 18%, #1a1a2e 33%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s linear infinite;
    z-index: 1;
}

html[data-theme="light"] .gallery-skeleton {
    background: linear-gradient(110deg, #e8e8e8 8%, #f5f5f5 18%, #e8e8e8 33%);
    background-size: 200% 100%;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.chaos-img.loaded~.gallery-skeleton {
    display: none;
}

/* =====================================================
   EXTRACTED: Legal Overlay (legal.php)
   ===================================================== */
#legal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--ov-backdrop, rgba(10, 10, 15, 0.85));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 20px 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#legal-overlay .overlay-inner-container {
    width: 100%;
    max-width: 900px !important;
    padding: 80px 40px !important;
    position: relative;
}

#legal-overlay .overlay-glass-card {
    border-radius: 20px !important;
    width: 100%;
    padding: 40px;
    box-sizing: border-box;
}

@media (max-width: 800px) {
    #legal-overlay {
        padding: 40px 0 80px 0;
    }

    #legal-overlay .overlay-inner-container {
        padding: 20px !important;
    }
}

/* =====================================================
   EXTRACTED: About Section (about.php)
   ===================================================== */
.doc-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid var(--ov-border);
    color: var(--ov-text-dim);
    font-size: 12px;
    font-weight: 800;
    margin-left: 10px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    vertical-align: middle;
    background: var(--tab-inactive);
    -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
    .career-table tr:hover .doc-hint {
        border-color: var(--ov-accent);
        color: #fff;
        background: var(--ov-accent);
        transform: scale(1.25) rotate(360deg);
        box-shadow: 0 0 12px var(--ov-accent);
    }
}

.career-table tr,
.career-table a {
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.2s ease;
}

.career-table tr:active {
    background-color: rgba(255, 255, 255, 0.05);
}

.separator {
    border: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    margin: 25px 0;
}

.sec-subtitle {
    margin-top: 30px;
    color: var(--plasma);
    border-bottom: 1px solid var(--border);
    padding-bottom: 5px;
}


/* FIX: Remove focus outline from project wrapper (Programmatic focus shouldn't show ring) */
.project-page-wrapper:focus,
.project-page-wrapper:focus-visible {
    outline: none !important;
}

/* REMOVED: duplicate skills section — styles now in the primary block above */

/* --- STICKY FOOTER & LAYOUT FIX REVERTED --- */

/* =====================================================
   SKELETON LOADERS (Glassmorphism)
   ===================================================== */
@keyframes skeleton-pulse {
    0% {
        opacity: 0.3;
    }

    50% {
        opacity: 0.6;
    }

    100% {
        opacity: 0.3;
    }
}

.skeleton-wrapper {
    width: 100%;
    max-width: 1200px;
    /* Match standard max-width */
    margin: 0 auto;
    padding: 20px;
    animation: skeleton-pulse 1.5s infinite ease-in-out;
}

/* Mimic .glass-card exactly */
.skeleton-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    /* Match project-page-wrapper radius often used */
    padding: 30px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* --- Chaos Events Notification System --- */
#chaos-event-notifications {
    position: fixed;
    bottom: 72px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999999;
    pointer-events: none;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 8px;
}

.event-notification {
    pointer-events: auto;
    padding: 12px 16px;
    border-radius: 12px;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(12px);
    width: 320px;
    height: 90px;
    overflow: hidden;
    box-sizing: border-box;
    border-width: 2px;
    border-style: solid;
}

/* Status: Visible */
.event-notification.show {
    opacity: 1;
    transform: translateY(0);
}

/* Theme Defaults */
[data-theme="dark"] .event-notification {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    color: #fff;
}

[data-theme="light"] .event-notification {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.05);
    color: #111;
}

/* Rarity: COMMON */
.event-notification[data-rarity="common"] {
    border-color: #22c55e;
    background: linear-gradient(135deg, #062006 0%, #020c02 100%);
}

.event-tier-common {
    color: #4ade80;
}

[data-theme="light"] .event-notification[data-rarity="common"] {
    border-color: #4ade80;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

[data-theme="light"] .event-tier-common {
    color: #15803d;
}

/* Rarity: UNCOMMON */
.event-notification[data-rarity="uncommon"] {
    border-color: #00c3d0;
    background: linear-gradient(135deg, #001a1c 0%, #000c0d 100%);
}

.event-tier-uncommon {
    color: #00f2ff;
}

[data-theme="light"] .event-notification[data-rarity="uncommon"] {
    border-color: #0ea5e9;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

[data-theme="light"] .event-tier-uncommon {
    color: #0369a1;
}

/* Rarity: RARE */
.event-notification[data-rarity="rare"] {
    border-color: #4f46e5;
    background: linear-gradient(135deg, #1e1b4b 0%, #100e2b 100%);
}

.event-tier-rare {
    color: #6366f1;
}

[data-theme="light"] .event-notification[data-rarity="rare"] {
    border-color: #6366f1;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
}

[data-theme="light"] .event-tier-rare {
    color: #4338ca;
}

/* Rarity: EPIC */
.event-notification[data-rarity="epic"] {
    border-color: #ea580c;
    background: linear-gradient(135deg, #2e1a0a 0%, #1f0d05 100%);
}

.event-tier-epic {
    color: #f97316;
}

[data-theme="light"] .event-notification[data-rarity="epic"] {
    border-color: #f97316;
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
}

[data-theme="light"] .event-tier-epic {
    color: #c2410c;
}

/* Rarity: MYTHIC */
.event-notification[data-rarity="mythic"] {
    border-color: #d92626;
    background: linear-gradient(135deg, #2e0505 0%, #1a0202 100%);
}

.event-tier-mythic {
    color: #ff3b3b;
}

[data-theme="light"] .event-notification[data-rarity="mythic"] {
    border-color: #ef4444;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

[data-theme="light"] .event-tier-mythic {
    color: #b91c1c;
}

/* Rarity: TRANSCENDENT */
.event-notification[data-rarity="transcendent"] {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #2e2405 0%, #1a1402 100%);
}

.event-tier-transcendent {
    color: #fbbf24;
}

[data-theme="light"] .event-notification[data-rarity="transcendent"] {
    border-color: #eab308;
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
}

[data-theme="light"] .event-tier-transcendent {
    color: #a16207;
}

/* Rarity: COSMIC */
.event-notification[data-rarity="cosmic"] {
    border-color: #d946ef;
    background: linear-gradient(135deg, #300130 0%, #1a011a 100%);
}

.event-tier-cosmic {
    color: #ff00ff;
}

[data-theme="light"] .event-notification[data-rarity="cosmic"] {
    border-color: #d946ef;
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
}

[data-theme="light"] .event-tier-cosmic {
    color: #a21caf;
}

/* Rarity: SYSTEM */
.event-notification[data-rarity="system"] {
    border-color: #888;
    background: #333;
}

.event-tier-system {
    color: #888;
}

[data-theme="light"] .event-notification[data-rarity="system"] {
    border-color: #888;
    background: #eee;
}

[data-theme="light"] .event-tier-system {
    color: #555;
}

/* Notification Inner Components */
.event-icon-box {
    font-size: 32px;
    min-width: 40px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.event-content-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    flex: 1;
    overflow: hidden;
}

.event-name-box {
    font-weight: 800;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.event-desc-box {
    opacity: 0.8;
    margin-top: 2px;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    width: 100%;
}

.event-tier-box {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

/* Text Scaling Utilities */
.fns-14 {
    font-size: 14px !important;
}

.fns-12 {
    font-size: 12px !important;
}

.fns-11 {
    font-size: 11px !important;
}

.fns-10 {
    font-size: 10px !important;
}

.fns-9 {
    font-size: 9px !important;
}

.bg-canvas-fixed {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.flex-row-center-gap-20-wrap {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* --- CSP-Safe Dynamic Styling --- */
.category-bar-fill {
    width: var(--skill-width, 0%);
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.tier-badge {
    background-color: color-mix(in srgb, var(--badge-color, #888) 13.5%, transparent);
    color: var(--badge-color, #888);
    border: 1px solid var(--badge-color, #888);
}

.o-0-3 {
    opacity: 0.3 !important;
}

.skeleton-container {
    max-width: 900px;
    margin: 40px auto;
    text-align: center;
    color: var(--text-muted);
}

.skeleton-header {
    height: 180px;
    /* Title area */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

.skeleton-content {
    height: 500px;
    /* Main content area */
}

/* Fake Text Bars */
.skeleton-text {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    width: 100%;
    height: 1em;
}

.skeleton-title {
    width: 60%;
    height: 2.5em;
    /* Large Title */
    background: rgba(255, 255, 255, 0.15);
    margin-bottom: 15px;
}

.skeleton-subtitle {
    width: 40%;
    height: 1.2em;
}


/* =========================================================================
   CSP UTILITIES: Use classes instead of inline .style manipulation
========================================================================= */
.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}


.v-hidden {
    visibility: hidden !important;
}

.v-visible {
    visibility: visible !important;
}

.o-0 {
    opacity: 0 !important;
}

.o-1 {
    opacity: 1 !important;
}

.pe-none {
    pointer-events: none !important;
}

.pe-auto {
    pointer-events: auto !important;
}

.pos-abs {
    position: absolute !important;
}

.pos-fixed {
    position: fixed !important;
}

.l-0 {
    left: 0 !important;
}

.t-0 {
    top: 0 !important;
}

.w-100 {
    width: 100% !important;
}

.h-100 {
    height: 100% !important;
}

.z-neg-1 {
    z-index: -1 !important;
}

.z-hud {
    z-index: 10000 !important;
}

/* Dynamic position & spacing helpers */
.pos-below-nav {
    top: var(--nav-height, 55px) !important;
}

.mt-20 {
    margin-top: 20px !important;
}

.mb-10 {
    margin-bottom: 10px !important;
}

.mb-20 {
    margin-bottom: 20px !important;
}

.mb-30 {
    margin-bottom: 30px !important;
}

.p-40 {
    padding: 40px !important;
}


.fs-1-1 {
    font-size: 1.1rem !important;
}

.fs-0-7 {
    font-size: 0.7rem !important;
}

.fs-0-8 {
    font-size: 0.8rem !important;
}

.fs-0-9 {
    font-size: 0.9rem !important;
}

/* Event Tiers */
.text-hard {
    color: #c084fc !important;
}

.text-very-hard {
    color: #f97316 !important;
}

/* Layout Helpers */
.mt-40 {
    margin-top: 40px !important;
}

.mt-10 {
    margin-top: 10px !important;
}

.pt-20 {
    padding-top: 20px !important;
}

.max-w-900 {
    max-width: 900px !important;
}

.mx-auto {
    margin-left: auto !important;
    margin-right: auto !important;
}

.bt-rgba-white-01 {
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.grid-2-col {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
}

/* Documentation Overlay specific utilities */
.ov-header-block {
    border-bottom: 1px solid var(--ov-border);
    padding-bottom: 25px;
    margin-bottom: 30px;
    text-align: center;
}

.ov-tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    width: 100%;
}

.ov-desc-text {
    font-size: 1.1rem;
    margin-bottom: 30px;
    font-weight: 300;
    text-align: center;
}

.ov-error-container {
    text-align: center;
    padding: 40px;
    color: var(--ov-text);
}

.ov-error-title {
    color: #ff6b6b;
    margin-bottom: 10px;
}

.ov-btn-secondary {
    background: transparent;
    border: 1px solid var(--ov-border);
    color: var(--ov-text);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.ov-btn-secondary:hover {
    background: var(--ov-border);
}

/* -----------------------------------------------
   TABLET LANDSCAPE OPTIMIZATION
   Targets iPads and Android tablets held sideways.
   Adjusts layout grids and content widths for the
   wider-but-shorter viewport shape.
   ----------------------------------------------- */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
    .glass-card {
        max-width: 85vw;
    }

    .hero-slide-content {
        flex-direction: row;
        gap: 30px;
    }

    .slide-visual {
        max-width: 280px;
        flex-shrink: 0;
    }

    .performance-grid {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }

    .audit-grid-20 {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    .glass-card {
        padding: 15px 20px;
    }

    .hero-slideshow-container {
        max-height: 60vh;
        overflow-y: auto;
    }

    .slide-visual {
        display: none;
    }

    .nav-links {
        gap: 20px;
    }
}

/* ============================================================
   SCROLL REVEAL ANIMATIONS
   Lightweight, CSP-safe. JS adds .visible via IntersectionObserver.
   Uses spring-like cubic-bezier (overshoot feel without JS spring).
   ============================================================ */

/* Base hidden state */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    filter: blur(5px);
    transition:
        opacity 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
        transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
        filter 0.45s ease;
    will-change: opacity, transform, filter;
}

/* Visible (intersection triggered) */
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

/* === Stagger delays for child items in a reveal container === */
.reveal-group .reveal:nth-child(1) {
    transition-delay: 0.00s;
}

.reveal-group .reveal:nth-child(2) {
    transition-delay: 0.06s;
}

.reveal-group .reveal:nth-child(3) {
    transition-delay: 0.12s;
}

.reveal-group .reveal:nth-child(4) {
    transition-delay: 0.18s;
}

.reveal-group .reveal:nth-child(5) {
    transition-delay: 0.24s;
}

.reveal-group .reveal:nth-child(6) {
    transition-delay: 0.30s;
}

.reveal-group .reveal:nth-child(7) {
    transition-delay: 0.36s;
}

.reveal-group .reveal:nth-child(8) {
    transition-delay: 0.42s;
}

.reveal-group .reveal:nth-child(n+9) {
    transition-delay: 0.48s;
}

/* === Slide-from-left variant for list items === */
.reveal-left {
    opacity: 0;
    transform: translateX(-20px);
    filter: blur(3px);
    transition:
        opacity 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
        transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
        filter 0.4s ease;
    will-change: opacity, transform, filter;
}

.reveal-left.visible {
    opacity: 1;
    transform: translateX(0);
    filter: blur(0);
}

/* Table row reveal rules are defined later in the file (translateY only — no horizontal overflow) */

/* === Photo grid items === */
.chaos-item {
    opacity: 0;
    transform: scale(0.96) translateY(12px);
    filter: blur(5px);
    transition:
        opacity 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
        transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
        filter 0.4s ease;
    will-change: opacity, transform, filter;
}

.chaos-item.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
}

/* === Skill cards === */
.skill-card {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(4px);
    transition:
        opacity 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
        transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
        filter 0.38s ease;
    will-change: opacity, transform, filter;
}

.skill-card.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* === Script items (ChaosScript repository list) ===
   .script-item.reveal merges with the existing hover transition. */
.script-item.reveal {
    transform: translateX(-16px);
    opacity: 0;
}

.script-item.reveal.visible {
    opacity: 1;
    transform: translateX(0);
}

/* === Respect reduced motion preference === */
@media (prefers-reduced-motion: reduce) {

    .reveal,
    .reveal-left,
    .script-item.reveal,
    .projects-table tbody tr,
    .career-table tbody tr,
    .chaos-item,
    .skill-card {
        transition: opacity 0.2s ease !important;
        transform: none !important;
        filter: none !important;
    }
}

/* ============================================================
   SCROLL PROGRESS BAR
   A 2px accent line at the top of the page that grows as the
   user scrolls. Injected via JS into <body>.
   ============================================================ */
#scroll-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: linear-gradient(90deg, var(--plasma) 0%, var(--accent) 100%);
    z-index: 99999;
    pointer-events: none;
    transition: width 0.08s linear;
    box-shadow: 0 0 8px var(--plasma);
}

/* ============================================================
   SCROLL REVEAL — blur-in rack-focus pattern
   .chaos-item         → observed-only (JS stamps delay, adds .visible)
   .reveal             → generic (JS adds class + .visible)
   transitionDelay is set inline by the diagonal-wave stagger in
   ui-core-org.js — these rules must NOT set their own delay.
   ============================================================ */

/* --- hidden state: chaos-item gets a stronger blur-in (photo grid)
       .reveal uses a lighter departure so other elements aren't over-dramatic --- */
.chaos-item {
    opacity: 0;
    transform: scale(0.88) translateY(40px);
    filter: blur(20px);
    /* longer per-item transition — more dramatic rise-into-focus per wave tier */
    transition:
        opacity   0.6s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.6s cubic-bezier(0.22, 1, 0.36, 1),
        filter    0.5s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform, filter;
}

.reveal {
    opacity: 0;
    transform: translateY(18px);
    filter: blur(5px);
    transition:
        opacity   0.45s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
        filter    0.45s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform, filter;
}

/* --- visible state: item fully resolved --- */
.chaos-item.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

/* --- table rows: lighter lift, no blur (layout-safe) --- */
.career-table tbody tr,
.projects-table tbody tr {
    opacity: 0;
    transform: translateY(10px);
    transition:
        opacity   0.35s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform;
}

.career-table tbody tr.visible,
.projects-table tbody tr.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- skill-cards: same blur-in as chaos-item --- */
.skill-card {
    opacity: 0;
    transform: translateY(14px);
    filter: blur(4px);
    transition:
        opacity   0.40s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.40s cubic-bezier(0.22, 1, 0.36, 1),
        filter    0.40s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform, filter;
}

.skill-card.visible {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

/* reduced-motion: collapse all animation durations (global rule
   at top of file already covers * — this is belt-and-suspenders
   for will-change elements that get their own transition) */
@media (prefers-reduced-motion: reduce) {
    .chaos-item,
    .reveal,
    .chaos-item.visible,
    .reveal.visible,
    .skill-card,
    .skill-card.visible,
    .career-table tbody tr,
    .projects-table tbody tr {
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
    }
}

/* =====================================================================
   SCROLL PROGRESS BAR
   Fixed 2px strip at the very top of the viewport.
   Width is driven by JS (scroll listener in ui-core-org.js).
   ===================================================================== */
#scroll-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(
        90deg,
        #00b8d9 0%,
        var(--plasma) 40%,
        #7b61ff 80%,
        #00e5ff 100%
    );
    z-index: 99999;
    pointer-events: none;
    /* vivid glow — visible even on bright backgrounds */
    box-shadow:
        0 0 10px rgba(0, 229, 255, 0.9),
        0 0 22px rgba(0, 229, 255, 0.4),
        0 2px 6px rgba(0, 0, 0, 0.3);
    will-change: width;
    transition: width 0.08s linear;
    border-radius: 0 3px 3px 0;
}

/* =====================================================================
   VIEW TRANSITIONS API — speed override
   Browser default cross-fade is ~250 ms which adds perceived latency.
   Clamped to 80 ms: fast enough to feel instant, slow enough to be
   a smooth visual cue. The prefers-reduced-motion block above already
   sets animation: none !important for users who need it.
   ===================================================================== */
::view-transition-old(root) {
    animation: vt-exit 0.15s cubic-bezier(0.4, 0, 1, 1) both;
}
::view-transition-new(root) {
    animation: vt-enter 0.22s cubic-bezier(0, 0, 0.2, 1) both;
}
@keyframes vt-exit {
    to { opacity: 0; transform: translateY(-5px); }
}
@keyframes vt-enter {
    from { opacity: 0; transform: translateY(7px); }
}

/* Suppress any JS-injected duplicate hover overlay */
.skill-hover-label { display: none !important; }

/* =====================================================================
   ACCESSIBILITY UTILITIES
   ===================================================================== */
/* Visually hidden but available to screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* --- Breadcrumb Navigation (project detail pages) --- */
.project-breadcrumb {
    padding: 8px 0 12px;
    font-size: 0.8rem;
    opacity: 0.65;
    /* Prevent view-transition name collision with main nav */
    view-transition-name: none !important;
}
.project-breadcrumb ol {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.project-breadcrumb a {
    color: var(--accent, #00e5ff);
    text-decoration: none;
}
.project-breadcrumb a:hover {
    text-decoration: underline;
}
.project-breadcrumb .breadcrumb-sep {
    color: var(--text-muted, rgba(255,255,255,0.35));
}

/* ─── VIEW TRANSITIONS — anti-shake fix ──────────────────────────────────────
 * The browser's default MPA view transition captures two full-page screenshots
 * and morphs them. When tabs have different content heights the glass card
 * appears to "jump". Override to a pure opacity cross-fade: hold both snapshots
 * fixed at the top of the viewport so there is zero positional shift.
 * The fade is kept deliberately short (180 ms) so it feels snappy.
 * ──────────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation-duration: 180ms;
        animation-timing-function: ease;
        /* kill any browser-default transform/morph */
        transform: none !important;
        /* anchor at the top so both snapshots align */
        inset-block-start: 0;
        object-position: top;
        mix-blend-mode: normal;
    }
    ::view-transition-old(root) {
        animation-name: vt-fade-out;
    }
    ::view-transition-new(root) {
        animation-name: vt-fade-in;
    }
    @keyframes vt-fade-out {
        from { opacity: 1; }
        to   { opacity: 0; }
    }
    @keyframes vt-fade-in {
        from { opacity: 0; }
        to   { opacity: 1; }
    }
}
/* Fancybox: Toolbar above canvas UI (z-index + visibility fix) */
.fancybox__toolbar {
    z-index: 1000001 !important;
    opacity: 1 !important;
    pointer-events: all !important;
}

/* Fancybox: Thumbs at TOP of viewer */
/* .fancybox__container is display:flex flex-direction:column              */
/* .fancybox__toolbar is position:absolute (out of flex flow, overlaps)    */
/* .fancybox__carousel has flex:1 (takes remaining height)                 */
/* Setting order:-1 on thumbs places them above carousel in flex flow      */
.fancybox__thumbs {
    order: -1 !important;
    flex-shrink: 0 !important;
    max-height: 90px !important;
    min-height: 60px !important;
}

/* Push down the carousel enough so the absolute toolbar doesn't eat into thumbs */
.fancybox__carousel {
    padding-top: 46px !important; /* toolbar height */
}

/* Tighten slide padding when thumbs are at top */
.fancybox__slide {
    padding-top: 0px !important;
}

/* Mobile: smaller thumbs at top */
@media (max-width: 768px) {
    .fancybox__thumbs {
        max-height: 62px !important;
    }
    .fancybox__carousel {
        padding-top: 40px !important;
    }
}

/* Fancybox: Infobar counter styling */
.fancybox__infobar {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    opacity: 0.9;
}

/* fb-wm-dl custom toolbar download button */
.fb-wm-dl {
    color: var(--plasma, #00d4ff) !important;
}
.fb-wm-dl:hover {
    background: rgba(0, 212, 255, 0.15) !important;
}
html[data-theme="light"] .fb-wm-dl {
    color: #0044ff !important;
}
html[data-theme="light"] .fb-wm-dl:hover {
    background: rgba(0, 68, 255, 0.1) !important;
}

/* fb-dl-bar disabled state */
.fb-dl-pill--disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}
/* --- S-TIER OMNIVERSE SLIDERS & DROPDOWNS --- */
.hud-slider-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    height: 18px;
    margin: 2px 0;
    --tick-color: rgba(255, 255, 255, 0.3);
}
html[data-theme="light"] .hud-slider-wrap {
    --tick-color: rgba(0, 0, 0, 0.5);
}
.hud-slider-track {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 2px;
    background: var(--track-bg, rgba(255,255,255,0.1));
    border-radius: 2px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
    overflow: visible;
}
.hud-slider-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--plasma, #00ffff);
    border-radius: 2px;
    box-shadow: 0 0 8px var(--plasma, #00ffff);
    pointer-events: none;
}
.hud-slider-ticks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: repeating-linear-gradient(90deg, transparent, transparent calc(10% - 1px), var(--tick-color) 10%);
    pointer-events: none;
}
.hud-slider-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid var(--plasma, #00ffff);
    box-shadow: 0 0 0 1px var(--bg), 0 0 4px var(--plasma, #00ffff);
    cursor: pointer;
    transition: transform 0.1s;
    z-index: 2;
}
.hud-slider-wrap:hover .hud-slider-thumb {
    transform: translate(-50%, -50%) scale(1.2);
    box-shadow: 0 0 10px var(--plasma, #00ffff), inset 0 0 6px var(--plasma, #00ffff);
}
.hud-slider-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 3;
    margin: 0;
}
.hud-slider-readout {
    position: absolute;
    top: -20px;
    transform: translateX(-50%);
    background: rgba(10, 10, 15, 0.9);
    color: var(--plasma, #00ffff);
    font-size: 10px;
    font-family: monospace;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--plasma, #00ffff);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 4;
}
.hud-slider-wrap:hover .hud-slider-readout {
    opacity: 1;
}

/* HOLOGRAPHIC DROPDOWN */
.holo-select-wrap {
    position: relative;
    width: 100%;
    font-size: 13px;
    color: var(--hud-text);
    user-select: none;
}
.holo-select-display {
    background: var(--btn-bg, rgba(255,255,255,0.05));
    border: 1px solid var(--track-bg, rgba(255,255,255,0.1));
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}
.holo-select-display:hover {
    border-color: var(--plasma, #00ffff);
    box-shadow: 0 0 8px rgba(0,255,255,0.2);
}
.holo-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--hud-bg);
    border: 1px solid var(--plasma, #00ffff);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    border-radius: 4px;
    margin-top: 4px;
    z-index: 10002;
    overflow: hidden;
    backdrop-filter: blur(10px);
    
    /* Engineering Grid Background */
    background-image: linear-gradient(rgba(128,128,128,0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(128,128,128,0.05) 1px, transparent 1px);
    background-size: 10px 10px;
    
    /* Shutter Reveal */
    clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
    transition: clip-path 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s;
    opacity: 0;
    pointer-events: none;
}
.holo-select-wrap.open .holo-select-dropdown {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    opacity: 1;
    pointer-events: all;
}
.holo-option {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s, color 0.2s, padding-left 0.2s;
}
.holo-option:last-child {
    border-bottom: none;
}
.holo-option:hover {
    background: var(--track-bg);
    color: var(--plasma, #00ffff);
    padding-left: 16px;
}

/* =====================================================
   Legal Overlay (legal.php)
   ===================================================== */
#legal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--ov-backdrop, rgba(10, 10, 15, 0.85));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 10001;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 20px 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#legal-overlay .overlay-inner-container {
    width: 100%;
    max-width: 900px;
    padding: 0 40px;
    position: relative;
}

#legal-overlay .overlay-glass-card {
    background: var(--ov-card);
    border: 1px solid var(--ov-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    box-sizing: border-box;
    margin-top: 0;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    color: var(--ov-text);
}

@media (max-width: 800px) {
    #legal-overlay {
        padding: 40px 0 80px 0;
    }

    #legal-overlay .overlay-inner-container {
        padding: 20px;
    }

    #legal-overlay .overlay-glass-card {
        padding: 25px 20px;
    }
}

/* --- S-TIER OMNIVERSE SCROLLBARS --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--plasma, #00ffff);
    box-shadow: 0 0 10px var(--plasma, #00ffff);
}
::-webkit-scrollbar-corner {
    background: transparent;
}

/* ====================================================
   ASSET ORCHESTRATOR OVERLAY
   ==================================================== */
#orchestrator-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100dvh;
    background: var(--ov-backdrop, rgba(10, 10, 15, 0.85));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 10001;
    display: none;
    justify-content: center;
    align-items: flex-start;
    overflow-y: scroll;
    overflow-x: hidden;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--ov-accent, var(--plasma)) var(--ov-card, var(--bg));
}

#orchestrator-overlay {
    inset: 0;
    width: auto;
}
#orchestrator-overlay.orch-active {
    display: flex;
}
#orchestrator-overlay.orch-visible {
    opacity: 1;
    pointer-events: all;
}
#orchestrator-overlay .overlay-inner-container {
    width: 100%;
    max-width: 900px !important;
    padding: 30px 40px !important;
    position: relative;
    height: auto;
    max-height: none;
    display: block;
    overflow: visible;
    box-sizing: border-box;
}
#orchestrator-overlay .overlay-glass-card {
    border-radius: 20px !important;
    width: 100%;
    padding: 40px;
    box-sizing: border-box;
    max-height: none;
    overflow: visible;
}
@media (max-width: 800px) {
    #orchestrator-overlay { padding: 15px 0 80px 0; }
    #orchestrator-overlay .overlay-inner-container { padding: 20px !important; }
    #orchestrator-overlay .overlay-glass-card { max-height: none; }
}

/* ====================================================
   LEGAL STYLES (shared overlay + standalone)
   ==================================================== */
.legal-header { border-bottom: 1px solid var(--ov-border); padding-bottom: 25px; margin-bottom: 30px; text-align: center; }
.legal-privacy-notice { font-style: italic; color: var(--plasma); }
.legal-reveal-btn { background: var(--plasma); color: var(--on-plasma); border: none; padding: 10px 20px; border-radius: 6px; font-weight: 700; cursor: pointer; margin-top: 10px; margin-bottom: 30px; transition: opacity 0.2s; }
.legal-reveal-btn:hover { opacity: 0.9; }
.legal-hr { margin: 40px 0; border: 0; border-top: 1px solid var(--border); }
.legal-section-heading { margin-top: 28px; }

#legal-overlay.legal-overlay-open {
    opacity: 1 !important;
    pointer-events: all !important;
}

#legal-overlay:not(.legal-overlay-open) .overlay-glass-card {
    transform: scale(0.95) translateY(10px);
    clip-path: polygon(0 50%, 100% 50%, 100% 50%, 0 50%);
}

#legal-overlay.legal-overlay-open .overlay-glass-card {
    transform: scale(1) translateY(0) !important;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%) !important;
}

.settings-btn,
#settings-btn,
#docs-toggle {
    z-index: 1000002 !important;
    pointer-events: auto !important;
    isolation: isolate;
}

/* Full-legal standalone page */
.legal-standalone-container { max-width: 900px; margin: 0 auto; margin-bottom: 40px; position: relative; }
.legal-back-btn { position: absolute; top: 25px; left: 25px; display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); text-decoration: none; font-weight: 600; z-index: 10; transition: color 0.2s; }
.legal-back-btn:hover { color: var(--plasma); }
.legal-card-padding { margin-top: 0; padding: 20px 40px; }

/* ====================================================
   PHOTO GALLERY OVERLAY (lightbox) — CSP-safe classes
   ==================================================== */
.csp-hidden { display: none !important; }
.csp-flex-active { display: flex !important; }
.csp-opacity-active { opacity: 1 !important; }
.csp-pointer-active { pointer-events: all !important; }
