:root {
    /* Full-screen intro: classic 100vh is taller than the visible viewport on many
       phones, so 50% vertical centering looks too low. Prefer svh/dvh with vh fallback. */
    --intro-screen-height: 100vh;
    --intro-screen-height: 100svh;
    --intro-screen-height: 100dvh;

    /* Color Palette - OKLCH for modern, perceptually uniform colors */
    --bg-dark: oklch(0.18 0.01 250);
    --bg-surface: oklch(0.22 0.02 250);
    --bg-surface-hover: oklch(0.26 0.03 250);
    
    --text-main: oklch(0.95 0.01 250);
    --text-muted: oklch(0.70 0.02 250);
    
    --brand-accent: oklch(0.75 0.15 250); /* Vibrant Blue */
    --brand-accent-glow: oklch(0.75 0.15 250 / 0.2);
    
    /* Animation Color Panels - "60% colors" (4×15vw panels in intro animation)
       These are dynamically updated by JS every 15-30 minutes for a living portfolio */
    --c1: oklch(0.70 0.15 250); /* Blue */
    --c2: oklch(0.70 0.15 300); /* Purple */
    --c3: oklch(0.70 0.15 350); /* Pink */
    --c4: oklch(0.70 0.18 40);  /* Orange */

    /* Fluid Typography */
    --font-display: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    
    --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
    --text-sm: clamp(0.875rem, 0.8rem + 0.375vw, 1rem);
    --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
    --text-lg: clamp(1.125rem, 1rem + 0.625vw, 1.375rem);
    --text-xl: clamp(1.5rem, 1.25rem + 1.25vw, 2rem);
    --text-2xl: clamp(2rem, 1.5rem + 2.5vw, 3rem);
    --text-3xl: clamp(2.5rem, 1.5rem + 5vw, 4.5rem);
    --text-4xl: clamp(3rem, 2rem + 6.5vw, 6rem);
    
    /* Spacing */
    --space-sm: clamp(0.5rem, 0.4rem + 0.5vw, 0.75rem);
    --space-md: clamp(1rem, 0.8rem + 1vw, 1.5rem);
    --space-lg: clamp(2rem, 1.5rem + 2.5vw, 3rem);
    --space-xl: clamp(4rem, 3rem + 5vw, 6rem);
    
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow: hidden; /* Initial state, will be changed by JS */
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

/* =========================================
   INTRO ANIMATION & HEADER
   ========================================= */
#header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: var(--intro-screen-height);
    z-index: 9999;
    background-color: #000; /* Pure black background during animation */
}

.header-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: var(--intro-screen-height);
    background-color: #000; /* Pure black initially as requested */
    z-index: 5;
    transform-origin: left center;
}

/* 4 Color panels - Each takes 15% width (15vw) */
.color-panel {
    position: absolute;
    top: 0;
    width: 15vw;
    height: var(--intro-screen-height);
    left: 25vw; /* Hidden behind 40vw black */
}
.c1 { background-color: var(--c1); z-index: 4; }
.c2 { background-color: var(--c2); z-index: 3; }
.c3 { background-color: var(--c3); z-index: 2; }
.c4 { background-color: var(--c4); z-index: 1; }

/* Smooth transitions for dynamic color changes (the 60% panels and accents) */
.color-panel,
.gradient-text,
.heart {
    transition: background-color 2.5s cubic-bezier(0.23, 1, 0.32, 1),
                color 2.5s cubic-bezier(0.23, 1, 0.32, 1),
                background-image 3s ease;
}

.header-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* Initially none to prevent clicks during intro */
}

#logo {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 250px;
    height: 250px;
    transform: translate(-50%, -50%);
    opacity: 0; /* Starts hidden for the blink */
    pointer-events: auto;
    object-fit: contain;
    transform-origin: center center;
}

#nav-links {
    position: absolute;
    top: 50%;
    right: 40px;
    transform: translateY(-50%);
    display: flex;
    gap: var(--space-lg);
    opacity: 0;
}

#nav-links a {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-main);
    letter-spacing: 1px;
    text-transform: uppercase;
    position: relative;
    padding: 8px 0;
    pointer-events: auto;
    transition: color 0.3s ease;
}

#nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--brand-accent);
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

#nav-links a:hover::after {
    width: 100%;
}

/* =========================================
   MAIN CONTENT
   ========================================= */
#main-content {
    opacity: 0; /* Faded out initially */
    padding-top: 100px;
    display: none; /* Hidden during intro */
}

.section-padding {
    padding: var(--space-xl) var(--space-lg);
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: 800;
    margin-bottom: var(--space-lg);
    line-height: 1.1;
}

/* Hero Section */
#hero {
    min-height: 85vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 100px var(--space-lg) 120px var(--space-lg);
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
    align-items: center;
    width: 100%;
}

.hero-content {
    text-align: left;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

.hero-badge::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #4ade80; /* Green dot */
    margin-right: 8px;
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.4);
}

.hero-title {
    font-family: var(--font-display);
    font-size: var(--text-4xl);
    font-weight: 800;
    line-height: 1.05;
    margin-bottom: var(--space-md);
    letter-spacing: -0.02em;
}

.gradient-text {
    background: var(--gradient-text, linear-gradient(135deg, var(--c1), var(--c3)));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

.hero-subtitle {
    font-size: var(--text-lg);
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
    max-width: 500px;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: var(--space-md);
}

.btn-primary, .btn-secondary {
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: var(--text-sm);
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--text-main);
    color: var(--bg-dark);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255,255,255,0.1);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid rgba(255,255,255,0.2);
}

.btn-secondary:hover {
    background-color: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.4);
}

.hero-visual {
    position: relative;
    perspective: 1000px;
}

.code-window {
    background-color: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.05);
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
    transform: rotateY(-5deg) rotateX(5deg);
    transition: transform 0.5s ease;
}

.code-window:hover {
    transform: rotateY(0) rotateX(0);
}

.window-header {
    background-color: rgba(0,0,0,0.3);
    padding: 12px 16px;
    display: flex;
    gap: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.red { background-color: #ff5f56; }
.dot.yellow { background-color: #ffbd2e; }
.dot.green { background-color: #27c93f; }

.window-body {
    padding: var(--space-md);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: var(--text-sm);
    line-height: 1.5;
    overflow-x: auto;
}

.window-body pre {
    margin: 0;
}

.window-body code {
    color: var(--text-main);
}

.keyword { color: #ff7b72; }
.string { color: #a5d6ff; }
.property { color: #79c0ff; }
.boolean { color: #ff7b72; }
.method { color: #d2a8ff; }
.comment { color: #8b949e; font-style: italic; }

@media (max-width: 900px) {
    .hero-grid {
        grid-template-columns: 1fr;
        text-align: center;
        gap: var(--space-md);
        margin-top: 0;
        width: 100%;
    }
    
    .hero-content {
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .hero-title {
        font-size: var(--text-3xl);
    }

    .hero-visual {
        display: none;
    }

    /* Stack scroll cue directly under hero text/buttons (red-circle zone), not on viewport bottom */
    #hero {
        min-height: auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding-top: max(72px, env(safe-area-inset-top));
        padding-bottom: max(32px, env(safe-area-inset-bottom));
        padding-left: var(--space-lg);
        padding-right: var(--space-lg);
    }

    .scroll-indicator {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        margin-top: 28px;
        margin-bottom: 8px;
        opacity: 0.55;
        flex-shrink: 0;
    }

    /* Push About Me section down a bit more on mobile so it doesn't feel cramped after the hero + scroll indicator */
    #about {
        margin-top: 10rem;
    }

}

/* Desktop only: pin near viewport bottom. Mobile uses flow layout (see max-width:900px). */
@media (min-width: 901px) {
    .scroll-indicator {
        position: absolute;
        bottom: 40px;
        left: 50%;
        transform: translateX(-50%);
        opacity: 0.5;
    }
}

.mouse {
    width: 26px;
    height: 40px;
    border: 2px solid var(--text-muted);
    border-radius: 20px;
    position: relative;
}

.mouse::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 6px;
    background-color: var(--text-muted);
    border-radius: 2px;
    animation: scrollWheel 2s infinite cubic-bezier(0.15, 0.41, 0.69, 0.94);
}

@keyframes scrollWheel {
    0% { transform: translate(-50%, 0); opacity: 1; }
    100% { transform: translate(-50%, 15px); opacity: 0; }
}

/* Bento Grid About Section */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--space-md);
    grid-auto-rows: minmax(180px, auto);
}

.bento-item {
    background-color: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.bento-item:hover {
    transform: translateY(-4px);
    border-color: rgba(255,255,255,0.1);
}

.bento-profile {
    grid-column: span 4;
    grid-row: span 2;
    align-items: center;
    text-align: center;
    background: linear-gradient(to bottom right, var(--bg-surface), rgba(0,0,0,0.5));
}

.profile-img {
    width: 140px;
    height: 140px;
    border-radius: var(--radius-full);
    object-fit: cover;
    margin-bottom: var(--space-md);
    border: 3px solid #8e68cc;
    padding: 4px;
}

.bento-intro {
    grid-column: span 8;
    grid-row: span 1;
}

.bento-intro h3 {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    margin-bottom: var(--space-sm);
}

.bento-intro p {
    font-size: var(--text-base);
    color: var(--text-muted);
}

.bento-edu {
    grid-column: span 4;
    grid-row: span 1;
    background-color: #8e68cc;
    color: #fff;
    justify-content: space-between;
}

.bento-icon {
    width: 48px;
    height: 48px;
    opacity: 0.8;
    margin-bottom: var(--space-sm);
}

.bento-edu h4 {
    font-family: var(--font-display);
    font-size: var(--text-base);
    font-weight: 700;
}

.bento-edu p {
    font-size: var(--text-sm);
    opacity: 0.9;
}

.bento-stats {
    grid-column: span 4;
    grid-row: span 1;
    gap: var(--space-sm);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.stat-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.stat-label {
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.stat-value {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-main);
}

.stat-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--brand-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

/* Projects Section */
.repos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-md);
}

.repo-card {
    background-color: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    border: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.repo-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-md);
    padding: 2px;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.repo-card:hover {
    transform: translateY(-6px);
    background-color: var(--bg-surface-hover);
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.repo-card:hover::before {
    opacity: 1;
}

.repo-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-sm);
}

.repo-title {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.repo-title:hover {
    color: var(--brand-accent);
}

.repo-desc {
    color: var(--text-muted);
    font-size: var(--text-sm);
    flex-grow: 1;
    margin-bottom: var(--space-md);
}

.repo-meta {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: var(--text-xs);
    color: var(--text-muted);
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: var(--space-sm);
}

.repo-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.repo-meta-item i {
    font-size: 1.2em;
}

.repo-actions {
    display: flex;
    gap: 10px;
    margin-top: var(--space-md);
}

.btn-link {
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s ease;
}

.btn-link:hover {
    background: rgba(255,255,255,0.15);
}

/* Footer */
footer {
    /* background-color: var(--bg-surface); */
    background-color: #000;

    padding: var(--space-xl) var(--space-lg) var(--space-md);
    border-top: 1px solid rgba(255,255,255,0.05);
    margin-top: var(--space-xl);
}

.footer-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-top {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.footer-brand .footer-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-bottom: var(--space-sm);
}

.footer-brand p {
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.footer h4 {
    font-family: var(--font-display);
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    position: relative;
    display: inline-block;
}

.footer h4::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -6px;
    width: 30px;
    height: 2px;
    background-color: var(--brand-accent);
}

.footer-links a, .footer-contact p, .footer-contact a {
    display: block;
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin-bottom: 8px;
    margin-top: 8px;
    transition: color 0.2s ease;
}

.footer-links a:hover, .footer-contact a:hover {
    color: var(--brand-accent);
}

.social-icons {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255,255,255,0.05);
    color: var(--text-main);
    font-size: 20px;
    transition: all 0.3s ease;
}

.social-icon:hover {
    background-color: var(--brand-accent);
    color: #000;
    transform: translateY(-3px);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--space-md);
    border-top: 1px solid rgba(255,255,255,0.05);
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.heart {
    color: var(--c1);
    display: inline-block;
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Responsive */
@media (max-width: 900px) {
    .bento-profile { grid-column: span 6; }
    .bento-intro { grid-column: span 6; grid-row: span 2; }
    .bento-edu { grid-column: span 6; }
    .bento-stats { grid-column: span 6; }
}

@media (max-width: 600px) {
    #nav-links { display: none; } /* Hide on very small screens for now, or implement hamburger */
    .bento-grid { display: flex; flex-direction: column; }
    .footer-bottom { flex-direction: column; gap: 10px; text-align: center; }
}

/* Utilities for JS animations */
.fade-up {
    opacity: 0;
    transform: translateY(30px);
}

/* Large Hero Styles */
.hero-content-large {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
}
.hero-greeting {
    font-family: var(--font-display);
    font-size: var(--text-sm);
    color: var(--text-muted);
    letter-spacing: 3px;
    text-transform: uppercase;
    display: block;
    margin-bottom: var(--space-md);
}
.hero-title-massive {
    font-family: var(--font-display);
    font-size: clamp(4rem, 9vw, 8rem);
    font-weight: 800;
    line-height: 0.95;
    margin-bottom: var(--space-lg);
    letter-spacing: -0.03em;
    color: #fff;
}
.gradient-text-large {
    background: linear-gradient(135deg, var(--c1), var(--c3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}
.hero-subtitle-large {
    font-size: var(--text-xl);
    color: var(--text-muted);
    max-width: 700px;
    line-height: 1.5;
    margin-bottom: var(--space-xl);
    margin-left: auto;
    margin-right: auto;
}
.hero-actions-large {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
}
.btn-primary-large {
    background-color: #fff;
    color: #000;
    padding: 16px 32px;
    border-radius: var(--radius-full);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: var(--text-base);
    transition: transform 0.3s ease, background-color 0.3s ease;
}
.btn-primary-large:hover { background-color: #ddd; transform: translateY(-4px); }
.btn-secondary-large { background-color: transparent; color: #fff; padding: 16px 32px; border-radius: var(--radius-full); border: 1px solid rgba(255,255,255,0.2); font-family: var(--font-display); font-weight: 700; font-size: var(--text-base); transition: all 0.3s ease; display: flex; align-items: center; gap: 8px; }
.btn-secondary-large:hover { border-color: #fff; background-color: rgba(255,255,255,0.05); transform: translateY(-4px); }

/* Footer Connect Styles */
.connect-heading {
    color: #fff;
    font-size: var(--text-lg);
    font-weight: 700;
    margin-bottom: var(--space-md);
    display: inline-block;
    position: relative;
    padding-bottom: 6px;
}
.connect-heading::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; width: 100%; height: 3px; background-color: #3b82f6;
}
.social-icons { display: flex; gap: 15px; margin-top: 15px; }
.social-icon { width: 44px; height: 44px; border-radius: 50%; background-color: #222; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; text-decoration: none; transition: all 0.3s ease; }
.social-icon:hover { background-color: #3b82f6; transform: translateY(-4px); color: #fff; }