/* --- Futuristic Theme: Cyber-Pulse --- */

:root {
    --bg-dark: #020204;
    --card-bg: rgba(15, 15, 20, 0.8);
    --neon-cyan: #00f2ff;
    --neon-purple: #bc13fe;
    --text-main: #e0e0e0;
    --text-dim: #94a3b8;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Animated Background Elements --- */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Moving "Starfield" or Data Nodes */
    background: 
        radial-gradient(1px 1px at 20px 30px, #fff, rgba(0,0,0,0)),
        radial-gradient(1.5px 1.5px at 40px 70px, var(--neon-cyan), rgba(0,0,0,0)),
        radial-gradient(1px 1px at 50px 160px, var(--neon-purple), rgba(0,0,0,0));
    background-size: 200px 200px;
    animation: dataStream 60s linear infinite;
    opacity: 0.3;
    z-index: -1;
}

@keyframes dataStream {
    from { background-position: 0 0; }
    to { background-position: 0 1000px; }
}

/* --- Header & Title --- */
.site-header {
    padding: 100px 20px;
    text-align: center;
    position: relative;
}

.site-title {
    font-size: clamp(1.8rem, 8vw, 3.5rem);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 8px;
    color: #fff;
    /* Glitch Shadow Effect */
    text-shadow: 
        3px 0 var(--neon-cyan), 
        -3px 0 var(--neon-purple);
    margin: 0;
}

/* --- Main Content Layout --- */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px 100px 20px;
}

/* --- Topic Sections --- */
.topic-section {
    margin-bottom: 100px;
    animation: fadeIn 0.8s ease-out forwards;
}

.topic-heading {
    font-size: 2.2rem;
    color: var(--neon-cyan);
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 40px;
    position: relative;
    display: inline-block;
}

/* The "Scanning" line under headings */
.topic-heading::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 60px;
    height: 4px;
    background: var(--neon-cyan);
    box-shadow: 0 0 10px var(--neon-cyan);
}

/* --- The Link Grid (Super Mobile Friendly) --- */
.link-list {
    display: grid;
    /* responsive columns: 1 column on mobile, up to 4 on wide screens */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* --- Futuristic Button/Link Interaction --- */
.link-item {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    color: var(--text-main);
    text-decoration: none;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
    border-left: 0px solid var(--neon-purple);
}

/* Interaction 1: Slide & Glow */
.link-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--neon-cyan);
    border-left: 8px solid var(--neon-purple);
    color: #fff;
    transform: scale(1.02) translateX(5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Interaction 2: Click effect */
.link-item:active {
    transform: scale(0.98);
    filter: brightness(1.2);
}

/* --- Subtopic Labels --- */
.subtopic-heading {
    color: var(--text-dim);
    font-size: 0.85rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin: 40px 0 20px 0;
    opacity: 0.7;
}

/* --- Animations --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Mobile Specific Optimization --- */
@media (max-width: 768px) {
    .site-header { padding: 60px 15px; }
    
    /* Larger touch targets for mobile thumbs */
    .link-item {
        padding: 25px 20px;
        font-size: 1.1rem;
    }
    
    /* Disable horizontal transform on mobile to prevent overflow bugs */
    .link-item:hover {
        transform: scale(1.02);
    }

    .topic-heading {
        font-size: 1.6rem;
    }
}

/* --- Animation States for JS --- */

/* Initial hidden state */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* State triggered by JS */
.reveal-on-scroll.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Advanced: Hover Glow following the mouse */
.link-item {
    position: relative;
    overflow: hidden;
}

.link-item::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        600px circle at var(--mouse-x) var(--mouse-y), 
        rgba(0, 242, 255, 0.08), 
        transparent 40%
    );
    z-index: -1;
    pointer-events: none;
}

/* --- High-End Intro Loader --- */
#loader {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 1s ease, visibility 1s;
}

#loader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-text {
    font-family: 'Courier New', monospace;
    font-size: clamp(2rem, 10vw, 5rem);
    color: var(--neon-cyan);
    letter-spacing: 10px;
    position: relative;
    /* Basic glitch animation */
    animation: textPulse 2s infinite;
}

/* Digital Progress Bar */
.loader-bar {
    width: 250px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    margin-top: 20px;
    position: relative;
    overflow: hidden;
}

.loader-progress {
    position: absolute;
    height: 100%;
    width: 0%;
    background: var(--neon-cyan);
    box-shadow: 0 0 15px var(--neon-cyan);
    animation: loadFill 2.5s cubic-bezier(0.1, 0, 0.1, 1) forwards;
}

.loader-status {
    margin-top: 15px;
    font-size: 0.7rem;
    letter-spacing: 3px;
    color: var(--neon-purple);
    font-family: monospace;
}

/* Animations */
@keyframes loadFill {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

@keyframes textPulse {
    0%, 100% { text-shadow: 0 0 5px var(--neon-cyan); opacity: 1; }
    50% { text-shadow: 0 0 20px var(--neon-cyan), 2px 2px var(--neon-purple); opacity: 0.8; }
}