/* ==========================================================================
   CSS Variables & Theme Setup
   ========================================================================== */
:root {
    /* Color Palette - Neo Noir Theme */
    --bg-primary: #050505;
    /* Deep pure black */
    --bg-secondary: rgba(15, 15, 18, 0.7);
    /* Very dark gray */

    --text-primary: #f0f0f0;
    --text-secondary: #9aa0a6;
    --text-muted: #5f6368;

    /* Vibrant Gradients & Accents (Neon Cyber feel) */
    --accent-1: #00ffcc;
    /* Neon Cyan */
    --accent-2: #ff0055;
    /* Neon Pink/Red */
    --accent-3: #bb00ff;
    /* Neon Purple */
    /* Semantic Colors */
    --success: #00ff9d;
    --warning: #ffaa00;
    --error: #ff3333;

    /* Code block / Terminal colors */
    --terminal-text: #e2e8f0;
    --code-json: #61afef;
    --code-keyword: #c678dd;
    --code-type: #e5c07b;
    --code-string: #98c379;
    --code-number: #d19a66;
    --code-variable: #61afef;

    /* Glassmorphism Tokens */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.15);
    --glass-blur: 16px;

    /* Typography */
    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-code: 'Fira Code', monospace;

    /* Layout */
    --max-width: 1200px;
    --nav-height: 80px;
    --section-padding: 100px 0;

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Mode Theme Variables */
body.light-mode {
    --bg-primary: #f8fafc;
    /* Very light gray/blue for a soft background */
    --bg-secondary: rgba(255, 255, 255, 0.7);
    /* White with opacity for glass effect */

    --text-primary: #0f172a;
    /* Slate 900 for high contrast text */
    --text-secondary: #475569;
    /* Slate 600 for secondary text */
    --text-muted: #64748b;
    /* Slate 500 for muted text */

    /* Vibrant Gradients & Accents (Light Mode feel) */
    --accent-1: #0ea5e9;
    /* Sky 500 (Blue) */
    --accent-2: #8b5cf6;
    /* Violet 500 */
    --accent-3: #ec4899;
    /* Pink 500 */

    /* Semantic Colors - Light Mode */
    --success: #10b981;
    /* Emerald 500 */
    --warning: #f59e0b;
    /* Amber 500 */
    --error: #ef4444;
    /* Red 500 */

    /* Code block / Terminal colors - Light Mode */
    --terminal-text: #334155;
    /* Slate 700 */
    --code-json: #0284c7;
    /* Sky 600 */
    --code-keyword: #9333ea;
    /* Purple 600 */
    --code-type: #d97706;
    /* Amber 600 */
    --code-string: #16a34a;
    /* Green 600 */
    --code-number: #ea580c;
    /* Orange 600 */
    --code-variable: #2563eb;
    /* Blue 600 */

    /* Glassmorphism Tokens - Light Mode */
    --glass-bg: rgba(255, 255, 255, 0.4);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-highlight: rgba(255, 255, 255, 0.9);

    /* Box shadows need to be darker in light mode so they show up on light backgrounds */
    --shadow-color: rgba(31, 38, 135, 0.07);
}

/* ==========================================================================
   Reset & Global Styles
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    box-sizing: border-box;
}

*, *:before, *:after {
    box-sizing: inherit;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    width: 100%;
    /* Ensure long continuous text wraps instead of breaking out */
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Prevent scroll during load */
body.loading {
    overflow: hidden;
    height: 100vh;
}

/* ==========================================================================
   Page Transitions
   ========================================================================== */
.page-transition-overlay {
    position: fixed;
    inset: 0;
    background-color: var(--bg-primary);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s cubic-bezier(0.7, 0, 0.3, 1), transform 0.8s cubic-bezier(0.7, 0, 0.3, 1);
}

.page-transition-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.1);
    /* Slight zoom out while fading */
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

/* Vertical Wordplay specifically for the loading screen */
.greeting-wordplay {
    height: 40px;
    overflow: hidden;
    position: relative;
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
}

.greeting-scroller {
    display: flex;
    flex-direction: column;
    animation: slideGreetings 5s infinite cubic-bezier(0.8, 0, 0.2, 1);
}

.greeting-scroller span {
    height: 40px;
    line-height: 40px;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes slideGreetings {
    0%, 5% { transform: translateY(0); }
    10%, 15% { transform: translateY(-40px); }
    20%, 25% { transform: translateY(-80px); }
    30%, 35% { transform: translateY(-120px); }
    40%, 45% { transform: translateY(-160px); }
    50%, 55% { transform: translateY(-200px); }
    60%, 65% { transform: translateY(-240px); }
    70%, 75% { transform: translateY(-280px); }
    80%, 85% { transform: translateY(-320px); }
    90%, 95% { transform: translateY(-360px); }
    100% { transform: translateY(0); }
}

/* Base fade for main content */
main {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease 0.3s, transform 1s ease 0.3s;
}

body:not(.loading) main {
    opacity: 1;
    transform: translateY(0);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
}

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

ul {
    list-style: none;
}

/* ==========================================================================
   Abstract Background Elements & 3D Grid
   ========================================================================== */
#bg-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    /* Hardware acceleration to stop mobile URL bar jitter */
    transform: translateZ(0); 
    will-change: transform;
}

/* The actual GIF Background rendered via pseudo-element to lock to viewport */
#bg-wrapper::before {
    content: '';
    position: absolute;
    top: -5%;
    left: -5%;
    right: -5%;
    bottom: -5%;
    width: 110%;
    height: 110%;
    background-image: url('../bac.gif');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    z-index: 0;
}

/* The Dark/Frosted Blur Overlay */
#bg-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    /* Subtle dark tint to prevent super bright GIF frames from swallowing text */
    background: rgba(5, 5, 5, 0.4); 
    /* Glassmorphic blur dynamically scales as user scrolls */
    backdrop-filter: blur(var(--bg-blur, 0px));
    -webkit-backdrop-filter: blur(var(--bg-blur, 0px));
    z-index: 1;
    /* Removed transition so JS can control the variable smoothly per-frame */
}

body.light-mode #bg-wrapper::after {
    /* Strong bright tint for light mode, slightly lowered to let the solid white cards pop */
    background: rgba(248, 250, 252, 0.55);
}

/* ==========================================================================
   Typography Utilities
   ========================================================================== */
.gradient-text {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
}

.highlight {
    color: var(--accent-1);
    font-weight: 600;
}

.section-spacing {
    padding: var(--section-padding);
    max-width: var(--max-width);
    margin: 0 auto;
    width: 90%;
    scroll-margin-top: calc(var(--nav-height) + 20px);
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* ==========================================================================
   UI Components (iPhone Glassmorphism Buttons & Elements)
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 32px;
    border-radius: 40px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    border: none;
    outline: none;
    position: relative;
    overflow: hidden;
    /* iOS style dynamic scale transition */
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s ease, background 0.3s ease;
    text-decoration: none;

    /* iPhone Glassmorphism Base */
    background: rgba(255, 255, 255, 0.05);
    /* Very subtle white */
    backdrop-filter: blur(25px) saturate(200%);
    -webkit-backdrop-filter: blur(25px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    /* Highlight top edge */

    /* Inner shadow for depth */
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.1),
        0 10px 20px rgba(0, 0, 0, 0.3);
}

.btn:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.2),
        0 10px 25px rgba(0, 0, 0, 0.4);
}


/* Base button text color */
.btn {
    color: var(--text-primary);
}

body.light-mode .btn {
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(255, 255, 255, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05), inset 0 1px 1px rgba(255, 255, 255, 1);
    color: var(--text-primary);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}

body.light-mode .btn:hover {
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08), inset 0 1px 1px rgba(255, 255, 255, 1);
}

body.light-mode .btn-primary {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(220, 225, 235, 1);
    color: var(--text-primary);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(255, 255, 255, 1);
}

body.light-mode .btn-primary:hover {
    background: #ffffff;
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Dark Mode (Default) Primary Button - Clean Glass */
.btn-primary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.1),
        0 8px 32px rgba(0, 0, 0, 0.3);
}

.btn-primary:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.3),
        0 12px 40px rgba(0, 0, 0, 0.4);
    transform: translateY(-2px);
}

/* Dark Mode (Default) Secondary Button - Translucent Glass */
.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.2),
        0 10px 30px rgba(0, 0, 0, 0.4);
}

/* Light Mode Secondary Button */
body.light-mode .btn-secondary {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--text-secondary);
}

body.light-mode .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-primary);
    border: 1px solid rgba(0, 0, 0, 0.12);
}

.btn:active {
    transform: scale(0.96) translateY(0);
    /* Tactile iOS press squeeze */
}

/* Resume Download Button – layout only; visual style from .btn + .btn-secondary */
.about-resume-btn {
    margin-top: 16px;
    width: fit-content;
    align-self: center;
}

@media (max-width: 768px) {
    .about-resume-btn {
        width: 100%;
        justify-content: center;
    }
}

.glass-card {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: 20px;
    padding: 30px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: var(--transition-normal);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.glass-card:hover {
    transform: translateY(-5px);
    border-color: rgba(0, 255, 204, 0.3);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7), 0 0 20px rgba(0, 255, 204, 0.1);
}

body.light-mode .glass-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(220, 225, 235, 1);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(255, 255, 255, 1);
}

body.light-mode .glass-card:hover {
    border-color: #ffffff;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08), 0 0 15px rgba(14, 165, 233, 0.15);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 10px var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* ==========================================================================
   Navigation
   ========================================================================== */
.glass-nav {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: var(--max-width);
    z-index: 1000;
    transition: var(--transition-normal);
}

.glass-nav .nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    padding: 0 30px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-radius: 30px;
}

.glass-nav.scrolled .nav-container {
    background: rgba(10, 10, 15, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
}

body.light-mode .glass-nav .nav-container {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(220, 225, 235, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

body.light-mode .glass-nav.scrolled .nav-container {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(200, 210, 220, 1);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.logo {
    font-family: var(--font-code);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-fast);
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0%;
    height: 2px;
    background: var(--accent-1);
    transition: var(--transition-normal);
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.theme-toggle {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    padding: 5px;
    border-radius: 50%;
}

.theme-toggle:hover {
    color: var(--accent-1);
    background: var(--glass-border);
}

.hamburger {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: calc(var(--nav-height) + 60px);
    gap: 40px;
}

.hero-content {
    flex: 1;
    max-width: 600px;
}

.hero-content h1 {
    font-size: 4rem;
    margin-bottom: 24px;
    letter-spacing: -1px;
}

body.light-mode .hero-content h1 {
    text-shadow: none;
}

.hero-content .subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    max-width: 90%;
}

body.light-mode p, body.light-mode li, body.light-mode .subtitle {
    /* Removed cloudy white halo */
    text-shadow: none;
}

.hero-cta {
    display: flex;
    gap: 20px;
    margin-bottom: 50px;
}

.tech-stack-sneak {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tech-stack-sneak span {
    font-family: var(--font-code);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.tech-icons {
    display: flex;
    gap: 20px;
    font-size: 1.8rem;
    color: var(--text-secondary);
}

.tech-icons i {
    transition: var(--transition-normal);
    cursor: pointer;
}

.tech-icons i:hover {
    color: var(--text-primary);
    transform: translateY(-3px) scale(1.1);
}

/* Terminal Visual */
.hero-visual {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.glass-terminal {
    width: 100%;
    max-width: 500px;
    min-width: 0;
    background: var(--bg-primary);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    overflow-x: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    font-family: var(--font-code);
    text-align: left;
}

body.light-mode .glass-terminal {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(220, 225, 235, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 1);
}

.terminal-header {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    position: relative;
}

body.light-mode .terminal-header {
    background: rgba(255, 255, 255, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.6);
}

.circles {
    display: flex;
    gap: 8px;
}

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

.circle.red {
    background-color: #ff5f56;
}

.circle.yellow {
    background-color: #ffbd2e;
}

.circle.green {
    background-color: #27c93f;
}

.terminal-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.terminal-body {
    padding: 20px;
    font-size: 0.9rem;
    color: var(--terminal-text);
    text-align: left;
    overflow-x: auto;
    word-break: break-word;
    min-width: 0;
    max-width: 100%;
}

/* Prevent <pre> from blowing out the terminal width on small screens */
.terminal-body pre {
    margin: 0;
    white-space: pre-wrap;      /* wrap long lines */
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
    font-size: 0.85rem;
    line-height: 1.6;
}

.terminal-body code {
    font-family: var(--font-code);
    display: block;
    overflow-wrap: break-word;
    word-break: break-word;
}

.terminal-body .line {
    margin-bottom: 15px;
}

.terminal-body .prompt {
    color: var(--success);
    margin-right: 10px;
    font-weight: bold;
}

.terminal-body .output {
    color: var(--text-secondary);
    margin-bottom: 15px;
    padding-left: 10px;
}

.terminal-body .output.json {
    color: var(--code-json);
    white-space: pre-line; /* Collapses extra spaces but keeps newlines - The permanent fix! */
    line-height: 1.6;
    max-width: 100%;
    width: fit-content;
    display: block;
    padding-left: 15px;
    margin-top: 5px;
    font-family: var(--font-code);
    text-align: left !important;
}

.typed-line {
    display: flex;
    align-items: center;
}

.cursor {
    display: inline-block;
    width: 8px;
    height: 15px;
    background-color: #fff;
    margin-left: 2px;
    animation: blink 1s step-end infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* ==========================================================================
   About Section
   ========================================================================== */
.about-wrapper {
    display: flex;
    flex-direction: row;
    gap: 40px;
    align-items: center; /* or stretch if we want equal heights */
    justify-content: center;
    width: 100%;
}

.about-content {
    display: flex;
    flex-direction: column;
    gap: 50px;
    flex: 1.6; /* Take up significantly more width than the terminal */
}

.about-text h1 {
    font-size: 3.5rem;
    margin-bottom: 20px;
    letter-spacing: -1px;
    line-height: 1.1;
}

.about-text h3 {
    font-size: 2rem;
    margin-bottom: 20px;
}

.about-text p.subtitle {
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 25px;
    color: var(--text-primary);
}

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

.about-stats {
    display: flex;
    gap: 40px;
    margin-top: 40px;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    font-family: var(--font-heading);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.about-visual {
    flex: 1;
    min-width: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}

.about-visual .glass-terminal {
    width: 100%;
}

/* Light Mode: Make the About text card vividly distinct */
body.light-mode .about-content.glass-card {
    background: #ffffff;
    border: 1px solid rgba(200, 210, 225, 1);
    border-left: 4px solid var(--accent-1);
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.12),
        0 4px 12px rgba(0, 0, 0, 0.06);
}

body.light-mode .about-text h1 {
    color: #0f172a;
}

body.light-mode .about-text p.subtitle {
    color: #1e293b;
}

body.light-mode .about-text p {
    color: #334155;
}

body.light-mode .stat .number {
    color: #0f172a;
    font-weight: 800;
}

body.light-mode .stat .label {
    color: #64748b;
}

.about-visual .code-block {
    width: 100%;
    overflow-x: auto;
}

.code-content pre {
    margin: 0;
    font-family: var(--font-code);
    font-size: 0.9rem;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap; /* Forces code to wrap on small screens instead of breaking layout */
    word-break: break-word;
}

/* Syntax Highlighting Mock */
.keyword {
    color: var(--code-keyword);
}

.type {
    color: var(--code-type);
}

.string {
    color: var(--code-string);
}

.number {
    color: var(--code-number);
}

.variable {
    color: var(--code-variable);
}

/* ==========================================================================
   Skills Section
   ========================================================================== */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.skill-card {
    display: flex;
    flex-direction: column;
}

.card-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.skill-card h3 {
    margin-bottom: 12px;
    font-size: 1.3rem;
}

.skill-card p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 0.95rem;
    flex-grow: 1;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.skill-tags li {
    font-family: var(--font-code);
    font-size: 0.8rem;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

/* ==========================================================================
   Projects Section
   ========================================================================== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 40px;
}

/* Ensure consistent sizing on larger screens even with fewer than 3 items */
@media screen and (min-width: 1100px) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.project-card {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.project-img-container {
    height: 220px;
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--glass-border);
    background: var(--bg-primary);
    position: relative;
    border-radius: 12px 12px 0 0;
}

.project-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.project-card:hover .project-img-container::after {
    opacity: 1;
}

.project-img-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Legacy spotlight styles removed */

body.light-mode .project-img-container {
    background: #f1f5f9;
}

.project-img-placeholder.p2 {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(139, 92, 246, 0.2));
}

.project-img-placeholder.p3 {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(59, 130, 246, 0.2));
}

/* Legacy mock styles removed */


.project-info {
    padding: 30px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.project-links {
    display: flex;
    justify-content: flex-end;
    gap: 20px;
    margin-bottom: 20px;
}

.icon-link {
    font-size: 1.3rem;
    color: var(--text-secondary);
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.icon-link span {
    font-size: 0.85rem;
    font-weight: 500;
}

.icon-link:hover {
    color: var(--accent-1);
    transform: translateY(-3px);
}

.project-info h3 {
    margin-bottom: 15px;
    font-size: 1.4rem;
}

.project-info p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 25px;
    flex-grow: 1;
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-family: var(--font-code);
    font-size: 0.8rem;
    color: var(--accent-1);
}

.view-more-container {
    text-align: center;
    margin-top: 60px;
}

/* ==========================================================================
   Contact Section
   ========================================================================== */
.contact-section {
    position: relative;
    z-index: 10;
}

.contact-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    padding: 50px;
}

.contact-info h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.contact-info p {
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 40px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.1rem;
}

.contact-item i {
    font-size: 1.5rem;
    color: var(--accent-1);
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-size: 1.2rem;
    transition: var(--transition-normal);
    border: 1px solid var(--glass-border);
}

.social-icon:hover {
    background: var(--accent-1);
    color: white;
    transform: translateY(-3px);
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition-fast);
}

body.light-mode .form-group input,
body.light-mode .form-group textarea {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(0, 0, 0, 0.1);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-1);
    background: rgba(0, 0, 0, 0.4);
}

body.light-mode .form-group input:focus,
body.light-mode .form-group textarea:focus {
    background: rgba(255, 255, 255, 0.8);
}

.submit-btn {
    margin-top: 10px;
    width: 100%;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.glass-footer {
    text-align: center;
    padding: 30px;
    border-top: 1px solid var(--glass-border);
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    color: var(--text-muted);
    font-size: 0.9rem;
}

body.light-mode .glass-footer {
    background: rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.6);
}

/* ==========================================================================
   Animations & Reveals
   ========================================================================== */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}

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

.reveal-up {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}

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

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s cubic-bezier(0.5, 0, 0, 1);
}

.reveal-right.active {
    opacity: 1;
    transform: translateX(0);
}

/* ==========================================================================
   GitHub Stats Section
   ========================================================================== */
.github-grid {
    display: grid;
    /* Use min(100%, 350px) to prevent layout break on small screens */
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 350px), 1fr));
    gap: 40px;
}

.github-grid .glass-card {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: hidden;
}

.github-streak-container {
    margin-top: 40px;
    width: 100%;
}

.streak-card {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: hidden;
}

/* Constrain SVG sizing and scaling */
.github-stat-img {
    width: 100%;
    max-width: 450px; /* Prevent over-stretching on big screens */
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 10px;
}

.streak-card .github-stat-img {
    max-width: 800px; /* Streak stat is naturally much wider */
}

/* On very small mobile screens, let users scroll the SVG horizontally instead of shrinking it to unreadable sizes */
@media screen and (max-width: 480px) {
    .github-grid .glass-card,
    .streak-card {
        padding: 15px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .github-stat-img,
    .streak-card .github-stat-img {
        width: 100%;
        min-width: 320px; /* Ensures text inside SVG remains perfectly readable */
    }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Large Desktop (1400px+) */
@media screen and (min-width: 1400px) {
    .section-spacing {
        max-width: 1300px;
    }

    .hero-content h1 {
        font-size: 5rem;
    }
}

/* Tablet / Small Desktop (992px) */
@media screen and (max-width: 992px) {
    section.hero {
        flex-direction: column;
        justify-content: center;
        text-align: center;
        padding-top: 160px;
        min-height: auto;
    }

    .hero-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        max-width: 100%;
    }

    .hero-content h1 {
        font-size: 3.5rem;
    }

    .hero-visual {
        margin-top: 50px;
        width: 100%;
        justify-content: center;
    }

    .about-content,
    .contact-box {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .about-visual {
        order: -1;
        /* Move code block above text on tablet */
    }
}

/* Mobile (768px) */
@media screen and (max-width: 768px) {
    section.hero {
        padding-top: 180px;
    }

    .glass-nav .nav-container {
        padding: 0 20px;
    }

    .nav-links {
        display: none;
        /* Managed by JS for mobile menu */
    }

    .hamburger {
        display: block;
    }

    .hero-content h1 {
        font-size: 2.8rem;
    }

    .hero-content .subtitle {
        font-size: 1rem;
    }

    .hero-cta {
        flex-direction: column;
        width: 100%;
        max-width: 300px;
    }

    .btn {
        width: 100%;
    }

    .section-spacing {
        padding: 60px 0;
        width: 100%; /* Force 100% width on mobile */
        padding-left: 20px; /* Use padding rather than reducing width percentage */
        padding-right: 20px;
    }

    .section-header h2 {
        font-size: 2rem;
        word-break: break-word; /* Prevent giant titles from causing overflow */
    }

    .skills-grid,
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .contact-box {
        padding: 30px 20px;
        gap: 30px;
    }

    .about-stats {
        flex-direction: column;
        gap: 20px;
        align-items: center;
        text-align: center;
    }

    .about-wrapper {
        flex-direction: column;
    }

    .about-content {
        flex-direction: column;
        gap: 40px;
        width: 100%;
    }

    .about-visual {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .terminal-body {
        font-size: 0.8rem;
        padding: 15px;
    }

    .terminal-body .output.json {
        font-size: 0.8rem;
        padding-left: 10px;
        line-height: 1.8; /* More breathing room on mobile */
    }
}

/* Small Mobile (480px) */
@media screen and (max-width: 480px) {
    .hero-content h1 {
        font-size: 2.2rem;
    }

    .glass-card {
        padding: 20px;
    }

    .project-info {
        padding: 20px;
    }

    .tech-icons {
        gap: 15px;
    }
}