/* =========================================
   1. VARIABLES & RESET
========================================= */
:root {
    --bg-color: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #38bdf8;
    --accent-alt: #818cf8; 
    --card-bg: #1e293b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    cursor: none; 
}

a, button, .project-card, .extra-media img {
    cursor: none !important;
}

/* Ensure text fields show a proper I-beam text cursor and accept clicks reliably */
input, textarea {
    cursor: text !important;
}

/* =========================================
   2. CUSTOM SCROLLBAR
========================================= */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--bg-color);
}

::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color); 
    border-left: 1px solid rgba(56, 189, 248, 0.1); 
}

::-webkit-scrollbar-thumb {
    background-color: var(--accent); 
    border-radius: 10px;
    border: 3px solid var(--bg-color); 
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--accent-alt); 
}

/* =========================================
   3. NAVIGATION
========================================= */
.navbar {
    display: flex;
    justify-content: space-between;
    padding: 1.2rem 5%; /* Slightly reduced padding so it takes up less screen space */
    align-items: center;
    
    /* NEW: Sticky Glass Effect */
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.85); /* Matches your dark theme */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px); /* Safari support */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05); /* Subtle edge to separate it from content */
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: -1px;
}

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

.nav-links a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
    position: relative; /* Needed for the active dot indicator */
}

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

/* NEW: The Active State (Triggered by Scroll Spy) */
.nav-links a.active {
    color: var(--accent);
}

/* NEW: A sleek glowing dot underneath the currently active section */
.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background-color: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent);
}

/* =========================================
   4. PARTICLE WRAPPER (HERO + PORTFOLIO)
========================================= */
.particle-wrapper {
    position: relative;
    overflow: hidden; 
}

#particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0; 
    pointer-events: none; 
}

/* =========================================
   5. HERO SECTION & STATUS BADGE
========================================= */
.hero {
    padding: 4rem 5% 2rem 5%; 
    display: flex;
    flex-direction: column;
    animation: fadeIn 1s ease-out;
    position: relative; 
}

.hero > *:not(canvas) {
    position: relative;
    z-index: 1;
}

/* =========================================
   STATUS BADGE
========================================= */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--card-bg);
    border: 1px solid rgba(56, 189, 248, 0.3);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
    
    /* Positioned cleanly below the navbar, aligned with site padding */
    margin: 1.5rem 5% 0 5%;
    width: max-content;
    position: relative;
    z-index: 1;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent);
    animation: pulseGlow 1.5s infinite;
}

@keyframes pulseGlow {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
    100% { opacity: 1; transform: scale(1); }
}

.greeting {
    color: var(--accent);
    font-weight: bold;
    margin-bottom: 0;
}

h1 {
    font-size: clamp(3rem, 5vw, 5rem);
    line-height: 1.2; 
    padding-bottom: 0.2rem; 
    margin-bottom: 0.5rem;
    position: relative;
    width: max-content;
    z-index: 1; 
}

h1::after {
    content: '';
    position: absolute;
    bottom: 12px; 
    left: 0;
    width: 100%;
    height: 6px; 
    border-radius: 4px; 
    background: linear-gradient(90deg, var(--accent), var(--accent-alt));
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.5); 
    z-index: -1; 
    transform: scaleX(0); 
    transform-origin: left; 
    animation: drawLine 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 0.6s; 
}

.gradient-text {
    background: linear-gradient(90deg, var(--text-main) 40%, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: clamp(2rem, 3vw, 3rem);
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.hero-description {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 500px;
    margin-bottom: 0; 
}

.btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    border: 1px solid var(--accent);
    color: var(--accent);
    text-decoration: none;
    border-radius: 4px;
    width: max-content;
    transition: all 0.3s;
}

.btn:hover {
    background-color: var(--accent);
    color: var(--bg-color);
}

/* =========================================
   6. PORTFOLIO GRID & TAG FILTERING
========================================= */
.portfolio-section {
    padding: 2rem 5% 5rem 5%; 
    position: relative; 
}

.portfolio-section .section-title, 
.portfolio-section .project-grid {
    position: relative;
    z-index: 1;
}

.section-title {
    font-size: 2rem;
    margin-bottom: 3rem;
}

.filter-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    background-color: var(--card-bg);
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    margin-bottom: 2rem;
    border-left: 4px solid var(--accent);
    font-size: 0.95rem;
    position: relative;
    z-index: 1;
}

.filter-banner button {
    background: none;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-banner button:hover {
    background-color: var(--accent);
    color: var(--bg-color);
}

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

.project-card {
    background-color: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    min-height: 250px;
    opacity: 0; 
    animation: slideUpCard 0.8s ease-out forwards;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
}

.project-card:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
}

.project-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 0.5s ease; 
}

.project-image.align-top {
    object-position: top;
}

.project-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project-card:hover .project-image {
    transform: scale(1.05); 
}

.project-card:hover .project-info {
    opacity: 1; 
}

.tech-stack {
    font-size: 0.85rem;
    color: var(--accent);
    margin-bottom: 1rem;
    font-family: monospace;
}

#modal-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-family: monospace;
    margin-bottom: 1rem;
}

.tech-tag {
    color: var(--accent);
    background-color: rgba(56, 189, 248, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
    display: inline-block;
}

.tech-tag:hover {
    background-color: var(--accent);
    color: var(--bg-color);
}

.project-card:nth-child(1) { animation-delay: 0.2s; }
.project-card:nth-child(2) { animation-delay: 0.4s; }
.project-card:nth-child(3) { animation-delay: 0.6s; }
.project-card:nth-child(4) { animation-delay: 0.8s; }

.emitter-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px; 
    background: linear-gradient(90deg, transparent, var(--accent), var(--text-main), var(--accent), transparent);
    box-shadow: 0 -4px 15px rgba(56, 189, 248, 0.6), 0 -10px 30px rgba(56, 189, 248, 0.2);
    z-index: 2; 
    transform: scaleX(0); 
    transform-origin: center; 
    animation: igniteEmitter 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 0.3s; 
}

@keyframes igniteEmitter {
    to { transform: scaleX(1); }
}

/* =========================================
   7. ABOUT SECTION
========================================= */
.about-section {
    padding: 5rem 5%;
    background-color: #0b1120; 
}

.about-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 4rem;
    max-width: 1000px;
}

.about-text p {
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.about-skills h3 {
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.skills-list {
    list-style: none;
}

.skills-list li {
    margin-bottom: 0.8rem;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-muted);
}

.skills-list li::before {
    content: "▹";
    color: var(--accent);
    position: absolute;
    left: 0;
    font-weight: bold;
}

@media (max-width: 768px) {
    .about-content {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   8. CONTACT SECTION & FORM
========================================= */
.contact-section {
    padding: 8rem 5%;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.contact-content p {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    max-width: 500px;
    margin: 0 auto;
    text-align: left;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    background-color: var(--card-bg);
    border: 1px solid #334155;
    border-radius: 6px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.contact-form input:focus,
.contact-form textarea:focus {
    border-color: var(--accent);
}

.contact-form button {
    width: 100%;
    cursor: pointer;
    text-align: center;
}

/* =========================================
   9. FOOTER
========================================= */
footer {
    text-align: center;
    padding: 2rem 5%;
    border-top: 1px solid #1e293b;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* =========================================
   10. POPUP MODAL & WEB WIDGET
========================================= */
.modal {
    border: none;
    border-radius: 8px;
    background-color: var(--card-bg);
    color: var(--text-main);
    max-width: 650px;
    width: 90%;
    margin: auto; 
    padding: 0;
    max-height: 85vh; 
    overflow-y: auto; 
}

.modal::backdrop {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
}

.modal-content {
    padding: 2.5rem;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 2rem;
    transition: color 0.3s;
}

.close-btn:hover {
    color: var(--accent);
}

#modal-image {
    width: 100%;
    height: 400px;
    object-fit: contain;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    background-color: transparent; 
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.3));
}

.extra-media {
    display: flex;
    flex-direction: column;
    gap: 1.5rem; 
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #334155;
}

.extra-media h4 {
    color: var(--accent);
    font-size: 1.25rem;
    margin-top: 1rem;
}

.extra-media p {
    color: var(--text-muted);
    line-height: 1.7;
    font-size: 1.05rem;
}

.extra-media img, 
.extra-media video, 
.extra-media iframe {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.web-game-container {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #334155;
}

.web-game-container iframe {
    border-radius: 8px;
    background: #000;
    margin-top: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

/* =========================================
   11. LIGHTBOX MODAL
========================================= */
.lightbox {
    border: none;
    background: transparent;
    max-width: 100vw;
    max-height: 100vh;
    width: 100%;
    height: 100%;
    margin: auto;
    padding: 0;
}

.lightbox[open] {
    display: flex; 
    justify-content: center;
    align-items: center;
}

.lightbox::backdrop {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

#lightbox-container {
    position: relative;
    display: inline-block; 
}

#lightbox-image {
    max-width: 90vw;
    max-height: 90vh;
    display: block; 
    border-radius: 4px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
}

#magnifier {
    position: absolute;
    width: 300px; 
    height: 300px;
    border: 2px solid var(--accent); 
    border-radius: 50%; 
    background-repeat: no-repeat;
    transform: translate(-50%, -50%); 
    pointer-events: none; 
    display: none; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.5), inset 0 0 20px rgba(0,0,0,0.5);
    z-index: 100;
}

#modal-image, 
.extra-media img {
    transition: transform 0.2s ease-out;
}

#modal-image:hover, 
.extra-media img:hover {
    transform: scale(1.02);
}

/* =========================================
   12. CUSTOM CURSOR
========================================= */
#custom-cursor-dot {
    position: fixed;
    top: 0;
    left: 0;
    width: 6px;
    height: 6px;
    background-color: var(--accent);
    border-radius: 50%;
    pointer-events: none; 
    z-index: 9999;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 8px var(--accent);
}

#custom-cursor-outline {
    position: fixed;
    top: 0;
    left: 0;
    width: 30px;
    height: 30px;
    border: 1px solid var(--accent);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%);
    transition: width 0.2s ease, height 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

#custom-cursor-outline.hover-active {
    width: 50px;
    height: 50px;
    background-color: rgba(56, 189, 248, 0.1); 
    border-color: transparent; 
}

#custom-cursor-dot, 
#custom-cursor-outline {
    margin: 0;
    padding: 0;
    inset: auto; 
}

#custom-cursor-dot { border: none; }
#custom-cursor-outline { background-color: transparent; }

/* =========================================
   13. SCROLL REVEAL ANIMATIONS
========================================= */
.reveal {
    opacity: 0;
    transform: translateY(60px); 
    transition: opacity 0.8s ease-out, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0); 
}

.reveal-stagger {
    transition-delay: 0.2s;
}

/* =========================================
   14. KEYFRAME ANIMATIONS
========================================= */
@keyframes drawLine {
    to { transform: scaleX(1); }
}

@keyframes slideUpCard {
    from {
        opacity: 0;
        top: 40px; 
    }
    to {
        opacity: 1;
        top: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px); 
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   15. EASTER EGG: RETRO MODE
========================================= */
body.retro-mode {
    --bg-color: #000000;
    --text-main: #39ff14; 
    --text-muted: #008000; 
    --accent: #ff00ff; 
    --accent-alt: #00ffff; 
    --card-bg: #111111;
}

body.retro-mode * {
    font-family: 'Courier New', Courier, monospace !important;
}

body.retro-mode h1, 
body.retro-mode .greeting, 
body.retro-mode .subtitle {
    text-shadow: 3px 3px 0px var(--accent-alt); 
}

body.retro-mode::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(18, 16, 16, 0.1);
    z-index: 999; 
    pointer-events: none; 
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0% { opacity: 0.05; }
    50% { opacity: 0.15; }
    100% { opacity: 0.02; }
}