:root {
    /* Default (Dark) Theme Variables */
    --bg: #0a0a0a;
    --text: #e1e1e1;
    --text-muted: #7a7a7a;
    --accent: #ffffff;
    --border: rgba(255, 255, 255, 0.1);
    --nav-bg: rgba(10, 10, 10, 0.8);
    --loader-bg: #000000;
    --loader-text: #ffffff;
    --noise-opacity: 0.05;
    
    --font-main: 'Syne', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/* Light Theme Variables */
[data-theme="light"] {
    --bg: #f4f4f0; /* Warm paper white for that "Editorial" look */
    --text: #1a1a1a;
    --text-muted: #666666;
    --accent: #000000;
    --border: rgba(0, 0, 0, 0.1);
    --nav-bg: rgba(244, 244, 240, 0.8);
    --loader-bg: #ffffff;
    --loader-text: #000000;
    --noise-opacity: 0.03;
}

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

html.lenis { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }

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

/* Noise Texture */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 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='1'/%3E%3C/svg%3E");
    opacity: var(--noise-opacity);
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: overlay;
}

/* --- INTERACTIVE PRELOADER --- */
.preloader {
    position: fixed;
    inset: 0;
    background: var(--loader-bg);
    color: var(--loader-text);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loader-content {
    text-align: center;
    width: 300px;
}

.counter {
    font-family: var(--font-main);
    font-size: 8rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 1rem;
}

.loading-text {
    font-family: var(--font-body);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1.5rem;
    height: 20px; /* Prevent jump when text changes */
    color: var(--text-muted);
}

.progress-bar {
    width: 100%;
    height: 2px;
    background: rgba(125, 125, 125, 0.2);
    position: relative;
    overflow: hidden;
}

.progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.2s ease;
}

/* Typography & UI */
h1, h2, h3, h4 { font-family: var(--font-main); font-weight: 700; }
a { text-decoration: none; color: inherit; cursor: none; }

/* Cursor */
.cursor-dot, .cursor-outline {
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 9999;
    pointer-events: none;
    mix-blend-mode: difference; /* Makes cursor visible on light/dark */
}
.cursor-dot { width: 8px; height: 8px; background-color: white; }
.cursor-outline { width: 40px; height: 40px; border: 1px solid rgba(255,255,255,0.5); transition: width 0.2s, height 0.2s; }

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 2rem 4vw;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    background: var(--nav-bg); /* Semi-transparent background */
    backdrop-filter: blur(5px);
}
.logo { font-family: var(--font-main); font-weight: 800; font-size: 1.5rem; }
.dot { color: var(--text-muted); }

.nav-right { display: flex; gap: 2rem; align-items: center; }
.link { font-size: 0.9rem; font-weight: 500; position: relative; }
.link::after {
    content: ''; position: absolute; bottom: -4px; left: 0; width: 0; height: 1px; background: var(--accent); transition: 0.3s;
}
.link:hover::after { width: 100%; }

/* Theme Toggle Button */
.icon-btn {
    background: none;
    border: none;
    cursor: none;
    color: var(--text);
    font-size: 1.2rem;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sun-icon { display: none; }
.moon-icon { display: block; }

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

.btn-filled {
    padding: 0.8rem 1.5rem;
    background: var(--accent);
    color: var(--bg); /* Inverts text color for button */
    border-radius: 30px;
    font-weight: 600;
    transition: transform 0.2s;
}
.btn-filled:hover { transform: scale(1.05); }

/* Hero */
.hero {
    height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    padding: 0 4vw;
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.8rem;
    margin-bottom: 2rem;
    color: var(--text-muted);
}
.pulsing-dot { width: 8px; height: 8px; background: #00ff88; border-radius: 50%; box-shadow: 0 0 10px #00ff88; }
.hero-title {
    font-size: clamp(3.5rem, 9vw, 10rem);
    line-height: 0.9;
    text-transform: uppercase;
    letter-spacing: -0.02em;
}
.hero-title .indent { margin-left: 10vw; color: var(--text-muted); }
.hero-footer {
    position: absolute;
    bottom: 3rem;
    left: 4vw;
    right: 4vw;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Projects */
.works { padding: 10vh 4vw; }
.section-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    padding-bottom: 2rem;
    margin-bottom: 4rem;
    color: var(--text-muted);
}
.project-item {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 4rem;
    margin-bottom: 15vh;
    align-items: center;
}
.project-item:nth-child(even) { direction: rtl; }
.project-item:nth-child(even) .project-info { direction: ltr; }

.project-info h3 { font-size: 3rem; margin-bottom: 0.5rem; }
.project-info > p { color: var(--text); font-size: 1.2rem; margin-bottom: 1rem; font-weight: 500;}
.project-desc { color: var(--text-muted); margin-bottom: 2rem; line-height: 1.6; max-width: 90%; }

.tags span { 
    display: inline-block; 
    padding: 5px 15px; 
    border: 1px solid var(--border); 
    border-radius: 15px; 
    font-size: 0.8rem; 
    margin-right: 10px; 
    margin-bottom: 10px;
    color: var(--text-muted);
}
.btn-group { display: flex; gap: 20px; margin-top: 2rem; }
.view-btn {
    display: inline-block;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--accent);
    padding-bottom: 5px;
}
.view-btn.small { font-size: 0.9rem; opacity: 0.7; border-bottom: 1px solid var(--border); }

.project-visual {
    width: 100%;
    height: 60vh;
    overflow: hidden;
    border-radius: 4px;
    background: var(--border); /* Placeholder color */
}
.img-reveal { width: 100%; height: 100%; clip-path: inset(0 100% 0 0); }

.project-visual img, 
.project-visual video,
.project-visual iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.2);
    transition: transform 0.5s;
    display: block;
}
.project-visual:hover img,
.project-visual:hover video { transform: scale(1); }

/* About & Marquee */
.big-text-wrapper {
    overflow: hidden;
    white-space: nowrap;
    margin-bottom: 4rem;
}
.scrolling-text {
    font-family: var(--font-main);
    font-size: 8rem;
    font-weight: 800;
    text-transform: uppercase;
    color: transparent;
    -webkit-text-stroke: 1px var(--border); /* Subtle stroke based on theme */
    opacity: 0.5;
}
.about-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 4rem;
    padding: 0 4vw;
}
.about-bio p { font-size: 1.5rem; line-height: 1.4; color: var(--text-muted); }
.tech-stack-minimal { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.tech-stack-minimal p { font-size: 1rem; color: var(--text-muted); }
.about-stats { display: flex; gap: 4rem; }
.stat-box h2 { font-size: 4rem; color: var(--accent); }
.stat-box p { color: var(--text-muted); }

/* Footer */
footer {
    height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 0 4vw;
}
.footer-content { text-align: center; width: 100%; }
.footer-cta {
    font-size: 8vw;
    line-height: 0.9;
    text-transform: uppercase;
    color: var(--text);
}
.footer-cta.outline {
    color: transparent;
    -webkit-text-stroke: 1px var(--text);
}
.footer-links {
    margin-top: 4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}
.email-link { font-size: 1.5rem; border-bottom: 1px solid var(--text-muted); padding-bottom: 5px; }
.email-link:hover { color: var(--accent); border-color: var(--accent); }
.socials { display: flex; gap: 2rem; }
.socials a { color: var(--text-muted); transition: 0.3s; }
.socials a:hover { color: var(--accent); }
.footer-bottom {
    margin-top: 5rem;
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
}

.tech-marquee {
    position: absolute;
    bottom: 15vh; /* Positioned above the footer text */
    left: 0;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    z-index: 1;
    opacity: 0.6; /* Subtle opacity */
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.tech-track {
    display: inline-flex;
    gap: 2rem;
    animation: marquee 60s linear infinite; /* Adjust speed here (60s is slow/smooth) */
    width: max-content;
}

.tech-item {
    font-family: var(--font-main); /* Matches your headers */
    font-size: 1.5rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    /* Optional: Add stroke effect for extra style */
    /* -webkit-text-stroke: 1px var(--border); 
       color: transparent; */
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%); /* Moves half the width (since content is doubled) */
    }
}

/* --- LOADER BACKGROUND EFFECTS --- */
.loader-bg-effect {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0; /* Behind the text */
}

.scan-line {
    position: absolute;
    background: #FF0033; /* Default Red */
    opacity: 0.7;
    box-shadow: 0 0 10px #FF0033; /* Glowing effect */
    transform-origin: left;
}

/* Optional: Add a subtle grid background to the loader for more texture */
.preloader::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: -1;
}

/* Mobile */
@media (max-width: 768px) {
    .counter { font-size: 4rem; }
    .navbar { padding: 1.5rem; }
    
    /* Mobile Menu Logic */
    .nav-right {
        position: fixed;
        top: 0;
        right: -100%; /* Hidden by default */
        width: 100%;
        height: 100vh;
        background: var(--bg);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: right 0.5s ease;
        z-index: 99;
    }
    
    .nav-right.active {
        right: 0; /* Slide in */
    }

    .hamburger {
        display: flex;
        flex-direction: column;
        gap: 6px;
        cursor: pointer;
        z-index: 101;
    }
    
    .line {
        width: 30px;
        height: 2px;
        background-color: var(--text);
        transition: all 0.3s ease;
    }

    /* Hamburger Animation */
    .hamburger.active .line:nth-child(1) {
        transform: rotate(45deg) translate(5px, 6px);
    }
    .hamburger.active .line:nth-child(2) {
        opacity: 0;
    }
    .hamburger.active .line:nth-child(3) { /* Assuming you might add a 3rd line or adjust logic */
        transform: rotate(-45deg) translate(5px, -6px);
    }
    /* Since you only have 2 lines in HTML, let's adjust for 2 lines */
    .hamburger.active .line:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    .hamburger.active .line:nth-child(2) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

    .hero-title { font-size: 3.5rem; }
    .hero-title .indent { margin-left: 0; }
    .project-item { grid-template-columns: 1fr; gap: 2rem; direction: ltr !important; }
    .project-visual { height: 35vh; }
    .about-grid { grid-template-columns: 1fr; }
    .scrolling-text { font-size: 4rem; }
    .cursor-dot, .cursor-outline { display: none; }
    .footer-cta { font-size: 12vw; }
    .tech-marquee {
        bottom: 18vh;
    }
    .tech-item {
        font-size: 1rem;
    }
    
    /* Fix for Footer/About overlap */
    footer {
        height: auto;
        min-height: 50vh;
        padding: 4rem 4vw;
    }
    .about-editorial {
        margin-bottom: 4rem;
    }
}

/* New Project Grid Styles */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.project-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.project-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
}

.project-img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
}

.project-meta {
    padding: 1.5rem;
}

.project-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.project-actions {
    display: flex;
    gap: 1rem;
}

.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    cursor: pointer;
}

.btn-sm {
    padding: 0.6rem 1.2rem;
    font-size: 0.8rem;
}

.btn-color-1 {
    background: transparent;
    border-color: var(--text);
    color: var(--text);
}

.btn-color-1:hover {
    background: var(--text);
    color: var(--bg);
}

.btn-color-2 {
    background: var(--accent);
    color: var(--bg);
}

.btn-color-2:hover {
    background: transparent;
    border-color: var(--accent);
    color: var(--accent);
}

.section__text__p1 {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.title {
    text-align: center;
    font-size: 3rem;
    margin-bottom: 3rem;
}