:root {
    --bg-void: #030014;
    --bg-panel: rgba(255, 255, 255, 0.03);
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.1);
    
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-bright: rgba(255, 255, 255, 0.2);
    
    --color-primary: #a855f7;
    --color-secondary: #06b6d4;
    --color-accent: #f472b6;
    
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    
    --font-sans: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* 1. Slider shouldn't show while scrolling (Firefox) */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* 1. Slider shouldn't show while scrolling (Chrome/Safari) */
*::-webkit-scrollbar {
    display: none;
    width: 0;
    background: transparent;
}

body {
    background-color: var(--bg-void);
    color: var(--text-main);
    font-family: var(--font-sans);
    height: 100vh;
    overflow: hidden; /* Prevent body scroll */
}

/* --- Atmospheric Effects --- */

.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 50;
    opacity: 0.5;
}

.aurora-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    animation: float 20s infinite alternate;
    opacity: 0.4;
}

.blob-1 {
    top: -10%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: var(--color-primary);
    animation-delay: 0s;
}

.blob-2 {
    bottom: -10%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: var(--color-secondary);
    animation-delay: -5s;
}

.blob-3 {
    top: 40%;
    left: 40%;
    width: 400px;
    height: 400px;
    background: var(--color-accent);
    animation-delay: -10s;
    opacity: 0.2;
}

@keyframes float {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* --- Layout Grid (Independent Scrolling) --- */

.app-layout {
    display: grid;
    /* Header row fixed, Content row fills rest */
    grid-template-areas: 
        "header header"
        "sidebar main";
    grid-template-columns: 280px 1fr;
    grid-template-rows: 80px 1fr; 
    height: 100vh; /* Full viewport height */
    position: relative;
    z-index: 10;
}

/* --- Header (Fixed at top) --- */

header {
    grid-area: header;
    z-index: 40;
    padding: 0 3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(3, 0, 20, 0.2);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-subtle);
}

.header-left { display: flex; align-items: center; gap: 2rem; }

.brand-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
}

.logo-mark {
    width: 40px;
    height: 40px;
    background: var(--text-main);
    color: var(--bg-void);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 1.2rem;
    border-radius: 8px;
    transform: rotate(-5deg);
}

.top-nav ul { display: flex; gap: 2.5rem; list-style: none; }
.top-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}
.top-nav a:hover, .top-nav a.active { color: var(--text-main); text-shadow: 0 0 10px rgba(255,255,255,0.3); }

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(6, 182, 212, 0.1);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.status-dot {
    width: 6px;
    height: 6px;
    background: var(--color-secondary);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--color-secondary);
}

.status-text { font-size: 0.75rem; color: var(--color-secondary); font-family: var(--font-mono); }

/* --- Sidebar (Scrolls Independently) --- */

aside.sidebar {
    grid-area: sidebar;
    background: rgba(3, 0, 20, 0.5);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-subtle);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    /* 4. Independent Scroll */
    height: 100%; 
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-left: 1rem;
}

.sidebar-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    font-weight: 700;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    border: 1px solid transparent;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-main);
    border-color: var(--border-subtle);
    transform: translateX(5px);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    opacity: 0.7;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-subtle);
}

.user-card {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name { font-size: 0.9rem; font-weight: 600; }
.user-role { font-size: 0.75rem; color: var(--text-muted); }

/* --- Main Content (Scrolls Independently) --- */

main {
    grid-area: main;
    position: relative;
    display: flex;
    flex-direction: column;
    /* 4. Independent Scroll */
    height: 100%;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 4rem 3rem;
    flex: 1;
}

/* --- Hero --- */

.hero-section {
    text-align: center;
    margin-bottom: 5rem;
}

.hero-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: linear-gradient(90deg, rgba(168, 85, 247, 0.1), rgba(6, 182, 212, 0.1));
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
    color: var(--color-secondary);
    font-family: var(--font-mono);
}

.hero-title {
    font-size: 4.5rem;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.04em;
    margin-bottom: 1.5rem;
}

.gradient-text {
    background: linear-gradient(135deg, #fff 30%, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 3rem;
    font-weight: 400;
}

/* --- Search Command Center --- */

.search-command-center {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    padding: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.5);
}

.search-command-center:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.15), 0 20px 40px -10px rgba(0,0,0,0.5);
    background: rgba(0, 0, 0, 0.8);
}

.search-icon { padding: 0 1rem; color: var(--text-muted); }
.search-icon svg { width: 24px; height: 24px; }

#searchInput {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.1rem;
    padding: 1rem 0;
    font-family: var(--font-sans);
}

#searchInput:focus { outline: none; }

.shortcut-hint {
    padding: 0.4rem 0.8rem;
    background: var(--border-subtle);
    border-radius: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-right: 0.5rem;
}

/* --- Bento Grid --- */

.section-header { margin-bottom: 2rem; border-bottom: 1px solid var(--border-subtle); padding-bottom: 1rem; }
.section-header h2 { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; }

.bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    list-style: none;
}

.bento-grid li {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.bento-grid li::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.bento-grid li:hover {
    transform: translateY(-5px);
    background: var(--bg-card-hover);
    border-color: var(--border-bright);
    box-shadow: 0 20px 40px -5px rgba(0,0,0,0.4);
}

.bento-grid li:hover::before { opacity: 1; }

.bento-grid a {
    display: block;
    padding: 2rem;
    text-decoration: none;
    color: var(--text-main);
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.4;
}

.bento-grid a::after {
    content: '→';
    display: block;
    margin-top: 1rem;
    color: var(--color-secondary);
    font-size: 1.5rem;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

.bento-grid li:hover a::after {
    opacity: 1;
    transform: translateX(0);
}

/* --- Article Viewer --- */

.viewer-modal {
    margin-top: 3rem;
    background: rgba(10, 10, 20, 0.6);
    backdrop-filter: blur(30px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 0;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow: hidden;
}

.viewer-modal.visible {
    opacity: 1;
    transform: translateY(0);
    padding: 4rem;
}

.viewer-modal h1 { font-size: 2.5rem; margin-bottom: 2rem; color: var(--text-main); line-height: 1.1; }
.viewer-modal h2 { font-size: 1.8rem; margin: 3rem 0 1.5rem; color: var(--color-secondary); }
.viewer-modal p { font-size: 1.1rem; line-height: 1.8; color: #cbd5e1; margin-bottom: 1.5rem; }

.viewer-modal code {
    font-family: var(--font-mono);
    color: var(--color-accent);
    background: rgba(244, 114, 182, 0.1);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
}

.viewer-modal pre {
    background: #000;
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    overflow-x: auto;
    margin: 2rem 0;
}

.viewer-modal pre code {
    background: none;
    color: #e2e8f0;
    padding: 0;
}

/* --- Footer --- */

footer { margin-top: auto; border-top: 1px solid var(--border-subtle); padding: 3rem; }
.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.footer-links { display: flex; gap: 2rem; }
.footer-links a { color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
.footer-links a:hover { color: var(--text-main); }

/* --- Mobile / Responsive --- */

.menu-btn, .close-btn { 
    display: none; 
    background: none; 
    border: none; 
    color: var(--text-main); 
    cursor: pointer;
}

@media (max-width: 1024px) {
    .app-layout {
        grid-template-areas: "header" "main";
        grid-template-columns: 1fr;
        grid-template-rows: 70px 1fr;
    }
    
    aside.sidebar {
        position: fixed;
        left: 0; top: 0;
        z-index: 100;
        width: 300px;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
        background: #030014;
    }
    
    aside.sidebar.open { transform: translateX(0); }
    
    .menu-btn { display: block; width: 40px; height: 40px; }
    .close-btn { display: block; width: 40px; height: 40px; font-size: 1.5rem; }
    
    .top-nav { display: none; }
    
    .hero-title { font-size: 3rem; }
    .content-wrapper { padding: 2rem 1.5rem; }
    .viewer-modal.visible { padding: 2rem; }
}

#scrollToTopBtn {
    position: fixed;
    bottom: 3rem;
    right: 3rem;
    width: 50px;
    height: 50px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
    z-index: 90;
}
#scrollToTopBtn:hover { transform: translateY(-5px); background: var(--color-accent); }
#scrollToTopBtn[style*="block"] { opacity: 1; pointer-events: all; }
