/* CSS Variables */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #0f0f17;
    --bg-card: #13131d;
    --bg-card-hover: #1a1a28;
    --text-primary: #f0f0f5;
    --text-secondary: #9090a0;
    --text-muted: #606070;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-tertiary: #06b6d4;
    --border-color: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --glow-primary: rgba(99, 102, 241, 0.5);
    --glow-secondary: rgba(6, 182, 212, 0.4);
    --gradient-start: #6366f1;
    --gradient-end: #06b6d4;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================================
   SCROLL ANIMATIONS
   ============================================ */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.stagger-children > *.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   NAVIGATION - Glassmorphism
   ============================================ */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(10, 10, 15, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 72px;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-img {
    height: 44px;
    width: auto;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.logo:hover .logo-img {
    transform: scale(1.05);
    filter: drop-shadow(0 0 20px var(--glow-primary));
}

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

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.nav-links a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-github {
    background: rgba(99, 102, 241, 0.1) !important;
    border: 1px solid rgba(99, 102, 241, 0.2) !important;
}

.nav-github:hover {
    background: rgba(99, 102, 241, 0.2) !important;
    border-color: rgba(99, 102, 241, 0.4) !important;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 120px 24px 80px;
    overflow: hidden;
}

/* Animated Mesh Gradient */
.mesh-gradient {
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0.6;
}

.mesh-gradient svg {
    position: absolute;
    width: 150%;
    height: 150%;
    top: -25%;
    left: -25%;
}

.blob {
    transform-origin: center;
}

.blob-1 {
    fill: var(--accent-primary);
    animation: blob-float 25s ease-in-out infinite;
}

.blob-2 {
    fill: var(--accent-secondary);
    animation: blob-float 20s ease-in-out infinite reverse;
    animation-delay: -5s;
}

.blob-3 {
    fill: var(--accent-tertiary);
    animation: blob-float 22s ease-in-out infinite;
    animation-delay: -10s;
}

.blob-4 {
    fill: #1e1b4b;
    animation: blob-float 28s ease-in-out infinite reverse;
    animation-delay: -15s;
}

@keyframes blob-float {
    0%, 100% {
        transform: translate(0%, 0%) scale(1);
    }
    25% {
        transform: translate(10%, -10%) scale(1.1);
    }
    50% {
        transform: translate(-5%, 15%) scale(0.95);
    }
    75% {
        transform: translate(-10%, -5%) scale(1.05);
    }
}

/* Grid Background */
.hero-grid {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0.4;
    pointer-events: none;
}

.grid-bg {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(99, 102, 241, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(99, 102, 241, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 50%, black 30%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 50%, black 30%, transparent 100%);
}

/* Hero Content */
.hero-content {
    text-align: center;
    max-width: 900px;
    position: relative;
    z-index: 2;
}

/* Hero Logo with Glow */
.hero-logo-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 32px;
}

.hero-logo {
    width: 180px;
    height: auto;
    position: relative;
    z-index: 2;
    animation: float 6s ease-in-out infinite;
}

.hero-logo-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, var(--glow-primary) 0%, transparent 70%);
    filter: blur(40px);
    z-index: 1;
    animation: glow-pulse 4s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

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

.hero h1 {
    font-size: clamp(2.8rem, 7vw, 4.5rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 24px;
    letter-spacing: -0.03em;
}

.gradient-text {
    background: linear-gradient(135deg, var(--gradient-start), var(--accent-secondary), var(--gradient-end));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 8s ease infinite;
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 48px;
    line-height: 1.7;
}

/* Hero Buttons */
.hero-cta {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 28px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gradient-start), var(--accent-secondary));
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent-secondary), var(--gradient-end));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 40px rgba(99, 102, 241, 0.5);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary span,
.btn-primary svg {
    position: relative;
    z-index: 1;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.scroll-arrow {
    width: 24px;
    height: 40px;
    border: 2px solid var(--border-hover);
    border-radius: 12px;
    position: relative;
}

.scroll-arrow::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 2px;
    animation: scroll-bounce 2s ease-in-out infinite;
}

@keyframes scroll-bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); opacity: 1; }
    50% { transform: translateX(-50%) translateY(10px); opacity: 0.3; }
}

/* ============================================
   SECTIONS
   ============================================ */
section {
    padding: 120px 0;
    position: relative;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.15rem;
    margin-bottom: 64px;
}

/* ============================================
   PROJECTS SECTION
   ============================================ */
.projects {
    background: var(--bg-secondary);
}

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

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 36px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.card-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), var(--accent-tertiary), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.project-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    transform: translateY(-8px);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 60px rgba(99, 102, 241, 0.1);
}

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

.project-card.featured {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(99, 102, 241, 0.05) 100%);
}

@media (min-width: 900px) {
    .project-card.featured {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto 1fr auto;
        gap: 0 48px;
    }

    .project-card.featured .project-header { grid-column: 1; }
    .project-card.featured h3 { grid-column: 1; }
    .project-card.featured .project-tagline { grid-column: 1; }
    .project-card.featured .project-description { grid-column: 1; }
    .project-card.featured .feature-list {
        grid-column: 2;
        grid-row: 1 / 5;
        align-self: center;
    }
    .project-card.featured .project-tech { grid-column: 1; }
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.project-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    transition: all 0.3s ease;
}

.project-icon.aegis {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
    color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.project-icon.pensive {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(99, 102, 241, 0.15));
    color: var(--accent-tertiary);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.2);
}

.project-icon.mudpuppy {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(236, 72, 153, 0.15));
    color: var(--accent-secondary);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
}

.project-card:hover .project-icon {
    transform: scale(1.1);
}

.project-tag {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.project-card h3 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.project-tagline {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent-tertiary);
    margin-bottom: 18px;
}

.project-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 24px;
    line-height: 1.75;
}

.feature-list {
    list-style: none;
    margin-bottom: 28px;
}

.feature-list li {
    position: relative;
    padding-left: 24px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.feature-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 6px;
    height: 6px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    border-radius: 50%;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.project-tech span {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.project-tech span:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* ============================================
   TECH STACK SECTION
   ============================================ */
.tech-stack {
    background: var(--bg-primary);
}

.tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
}

.tech-item {
    text-align: center;
    padding: 48px 28px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.tech-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, var(--glow-primary) 0%, transparent 70%);
    filter: blur(30px);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.tech-item:hover {
    border-color: var(--border-hover);
    transform: translateY(-5px);
}

.tech-item:hover::before {
    opacity: 0.5;
}

.tech-icon-wrapper {
    margin-bottom: 20px;
    display: inline-block;
}

.tech-item h4 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.tech-item p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ============================================
   ABOUT SECTION
   ============================================ */
.about {
    background: var(--bg-secondary);
}

.about-content {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.about h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 28px;
    letter-spacing: -0.02em;
}

.about p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 20px;
    line-height: 1.85;
}

.about-stats {
    display: flex;
    justify-content: center;
    gap: 64px;
    margin-top: 56px;
    padding-top: 56px;
    border-top: 1px solid var(--border-color);
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 56px 0 28px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 28px;
}

.footer-brand {
    display: flex;
    align-items: center;
}

.footer-logo {
    height: 56px;
    width: auto;
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.footer-logo:hover {
    opacity: 1;
}

.footer-links {
    display: flex;
    gap: 32px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--text-primary);
}

.footer-bottom {
    text-align: center;
}

.footer-bottom p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .nav-container {
        height: 64px;
    }

    .nav-links {
        gap: 4px;
    }

    .nav-links a {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .hero {
        padding-top: 100px;
    }

    .hero-logo {
        width: 140px;
    }

    .hero-cta {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }

    section {
        padding: 80px 0;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }

    .about-stats {
        flex-direction: column;
        gap: 36px;
    }

    .footer-content {
        flex-direction: column;
        gap: 28px;
        text-align: center;
    }

    .scroll-indicator {
        display: none;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
