:root {
    --bg-base: #141416;
    --text-main: #f0f0f0;
    --text-muted: #8e8e93;
    --accent: #ffffff;
    --glass-bg: rgba(30, 30, 35, 0.4);
    --glass-border: rgba(255, 255, 255, 0.1);
    
    /* Variables for toggling */
    --blob-1: #1a1a2e;
    --blob-2: #16213e;
    --blob-3: #0f3460;
    --blob-opacity: 0.6;
    --cursor-color: #fff;
    --cursor-border: rgba(255, 255, 255, 0.4);
    --cursor-bg: rgba(255, 255, 255, 0.1);
    --card-border-hover: rgba(255, 255, 255, 0.4);

    --font-heading: 'Syne', sans-serif;
    --font-body: 'Space Grotesk', sans-serif;
}

[data-theme="light"] {
    --bg-base: #f5f5f5;
    --text-main: #1a1a1a;
    --text-muted: #333333;
    --accent: #202020;
    --glass-bg: rgba(255, 255, 255, 0.4);
    --glass-border: rgba(0, 0, 0, 0.1);
    
    --blob-1: #c4b5fd;
    --blob-2: #93c5fd;
    --blob-3: #fbcfe8;
    --blob-opacity: 0.8;
    --cursor-color: #000;
    --cursor-border: rgba(0, 0, 0, 0.4);
    --cursor-bg: rgba(0, 0, 0, 0.1);
    --card-border-hover: rgba(0, 0, 0, 0.3);
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-body);
    /* Fixed on desktop */
    overflow: hidden; 
    cursor: none; 
    line-height: 1.5;
}

/* Custom Cursor */
.cursor, .cursor-follower {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    border-radius: 50%;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s, background-color 0.3s;
}

.cursor {
    width: 6px;
    height: 6px;
    background-color: var(--cursor-color);
    mix-blend-mode: difference;
}

.cursor-follower {
    width: 36px;
    height: 36px;
    border: 1px solid var(--cursor-border);
    transition: transform 0.1s ease-out, width 0.3s, height 0.3s, background-color 0.3s;
}

.cursor-follower.hover-active {
    width: 50px;
    height: 50px;
    background-color: var(--cursor-bg);
    border-color: transparent;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Kinetic Mesh & Noise Background */
.mesh-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: var(--bg-base);
}

.mesh-blob {
    position: absolute;
    filter: blur(90px);
    opacity: var(--blob-opacity);
    border-radius: 50%;
    animation: rotateBlob 25s infinite linear;
}

.blob-1 {
    width: 60vw;
    height: 60vh;
    background: var(--blob-1);
    top: -10vh;
    left: -10vw;
}

.blob-2 {
    width: 50vw;
    height: 50vh;
    background: var(--blob-2);
    bottom: -10vh;
    right: -10vw;
    animation-direction: reverse;
    animation-duration: 30s;
}

.blob-3 {
    width: 40vw;
    height: 40vh;
    background: var(--blob-3);
    top: 40vh;
    left: 30vw;
    animation-duration: 40s;
}

@keyframes rotateBlob {
    0% { transform: rotate(0deg) scale(1) translate(0, 0); }
    33% { transform: rotate(120deg) scale(1.1) translate(5vw, 5vh); }
    66% { transform: rotate(240deg) scale(0.9) translate(-5vw, -5vh); }
    100% { transform: rotate(360deg) scale(1) translate(0, 0); }
}

.noise-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: transparent;
    /* Apply SVG filter */
    filter: url(#noiseFilter);
    opacity: 0.4;
    mix-blend-mode: overlay;
}

/* Layout */
.fixed-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3vh 3vw;
    position: relative;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 1.5vh;
    right: 1.5vw;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-main);
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 50%;
    transition: border-color 0.3s, transform 0.3s, background 0.3s;
}

.theme-toggle:hover {
    border-color: var(--card-border-hover);
    transform: scale(1.1);
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
    transition: opacity 0.3s, transform 0.3s;
}

.moon-icon { display: none; }
.sun-icon { display: block; }

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

/* Hero Section */
.hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    margin-bottom: 4vh;
    margin-top: 2vh;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(3rem, 5vw, 5rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    color: var(--accent);
}

.hero-subtitle {
    font-size: clamp(1rem, 1.2vw, 1.2rem);
    color: var(--text-muted);
    margin-top: 1vh;
    font-weight: 500;
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5vw;
    padding: 0 6vw;
}

/* Project Card */
.project-card {
    position: relative;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    border-radius: 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 1.5vw;
    overflow: hidden;
    transform-style: preserve-3d;
    transition: border-color 0.4s ease, transform 0.4s ease;
    height: 100%;
}

.project-card:hover {
    border-color: var(--card-border-hover);
}

.card-image-wrapper {
    width: 100%;
    aspect-ratio: 3 / 4; 
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 2vh;
    transform: translateZ(20px);
    flex-shrink: 0;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(40%);
    transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1), filter 0.7s ease;
}

.project-card:hover .card-image-wrapper img {
    transform: scale(1.03);
    filter: grayscale(0%);
}

.card-content {
    transform: translateZ(30px);
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    position: relative;
}

.card-header {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-category {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-top: 0.5vh;
    display: block;
}

.project-title {
    font-family: var(--font-heading);
    font-size: clamp(1.2rem, 1.8vw, 2rem);
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Description sliding up on hover */
.card-description {
    margin-top: auto;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.view-project {
    display: inline-block;
    margin-top: 1.5vh;
    font-weight: 700;
    color: var(--accent);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-card:hover .view-project {
    transform: translateX(5px);
}

.project-card:hover .card-header {
    transform: translateY(-10px);
}

.project-card:hover .card-description {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}



/* Mobile & Tablet Responsiveness */
@media (max-width: 1024px) {
    /* Enable scrolling on smaller screens */
    body {
        overflow-y: auto;
    }
    
    .fixed-container {
        height: auto;
        padding: 5vh 5vw;
        padding-bottom: 10vh;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 5vh;
        padding: 0;
    }
    
    .project-card {
        height: auto;
        min-height: auto;
        padding: 4vw;
    }

    .card-image-wrapper {
        height: auto;
        aspect-ratio: 3 / 4;
    }

    .card-content {
        height: auto;
        flex-grow: 1;
        padding-bottom: 2vh;
    }

    /* On mobile, always show description */
    .card-description {
        opacity: 1;
        transform: translateY(0);
        margin-top: 2vh;
    }

    .project-card:hover .card-header {
        transform: translateY(0);
    }
    
    .hero {
        margin-bottom: 6vh;
    }
}

/* Disable custom cursor on touch devices */
@media (hover: none) and (pointer: coarse) {
    .cursor, .cursor-follower {
        display: none;
    }
    body {
        cursor: auto;
    }
}
