/* 
  ========================================
  VARIABLES & THEME
  ========================================
*/
:root {
    /* LIGHT MODE (Default) */
    --bg-color: #f0f0f5;
    --text-primary: #2a2a2a; /* Softer Gray */
    --text-outline: #5a5a70;
    --text-secondary: #5a5a70;
    --line-color: rgba(90, 90, 112, 0.2);
    --blob-1: #80ffc5; /* Stronger Pastel Green */
    --blob-2: #ffa08c; /* Stronger Pastel Pink/Peach */
    --blob-3: #fffc79; /* Stronger Pastel Yellow */
    --blob-4: #dcd3ff; /* Pastel Purple */
    --cursor-color: #151515;
    
    /* Updated Font Stack to VT323 */
    --font-main: 'VT323', monospace;
    --text-size-hero: clamp(3rem, 6vw, 5rem);
    
    /* Light Mode Noise: Black/Dark grit */
    --noise-opacity: 0.6; /* Increased from 0.5 */
    --noise-blend: multiply;
    /* SVG with black fill/turbulence */
    --noise-url: 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='5' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='1' fill='black'/%3E%3C/svg%3E");
}

[data-theme="dark"] {
    --bg-color: #1a1a1e;
    --text-primary: #e0e0e5;
    --text-outline: #e0e0e5;
    --text-secondary: #a0a0b0;
    --line-color: rgba(224, 224, 229, 0.2);
    --blob-1: #2a2a35; 
    --blob-2: #3a3a45; 
    --blob-3: #1f1f25;
    --blob-4: #4a3b55;
    --cursor-color: #e0e0e5;
    
    /* Dark Mode Noise: White/Light dust - Finer and subtler */
    --noise-opacity: 0.3; /* Increased from 0.2 */
    --noise-blend: screen; /* Screen or Overlay works best for white on dark */
    /* SVG with white fill/turbulence - High frequency for fine grain */
    --noise-url: 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='10' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='1'/%3E%3C/svg%3E");
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    cursor: none; /* Hide Default Cursor */
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    overflow-x: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
    min-height: 100vh;
    font-size: 18px; /* Slightly larger base size for pixel font */
}

a, button {
    color: inherit;
    text-decoration: none;
    cursor: none; /* Hide Default Cursor */
}

/* 
  ========================================
  CUSTOM CURSOR
  ========================================
*/
.cursor-dot, .cursor-circle {
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 9999;
    pointer-events: none;
}

.cursor-dot {
    width: 4px;
    height: 4px;
    background-color: var(--cursor-color);
}

.cursor-circle {
    width: 20px;
    height: 20px;
    border: 1px solid var(--cursor-color);
    transition: width 0.2s, height 0.2s, background-color 0.2s;
}

/* Hover State for Cursor */
body.hovering .cursor-circle {
    width: 40px;
    height: 40px;
    background-color: rgba(128,128,128, 0.1);
    border-color: transparent;
}

/* 
  ========================================
  BACKGROUND BLOBS
  ========================================
*/
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

/* Wrapper handles Positioning & JS Interaction (Push) */
.blob-wrapper {
    position: absolute;
    will-change: transform;
    transition: transform 0.1s ease-out; /* Smooth push return */
}

.blob-wrapper-1 {
    width: 50vw;
    height: 50vw;
    min-width: 400px;
    min-height: 400px;
    top: -10%;
    left: -10%;
}

.blob-wrapper-2 {
    width: 40vw;
    height: 40vw;
    min-width: 350px;
    min-height: 350px;
    bottom: -10%;
    right: -10%;
}

.blob-wrapper-3 {
    width: 45vw;
    height: 45vw;
    min-width: 380px;
    min-height: 380px;
    top: 30%;
    left: 30%;
}

.blob-wrapper-4 {
    width: 35vw;
    height: 35vw;
    min-width: 300px;
    min-height: 300px;
    bottom: 10%;
    left: 10%;
}

/* Inner Blob handles Color & Floating Animation */
.blob {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.7;
    position: absolute;
    top: 0;
    left: 0;
}

.blob-inner-1 {
    background-color: var(--blob-1);
    animation: floatOne 25s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}

.blob-inner-2 {
    background-color: var(--blob-2);
    animation: floatTwo 30s infinite alternate-reverse cubic-bezier(0.4, 0, 0.2, 1);
}

.blob-inner-3 {
    background-color: var(--blob-3);
    animation: floatThree 35s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}

.blob-inner-4 {
    background-color: var(--blob-4);
    animation: floatFour 40s infinite alternate-reverse cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes floatOne {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(10vw, 15vh) scale(1.1); }
    66% { transform: translate(-5vw, 20vh) scale(0.9); }
    100% { transform: translate(15vw, -10vh) scale(1.05); }
}

@keyframes floatTwo {
    0% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-15vw, -10vh) rotate(10deg); }
    66% { transform: translate(5vw, -25vh) rotate(-5deg); }
    100% { transform: translate(-10vw, 15vh) rotate(5deg); }
}

@keyframes floatThree {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-10vw, 10vh) scale(1.2); }
    66% { transform: translate(15vw, -15vh) scale(0.85); }
    100% { transform: translate(-5vw, 5vh) scale(1.1); }
}

@keyframes floatFour {
    0% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(10vw, -15vh) rotate(-10deg); }
    66% { transform: translate(-10vw, 10vh) rotate(5deg); }
    100% { transform: translate(5vw, -20vh) rotate(-5deg); }
}

/* 
  ========================================
  HEADER & NAV
  ========================================
*/
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 3rem;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 200;
}

.logo a {
    display: block;
    color: var(--text-primary);
}

/* .header-controls {
    display: flex;
    align-items: center;
    gap: 2rem;
    font-size: 1.2rem;
    font-weight: 500;
} */
/* Removed old definition to avoid conflict with the new fixed width definition below */

.lang-switch, .theme-toggle, .menu-trigger {
    background: none;
    border: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    font-size: inherit;
    padding: 0.5rem;
    width: 40px; /* Fixed width to prevent layout shift */
    height: 40px; /* Fixed height */
    box-sizing: border-box; /* Ensure padding is included in width */
}

.menu-trigger {
    position: relative;
    width: 24px;
    height: 24px;
}

.grid-dots, .close-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.grid-dots {
    display: grid;
    grid-template-columns: repeat(3, 6px);
    gap: 4px;
}

.grid-dots span {
    width: 6px;
    height: 6px;
    background-color: transparent;
    border: 1.5px solid var(--text-primary);
    border-radius: 50%;
}

.close-icon {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-90deg);
}

body.menu-open .grid-dots {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(90deg);
}

body.menu-open .close-icon {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(0);
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    z-index: 150;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 3rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

body.menu-open .menu-overlay {
    opacity: 1;
    pointer-events: auto;
}

.menu-nav ul { list-style: none; }
.menu-nav li { 
    margin-bottom: 1rem; 
    overflow: hidden; 
    display: flex;
    align-items: baseline;
    flex-direction: row-reverse; /* Move number to left */
    justify-content: flex-end; /* Align to left */
    gap: 1rem; /* Gap between Text and Number */
}
.menu-link {
    font-size: clamp(4rem, 8vw, 6rem); /* Increased size */
    font-weight: 400;
    text-transform: uppercase;
    display: block; /* Changed from flex to block since li is now the flex container */
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), letter-spacing 0.3s ease; /* Reverted to simpler transition */
    line-height: 1;
    color: var(--text-primary);
}
.menu-link:hover {
    /* animation: textSqueeze 0.4s ease-out forwards; */ /* Removed spring animation */
    letter-spacing: -0.05em; /* Simpler squeeze effect */
    font-style: italic; /* Optional: Adds a bit of flair like reference */
}
body.menu-open .menu-link { 
    transform: translateY(0); 
}

.menu-footer {
    display: flex;
    gap: 4rem; /* Increased gap between footer links */
    margin-top: 4rem;
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.menu-footer a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background-color: var(--text-primary);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.menu-footer a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* Staggered Animation Delays (Entry) */
body.menu-open li:nth-child(1) .menu-link { transition-delay: 0.1s; }
body.menu-open li:nth-child(2) .menu-link { transition-delay: 0.2s; }
body.menu-open li:nth-child(3) .menu-link { transition-delay: 0.3s; }
body.menu-open li:nth-child(4) .menu-link { transition-delay: 0.4s; }

/* Exit Animation (Bottom to Top) */
body.exiting-menu .menu-link {
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reverse Delays for Exit */
body.exiting-menu li:nth-child(1) .menu-link { transition-delay: 0.3s; }
body.exiting-menu li:nth-child(2) .menu-link { transition-delay: 0.2s; }
body.exiting-menu li:nth-child(3) .menu-link { transition-delay: 0.1s; }
body.exiting-menu li:nth-child(4) .menu-link { transition-delay: 0s; }

.menu-number { 
    font-size: 1.5rem; 
    color: var(--text-secondary); 
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
body.menu-open .menu-number { transform: translateY(0); transition-delay: 0.5s; }

/* 
  ========================================
  HERO SECTION
  ========================================
*/
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 2rem;
}

.hero-title {
    display: flex;
    flex-direction: column;
    font-size: var(--text-size-hero);
    line-height: 0.9;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

.outline-text {
    color: transparent;
    -webkit-text-stroke: 1px var(--text-primary);
    font-weight: 400;
}

.filled-text {
    color: var(--text-primary);
    font-weight: 400;
}

.hero-description {
    font-size: 1.4rem;
    margin-bottom: 3rem;
    line-height: 1.4;
    color: var(--text-secondary);
}

/* Pretty Arrows */
.hero-links {
    display: flex;
    justify-content: center;
    gap: 3rem;
}

.pretty-arrow {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    color: var(--text-primary);
    position: relative;
    padding-bottom: 5px;
}

.pretty-arrow::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background-color: var(--text-primary);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.pretty-arrow:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

.arrow-icon {
    transition: transform 0.3s ease;
}

.pretty-arrow:hover .arrow-icon {
    transform: translateX(5px);
}


/* 
  ========================================
  SPLIT VIEW LAYOUT (WORK.HTML)
  ========================================
*/
.split-view {
    display: flex;
    height: 100vh;
    width: 100vw;
    padding-top: 100px; /* Space for Header */
}

.preview-container {
    width: 40%;
    display: flex;
    align-items: flex-end; /* Align to bottom */
    justify-content: flex-start; /* Align to left */
    position: sticky;
    top: 100px;
    height: calc(100vh - 100px);
    padding: 0; /* Remove padding */
    overflow: hidden;
}

.preview-image-wrapper {
    width: 100%;
    height: 100%;
    aspect-ratio: auto; /* Reset aspect ratio */
    overflow: hidden;
    border-radius: 0 24px 0 0; /* Round top-right corner only */
    background-color: transparent;
    margin: 0; /* Ensure no margins */
}

.preview-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0; /* Hidden by default */
    transform: scale(1); /* Start at normal scale */
    transition: opacity 0.6s ease, transform 6s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Slow zoom, smooth fade */
    will-change: transform, opacity;
}

.list-container {
    width: 60%;
    padding: 2rem 4rem;
    overflow-y: auto;
}

.work-header-group {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 2px solid var(--text-primary);
    padding-bottom: 0.5rem;
    margin-bottom: 0; /* Removed margin to match item spacing */
}

.work-main-title {
    font-size: 4rem;
    font-weight: 400;
    text-transform: uppercase;
    line-height: 1;
}

.work-count {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.work-list {
    list-style: none;
}

.work-item {
    border-bottom: 1px solid var(--line-color);
}

.work-item a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    width: 100%;
    font-size: 1.8rem;
    transition: all 0.3s ease;
    position: relative; /* For arrow positioning */
}

.work-cat {
    font-size: 1.8rem; /* Same size as title */
    text-transform: uppercase;
    color: var(--text-secondary);
    text-align: right;
}

.work-title {
    position: relative;
    display: inline-block;
    transition: transform 0.3s ease;
}

.work-title::before {
    content: '→';
    position: absolute;
    left: -1.2em; /* Position outside left */
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    font-size: 1.8rem;
    line-height: 1;
}

.work-item a:hover .work-title {
    transform: translateX(1.2em); /* Move right by arrow size */
}

.work-item a:hover .work-title::before {
    opacity: 1;
    /* No transform needed, it moves with the parent */
}

/* Background Texture */
body::before {
    content: "";
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    pointer-events: none;
    z-index: 9998; /* Below cursor */
    opacity: var(--noise-opacity); 
    mix-blend-mode: var(--noise-blend); /* Adaptive blending */
    
    /* Use the theme-specific noise URL */
    background-image: var(--noise-url);
    background-size: 600px 600px; /* Enlarged for visibility */
    
    animation: grain 0.5s steps(5) infinite;
}


/* Film Grain Animation */
@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-5%, -10%); }
  30% { transform: translate(3%, -5%); }
  50% { transform: translate(-3%, 5%); }
  70% { transform: translate(5%, 10%); }
  90% { transform: translate(-5%, 5%); }
}

/* Updated Cursor Hover State */
body.hovering .cursor-circle {
    width: 60px;
    height: 60px;
    background-color: rgba(128, 128, 128, 0.3);
    border-color: transparent;
    mix-blend-mode: difference; /* Optional: for visibility over images */
}

/* 
  ========================================
  ABOUT PAGE
  ========================================
*/
.content-container {
    padding: 8rem 4rem;
    max-width: 1200px;
    margin: 0 auto;
}

.about-bio-section {
    margin-bottom: 8rem; /* Increased gap before Experience section */
}

.about-bio-section h1 {
    font-size: 4rem;
    margin-bottom: 2rem;
}

.experience-list {
    list-style: none;
    margin-top: 2rem;
}

.experience-list li {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    border-bottom: 1px solid var(--line-color);
    padding: 1.5rem 0;
    font-size: 1.5rem;
}

/* Disabled Link Style */
a.disabled-link {
    pointer-events: auto; /* Keep auto so hover works */
    cursor: not-allowed; /* Changed from default to not-allowed to indicate disabled state */
}


/* MOBILE TWEAKS */

@media (max-width: 768px) {
    .split-view {
        flex-direction: column;
        height: auto;
    }
    .preview-container {
        display: none; /* Hide desktop preview */
    }
    
    /* Mobile Image Preview - Hidden by default, shown via JS */
    .mobile-preview {
        display: none;
        width: 100%;
        aspect-ratio: 4/3;
        margin-top: 1rem;
        border-radius: 8px;
        overflow: hidden;
    }
    
    .mobile-preview.active {
        display: block;
        animation: fadeIn 0.3s ease;
    }
    
    .mobile-preview img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .list-container {
        width: 100%;
        padding: 2rem;
    }
    .experience-list li {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    /* Reduce noise slightly on mobile dark mode */
    [data-theme="dark"] {
        --noise-opacity: 0.25; /* Slightly reduced from 0.3 */
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Page Transitions */
/* Removed body opacity/fade to keep background global/static */

/* Text Transitions */
.transition-text {
    /* Ensure block or inline-block is handled by specific elements if needed, 
       but avoid breaking flex containers like header-controls */
    transition: transform 0.5s ease, opacity 0.5s ease;
    
    /* Entry Animation State (start invisible and slightly down) */
    opacity: 0;
    transform: translateY(20vh);
    animation: textEntry 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes textEntry {
    from {
        opacity: 0;
        transform: translateY(20vh);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Exit State */
body.exiting .transition-text {
    transform: translateY(-20vh); /* Move UP on exit */
    opacity: 0;
    animation: none; /* Override entry animation */
    transition: transform 0.5s ease, opacity 0.5s ease;
}

/* 
  ========================================
  LIGHTBOX
  ========================================
*/
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 10000; /* Topmost */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer; /* Indicates click to close */
}

.lightbox.active {
    opacity: 1;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    cursor: default; /* Prevent closing when clicking image */
}

.lightbox.active img {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 3rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.5rem;
    transition: transform 0.2s ease;
}

.lightbox-close:hover {
    transform: scale(1.1);
}

.lightbox-link-btn {
    position: absolute;
    bottom: 2rem;
    background-color: white;
    color: black;
    padding: 1rem 2rem;
    font-size: 1.5rem;
    text-transform: uppercase;
    border-radius: 50px;
    transition: transform 0.2s ease, background-color 0.2s ease;
    font-family: var(--font-main);
    letter-spacing: 0.05em;
}

.lightbox-link-btn:hover {
    transform: scale(1.05);
    background-color: #f0f0f0;
}

.header-controls {
    display: flex !important;  
    align-items: center !important;
    gap: 1rem; /* Reduced gap slightly to keep tighter control */
    font-size: 1.2rem;
    font-weight: 500;
    flex-direction: row !important;
    opacity: 1 !important; /* Container shouldn't hide, children will animate */
    transform: none !important;
    animation: none !important;
    width: 140px; /* Fixed width for the container to prevent outer shifts */
    justify-content: flex-end; /* Align items to the right */
}

/* Apply transition to children of header-controls instead if targeted */
.header-controls > * {
    /* These are the buttons */
}