/* === CSS VARIABLES === */
:root {
    --color-bg: #0D0C1D;
    --color-bg-panel: rgba(23, 22, 45, 0.5);
    --color-text: #E0E0E0;
    --color-text-muted: #A8A7B4;
    --color-primary: #8A44F2;
    --color-primary-dark: #7B3CD7;
    --color-secondary: #4A4A6A;
    --color-accent: #4DD9BF;
    --color-border: rgba(74, 74, 106, 0.5);
    --color-shadow: rgba(0, 0, 0, 0.2);
    --color-glow: rgba(138, 68, 242, 0.3);

    --gradient-bg: radial-gradient(circle at 100% 0%, rgba(77, 217, 191, 0.15), transparent 30%),
                   radial-gradient(circle at 0% 100%, rgba(138, 68, 242, 0.15), transparent 30%);
    --gradient-border: linear-gradient(90deg, #4DD9BF, #8A44F2, #4DD9BF);
    --gradient-overlay: linear-gradient(to top, rgba(13, 12, 29, 0.9) 10%, transparent 70%);


    --font-family: 'Inter', sans-serif;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow-sm: 0 4px 8px var(--color-shadow);
    --shadow-md: 0 8px 24px var(--color-shadow);
    --transition-fast: 0.2s ease;
    --transition-med: 0.4s ease;
}

html.light {
    --color-bg: #F9FAFB;
    --color-bg-panel: rgba(255, 255, 255, 0.7);
    --color-text: #111827;
    --color-text-muted: #6B7280;
    --color-secondary: #F3F4F6;
    --color-border: rgba(0, 0, 0, 0.08);
    --color-shadow: rgba(138, 68, 242, 0.1);
    --color-glow: rgba(138, 68, 242, 0.15);

    --gradient-bg: radial-gradient(circle at 100% 0%, rgba(77, 217, 191, 0.2), transparent 35%),
                   radial-gradient(circle at 0% 100%, rgba(138, 68, 242, 0.2), transparent 35%);
}

/* === BASE & RESET === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    transition: background-color var(--transition-fast), color var(--transition-fast);
    overflow-x: hidden; /* Prevent horizontal scroll */
}

#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* Pushed behind content */
    pointer-events: none;
}

.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-bg);
    z-index: -2; /* Pushed even further behind */
    pointer-events: none;
    transition: background var(--transition-fast);
}

.content-wrapper {
    /* This wrapper is part of the normal document flow. No special positioning needed. */
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary);
}

img {
    max-width: 100%;
    display: block;
}

/* === LAYOUT === */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    padding: 100px 0;
}

.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 50px;
    background: linear-gradient(90deg, var(--color-accent), var(--color-primary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.text-center {
    text-align: center;
}

/* === HEADER & NAV === */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 20px 0;
    background: rgba(13, 12, 29, 0.5);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

html.light .header {
    background: rgba(249, 250, 251, 0.7);
    border-bottom: 1px solid var(--color-border);
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-text);
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    font-weight: 500;
    color: var(--color-text-muted);
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-primary);
    transition: width var(--transition-fast);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--color-text);
}

.nav-links a:hover::after {
    width: 100%;
}

.nav-actions {
    display: flex;
    align-items: center;
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 0;
}

.icon-moon { display: block; }
.icon-sun { display: none; }

html.light .icon-moon { display: none; }
html.light .icon-sun { display: block; }

.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 101; 
}

.mobile-nav-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--color-text);
    margin: 5px 0;
    transition: var(--transition-med);
}

/* === HERO SECTION === */
.hero {
    min-height: calc(100vh - 85px); /* Full height minus header */
    display: flex;
    align-items: center;
    text-align: center;
    padding: 50px 0;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.hero-image-container {
    position: relative;
    margin-bottom: 20px;
}

.hero-image-frame {
    position: relative;
    padding: 5px;
    border-radius: 50%;
    overflow: hidden;
}

.hero-image-frame::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--gradient-border);
    animation: rotateGradient 5s linear infinite;
}

@keyframes rotateGradient {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hero-image {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 5px solid var(--color-bg);
}

.hero-title {
    font-size: 4rem;
    font-weight: 800;
}

.hero-subtitle {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--color-text-muted);
}

.hero-description {
    max-width: 600px;
    font-size: 1.1rem;
}

.hero-buttons {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

/* === BUTTONS === */
.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-align: center;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast), filter var(--transition-fast);
    border: none;
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}
.btn-primary:hover {
    background-color: var(--color-primary-dark);
}

.btn-secondary {
    background-color: var(--color-secondary);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}
.btn-secondary:hover {
    filter: brightness(0.97);
}

.btn-tertiary {
    background-color: transparent;
    color: var(--color-accent);
    padding: 8px 0;
    border-bottom: 1px solid transparent;
}

.btn-tertiary:hover {
    transform: none;
    box-shadow: none;
    border-bottom-color: var(--color-primary);
    color: var(--color-primary);
}


/* === ABOUT SECTION === */
.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    font-size: 1.1rem;
    color: var(--color-text-muted);
}

/* === SKILLS SECTION === */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.skill-card {
    background: var(--color-bg-panel);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 30px;
    backdrop-filter: blur(10px);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-med), transform var(--transition-med);
    opacity: 0;
    transform: translateY(20px);
}

.skill-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.skill-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 20px var(--color-glow);
}

.skill-card-title {
    font-size: 1.5rem;
    color: var(--color-primary);
    margin-bottom: 15px;
}

/* === PROJECTS SECTION === */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
}

.project-card {
    background: var(--color-bg-panel);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.project-card:hover {
    transform: scale(1.03);
    box-shadow: 0 0 30px var(--color-glow);
}

.project-image-wrapper {
    position: relative;
}

.project-image-wrapper img {
    width: 100%;
    height: 220px;
    object-fit: contain;
    object-position: center;
    background-color: var(--color-bg);
}

.project-image-overlay {
    position: absolute;
    inset: 0;
    background: var(--gradient-overlay);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.project-card:hover .project-image-overlay {
    opacity: 1;
}

.project-content {
    padding: 25px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.project-title {
    font-size: 1.4rem;
    margin-bottom: 10px;
}

.project-description {
    color: var(--color-text-muted);
    margin-bottom: 20px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.project-tags span {
    background: var(--color-secondary);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.8rem;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
}

/* === PROJECT DETAIL === */
#project-hero {
    min-height: auto;
}

#project-hero .hero-content {
    max-width: 820px;
    margin: 0 auto;
}

#project-hero .hero-image-frame {
    padding: 0;
    border-radius: var(--radius-md);
    width: min(100%, 720px);
    aspect-ratio: 16 / 9;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    overflow: hidden;
    display: grid;
    place-items: center;
}

#project-hero .hero-image-frame::before {
    display: none;
}

#project-hero .hero-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 0;
    border: none;
}

#project-hero .hero-subtitle {
    max-width: 680px;
    line-height: 1.7;
    text-wrap: balance;
}

#project-overview .project-overview-text {
    max-width: 760px;
    margin: 0 auto;
    text-align: left;
    line-height: 1.75;
    color: var(--color-text-muted);
    white-space: pre-line;
}

#project-video .project-video-frame {
    position: relative;
    width: min(100%, 760px);
    aspect-ratio: 16 / 9;
    margin: 0 auto;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    box-shadow: 0 12px 30px rgba(0,0,0,0.25);
}

#project-video .project-video-frame iframe,
#project-video .project-video-frame video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

#project-features .features-list {
    list-style: none;
    padding: 0;
    margin: 0 auto;
    max-width: 760px;
    text-align: left;
    line-height: 1.7;
    color: var(--color-text-muted);
}

#project-features .features-list li {
    margin-bottom: 12px;
}

/* === CONTACT SECTION === */
#contact {
    text-align: center;
}
.contact-card {
    background: var(--color-bg-panel);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 50px;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    backdrop-filter: blur(10px);
}
.contact-card .section-title {
    margin-bottom: 20px;
}
.contact-text {
    max-width: 600px;
    margin: 0 auto 30px;
    font-size: 1.1rem;
    color: var(--color-text-muted);
}
.social-links {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    gap: 20px;
}
.social-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-secondary);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-weight: bold;
    font-size: 1.2rem;
    transition: background-color var(--transition-fast), transform var(--transition-fast);
}
.social-icon:hover {
    background: var(--color-primary);
    transform: translateY(-3px);
    color: white;
}


/* === FOOTER === */
.footer {
    padding: 40px 0;
    text-align: center;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

/* === UTILITIES & ANIMATIONS === */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity var(--transition-med), transform var(--transition-med);
}

.reveal--visible {
    opacity: 1;
    transform: translateY(0);
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
    .section {
        padding: 80px 0;
    }

    .section-title {
        font-size: 2rem;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        width: 70%;
        height: 100vh;
        background: rgba(23, 22, 45, 0.9); /* 90% opacity */
        backdrop-filter: blur(20px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transform: translateX(100%);
        transition: transform var(--transition-med);
        z-index: 100; /* Ensure nav is above other header content */
    }
    
    html.light .nav-links {
      background: rgba(249, 250, 251, 0.9);
    }

    .nav-links.active {
        transform: translateX(0);
    }

    .mobile-nav-toggle {
        display: block;
    }

    /* Hamburger animation */
    .mobile-nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    .mobile-nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    .mobile-nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }

    .hero-title {
        font-size: 3rem;
    }
    .hero-subtitle {
        font-size: 1.2rem;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .contact-card {
        padding: 30px;
    }
}
