/* === FONT & ROOT VARIABLES === */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@700;800&family=Inter:wght@400;500;600&display=swap');

:root {
    /* --- Light Theme (Default) --- */
    --bg-primary: #F8F8FA;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F0F0F2;
    --text-primary: #1A1A1A;
    --text-secondary: #6B6B6B;
    --accent-gradient: linear-gradient(45deg, #0057FF, #2979FF);
    --accent-text: #0057FF;
    --border-color: #EAEAEA;
    --glow-color: rgba(0, 87, 255, 0.2);
    --shadow-color: rgba(0,0,0,0.08);
    --grid-color: rgba(220, 220, 220, 0.5);

    --font-heading: 'Syne', sans-serif;
    --font-body: 'Inter', sans-serif;
}

html[data-theme="dark"] {
    /* --- Dark Theme --- */
    --bg-primary: #0D1117;
    --bg-secondary: #161B22;
    --bg-tertiary: #21262D;
    --text-primary: #E5E7EB;
    --text-secondary: #9CA3AF;
    --accent-gradient: linear-gradient(90deg, #22D3EE, #A78BFA, #F472B6);
    --accent-text: linear-gradient(90deg, #22D3EE, #A78BFA);
    --border-color: #30363D;
    --glow-color: rgba(167, 139, 250, 0.2);
    --shadow-color: rgba(0,0,0,0.2);
    --grid-color: rgba(48, 54, 61, 0.5);
}

/* === BASE & THEME TRANSITIONS === */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 2rem; }

/* === INTERACTIVE GRID BACKGROUND === */
.background-grid {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    background-image:
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 40px 40px;
    animation: pan-grid 60s linear infinite;
    mask-image: radial-gradient(ellipse 80% 80% at var(--mouse-x, 50%) var(--mouse-y, 50%), black 0%, transparent 50%);
    transition: background-color 0.4s ease;
}
@keyframes pan-grid { from { background-position: 0 0; } to { background-position: -400px -400px; } }

/* === HEADER, NAVIGATION, THEME TOGGLE === */
.navbar { position: fixed; top: 0; left: 0; width: 100%; padding: 1rem 0; z-index: 100; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); background-color: color-mix(in srgb, var(--bg-primary) 70%, transparent); border-bottom: 1px solid transparent; transition: all 0.3s ease; }
.navbar.nav-hidden { transform: translateY(-100%); }
.navbar.nav-scrolled { border-bottom-color: var(--border-color); }
.nav-container { display: flex; justify-content: space-between; align-items: center; }
.nav-logo { font-family: var(--font-heading); font-weight: 800; font-size: 1.5rem; text-decoration: none; color: var(--text-primary); }
.nav-menu { display: flex; align-items: center; gap: 1.5rem; }
.nav-link { color: var(--text-secondary); text-decoration: none; font-weight: 500; font-size: 0.95rem; transition: color 0.3s ease; }
.nav-link:hover { color: var(--text-primary); }
.theme-toggle { background: none; border: none; cursor: pointer; padding: 0.5rem; display: flex; align-items: center; justify-content: center; position: relative; width: 24px; height: 24px; }
.theme-toggle svg { position: absolute; width: 20px; height: 20px; transition: transform 0.4s ease, opacity 0.4s ease; color: var(--text-secondary); }
.theme-toggle .sun { opacity: 1; transform: rotate(0) scale(1); }
.theme-toggle .moon { opacity: 0; transform: rotate(-90deg) scale(0); }
html[data-theme="dark"] .theme-toggle .sun { opacity: 0; transform: rotate(90deg) scale(0); }
html[data-theme="dark"] .theme-toggle .moon { opacity: 1; transform: rotate(0) scale(1); }
.hamburger { display: none; cursor: pointer; z-index: 1001; }
.bar { display: block; width: 25px; height: 3px; margin: 5px auto; transition: all 0.3s ease-in-out; background-color: var(--text-primary); border-radius: 2px; }

/* === BUTTONS === */
.btn { display: inline-block; padding: 0.75rem 1.5rem; border-radius: 50px; text-decoration: none; font-weight: 600; font-size: 0.95rem; border: none; transition: transform 0.3s ease, box-shadow 0.3s ease; }
.btn-primary { background: var(--accent-gradient); color: #FFF; }
.btn-primary:hover { transform: scale(1.05); box-shadow: 0 10px 25px var(--glow-color); }
.btn-secondary { background-color: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-secondary:hover { transform: scale(1.05); border-color: var(--text-secondary); }

/* === HERO SECTION === */
.hero { min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; position: relative; }
.hero-content { display: flex; flex-direction: column; gap: 1rem; }
.hero-title { font-family: var(--font-heading); font-size: clamp(3rem, 10vw, 6rem); line-height: 1; font-weight: 800; color: var(--text-primary); }
.hero-subtitle { font-family: var(--font-heading); font-size: clamp(1.25rem, 5vw, 2.25rem); color: var(--text-secondary); font-weight: 700; }
.hero-description { max-width: 600px; margin: 0.5rem auto 0 auto; font-size: 1.1rem; color: var(--text-secondary); }
.scroll-down-indicator { position: absolute; bottom: 2rem; font-size: 1.5rem; color: var(--border-color); animation: bounce 2s infinite 1s; }
@keyframes bounce { 0%, 20%, 50%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-15px); } 60% { transform: translateY(-5px); } }

/* === CSS-BASED SCROLL ANIMATIONS === */
.animate-on-scroll { opacity: 0; transform: translateY(30px); transition: opacity 0.8s ease-out, transform 0.8s ease-out; }
.animate-on-scroll.is-visible { opacity: 1; transform: translateY(0); }

/* === GENERAL SECTION STYLES & GRADIENT TITLES === */
section { padding: 6rem 0; transition: background-color 0.4s ease; }
.section-title { font-family: var(--font-heading); font-size: 2.5rem; font-weight: 800; margin-bottom: 3rem; text-align: center; background: var(--accent-text, var(--accent-gradient)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
#about, #projects, .footer, #certifications { background-color: var(--bg-secondary); }

/* === CERTIFICATIONS SECTION === */
#certifications { background-color: var(--bg-primary); }
.certifications-list { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; max-width: 900px; margin: 0 auto; }
.certification-item { padding: 1.5rem; border: 1px solid var(--border-color); background-color: var(--bg-secondary); border-radius: 12px; transition: all 0.3s ease; text-decoration: none; position: relative; }
.certification-item:hover { transform: translateY(-5px); box-shadow: 0 10px 20px var(--shadow-color); border-color: color-mix(in srgb, var(--border-color) 50%, transparent); }
.certification-item h4 { font-family: var(--font-heading); font-size: 1.25rem; color: var(--text-primary); margin-bottom: 0.25rem; }
.certification-item p { color: var(--text-secondary); font-weight: 500; }
.certification-link-icon { position: absolute; top: 1.5rem; right: 1.5rem; color: var(--text-secondary); opacity: 0; transform: scale(0.8); transition: opacity 0.3s ease, transform 0.3s ease; }
.certification-item:hover .certification-link-icon { opacity: 1; transform: scale(1); }

/* === All other styles are copied from your previous version === */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 2rem; }
.project-card { background-color: var(--bg-primary); border-radius: 20px; border: 1px solid var(--border-color); cursor: pointer; transition: all 0.3s ease; display: flex; flex-direction: column; height: 100%; }
.project-card:hover { transform: translateY(-10px); box-shadow: 0 20px 40px var(--shadow-color); border-color: color-mix(in srgb, var(--border-color) 50%, transparent); }
.about-content { display: grid; grid-template-columns: 1fr 1.5fr; gap: 4rem; align-items: center; }
.about-image { border-radius: 20px; overflow: hidden; box-shadow: 0 20px 40px var(--shadow-color); }
.about-image img { width: 100%; display: block; }
.about-text p { margin-bottom: 1.5rem; color: var(--text-secondary); max-width: 600px; }
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.skill-category { background-color: var(--bg-secondary); padding: 2rem; border-radius: 20px; border: 1px solid var(--border-color); }
.skill-category h4 { font-family: var(--font-heading); font-size: 1.2rem; margin-bottom: 1.5rem; color: var(--text-primary); }
.skill-tags { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.skill-tags span { background-color: var(--bg-tertiary); border: 1px solid var(--border-color); color: var(--text-secondary); padding: 0.5rem 1rem; border-radius: 8px; font-weight: 500; font-size: 0.9rem; }
.project-content { padding: 1.75rem; display: flex; flex-direction: column; flex-grow: 1; }
.project-category { color: var(--text-secondary); font-weight: 600; font-size: 0.9rem; text-transform: uppercase; }
.project-content h4 { font-family: var(--font-heading); font-size: 1.75rem; margin: 0.25rem 0 0.75rem 0; }
.project-description { color: var(--text-secondary); margin-bottom: 1.5rem; flex-grow: 1; }
.project-tech { display: flex; flex-wrap: wrap; gap: 0.5rem; border-top: 1px solid var(--border-color); padding-top: 1.5rem; }
.project-tech span { background: var(--bg-tertiary); color: var(--text-secondary); padding: 0.25rem 0.75rem; border-radius: 50px; font-size: 0.8rem; font-weight: 500; }
.contact { text-align: center; }
.contact-description { max-width: 500px; margin: 0 auto 1.5rem auto; color: var(--text-secondary); font-size: 1.1rem; }
.contact-email-link { display: inline-block; font-size: clamp(1rem, 5vw, 1.5rem); font-weight: 600; text-decoration: none; position: relative; margin-bottom: 2rem; color: var(--text-primary); }
.social-links { display: flex; justify-content: center; gap: 2rem; }
.social-link { font-weight: 500; color: var(--text-secondary); text-decoration: none; font-size: 1rem; transition: color 0.3s; }
.social-link:hover { color: var(--text-primary); }
.footer { padding: 2rem 0; text-align: center; color: var(--text-secondary); }
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1000; display: flex; align-items: center; justify-content: center; pointer-events: none; opacity: 0; transition: opacity 0.4s ease; }
.modal.active { pointer-events: all; opacity: 1; }
.modal-overlay { position: absolute; width: 100%; height: 100%; background-color: color-mix(in srgb, var(--bg-primary) 70%, transparent); backdrop-filter: blur(8px); }
.modal-content { background-color: var(--bg-secondary); border-radius: 20px; max-width: 800px; width: 90%; max-height: 90vh; overflow-y: auto; z-index: 1; transform: scale(0.95); transition: transform 0.4s ease, background-color 0.4s ease, border-color 0.4s ease; border: 1px solid var(--border-color); }
.modal.active .modal-content { transform: scale(1); }
.modal-close { position: absolute; top: 1rem; right: 1rem; background: var(--bg-tertiary); border: 1px solid var(--border-color); width: 40px; height: 40px; border-radius: 50%; font-size: 1.25rem; color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.3s; }
.modal-close:hover { background-color: var(--border-color); color: var(--text-primary); }
.modal-body { padding: 2rem 3rem; }
.modal-body .project-image { width: 100%; height: 300px; background-color: var(--bg-tertiary); border-radius: 12px; margin-bottom: 2rem; object-fit: cover; }
.modal-body .modal-header h3 { font-family: var(--font-heading); font-size: 2.25rem; }
.modal-body .modal-header .project-category { color: var(--text-secondary); font-weight: 600; }
.modal-body .modal-buttons { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1.5rem 0; }
.modal-body h4 { font-family: var(--font-heading); font-size: 1.25rem; margin-top: 2rem; margin-bottom: 1rem; }
.modal-body ul { list-style-position: inside; padding-left: 0.5rem; }
.modal-body li, .modal-body p { color: var(--text-secondary); }
.modal-body .tech-stack-tags { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* === RESPONSIVE STYLES (MOBILE & TABLET FIX) === */
@media (max-width: 768px) { 
    .container {
        padding: 0 1.5rem; /* Reduce side padding on mobile */
    }

    /* --- Mobile Navigation --- */
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 0;
        gap: 0;
        flex-direction: column;
        background-color: var(--bg-secondary);
        width: 100%;
        height: 100vh;
        text-align: center;
        transition: 0.3s;
        justify-content: center;
        z-index: 1000;
    }
    .nav-menu.active {
        left: 0;
    }
    .nav-link {
        margin: 1.5rem 0;
        font-size: 1.5rem;
    }
    .nav-menu .btn {
        margin-left: 0;
    }
    .nav-menu #theme-toggle {
        margin-top: 1rem;
    }
    .hamburger {
        display: block; /* Show the hamburger icon */
        z-index: 1001; /* Place it above the menu overlay */
    }
    .hamburger.active .bar:nth-child(2) { opacity: 0; }
    .hamburger.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .hamburger.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

    /* --- Section & Font Adjustments --- */
    section { 
        padding: 4rem 0; 
    }
    .hero-title {
        font-size: clamp(2.5rem, 12vw, 4rem); /* Smaller title on mobile */
    }
    .hero-subtitle {
        font-size: clamp(1.1rem, 4vw, 1.5rem); /* Smaller subtitle on mobile */
    }
    .section-title {
        font-size: 2rem;
    }

    /* --- Stack Multi-Column Layouts --- */
    .about-content, 
    .skills-grid, 
    .certifications-list, 
    .projects-grid { 
        grid-template-columns: 1fr; /* Stack all grids into a single column */
    } 
    .about-image-wrapper { 
        max-width: 350px; 
        margin: 0 auto 2rem auto;
    }

    /* --- Modal Fixes --- */
    .modal-body { 
        padding: 2rem 1.5rem; 
    } 
    .modal-body .modal-header h3 { 
        font-size: 1.75rem; 
    } 
}
