/* Core & Variables */
:root {
    --bg-color: #050505;
    --text-color: #f0f0f0;
    --nav-bg: rgba(5, 5, 5, 0.8);
    --nav-bg-scrolled: rgba(5, 5, 5, 0.98);
    --nav-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    --accent-color: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.4);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] {
    --bg-color: #f7f7f7;
    --text-color: #111111;
    --nav-bg: rgba(247, 247, 247, 0.8);
    --nav-bg-scrolled: rgba(247, 247, 247, 0.98);
    --nav-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
    --accent-color: #4f46e5;
    --accent-glow: rgba(79, 70, 229, 0.2);
    --glass-bg: rgba(0, 0, 0, 0.03);
    --glass-border: rgba(0, 0, 0, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
}

h1, h2, h3 {
    overflow-wrap: break-word;
}

/* Typography & Layout */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    text-align: center;
    background: linear-gradient(135deg, var(--text-color) 0%, #888 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

section {
    padding: 6rem 0;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    background: var(--nav-bg);
    border-bottom: 1px solid var(--glass-border);
}

.navbar.scrolled {
    background: var(--nav-bg-scrolled);
    box-shadow: var(--nav-shadow);
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-color);
    text-decoration: none;
    letter-spacing: -1px;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: inherit;
    opacity: 0.7;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-links a:hover {
    opacity: 1;
    color: var(--accent-color);
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    opacity: 0.7;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    opacity: 1;
    color: var(--accent-color);
    transform: rotate(15deg);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    text-align: center;
}

.hero-content {
    z-index: 2;
}

.hero h1 {
    font-size: 5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
    letter-spacing: -2px;
}

.subtitle {
    font-size: 1.5rem;
    color: #888;
    margin-bottom: 1.5rem;
    font-weight: 300;
}

.hero-bio {
    font-size: 1.1rem;
    color: #bbb;
    max-width: 600px;
    margin: 0 auto 2.5rem auto;
    line-height: 1.8;
}

.nav-socials {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-left: 0.5rem;
}

.social-icon {
    color: #888;
    width: 20px;
    height: 20px;
    transition: color 0.3s ease, transform 0.3s ease;
    display: inline-flex;
}

.social-icon svg {
    width: 100%;
    height: 100%;
}

.social-icon:hover {
    color: var(--accent-color);
    transform: translateY(-3px);
}

.glow-bg {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-glow) 0%, rgba(5,5,5,0) 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    pointer-events: none;
    animation: pulse 8s infinite alternate;
}

@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    100% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.8; }
}

/* Buttons */
.cta-button {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: var(--text-color);
    color: var(--bg-color);
    text-decoration: none;
    font-weight: 600;
    border-radius: 50px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.cta-button:hover {
    background: transparent;
    color: var(--text-color);
    border-color: var(--text-color);
    box-shadow: 0 0 20px rgba(255,255,255,0.2);
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2.5rem;
    backdrop-filter: blur(12px);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255,255,255,0.1);
}

/* Timeline (Experience) */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 40px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--glass-border);
}

@media (max-width: 768px) {
    .timeline::before {
        left: 20px;
    }
}

.timeline-item {
    position: relative;
    padding-left: 80px;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px) {
    .timeline-item {
        padding-left: 50px;
    }
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 35px;
    top: 3rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-glow);
    z-index: 2;
}

@media (max-width: 768px) {
    .timeline-item::before {
        left: 15px;
    }
}

.timeline-content h3 {
    font-size: 1.5rem;
    color: var(--text-color);
    margin-bottom: 0.2rem;
}

.timeline-content h4 {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

.timeline-date {
    display: inline-block;
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 1rem;
}

.timeline-context {
    font-size: 0.9rem;
    font-style: italic;
    color: #aaa;
    margin-bottom: 1rem;
}

.timeline-content ul {
    list-style-type: none;
    color: #ccc;
}

.timeline-content ul li {
    position: relative;
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
}

.timeline-content ul li::before {
    content: '▹';
    position: absolute;
    left: 0;
    color: var(--accent-color);
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.project-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.project-card p {
    color: #aaa;
    margin-bottom: 1.5rem;
}

.inline-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: opacity 0.3s ease;
}

.inline-link:hover {
    opacity: 0.8;
}

/* Canvas Card (Three.js) */
.canvas-card {
    position: relative;
    padding: 0;
    overflow: hidden;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.canvas-card canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    z-index: 1;
    cursor: grab;
}

.canvas-card canvas:active {
    cursor: grabbing;
}

.card-content-overlay {
    position: relative;
    z-index: 2;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
    padding: 2.5rem;
    width: 100%;
    pointer-events: none;
}

[data-theme="light"] .card-content-overlay {
    background: linear-gradient(to top, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0) 100%);
}

.card-content-overlay h3,
.card-content-overlay p {
    margin: 0;
}

.card-content-overlay p {
    margin-top: 0.5rem;
}

/* Full-Stack Flow Animation */
#fullstack-container {
    background: linear-gradient(135deg, rgba(15,20,30,1) 0%, rgba(20,15,35,1) 100%);
}

[data-theme="light"] #fullstack-container {
    background: linear-gradient(135deg, rgba(235,240,255,1) 0%, rgba(245,235,255,1) 100%);
}

.flow-diagram {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-bottom: 3rem; /* Leave room for text */
    gap: 15px;
    z-index: 1;
}

.node {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--accent-color);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    color: var(--text-color);
    box-shadow: 0 0 15px var(--accent-glow);
    animation: pulse-node 3s infinite alternate;
}

[data-theme="light"] .node {
    background: rgba(255, 255, 255, 0.6);
}

.path {
    width: 4px;
    height: 40px;
    background: rgba(99, 102, 241, 0.2);
    position: relative;
    border-radius: 2px;
    overflow: hidden;
}

.packet {
    position: absolute;
    top: -10px;
    left: 0;
    width: 100%;
    height: 10px;
    background: var(--accent-color);
    border-radius: 2px;
    box-shadow: 0 0 10px var(--accent-color);
}

.packet-1 {
    animation: flow-down 2s infinite linear;
}

.packet-2 {
    animation: flow-down 2s infinite linear;
    animation-delay: 1s;
}

@keyframes flow-down {
    0% { top: -10px; opacity: 1; }
    80% { opacity: 1; }
    100% { top: 40px; opacity: 0; }
}

@keyframes pulse-node {
    0% { box-shadow: 0 0 5px var(--accent-glow); transform: scale(1); }
    100% { box-shadow: 0 0 20px var(--accent-glow); transform: scale(1.02); }
}

/* D3 Chart Animation */
.bar {
    fill: var(--accent-color);
    cursor: pointer;
    transition: fill 0.3s ease;
}

.bar:hover {
    fill: #8b5cf6;
}

.axis path,
.axis line {
    stroke: var(--glass-border);
}

.axis text {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    fill: var(--text-color);
}

/* Contact & Footer */
.contact-section {
    text-align: center;
}

.contact-section p {
    color: #888;
    max-width: 600px;
    margin: 0 auto 2rem auto;
}

footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--glass-border);
    color: #666;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 { font-size: 3.5rem; }
    
    .navbar {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        box-sizing: border-box;
        width: 100vw;
    }

    .nav-links { 
        display: flex;
        flex-wrap: wrap;
        gap: 1rem;
        width: 100%;
        justify-content: flex-start;
        font-size: 0.9rem;
    }

    .nav-socials {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
        margin-top: 0.5rem;
    }

    .glow-bg {
        width: 100vw;
        height: 100vw;
    }
}
