/* ::::: 1. CONFIGURATION & VARIABLES ::::: */
:root {
    /* --- Light Theme Variables --- */
    --bg-color-light: #f8fafc;
    --text-primary-light: #0f172a;
    --text-secondary-light: #475569;
    --accent-light: #2563eb; /* Core Blue */
    --accent-glow-light: rgba(37, 99, 235, 0.5);
    --card-bg-light: rgba(255, 255, 255, 0.6);
    --border-light: rgba(226, 232, 240, 0.6);
    --nav-glass-light: rgba(248, 250, 252, 0.7);
    
    /* --- Dark Theme Variables (Default) --- */
    --bg-color-dark: #030712; /* Deepest Blue/Black */
    --text-primary-dark: #f8fafc;
    --text-secondary-dark: #94a3b8;
    --accent-dark: #38bdf8; /* Electric Cyan */
    --accent-glow-dark: rgba(56, 189, 248, 0.4);
    --card-bg-dark: rgba(17, 24, 39, 0.6);
    --border-dark: rgba(51, 65, 85, 0.5);
    --nav-glass-dark: rgba(3, 7, 18, 0.7);

    /* --- Shared Physics & Animation Variables --- */
    --section-spacing: 140px;
    --transition-smooth: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-bounce: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Theme mapping based on data-theme attribute */
[data-theme="light"] {
    --bg-MAIN: var(--bg-color-light);
    --text-MAIN: var(--text-primary-light);
    --text-MUTED: var(--text-secondary-light);
    --accent-MAIN: var(--accent-light);
    --accent-GLOW: var(--accent-glow-light);
    --card-BG: var(--card-bg-light);
    --border-MAIN: var(--border-light);
    --nav-GLASS: var(--nav-glass-light);
}

[data-theme="dark"] {
    --bg-MAIN: var(--bg-color-dark);
    --text-MAIN: var(--text-primary-dark);
    --text-MUTED: var(--text-secondary-dark);
    --accent-MAIN: var(--accent-dark);
    --accent-GLOW: var(--accent-glow-dark);
    --card-BG: var(--card-bg-dark);
    --border-MAIN: var(--border-dark);
    --nav-GLASS: var(--nav-glass-dark);
}

/* ::::: 2. CORE RESET & BASE STYLES ::::: */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-MAIN);
    color: var(--text-MAIN);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
    position: relative;
}

/* The interactive particle canvas background */
#neural-canvas {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1; pointer-events: none; opacity: 1; transition: opacity 0.5s;
}
[data-theme="light"] #neural-canvas { opacity: 0.5; }

/* ::::: 3. GLASS NAVIGATION ::::: */
header {
    position: fixed; top: 25px; left: 50%; transform: translateX(-50%);
    width: 90%; max-width: 1100px; height: 65px;
    background: var(--nav-GLASS);
    backdrop-filter: blur(16px) saturate(180%); -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--border-MAIN); border-radius: 100px;
    z-index: 1000;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 30px;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.1);
    transition: var(--transition-smooth);
}
header.scrolled { top: 10px; height: 55px; width: 95%; }

.logo { font-weight: 800; font-size: 1.4rem; letter-spacing: -0.5px; position: relative; }
.logo span { color: var(--accent-MAIN); }
/* Subtle pulse on the dot */
.logo span::after { content:''; position:absolute; right:1px; bottom:3px; width:4px; height:4px; background:var(--accent-MAIN); border-radius:50%; animation: pulseDot 2s infinite;}
@keyframes pulseDot { 0% { box-shadow: 0 0 0 0 var(--accent-MAIN); } 70% { box-shadow: 0 0 0 8px transparent; } }

nav ul { display: flex; gap: 35px; list-style: none; }
nav a { 
    font-size: 0.9rem; font-weight: 600; color: var(--text-MUTED); 
    text-decoration: none; position: relative; transition: color 0.3s;
}
nav a:hover { color: var(--accent-MAIN); }
/* Animated underline */
nav a::before {
    content: ''; position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); width: 0; height: 2px;
    background: var(--accent-MAIN); transition: width 0.3s ease-out; border-radius: 2px;
}
nav a:hover::before { width: 100%; }

.theme-toggle-btn {
    background: transparent; border: none; cursor: pointer; color: var(--text-MAIN);
    padding: 8px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    transition: var(--transition-bounce);
}
.theme-toggle-btn:hover { background: var(--border-MAIN); transform: rotate(15deg) scale(1.1); }

/* ::::: 4. HERO SECTION & TYPOGRAPHY ::::: */
section { padding: var(--section-spacing) 20px; max-width: 1200px; margin: 0 auto; position: relative; }
.hero { min-height: 95vh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding-top: 0; }

/* Status Chip */
.cyber-chip {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 8px 20px; background: rgba(var(--accent-MAIN), 0.05);
    border: 1px solid var(--accent-MAIN); border-radius: 50px;
    font-size: 0.85rem; font-weight: 700; color: var(--accent-MAIN); text-transform: uppercase; letter-spacing: 1px;
    margin-bottom: 30px; backdrop-filter: blur(5px);
    box-shadow: 0 0 20px var(--accent-GLOW);
}
.cyber-chip i { width: 8px; height: 8px; background: var(--accent-MAIN); border-radius: 50%; animation: blink 1.5s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Main Heading with animated gradient */
h1.glitch-header {
    font-size: clamp(3.5rem, 7vw, 6rem); font-weight: 800; line-height: 1;
    margin-bottom: 20px; letter-spacing: -2px;
    background: linear-gradient(135deg, var(--text-MAIN) 20%, var(--accent-MAIN) 80%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-size: 200% auto; animation: gradientShimmer 5s ease infinite alternate;
}
@keyframes gradientShimmer { to { background-position: 200% center; } }

.typewriter { font-size: 1.25rem; color: var(--text-MUTED); margin-bottom: 50px; min-height: 1.6em; font-weight: 500; }

/* ::::: 5. MAGNETIC BUTTONS ::::: */
.btn-container { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }
.mag-btn {
    position: relative; padding: 18px 40px; border-radius: 100px; font-weight: 700; font-size: 1rem;
    text-decoration: none; cursor: pointer; overflow: hidden; transition: transform 0.1s linear; /* Fast for magnet effect */
    z-index: 1; isolation: isolate;
}
.mag-btn-primary { background: var(--accent-MAIN); color: var(--bg-color-dark); border: none; box-shadow: 0 10px 30px -5px var(--accent-GLOW); }
.mag-btn-outline { background: transparent; color: var(--text-MAIN); border: 1px solid var(--border-MAIN); backdrop-filter: blur(10px); }

/* Button hover fill effect */
.mag-btn::before {
    content: ''; position: absolute; top: var(--y, 50%); left: var(--x, 50%);
    transform: translate(-50%, -50%) scale(0); width: 100%; padding-bottom: 100%; border-radius: 50%;
    background: var(--text-MAIN); z-index: -1; transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.mag-btn-primary:hover::before { background: #fff; transform: translate(-50%, -50%) scale(2.5); }
.mag-btn-primary:hover { color: black; }
.mag-btn-outline:hover::before { background: var(--accent-MAIN); transform: translate(-50%, -50%) scale(2.5); }
.mag-btn-outline:hover { border-color: transparent; }

/* ::::: 6. SECTION HEADERS & LAYOUTS ::::: */
.section-header { margin-bottom: 80px; max-width: 700px; }
.section-header h2 { font-size: 2.5rem; font-weight: 800; margin-bottom: 15px; display: flex; align-items: center; gap: 15px; }
/* Decorative line next to headers */
.section-header h2::before { content: ''; width: 40px; height: 3px; background: var(--accent-MAIN); border-radius: 10px; }
.section-header p { font-size: 1.1rem; color: var(--text-MUTED); }

.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 30px; }

/* ::::: 7. 3D TILT CARDS (The Star Feature) ::::: */
.tilt-card {
    background: var(--card-BG);
    border: 1px solid var(--border-MAIN);
    border-radius: 24px;
    padding: 40px;
    position: relative;
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    /* Crucial for 3D effect */
    transform-style: preserve-3d;
    transform: perspective(1000px);
    transition: border-color 0.3s;
    cursor: default;
}
/* The inner content that pops out */
.tilt-content { transform: translateZ(30px); /* Pushes content forward in 3D space */ }

/* Glare effect overlay */
.tilt-card::after {
    content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255,255,255,0.1) 0%, transparent 50%);
    opacity: 0; transition: opacity 0.3s; pointer-events: none; border-radius: inherit; z-index: 2;
}
.tilt-card:hover::after { opacity: 1; }
.tilt-card:hover { border-color: var(--accent-MAIN); box-shadow: 0 20px 40px -10px var(--accent-GLOW); }

.tilt-card h3 { font-size: 1.5rem; margin-bottom: 15px; font-weight: 700; }
.tilt-card p { color: var(--text-MUTED); margin-bottom: 25px; }

.tag-rail { display: flex; flex-wrap: wrap; gap: 10px; }
.tech-tag {
    font-size: 0.8rem; font-weight: 600; padding: 6px 14px;
    border: 1px solid var(--border-MAIN); border-radius: 8px; color: var(--text-MUTED);
    transition: var(--transition-bounce);
}
.tilt-card:hover .tech-tag { background: rgba(var(--accent-MAIN), 0.1); color: var(--accent-MAIN); border-color: var(--accent-MAIN); }

/* ::::: 8. ENHANCED TIMELINE ::::: */
.timeline-container { position: relative; padding-left: 50px; }
/* The main vertical line */
.timeline-line {
    position: absolute; left: 0; top: 10px; bottom: 0; width: 2px;
    background: var(--border-MAIN);
    overflow: hidden;
}
/* The animated fill of the line */
.timeline-fill {
    position: absolute; top: 0; left: 0; width: 100%; height: 0%; /* Starts empty */
    background: var(--accent-MAIN); box-shadow: 0 0 15px var(--accent-MAIN);
    transition: height 0.1s linear; /* Controlled by JS scroll */
}

.timeline-item { position: relative; margin-bottom: 70px; }
/* The dot on the timeline */
.timeline-marker {
    position: absolute; left: -59px; top: 5px; width: 20px; height: 20px;
    border-radius: 50%; background: var(--bg-MAIN); border: 2px solid var(--border-MAIN);
    z-index: 2; transition: var(--transition-bounce); display: flex; align-items: center; justify-content: center;
}
/* Inner dot that glows when active */
.timeline-marker::after { content: ''; width: 8px; height: 8px; background: var(--border-MAIN); border-radius: 50%; transition: 0.3s; }

/* Active state when scrolled past */
.timeline-item.active .timeline-marker { border-color: var(--accent-MAIN); box-shadow: 0 0 20px var(--accent-GLOW); }
.timeline-item.active .timeline-marker::after { background: var(--accent-MAIN); }

.time-period { font-size: 0.9rem; font-weight: 700; color: var(--accent-MAIN); letter-spacing: 1px; margin-bottom: 5px; display: block; }
.role-title { font-size: 1.6rem; font-weight: 800; }
.company-name { font-size: 1.1rem; color: var(--text-MUTED); margin-bottom: 25px; }
.role-details li { color: var(--text-MUTED); margin-bottom: 12px; list-style: none; position: relative; padding-left: 25px; }
.role-details li::before { content: '▹'; position: absolute; left: 0; color: var(--accent-MAIN); font-weight: bold; }

/* ::::: 9. FOOTER ::::: */
footer {
    background: var(--card-BG); border-top: 1px solid var(--border-MAIN);
    padding: 80px 20px; text-align: center; position: relative; overflow: hidden;
}
footer h2 { font-size: 2.5rem; margin-bottom: 30px; }
footer::before { /* Subtle glow at bottom */
    content: ''; position: absolute; bottom: -100px; left: 50%; transform: translateX(-50%);
    width: 80%; height: 200px; background: var(--accent-MAIN); filter: blur(150px); opacity: 0.15; pointer-events: none;
}

/* ::::: 10. SCROLL REVEAL ANIMATIONS ::::: */
/* Base class for hidden elements */
.reveal-up { opacity: 0; transform: translateY(40px) scale(0.98); transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
/* Class added by JS when in view */
.reveal-up.in-view { opacity: 1; transform: translateY(0) scale(1); }

/* Stagger delays (handled in CSS for cleaner JS) */
.delay-1 { transition-delay: 0.1s; } .delay-2 { transition-delay: 0.2s; } .delay-3 { transition-delay: 0.3s; } .delay-4 { transition-delay: 0.4s; }

/* Mobile Responsiveness */
@media (max-width: 768px) {
    nav { display: none; } /* Hide nav links on mobile for simplicity */
    h1.glitch-header { font-size: 3rem; }
    .hero { min-height: 80vh; }
    .grid-3 { grid-template-columns: 1fr; }
    .tilt-card { transform: none !important; /* Disable 3D tilt on mobile for performance */ }
    .tilt-content { transform: none !important; }
    .section-header h2 { font-size: 2rem; }
}