/* Core Layout Styles */
body {
    font-family: 'Inter', sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

/* Hero Animation Elements */

/* Dots: Small, vibrant circles with a subtle blur */
.dot {
    position: absolute;
    border-radius: 9999px;
    pointer-events: none;
    opacity: 0.8;
    filter: blur(2px);
    z-index: -1;
}

/* Blobs: Large, soft organic shapes that drift centrally */
.blob {
    position: absolute;
    border-radius: 9999px;
    pointer-events: none;
    opacity: 0.6;
    filter: blur(40px);
    z-index: -1;
}

/* Constellation: Full-screen canvas for the particle network */
#constellation-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

/* Container for all hero background effects */
#animation-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

/* Smooth Transitions for Theme Switching */
.dark-mode-transition {
    transition: background-color 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Smooth scroll */
html { scroll-behavior: smooth; }

/* Material-style light/dark theme switch */
.theme-switch {
    width: 64px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 9999px;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.theme-switch-track {
    position: relative;
    width: 58px;
    height: 30px;
    border-radius: 9999px;
    background: linear-gradient(135deg, #f8fafc 0%, #dbeafe 100%);
    border: 1px solid rgba(44, 62, 80, 0.12);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.12), 0 6px 16px rgba(15, 23, 42, 0.10);
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.theme-switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 9999px;
    background: #ffffff;
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.24);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.25s ease;
    z-index: 2;
}

.theme-switch-icon {
    position: absolute;
    top: 6px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: color 0.25s ease, opacity 0.25s ease;
}

.theme-switch-icon svg {
    width: 15px;
    height: 15px;
}

.theme-switch-sun {
    left: 6px;
    color: #f59e0b;
    opacity: 1;
}

.theme-switch-moon {
    right: 6px;
    color: #64748b;
    opacity: 0.62;
}

.dark .theme-switch-track {
    background: linear-gradient(135deg, #172033 0%, #0f172a 100%);
    border-color: rgba(236, 240, 241, 0.20);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 16px rgba(0, 0, 0, 0.25);
}

.dark .theme-switch-thumb {
    background: #e2e8f0;
    transform: translateX(28px);
}

.dark .theme-switch-sun {
    color: #94a3b8;
    opacity: 0.62;
}

.dark .theme-switch-moon {
    color: #f8fafc;
    opacity: 1;
}

.theme-switch:focus-visible {
    outline: 3px solid rgba(41, 128, 185, 0.45);
    outline-offset: 3px;
}

/* ── Navbar on dark-hero pages (light mode, not yet scrolled) ──────────────
   Dark mode handles itself via Tailwind's dark: prefix.
   In light mode, the transparent navbar sits over a dark gradient, force
   the theme toggle icon and lab button to white so they're legible.
*/
body[data-dark-hero="true"] #navbar:not(.scrolled) #theme-toggle {
    color: white;
}
body[data-dark-hero="true"] #navbar:not(.scrolled) #theme-toggle:hover {
    background-color: transparent;
}
body[data-dark-hero="true"] #navbar:not(.scrolled) .theme-switch-track {
    border-color: rgba(255, 255, 255, 0.32);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.18), 0 6px 18px rgba(0, 0, 0, 0.22);
}
body[data-dark-hero="true"] #navbar:not(.scrolled) a[href="lab.html"] {
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
/* Also ensure nav links are white over the dark hero in light mode */
body[data-dark-hero="true"] #navbar:not(.scrolled) nav a {
    color: rgba(255, 255, 255, 0.85);
}
body[data-dark-hero="true"] #navbar:not(.scrolled) nav a:hover {
    color: white;
}
/* Back arrow / "All Projects" link on project pages */
body[data-dark-hero="true"] #navbar:not(.scrolled) header > div > a:first-child,
body[data-dark-hero="true"] #navbar:not(.scrolled) .container > div > a:first-child {
    color: rgba(255, 255, 255, 0.85);
}
/* Separator between nav and theme toggle */
body[data-dark-hero="true"] #navbar:not(.scrolled) .bg-gray-200 {
    background-color: rgba(255, 255, 255, 0.25) !important;
}

/* Anchor offset for fixed nav */
[id] { scroll-margin-top: 80px; }

/* Publication list items */
.pub-item {
    border-left: 3px solid transparent;
    transition: border-color 0.2s ease;
}
.pub-item:hover { border-left-color: #004a99; }

/* Member photo placeholders */
.member-photo {
    width: 96px;
    height: 96px;
    border-radius: 9999px;
    object-fit: cover;
    background-color: #c7d2e7;
}

/* Lab hero gradient */
.lab-hero-bg {
    background: linear-gradient(135deg, #003d80 0%, #004a99 50%, #0060c0 100%);
}

/* Scroll indicator fade */
#scroll-indicator { transition: opacity 0.4s ease; }

/* Navbar text on dark-hero pages: white until frosted glass kicks in */
[data-dark-hero="true"] #navbar:not(.scrolled) a,
[data-dark-hero="true"] #navbar:not(.scrolled) button:not(#theme-toggle) {
    color: white !important;
}
