:root {
    /* Color System - Dark Mode Default */
    --bg: #050505;
    --fg: #ffffff;
    --accent: #ffffff;
    --surface: #0F0F0F;
    --surface-highlight: #1A1A1A;
    --border: rgba(255, 255, 255, 0.08);
    --text-secondary: #888888;
    --gradient-1: #4facfe;
    --gradient-2: #00f2fe;
    
    /* Spacing */
    --container: 1280px;
    --nav-height: 80px;
    --gap: 24px;
    
    /* Typography */
    --font-sans: 'Inter', sans-serif;
    --font-display: 'Space Grotesk', sans-serif;
}

/* Light Theme Variables */
[data-theme="light"] {
    --bg: #f4f4f5;
    --fg: #09090b;
    --accent: #000000;
    --surface: #ffffff;
    --surface-highlight: #f0f0f0;
    --border: rgba(0, 0, 0, 0.08);
    --text-secondary: #666666;
}

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

body {
    background-color: var(--bg);
    color: var(--fg);
    font-family: var(--font-sans);
    overflow-x: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
    cursor: auto;
}

@media (min-width: 1024px) {
    body {
        cursor: none;
    }
}

/* Smooth Scrolling Container */
#smooth-wrapper {
    overflow: hidden;
    width: 100%;
}

/* Typography */
h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.1;
}

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

/* Preloader */
.loader {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
}

.loader-text {
    font-family: monospace;
    color: #fff;
    margin-top: 1rem;
    letter-spacing: 2px;
}

body.loaded .loader {
    opacity: 0;
    pointer-events: none;
}

/* Custom Cursor (Desktop Only) */
.cursor-dot, .cursor-ring {
    display: none;
    pointer-events: none;
    mix-blend-mode: difference;
    position: fixed;
    z-index: 999;
}

@media (min-width: 1024px) {
    .cursor-dot {
        display: block;
        width: 6px;
        height: 6px;
        background: var(--accent);
        border-radius: 50%;
        top: 0;
        left: 0;
    }

    .cursor-ring {
        display: block;
        width: 40px;
        height: 40px;
        border: 1px solid var(--accent);
        border-radius: 50%;
        top: -17px;
        left: -17px;
        z-index: 998;
        transition: transform 0.15s ease-out, width 0.3s ease, height 0.3s ease;
    }
}

/* Ambient Background */
.noise-overlay {
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1;
}

.glow-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    z-index: 0;
    transition: transform 1s ease;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--gradient-1);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: var(--gradient-2);
    bottom: 0;
    right: 0;
}

/* Navigation */
.glass-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    z-index: 100;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-content {
    max-width: var(--container);
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.logo-mark {
    width: 40px;
    height: 40px;
    background: var(--fg);
    color: var(--bg);
    display: grid;
    place-items: center;
    font-weight: 800;
    border-radius: 8px;
}

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

.nav-item {
    font-size: 0.95rem;
    color: var(--text-secondary);
    transition: color 0.3s;
    position: relative;
}

.nav-item:hover {
    color: var(--fg);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--fg);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.icon-light { display: none; }
[data-theme="light"] .icon-light { display: block; }
[data-theme="light"] .icon-dark { display: none; }

.btn-primary {
    background: var(--fg);
    color: var(--bg);
    padding: 0.8rem 1.5rem;
    border-radius: 100px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: transform 0.2s;
}

/* Mobile Menu */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--fg); /* Ensure visible in light mode */
    cursor: pointer;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--bg);
    z-index: 90;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.mobile-link {
    font-size: 2rem;
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--fg); /* Ensure correct text color */
}

@media (max-width: 1023px) {
    .nav-links { display: none; }
    .desktop-only { display: none; }
    .mobile-menu-btn { display: block; }
}

/* Hero */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    /* Increased padding to prevent overlap behind nav */
    padding-top: calc(var(--nav-height) + 4rem);
    padding-bottom: 4rem;
    position: relative;
    z-index: 10;
}

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
}

/* Hero Grid */
.hero .container {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    align-items: center;
    gap: 4rem;
}

.hero-content {
    max-width: 700px;
}

.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 0.85rem;
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .badge-pill {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 8px #22c55e;
}

.hero-title {
    font-size: clamp(2.5rem, 8vw, 6rem);
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 2rem;
}

.hero-sub {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    line-height: 1.6;
}

.gradient-text {
    background: linear-gradient(to right, #fff, #666);
    -webkit-background-clip: text;
    color: transparent;
}

[data-theme="light"] .gradient-text {
    background: linear-gradient(to right, #000, #666);
    -webkit-background-clip: text;
}

/* Code Card Responsive */
.code-card-wrapper {
    position: relative;
    width: 100%;
    max-width: 520px;
    perspective: 1000px;
    display: flex;
    justify-content: center;
}

.code-card {
    background: rgba(15, 15, 15, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    transition: transform 0.1s ease-out, box-shadow 0.3s ease;
    transform-style: preserve-3d;
    cursor: default;
    position: relative;
    overflow: hidden;
    outline: none;
    width: 100%;
}

[data-theme="light"] .code-card {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.8) inset;
}

/* Card internals */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.8rem;
}

[data-theme="light"] .card-header { border-bottom-color: rgba(0, 0, 0, 0.05); }

.window-controls { display: flex; gap: 8px; }
.window-controls span { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); }
[data-theme="light"] .window-controls span { background: rgba(0, 0, 0, 0.2); }

.lang-badge {
    font-size: 0.75rem;
    font-family: var(--font-sans);
    background: rgba(49, 120, 198, 0.2);
    color: #3178c6;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
}

.card-body {
    display: flex;
    gap: 1rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    overflow-x: auto;
}

.line-numbers {
    display: flex;
    flex-direction: column;
    color: rgba(255, 255, 255, 0.2);
    user-select: none;
    text-align: right;
    min-width: 1.5rem;
}

[data-theme="light"] .line-numbers { color: rgba(0, 0, 0, 0.3); }

.code-content {
    color: #e2e8f0;
    white-space: pre;
    position: relative;
}

[data-theme="light"] .code-content { color: #334155; }
.keyword { color: #c678dd; }
.function { color: #61afef; }
.string { color: #98c379; }
.variable { color: #e06c75; }
[data-theme="light"] .keyword { color: #a626a4; }
[data-theme="light"] .function { color: #4078f2; }
[data-theme="light"] .string { color: #50a14f; }
[data-theme="light"] .variable { color: #e45649; }

.cursor-blink {
    display: inline-block;
    width: 2px;
    height: 1em;
    background: var(--accent);
    animation: blink 1s step-end infinite;
    vertical-align: text-bottom;
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* Bento Grid */
.section-padding { padding: 8rem 0; }
@media (max-width: 768px) { .section-padding { padding: 4rem 0; } }

.bento-grid {
    display: grid;
    grid-template-columns: 1.5fr 2fr;
    gap: 2rem;
}

.bento-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 3rem;
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s;
}

.bento-card:hover { border-color: rgba(255, 255, 255, 0.2); }
.card-header h3 { font-size: 1.5rem; margin-bottom: 2rem; color: var(--text-secondary); }

.stats-row {
    display: flex;
    gap: 3rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.stat { display: flex; flex-direction: column; }
.stat-num { font-size: 2.5rem; font-weight: 700; font-family: var(--font-display); }
.stat-label { font-size: 0.85rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; }

.timeline { list-style: none; }
.timeline-item { padding-bottom: 2rem; border-bottom: 1px solid var(--border); margin-bottom: 2rem; }
.timeline-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.time-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.5rem; flex-wrap: wrap; gap: 0.5rem; }
.role { font-size: 1.2rem; font-weight: 600; }
.company { color: var(--text-secondary); }
.date { display: block; font-size: 0.9rem; margin-bottom: 1rem; opacity: 0.7; }
.desc { font-size: 0.95rem; line-height: 1.6; color: var(--text-secondary); }

/* Marquee */
.skills-section { padding: 4rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface); overflow: hidden; }
.section-label { text-align: center; margin-bottom: 2rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 2px; color: var(--text-secondary); }
.marquee-wrapper { display: flex; overflow: hidden; }
.marquee { display: flex; gap: 4rem; animation: scroll 20s linear infinite; padding: 0 2rem; }
.tech-item { display: flex; align-items: center; gap: 12px; font-size: 1.2rem; font-weight: 500; color: var(--text-secondary); white-space: nowrap; }
.tech-item img { width: 24px; height: 24px; opacity: 0.7; }
[data-theme="light"] .tech-item img { filter: invert(1); }
@keyframes scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* Projects */
.project-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 4rem;
    margin-bottom: 8rem;
    align-items: center;
}

.project-row.reverse { grid-template-columns: 1.5fr 1fr; }
.project-row.reverse .project-info { order: 2; }

.project-title { font-size: 3rem; margin-bottom: 1rem; }
.project-desc { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 2rem; line-height: 1.6; }

.tags { display: flex; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }
.tags span { font-size: 0.85rem; padding: 6px 12px; border: 1px solid var(--border); border-radius: 100px; font-family: monospace; }

/* Project Link Arrow Fix */
.link-hover {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    transition: color 0.2s;
    margin-right: 1.5rem;
    color: var(--fg); /* Ensures visible in both themes */
}

.link-hover:hover { opacity: 0.7; }

.project-visual { height: 400px; border-radius: 24px; overflow: hidden; cursor: pointer; }
.visual-card { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; transition: transform 0.5s ease; }
.project-visual:hover .visual-card { transform: scale(1.05); }

/* Abstract UI */
.ui-mockup { width: 80%; height: 70%; background: rgba(255,255,255,0.05); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; display: flex; flex-direction: column; padding: 1rem; box-shadow: 0 20px 40px rgba(0,0,0,0.2); }
.ui-header { height: 12px; background: rgba(255,255,255,0.1); border-radius: 6px; width: 40%; margin-bottom: 1rem; }
.ui-body { display: flex; gap: 1rem; flex: 1; }
.ui-sidebar { width: 25%; background: rgba(255,255,255,0.05); border-radius: 8px; }
.ui-content { flex: 1; background: rgba(255,255,255,0.05); border-radius: 8px; }
.ui-toolbar { height: 30px; background: rgba(255,255,255,0.1); border-radius: 6px; margin-bottom: 1rem; }
.ui-canvas { flex: 1; position: relative; }
.ui-shape { position: absolute; border: 2px solid rgba(255,255,255,0.2); }
.circle { width: 60px; height: 60px; border-radius: 50%; top: 20%; left: 20%; }
.rect { width: 80px; height: 50px; bottom: 30%; right: 20%; }

/* Contact */
.contact-section { min-height: 80vh; display: flex; align-items: center; justify-content: center; text-align: center; }
.cta-title { font-size: clamp(2.5rem, 6vw, 5rem); margin-bottom: 3rem; }
.email-link { font-size: clamp(1.2rem, 3vw, 2.5rem); border-bottom: 2px solid var(--border); padding-bottom: 0.5rem; transition: border-color 0.3s; word-break: break-all; }
.email-link:hover { border-color: var(--fg); }
.socials { margin-top: 4rem; display: flex; justify-content: center; gap: 2rem; flex-wrap: wrap; }
.social-btn { padding: 1rem 2rem; border: 1px solid var(--border); border-radius: 100px; transition: background 0.3s, color 0.3s; }
.social-btn:hover { background: var(--fg); color: var(--bg); }

/* Footer */
footer { padding: 2rem 0; border-top: 1px solid var(--border); color: var(--text-secondary); font-size: 0.9rem; }
.footer-content { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }

/* --- RESPONSIVE MEDIA QUERIES --- */

/* Tablet & Mobile (1024px and below) */
@media (max-width: 1024px) {
    .hero-grid {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 3rem;
        margin-top: 0;
    }

    .hero-content {
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .code-card-wrapper { max-width: 100%; }
    
    .bento-grid { grid-template-columns: 1fr; }
    
    .project-row, .project-row.reverse { 
        grid-template-columns: 1fr; 
        text-align: left; 
        gap: 2rem; 
        margin-bottom: 6rem; 
    }
    .project-row.reverse .project-info { order: 0; }
    
    .project-visual { height: 300px; }
}

/* Mobile Only (768px and below) */
@media (max-width: 768px) {
    .section-padding { padding: 4rem 0; }
    
    .hero-sub { font-size: 1.1rem; }
    
    .bento-card { padding: 2rem; }
    
    .stats-row { gap: 2rem; }
    .stat-num { font-size: 2rem; }
    
    .project-title { font-size: 2rem; }
    
    .code-card-wrapper { display: none; }
    
    .footer-content { flex-direction: column; text-align: center; }
}
/* Fix custom cursor visibility in LIGHT theme */
[data-theme="light"] .cursor-dot,
[data-theme="light"] .cursor-ring {
    mix-blend-mode: normal;
}

/* Make sure colors are hard-contrast in light */
[data-theme="light"] .cursor-dot {
    background: #000;
}

[data-theme="light"] .cursor-ring {
    border-color: #000;
}
