/* --- CSS VARIABLES & RESET --- */
:root {
    --bg-color: #050505;
    --card-bg: #121212;
    --primary: #ff0000;
    --text-white: #ffffff;
    --text-gray: #a1a1a1;
    --nav-bg: rgba(5, 5, 5, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}

/* Light Mode Variables */
[data-theme="light"] {
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --primary: #d00000;
    --text-white: #1a1a1a;
    --text-gray: #555555;
    --nav-bg: rgba(245, 247, 250, 0.9);
    --border-color: rgba(0, 0, 0, 0.06);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

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

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

/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0; left: 0; width: 0%; height: 3px;
    background: var(--primary); z-index: 9999;
    transition: width 0.1s; box-shadow: 0 0 10px var(--primary);
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-color); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 5px; }

a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* --- CANVAS BACKGROUND --- */
#canvas-bg {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%; z-index: -1;
    pointer-events: none;
}

/* --- NAVIGATION --- */
nav {
    position: fixed; top: 0; width: 100%;
    padding: 20px 8%; display: flex;
    justify-content: space-between; align-items: center;
    background: var(--nav-bg); backdrop-filter: blur(15px);
    z-index: 1000; border-bottom: 1px solid var(--border-color);
    transition: 0.3s;
}

.logo {
    font-size: 1.5rem; font-weight: 700; letter-spacing: 1px;
    z-index: 1001; position: relative; overflow: hidden;
}

.logo a {
    background: linear-gradient(90deg, var(--text-white), var(--text-gray), var(--text-white));
    background-size: 200%; -webkit-background-clip: text;
    -webkit-text-fill-color: transparent; animation: shine 5s linear infinite;
}

@keyframes shine { to { background-position: 200% center; } }
.logo span { color: var(--primary); -webkit-text-fill-color: var(--primary); }

.nav-links { display: flex; gap: 30px; align-items: center; }
.nav-links li { opacity: 0; animation: slideDown 0.5s forwards; }
.nav-links li:nth-child(1) { animation-delay: 0.1s; }
.nav-links li:nth-child(2) { animation-delay: 0.15s; }
.nav-links li:nth-child(3) { animation-delay: 0.2s; }
.nav-links li:nth-child(4) { animation-delay: 0.25s; }
.nav-links li:nth-child(5) { animation-delay: 0.3s; }
.nav-links li:nth-child(6) { animation-delay: 0.35s; }
.nav-links li:nth-child(7) { animation-delay: 0.4s; }
.nav-links li:nth-child(8) { animation-delay: 0.45s; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-15px); }
    to { opacity: 1; transform: translateY(0); }
}

.nav-links a {
    font-size: 0.9rem; font-weight: 500;
    transition: var(--transition); position: relative;
    padding: 5px; color: var(--text-white);
}

.nav-links a::after {
    content: ''; position: absolute; width: 0; height: 2px;
    bottom: 0px; left: 50%; background: var(--primary);
    transition: var(--transition); transform: translateX(-50%);
}

.nav-links a:hover { color: var(--primary); }
.nav-links a:hover::after { width: 100%; }

.nav-resume { border: none; padding: 5px; }
.nav-resume:hover { color: var(--primary); }

.theme-li {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
}

#theme-toggle {
    background: transparent; border: none;
    color: var(--text-white); font-size: 1.2rem;
    cursor: pointer; transition: color 0.3s ease;
    padding: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
}

#theme-toggle:hover { 
    color: var(--primary); background: rgba(255,255,255,0.05);
}

.menu-btn {
    display: none; font-size: 1.5rem; color: var(--text-white);
    cursor: pointer; z-index: 1001; width: 40px; height: 40px;
    align-items: center; justify-content: center;
}

/* --- HERO SECTION --- */
.hero {
    display: flex; align-items: center; justify-content: space-between;
    padding: 140px 10% 80px; position: relative; min-height: 100vh;
}
.hero-content { max-width: 600px; z-index: 2; width: 100%; }

.hello-tag {
    color: var(--primary); font-family: 'Fira Code', monospace;
    font-size: 1rem; margin-bottom: 15px; display: inline-block;
}

.hero h1 {
    font-size: clamp(2.5rem, 7vw, 4.5rem); line-height: 1.1;
    margin-bottom: 15px; color: var(--text-white);
    font-weight: 700; letter-spacing: -1px;
}

.typing-container {
    font-size: clamp(1.2rem, 3.5vw, 1.8rem); font-weight: 600;
    margin-bottom: 25px; color: var(--text-gray);
    min-height: 1.5em; display: flex; align-items: center;
}
.type-text { color: var(--primary); }

.hero-desc {
    color: var(--text-gray); max-width: 500px; margin-bottom: 35px;
    font-size: 1.05rem; opacity: 0.9; line-height: 1.8;
}

.hero-actions {
    display: flex; align-items: center; gap: 25px;
    margin-top: 20px; flex-wrap: wrap;
}

.magnetic-btn {
    position: relative; display: inline-block; padding: 14px 35px;
    border: 1px solid var(--primary); color: var(--primary);
    font-weight: 600; text-transform: uppercase; letter-spacing: 1px;
    border-radius: 4px; overflow: hidden;
    transition: color 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    background: transparent;
}
.magnetic-btn span { position: relative; z-index: 1; }
.magnetic-btn::before {
    content: ''; position: absolute; top: 0; left: 0;
    width: 100%; height: 100%; background: var(--primary);
    transform: scaleX(0); transform-origin: right;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 0;
}
.magnetic-btn:hover { color: #fff; }
.magnetic-btn:hover::before { transform: scaleX(1); transform-origin: left; }

.social-icons { display: flex; gap: 20px; }
.social-icon {
    width: 45px; height: 45px; border-radius: 50%;
    border: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; color: var(--text-gray);
    /* IMPORTANT: No transform transition here, only colors */
    transition: border-color 0.3s, color 0.3s, box-shadow 0.3s; 
}
.social-icon:hover {
    border-color: var(--primary); color: var(--primary);
    box-shadow: 0 5px 15px rgba(255, 0, 0, 0.2);
    /* IMPORTANT: Removed transform: translateY here to fix glitch */
}

.hero-img-container {
    position: relative; width: clamp(280px, 40vw, 420px); 
    height: clamp(280px, 40vw, 420px);
    display: flex; justify-content: center; align-items: center; z-index: 1;
}
.img-wrapper {
    position: relative; width: 100%; height: 100%;
    border-radius: 50%; transition: var(--transition);
}
.floating-anim { animation: floatProfile 6s ease-in-out infinite; }
@keyframes floatProfile {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
}
.hero-img-container img.profile-pic {
    width: 100%; height: 100%; object-fit: cover;
    border-radius: 50%; border: 2px solid rgba(255,255,255,0.05);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.2); transition: all 0.5s ease;
}
.hero-img-container:hover img.profile-pic {
    transform: scale(1.02); border-color: var(--primary);
    box-shadow: 0 0 40px rgba(255, 0, 0, 0.15);
}

/* --- SECTIONS COMMON --- */
section { padding: 120px 10%; }
.section-title {
    text-align: center; font-size: clamp(2rem, 5vw, 2.8rem);
    margin-bottom: 80px; padding-bottom: 15px; position: relative;
    opacity: 0; transform: translateY(20px); transition: all 0.6s ease;
}
.section-title.show { opacity: 1; transform: translateY(0); }
.section-title::after {
    content: ''; display: block; width: 0px; height: 4px;
    background: var(--primary); margin: 12px auto 0;
    border-radius: 2px; transition: width 0.8s ease 0.3s;
}
.section-title.show::after { width: 70px; }
.section-title span { color: var(--primary); }

/* --- SKILLS --- */
.skills-grid {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 30px;
}
.skill-item {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    transition: var(--transition); width: 90px; padding: 15px;
    background: rgba(255,255,255,0.03); border-radius: 12px;
    border: 1px solid transparent;
    opacity: 0; transform: translateY(20px);
    animation: fadeInUp 0.5s forwards; animation-play-state: paused;
}
.skills-grid.show .skill-item { animation-play-state: running; }
.skills-grid.show .skill-item:nth-child(1) { animation-delay: 0.02s; }
.skills-grid.show .skill-item:nth-child(2) { animation-delay: 0.04s; }
.skills-grid.show .skill-item:nth-child(3) { animation-delay: 0.06s; }
.skills-grid.show .skill-item:nth-child(4) { animation-delay: 0.08s; }
.skills-grid.show .skill-item:nth-child(5) { animation-delay: 0.1s; }
.skills-grid.show .skill-item:nth-child(6) { animation-delay: 0.12s; }
.skills-grid.show .skill-item:nth-child(7) { animation-delay: 0.14s; }
.skills-grid.show .skill-item:nth-child(8) { animation-delay: 0.16s; }
.skills-grid.show .skill-item:nth-child(9) { animation-delay: 0.18s; }
.skills-grid.show .skill-item:nth-child(10) { animation-delay: 0.2s; }

@keyframes fadeInUp { to { opacity: 1; transform: translateY(0); } }

.skill-item:hover {
    transform: translateY(-5px) !important;
    background: rgba(255,255,255,0.06); border-color: rgba(255,0,0,0.3);
}
.skill-item img { width: 50px; height: 50px; transition: transform 0.3s; }
.skill-item:hover img { transform: scale(1.1) rotate(5deg); }
.skill-item p { font-size: 0.85rem; color: var(--text-gray); text-align: center; }

/* --- PROJECTS --- */
.projects-container {
    display: flex; flex-direction: column; gap: 40px; align-items: center;
    width: 100%; position: relative;
}
.projects-container.active-view {
    flex-direction: row; align-items: flex-start; justify-content: center; gap: 30px;
}
.project-list {
    display: flex; flex-direction: row; flex-wrap: wrap;
    justify-content: center; gap: 30px; transition: all 0.5s ease; width: 100%;
}
.projects-container.active-view .project-list {
    flex-direction: column; width: 350px; flex-wrap: nowrap;
}
.projects-container.active-view .project-card:not(.active) { display: none; }

.project-card {
    background: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: 15px; padding: 30px; width: 350px; min-height: 280px;
    cursor: pointer; transition: var(--transition); position: relative;
    overflow: hidden; display: flex; flex-direction: column;
    transform-style: preserve-3d; transform: perspective(1000px);
}
.card-glow {
    position: absolute; width: 100%; height: 100%; top: 0; left: 0;
    background: radial-gradient(circle at 50% 0%, rgba(255,0,0,0.05), transparent 70%);
    opacity: 0; transition: opacity 0.5s; pointer-events: none;
}
.project-card:hover .card-glow { opacity: 1; }
.project-card:hover {
    transform: translateY(-8px); box-shadow: var(--shadow); border-color: var(--primary);
}
.project-card.active {
    border-color: var(--primary); background: rgba(255, 0, 0, 0.02);
    cursor: default; transform: none !important; box-shadow: none;
}
.card-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;
}
.folder-icon { font-size: 2.2rem; color: var(--primary); }
.expand-icon {
    font-size: 1.2rem; color: var(--text-gray); transition: 0.3s;
    opacity: 0; transform: translateX(-10px);
}
.project-card:hover .expand-icon { opacity: 1; transform: translateX(0); }
.project-card h3 {
    font-size: 1.5rem; margin-bottom: 10px;
    color: var(--text-white); transition: 0.3s;
}
.project-card:hover h3 { color: var(--primary); }
.project-card p {
    color: var(--text-gray); font-size: 0.95rem; line-height: 1.6;
    margin-bottom: 25px; flex-grow: 1;
}
.card-footer-links { display: flex; gap: 15px; margin-top: auto; }

/* CARD BUTTONS (Highlighted) */
.card-link-btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px;
    border-radius: 6px; font-size: 0.85rem; font-weight: 600;
    background: rgba(255,255,255,0.08); color: var(--text-white);
    transition: 0.3s; border: 1px solid rgba(255,255,255,0.1);
}
.card-link-btn:hover {
    background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.3);
}
.card-link-live { color: var(--primary); background: rgba(255,0,0,0.1); }
.card-link-live:hover { background: var(--primary); color: #fff; }

/* Detailed View */
.project-detail-view {
    flex: 1; background: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: 20px; padding: 0; max-height: 0; opacity: 0;
    visibility: hidden; transform: translateY(20px); transition: var(--transition);
    overflow: hidden; position: relative; max-width: 800px;
}
.projects-container.active-view .project-detail-view {
    opacity: 1; visibility: visible; transform: translateY(0);
    padding: 40px; max-height: 1200px; box-shadow: var(--shadow);
}
.close-details {
    position: absolute; top: 25px; right: 25px; width: 35px; height: 35px;
    background: rgba(255,255,255,0.1); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: 0.3s; z-index: 10;
}
.close-details:hover { background: var(--primary); transform: rotate(90deg); color: #fff; }

.detail-header-group { margin-bottom: 30px; }
.detail-header-group h2 { font-size: 2.2rem; color: var(--text-white); margin-bottom: 15px; }

/* Detail Buttons - Highlighted */
.detail-links { display: flex; gap: 15px; }
.detail-btn {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 10px 20px; background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2); border-radius: 6px;
    font-weight: 600; font-size: 0.95rem; color: var(--text-white); transition: 0.3s;
}
.detail-btn:hover {
    background: rgba(255,255,255,0.2); transform: translateY(-2px);
}
.detail-btn-live {
    background: rgba(255,0,0,0.15); border-color: rgba(255,0,0,0.3); color: var(--primary);
}
.detail-btn-live:hover {
    background: var(--primary); color: #fff; border-color: var(--primary);
}

.detail-content h4 { color: var(--primary); margin: 30px 0 10px; font-size: 1.15rem; }
.project-desc { font-size: 1.1rem; line-height: 1.8; color: var(--text-gray); }

.feature-list { list-style: disc inside; color: var(--text-gray); }
.feature-list li { margin-bottom: 5px; }

.tech-stack-detail { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.tech-badge {
    font-size: 0.8rem; font-family: 'Fira Code', monospace;
    color: var(--primary); background: rgba(255, 0, 0, 0.1);
    padding: 5px 12px; border-radius: 15px;
}

/* --- EDUCATION --- */
.education-container { max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; gap: 25px; }
.edu-card {
    display: flex; gap: 25px; background: var(--card-bg);
    border: 1px solid var(--border-color); border-radius: 16px;
    padding: 30px; transition: var(--transition); position: relative; overflow: hidden;
}
.edu-card::before {
    content: ''; position: absolute; left: 0; top: 0;
    height: 100%; width: 4px; background: var(--primary);
    transform: scaleY(0); transform-origin: bottom; transition: transform 0.4s ease;
}
.edu-card:hover::before { transform: scaleY(1); }
.edu-card:hover { transform: translateX(10px); box-shadow: var(--shadow); }
.edu-icon {
    width: 60px; height: 60px; border-radius: 12px;
    background: rgba(255,0,0,0.1); display: flex;
    align-items: center; justify-content: center; font-size: 1.5rem;
    color: var(--primary); transition: 0.3s;
}
.edu-card:hover .edu-icon { transform: rotate(15deg) scale(1.1); background: var(--primary); color: #fff; }
.edu-badge {
    font-size: 0.75rem; font-family: 'Fira Code', monospace;
    color: var(--primary); border: 1px solid rgba(255,0,0,0.3);
    padding: 4px 10px; border-radius: 20px; display: inline-block; margin-bottom: 10px;
}
.edu-school { color: var(--text-white); font-weight: 600; margin-top: 5px; }
.edu-location { font-size: 0.9rem; color: var(--text-gray); margin-top: 2px; }

/* --- CONTACT --- */
.contact-container {
    text-align: center; max-width: 600px; margin: 0 auto;
    padding: 50px 20px; background: var(--card-bg);
    border-radius: 20px; border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}
.email-btn { margin-top: 30px; padding: 15px 40px; font-size: 1.1rem; }

/* --- ANIMATIONS --- */
.hidden { opacity: 0; transform: translateY(40px); transition: all 0.8s ease; }
.hidden-stagger { opacity: 0; transform: translateY(30px); }
.show { opacity: 1; transform: translateY(0); }

/* --- MOBILE --- */
@media (max-width: 1024px) {
    section { padding: 100px 5%; }
    .hero { flex-direction: column-reverse; justify-content: center; text-align: center; gap: 50px; padding-top: 120px; }
    .hero-content { align-items: center; display: flex; flex-direction: column; }
    .hero-actions { justify-content: center; }
    .hero-img-container { width: 300px; height: 300px; }
    
    .nav-links {
        position: fixed; top: 0; right: -100%;
        width: 80%; max-width: 400px; height: 100vh;
        background: var(--card-bg); flex-direction: column;
        justify-content: center; border-left: 1px solid var(--border-color);
        transition: 0.4s cubic-bezier(0.77, 0, 0.175, 1);
        z-index: 999; box-shadow: -10px 0 30px rgba(0,0,0,0.7); gap: 30px;
    }
    .nav-links.active { right: 0; }
    .menu-btn { display: flex; }
    
    .projects-container.active-view { flex-direction: column; }
    .projects-container.active-view .project-list { width: 100%; flex-direction: row; }
    .project-card { width: 100%; }
}

@media (max-width: 768px) {
    .section-title { font-size: 2.2rem; margin-bottom: 50px; }
    .hero h1 { font-size: 3rem; }
    .project-card { min-height: auto; }
    .projects-container.active-view .project-detail-view { padding: 25px; }
    .detail-header h2 { font-size: 1.6rem; }
    .edu-card { flex-direction: column; padding: 25px; }
    .edu-icon { width: 50px; height: 50px; }
    .contact-container { padding: 30px 20px; }
    body, html { overflow-x: hidden; width: 100%; }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 2.4rem; }
    .typing-container { font-size: 1rem; }
    .btn-hero-resume { padding: 10px 25px; font-size: 0.9rem; }
    .social-icon { width: 40px; height: 40px; }
    .hero-img-container { width: 240px; height: 240px; }
    .project-card h3 { font-size: 1.3rem; }
    .folder-icon { font-size: 1.8rem; }
}