/* =========================================================
   1. VARIABLES & RESET
   ========================================================= */
:root {
    --bg-base: #030407;
    --surface-color: rgba(16, 18, 27, 0.6);
    --surface-border: rgba(0, 240, 255, 0.15);
    --text-primary: #f0f2f5;
    --text-secondary: #8b949e;
    --accent-color: #00f0ff;
    --accent-glow: rgba(0, 240, 255, 0.15);
    --font-main: 'Space Grotesk', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

/* ANTI-FLASH & SCROLL FIXES */
html {
    scroll-behavior: smooth;
    background-color: var(--bg-base); /* Stops the white flash */
}

body {
    background-color: transparent !important; /* Lets WebGL show through */
    color: var(--text-primary);
    font-family: var(--font-main);
    margin: 0;
    overflow-x: hidden; 
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2a2f3a; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-color); }

/* =========================================================
   2. BACKGROUND LAYERS (POSITIVE Z-INDEX STACKING)
   ========================================================= */
#shader-canvas {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1; /* Deepest background layer */
    pointer-events: none;
}

.noise-overlay {
    position: fixed; inset: 0; 
    z-index: 2; /* Sits over shader to smooth banding */
    background-image: 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.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.06'/%3E%3C/svg%3E");
    pointer-events: none;
}

#particle-canvas {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 3; /* Floats above the noise */
    pointer-events: none; opacity: 0.8;
}

.dashboard, .article-container, .gizmo-widget {
    position: relative; 
    z-index: 10; /* UI sits safely on top of everything */
}
/* =========================================================
   3. TYPOGRAPHY & BASE ELEMENTS
   ========================================================= */
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.2; }
p { color: var(--text-secondary); margin-bottom: 1rem; line-height: 1.6; }
a { text-decoration: none; color: inherit; }
.accent { color: var(--accent-color); }
.mono { font-family: var(--font-mono); }
.text-gradient { background: linear-gradient(135deg, #fff 0%, var(--accent-color) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }


/* =========================================================
   4. LAYOUT & SIDEBAR (MAIN PAGE)
   ========================================================= */
.dashboard { display: flex; max-width: 1600px; margin: 0 auto; padding: 2rem; gap: 3rem; align-items: flex-start; }

.sidebar { 
    position: sticky; 
    top: 2rem; 
    width: 380px; 
    height: calc(100vh - 4rem); 
    display: flex; flex-direction: column; justify-content: space-between; 
    background: rgba(10, 12, 16, 0.4); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); 
    border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 24px; padding: 2.5rem; box-shadow: 0 20px 40px rgba(0,0,0,0.5); overflow-y: auto; 
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar h1 { font-size: 3.2rem; letter-spacing: -1px; margin-bottom: 0.5rem; }
.sidebar h2 { font-size: 1.2rem; color: var(--text-secondary); font-weight: 400; margin-bottom: 1.5rem; }
.sidebar-footer { font-family: var(--font-mono); font-size: 0.75rem; color: #555; display: flex; justify-content: space-between; border-top: 1px solid rgba(255,255,255,0.05); padding-top: 1rem; }

.main-content { flex: 1; display: flex; flex-direction: column; gap: 4rem; min-width: 0; }
.section-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 2rem; }
.section-header h3 { font-size: 1.5rem; text-transform: uppercase; letter-spacing: 2px; color: #fff; }
.section-header::after { content: ""; height: 1px; flex: 1; background: linear-gradient(90deg, var(--surface-border), transparent); }


/* =========================================================
   5. UI COMPONENTS
   ========================================================= */
.status-badge { display: inline-flex; align-items: center; gap: 8px; background: rgba(0, 240, 255, 0.1); border: 1px solid var(--surface-border); padding: 6px 12px; border-radius: 100px; font-size: 0.75rem; font-family: var(--font-mono); color: var(--accent-color); margin-bottom: 2rem; width: max-content; }
.status { font-family: var(--font-mono); font-size: 0.75rem; padding: 4px 10px; border-radius: 100px; background: rgba(255,255,255,0.1); color: #fff; font-weight: 400; }
.status.active { background: var(--accent-glow); color: var(--accent-color); border: 1px solid var(--surface-border); }

.pulse { width: 8px; height: 8px; background: var(--accent-color); border-radius: 50%; box-shadow: 0 0 10px var(--accent-color); animation: pulse-anim 2s infinite; }
@keyframes pulse-anim { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.5); } 100% { opacity: 1; transform: scale(1); } }

.instant-skills { display: flex; flex-wrap: wrap; gap: 8px; margin: 2rem 0; }
.skill-tag { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.1); padding: 6px 12px; border-radius: 6px; font-size: 0.8rem; font-family: var(--font-mono); color: #d1d5db; cursor: default; }
.tech-list { display: flex; gap: 10px; font-family: var(--font-mono); font-size: 0.85rem; color: var(--accent-color); margin-bottom: 15px; flex-wrap: wrap; }

.nav-links { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2rem; }
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 14px; border-radius: 8px; font-family: var(--font-mono); font-size: 0.9rem; font-weight: 700; transition: 0.3s; cursor: pointer; text-align: center; }
.btn-primary { background: var(--accent-color); color: #000; border: none; box-shadow: 0 0 20px rgba(0,240,255,0.2); }
.btn-primary:hover { background: #fff; box-shadow: 0 0 30px rgba(255,255,255,0.3); transform: translateY(-2px); }
.btn-secondary { background: transparent; border: 1px solid rgba(255,255,255,0.2); color: #fff; }
.btn-secondary:hover { border-color: var(--accent-color); color: var(--accent-color); background: rgba(0,240,255,0.05); }

.media-wrapper { position: relative; width: 100%; padding-bottom: 56.25%; background: #000; overflow: hidden; border-bottom: 1px solid rgba(255,255,255,0.05); }
.media-wrapper img, .media-wrapper video, .media-wrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; border: none; transition: transform 0.5s ease; }

.featured-card { 
    background: var(--surface-color); 
    backdrop-filter: blur(10px); 
    border-radius: 20px; 
    border: 1px solid rgba(255,255,255,0.05); 
    overflow: hidden; 
    /* Changed transition for a snappier, smoother lift */
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1); 
    display: flex; 
    flex-direction: column; 
    cursor: pointer; /* Forces the hand icon so they know it's a button! */
}

/* THE BIG HOVER EFFECT */
.featured-card:hover { 
    border-color: var(--accent-color); /* Full cyan border glow */
    background: rgba(20, 25, 35, 0.9); /* Slightly brightens the card background */
    /* Deep shadow + Cyan glowing aura */
    box-shadow: 0 25px 50px rgba(0,0,0,0.8), 0 0 30px rgba(0, 240, 255, 0.15); 
    transform: translateY(-8px); /* Lifts it higher off the page */
}

/* Bigger zoom on the video/image when hovering */
.featured-card:hover .media-wrapper img, 
.featured-card:hover .media-wrapper video,
.featured-card:hover .media-wrapper iframe { 
    transform: scale(1.05); 
}

.card-body { padding: 2.5rem; display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: start; }
.card-title-area h4 { font-size: 2.2rem; margin-bottom: 10px; display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
/* Grid Auto-Sizing with min() for Mobile */
.bento-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 1.5rem; }
.bento-card { background: var(--surface-color); border: 1px solid rgba(255,255,255,0.05); border-radius: 16px; transition: 0.3s; display: flex; flex-direction: column; overflow: hidden; }
.bento-card:hover { border-color: var(--accent-color); background: rgba(20, 25, 35, 0.8); transform: translateY(-4px); }
.bento-content { padding: 1.5rem; display: flex; flex-direction: column; flex: 1; }
.bento-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.bento-card h4 { font-size: 1.3rem; margin: 0; }
.bento-card p { font-size: 0.9rem; margin: 0; flex: 1; }
.bento-footer { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-secondary); margin-top: 1.5rem; display: flex; justify-content: space-between; }

/* =========================================================
   Code Window (Sci-Fi Engine HUD Aesthetic - COLLAPSIBLE)
   ========================================================= */
.ide-window { 
    background: rgba(10, 15, 20, 0.6); 
    border-top: 1px solid var(--surface-border);
    border-right: 1px solid var(--surface-border);
    border-bottom: 1px solid var(--surface-border);
    border-left: 3px solid var(--accent-color); /* Thick glowing left edge */
    border-radius: 0; 
    font-family: var(--font-mono); 
    font-size: 0.85rem; 
    overflow: hidden; 
    box-shadow: inset 0 0 30px rgba(0, 240, 255, 0.05); 
    max-width: 100%; 
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%);
    transition: all 0.3s ease;
}

.ide-header { 
    background: rgba(0, 240, 255, 0.05); 
    padding: 8px 15px; 
    display: flex; 
    align-items: center; 
    border-bottom: 1px solid rgba(0, 240, 255, 0.15); 
    cursor: pointer; /* Shows a pointing hand when hovering */
    user-select: none; /* Prevents the text from highlighting when you click */
    transition: background 0.2s ease;
}

.ide-header:hover {
    background: rgba(0, 240, 255, 0.15); /* Brightens the header when hovered */
}

/* Hide Mac Dots */
.ide-dot { display: none !important; }

/* Techy uppercase title */
.ide-header span { 
    margin-left: 0 !important; 
    color: var(--accent-color) !important; 
    font-size: 0.75rem !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* The interactive collapse arrow */
.ide-header span::before {
    content: "▼";
    font-size: 0.6rem;
    transition: transform 0.3s ease;
}

.ide-content { 
    padding: 20px; 
    color: #e0e0e0; 
    overflow-x: auto; 
    white-space: pre; 
    line-height: 1.6; 
}

/* Neon-tinted syntax highlighting */
.kw { color: #ff7b72; } 
.ty { color: var(--accent-color); text-shadow: 0 0 8px rgba(0,240,255,0.3); } 
.fn { color: #d2a8ff; } 
.cm { color: #8b949e; font-style: italic; } 

/* --- THE COLLAPSED STATE LOGIC --- */
.ide-window.collapsed {
    clip-path: none; /* Temporarily removes the sliced corner so it doesn't cut the header text off */
}

.ide-window.collapsed .ide-content {
    display: none; /* Hides the code body */
}

.ide-window.collapsed .ide-header {
    border-bottom: none; /* Removes the line under the header */
}

.ide-window.collapsed .ide-header span::before {
    transform: rotate(-90deg); /* Rotates the arrow to point right (▶) */
}


/* =========================================================
   6. GIZMO WIDGET
   ========================================================= */
.gizmo-widget { position: fixed; bottom: 30px; right: 30px; width: 120px; height: 120px; z-index: 1000; pointer-events: none; }
#gizmo-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }


/* =========================================================
   7. PROJECT DEEP DIVE PAGES (AAA SHOWCASE)
   ========================================================= */
.article-container { max-width: 1400px; margin: 0 auto; padding: 100px 5% 60px 5%; position: relative; z-index: 1; width: 100%; }
.back-nav { margin-bottom: 40px; }
.back-btn { 
    display: inline-flex; 
    align-items: center; 
    gap: 10px;
    color: #fff; 
    font-family: var(--font-mono); 
    font-size: 0.85rem; 
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none; 
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1); 
    padding: 12px 24px; 
    border-radius: 6px; 
    border: 1px solid rgba(255, 255, 255, 0.1); 
    background: rgba(16, 18, 27, 0.6); 
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.back-btn:hover { 
    color: var(--accent-color); 
    border-color: var(--accent-color); 
    background: rgba(0, 240, 255, 0.05);
    transform: translateX(-5px); 
    box-shadow: 0 10px 20px rgba(0,0,0,0.5), 0 0 15px rgba(0, 240, 255, 0.2); 
}
.project-hero { text-align: left; }
.project-hero h1 { font-size: clamp(2.5rem, 5vw, 5.5rem); margin: 10px 0 10px 0; letter-spacing: -2px; }
.project-tagline { font-size: clamp(1rem, 2vw, 1.2rem); color: var(--accent-color); font-family: var(--font-mono); margin-bottom: 20px; }

.hero-media { border-radius: 16px; border: 1px solid var(--surface-border); box-shadow: 0 30px 60px rgba(0,0,0,0.8); margin: 3rem 0 5rem 0; }

.article-layout { display: flex; gap: 4rem; align-items: flex-start; }

/* The telemetry widget sidebar */
.article-sidebar { 
    position: sticky; 
    top: 40px; 
    width: 320px; 
    flex-shrink: 0; 
}

.article-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 60px; max-width: 100%; }

.stats-panel { background: rgba(16, 18, 27, 0.4); border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 16px; padding: 2rem; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.stat-item { border-bottom: 1px solid rgba(255,255,255,0.05); padding: 1.2rem 0; display: flex; flex-direction: column; gap: 0.4rem; }
.stat-item:first-of-type { padding-top: 0; }
.stat-label { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; }
.stat-value { font-size: 1.1rem; color: #fff; font-weight: 600; }

.article-section h2 { font-size: clamp(1.5rem, 3vw, 2rem); color: #fff; margin-bottom: 25px; display: flex; align-items: center; gap: 15px; letter-spacing: -0.5px; }
.article-section h2::after { content: ""; height: 1px; flex: 1; background: linear-gradient(90deg, var(--surface-border), transparent); }
.article-section p { font-size: 1.15rem; color: var(--text-secondary); line-height: 1.8; }

.ide-wrapper { padding: 1px; background: linear-gradient(180deg, var(--surface-border), transparent); border-radius: 9px; box-shadow: 0 20px 40px rgba(0,0,0,0.5); width: 100%; }

/* Grid Auto-Sizing with min() for Mobile */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 20px; margin-top: 30px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 20px; }

.gallery-item { background: var(--surface-color); border: 1px solid rgba(255,255,255,0.05); border-radius: 12px; overflow: hidden; transition: 0.3s; }
.gallery-item:hover { border-color: var(--accent-color); box-shadow: 0 15px 30px rgba(0,0,0,0.6); transform: translateY(-5px); }
.gallery-caption { padding: 15px; font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-secondary); background: rgba(10, 12, 16, 0.9); border-top: 1px solid rgba(255,255,255,0.05); }

/* Scroll Reveal Animations */
.scroll-reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1); will-change: opacity, transform; }
.scroll-reveal.visible { opacity: 1; transform: translateY(0); }


/* =========================================================
   8. MEDIA QUERIES & MOBILE FIXES
   ========================================================= */
@media (max-width: 1200px) {
    .card-body { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
    /* Tablet/Medium Screen Breakpoints */
    .dashboard { flex-direction: column; padding: 1rem; gap: 2rem; }
    .sidebar { position: static; width: 100%; height: auto; padding: 2rem; }
    
    .article-layout { flex-direction: column; gap: 3rem; }
    .article-sidebar { position: static; width: 100%; }
}

@media (max-width: 768px) {
    /* Mobile Phone Breakpoints */
    .sidebar h1 { font-size: 2.5rem; }
    .project-hero h1 { font-size: 2.2rem !important; }
    
    /* Shrink the rotating 3D widget so it doesn't block content on mobile */
    .gizmo-widget { transform: scale(0.7); transform-origin: bottom right; }
    
    .article-container { padding: 80px 15px 40px 15px; }
}


/* =========================================================
   9. ANIMATIONS & PAGE TRANSITIONS (SMOOTH FADE)
   ========================================================= */
#transition-curtain { 
    position: fixed; inset: 0; background-color: #030407; 
    z-index: 9999; pointer-events: none; 
    opacity: 1; transition: opacity 0.5s ease; 
}
body.is-loaded #transition-curtain { opacity: 0; }
body.is-exiting #transition-curtain { opacity: 1; }

body.is-exiting .dashboard, body.is-exiting .article-container, body.is-exiting .gizmo-widget {
    transition: transform 0.5s ease, filter 0.5s ease, opacity 0.5s ease;
    transform: scale(0.96) translateY(10px); filter: blur(4px); opacity: 0;
}

.fade-in { opacity: 0; transform: perspective(1000px) rotateX(15deg) translateY(20px); transform-origin: top center; animation: none; will-change: transform, opacity; }
body.is-loaded .fade-in { animation: flipIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.d-1 { animation-delay: 0.1s; } .d-2 { animation-delay: 0.2s; } .d-3 { animation-delay: 0.3s; } .d-4 { animation-delay: 0.4s; } .d-5 { animation-delay: 0.5s; }

@keyframes flipIn { 100% { opacity: 1; transform: perspective(1000px) rotateX(0deg) translateY(0); } }
.media-reveal { opacity: 0; transform: scale(0.95); animation: none; }
body.is-loaded .media-reveal { animation: mediaPop 1s cubic-bezier(0.16, 1, 0.3, 1) forwards; animation-delay: 0.3s; }
@keyframes mediaPop { 100% { opacity: 1; transform: scale(1); } }