:root {
    --bg0: #070914;
    --bg1: #0b1030;
    --ink: #ffffff;
    --cosmic-bg: url('/static/assets/Cosmic_dance_of_stars_and_nebulae.png');
    --glass: rgba(18, 22, 45, 0.58);
    --glass2: rgba(24, 28, 58, 0.68);
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
    --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

.light-mode {
    --bg0: #e0e5ec;
    --bg1: #ffffff;
    --ink: #141414;
    --glass: rgba(255, 255, 255, 0.58);
    --glass2: rgba(255, 255, 255, 0.88);
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.15);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    color: var(--ink);
    background: linear-gradient(var(--bg0), var(--bg1));
    transition: background 0.3s ease, color 0.3s ease;
}

.frame {
    position: relative;
    width: min(1100px, 96vw);
    min-height: 100vh;
    margin: 0 auto;
    border-left: 1px solid rgba(128, 128, 128, 0.2);
    border-right: 1px solid rgba(128, 128, 128, 0.2);
    box-shadow: var(--shadow);
    background: var(--bg0);
    display: flex;
    flex-direction: column;
}

/* HEADER */
header {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 22px;
    pointer-events: none;
}
.brand, .actions { pointer-events: auto; }
/*.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }*/
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); }
.badge {
    display: inline-grid; place-items: center;
    width: 28px; height: 28px; border-radius: 10px;
    background: rgba(229, 9, 20, 0.18);
    border: 1px solid rgba(229, 9, 20, 0.5);
    color: #e50914;
}
.actions { display: flex; gap: 10px; }
.btn {
    color: var(--ink);
    border: 1px solid rgba(128, 128, 128, 0.3);
    background: var(--glass);
    backdrop-filter: blur(10px);
    padding: 10px 12px; border-radius: 12px; cursor: pointer;
    font-size: 13px; font-weight: 600; transition: all 0.2s;
}
.btn:hover { border-color: #e50914; }

/* HERO & 3D GRAPH */
.hero {
    position: relative;
    flex-grow: 1; /* Pushes dock to bottom */
    min-height: 60vh;
    overflow: hidden;
    background: linear-gradient(rgba(8, 10, 24, 0.18), rgba(8, 10, 24, 0.28)),
                var(--cosmic-bg) center / cover no-repeat;
}
#3d-graph {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%; height: 100%;
}
.welcomeBlock, .instruction {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 3;
    pointer-events: none; /* Allows mouse to click graph behind text */
}
.welcomeBlock { top: 120px; width: min(760px, 92%); }
/*.welcomeBlock h1 { font-size: clamp(38px, 4.6vw, 62px); margin: 0; text-shadow: 0 10px 35px rgba(0,0,0,0.8); color: white;} 
.instruction { bottom: 40px; color: rgba(255, 255, 255, 0.7); font-size: 15px; } */
.welcomeBlock h1 { font-size: clamp(38px, 4.6vw, 62px); margin: 0; text-shadow: 0 10px 35px rgba(0,0,0,0.8); color: var(--ink)}
.instruction { bottom: 40px; color: var(--ink); opacity: 0.8; font-size: 15px; }

/* PROJECTS DOCK */
.projectsWrap {
    padding: 22px 18px 28px;
    background: var(--bg0);
    position: relative;
    z-index: 4;
}
.dock {
    width: 100%; overflow: hidden;
    padding: 14px 14px 12px;
    border: 1px solid rgba(128, 128, 128, 0.2);
    border-radius: 18px;
    background: var(--glass);
    backdrop-filter: blur(14px);
}
.dockTop { display: flex; justify-content: space-between; align-items: center; padding: 2px 6px 10px; }
.dockTop h2 { margin: 0; font-size: 14px; }
.hint { font-size: 12px; opacity: 0.6; }

/* TABS & CAROUSEL */
.tabs {
    display: flex; gap: 12px; overflow-x: auto;
    padding-bottom: 8px; scroll-snap-type: x mandatory;
}
.tab {
    flex: 0 0 auto; scroll-snap-align: start;
    padding: 10px 12px; border: 1px solid rgba(128, 128, 128, 0.2);
    border-radius: 14px; background: var(--glass2); color: var(--ink);
    cursor: pointer; font-size: 12.5px; font-weight: 700;
}
.tab[aria-selected="true"] { border-color: #e50914; box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.2); }

.cards {
    display: flex; gap: 12px; overflow-x: auto;
    padding: 4px 0 12px; scroll-snap-type: x mandatory;
}
.card {
    flex: 0 0 auto; width: 210px; overflow: hidden;
    padding: 12px; border: 1px solid rgba(128, 128, 128, 0.2);
    border-radius: 16px; background: var(--glass2);
    scroll-snap-align: start; cursor: pointer; transition: transform 0.2s;
}
.card:hover { transform: scale(1.02); }
.thumb { height: 92px; border-radius: 12px; background: linear-gradient(135deg, rgba(229, 9, 20, 0.2), rgba(0, 0, 0, 0)); border: 1px solid rgba(128,128,128,0.1);}
.card h3 { margin: 10px 0 0; font-size: 13px; }
.card p { margin: 6px 0 0; opacity: 0.7; font-size: 12.5px; }

/* OVERLAY NAVIGATION CHIPS */
.graph-overlay-chips {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    z-index: 10; /* Ensures buttons sit above the 3D canvas */
    pointer-events: auto; /* Makes them clickable */
    width: 90%;
}
.chip {
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--glass); /* Dynamically changes from dark glass to light glass */
    border: 1px solid rgba(128, 128, 128, 0.3);
    color: var(--ink); /* Flips from white to #141414 */
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}

.chip:hover {
    box-shadow: 0 0 10px rgba(128, 128, 128, 0.3);
}

/* Hides the nebula, letting the light/dark body gradient show through */
.no-bg .hero {
    background: transparent; 
}

/* SMART CONTRAST: Force text to white if Light Mode is ON but Dark Nebula is VISIBLE */
body:not(.no-bg).light-mode .brand,
body:not(.no-bg).light-mode .welcomeBlock h1,
body:not(.no-bg).light-mode .instruction {
    color: #ffffff;
}