:root {
    --background: 0 0% 3%;
    --foreground: 0 0% 95%;

    --muted: 0 0% 20%;
    --muted-foreground: 0 0% 60%;

    --border: 0 0% 12%;
}

body {
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    font-family: 'Lato', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    letter-spacing: 0.02em;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Playfair Display', serif;
}

#showreel {
    scroll-margin-top: 1920px; 
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Minimal scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: hsl(var(--muted));
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--muted-foreground));
}

/* Pulsing Dot (Kept subtle) */
@keyframes pulse-white {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(0.95);
    }
}

.animate-pulse-white {
    animation: pulse-white 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.hero-transition {
    transition: all 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.blur-hidden {
    filter: blur(20px);
    opacity: 0;
    transform: scale(1.05);
    pointer-events: none;
}

/* =========================================
   BACKGROUND SLIDESHOW (Moodier)
   ========================================= */

.slideshow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -2;
    overflow: hidden;
}

.slide-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Reset state: Hidden & Reset properties */
    opacity: 0;
    z-index: 0;
    transform: scale(1);

    /* Transition: Simple opacity fade */
    transition: opacity 2s ease-in-out, filter 1s ease-in-out;

    /* Film Look default */
    filter: brightness(0.7) contrast(1) saturate(1.1) sepia(0.1) blur(0px);
}

@keyframes zoom-continuous {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.3);
    }
}

.slide-img.active {
    opacity: 1;
    z-index: 2;
    /* On Top */

    /* Hardware Hints */
    will-change: transform, opacity;
    backface-visibility: hidden;
    perspective: 1000px;
    transform-style: preserve-3d;

    /* Zoom Loop */
    animation: zoom-continuous 20s linear forwards;
}

.slide-img.exiting {
    opacity: 1;
    /* Stay visible behind the new slide until removed */
    z-index: 1;
    /* Background */

    /* Continue Zoom - MUST MATCH .active exactly */
    animation: zoom-continuous 20s linear forwards;

    /* Allow filter to transition if scrolling happens during exit */
    /* Allow filter to transition if scrolling happens during exit - Inherited from base */
}

/* Reading Mode (Scrolled) */
.body-scrolled .slide-img {
    filter: brightness(0.15) contrast(1) saturate(0) sepia(0) blur(15px);
    /* Very dark and blurred for reading */
    /* opacity removed to allow transition */
}

/* =========================================
   PERFORMANCE OPTIMIZATIONS
   ========================================= */

/* Mobile / Tablets 
   Reduces memory usage */
@media (max-width: 768px) {
    .slide-img {
        transition: opacity 2s ease-in-out, filter 1s ease-in-out !important;
    }

    .slide-img.active {
        opacity: 1;
        animation: zoom-continuous 20s linear forwards;
    }

    /* Reduce blur cost */
    .slideshow-overlay {
        backdrop-filter: none;
    }
}

/* Gradient Overlay - Cinematic Vignette */

.slideshow-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -1;
    background: radial-gradient(circle at center, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.95) 100%);
    pointer-events: none;
}

/* =========================================
   EDITORIAL UI COMPONENTS
   ========================================= */

/* Minimal Button - Underline style */
.btn-minimal {
    position: relative;
    padding-bottom: 2px;
    font-family: 'Lato', sans-serif;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.75rem;
    transition: color 0.3s ease;
}

.btn-minimal::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background-color: white;
    transition: width 0.3s ease;
}

.btn-minimal:hover::after {
    width: 100%;
}

/* Project Card - Clean / Magazine style */
.project-card {
    position: relative;
    margin-bottom: 2rem;
}

.project-image-container {
    overflow: hidden;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    background: rgba(255, 255, 255, 0.03);
    /* Subtle placeholder color */
}

.project-image {
    transition: transform 1.5s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.7s ease;
    opacity: 0;
    /* Hidden initially */
}

.project-image.revealed {
    opacity: 0.8;
    /* Base opacity when revealed */
}

.project-card:hover .project-image.revealed {
    transform: scale(1.05);
    opacity: 1;
}


.project-info {
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.project-card:hover .project-info {
    opacity: 1;
}

.project-title {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 1.5rem;
}

.project-meta {
    font-family: 'Lato', sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* =========================================
   MOBILE MENU ANIMATION
   ========================================= */

/* Button Icon Swapping */
.mobile-toggle .icon-menu {
    display: block;
    transition: transform 0.3s ease;
}

.mobile-toggle .icon-close {
    display: none;
    transition: transform 0.3s ease;
}

.mobile-toggle.is-open .icon-menu {
    display: none;
}

.mobile-toggle.is-open .icon-close {
    display: block;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Menu Unfold Animation */
.mobile-menu-wrapper {
    display: block;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.4s ease,
        margin 0.3s ease,
        padding 0.3s ease;

    /* Reset margins/borders to 0 when closed to prevent layout shift */
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-top-width: 0;
    border-color: rgba(255, 255, 255, 0.1);
}

.mobile-menu-wrapper.is-open {
    max-height: 300px;
    /* Enough for the links */
    opacity: 1;
    margin-top: 0.5rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
    border-top-width: 1px;
}

.mobile-link {
    transform: translateY(-10px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.mobile-menu-wrapper.is-open .mobile-link {
    transform: translateY(0);
    opacity: 1;
}

/* Stagger delays for links */
.mobile-menu-wrapper.is-open .mobile-link:nth-child(1) {
    transition-delay: 0.1s;
}

.mobile-menu-wrapper.is-open .mobile-link:nth-child(2) {
    transition-delay: 0.2s;
}

.mobile-menu-wrapper.is-open .mobile-link:nth-child(3) {
    transition-delay: 0.3s;
}

/* =========================================
   INTRO ANIMATIONS
   ========================================= */

@keyframes introFadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes introSimpleFade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* 1. Logo - Appears First */
.intro-logo {
    opacity: 0;
    animation: introFadeInUp 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: 0.2s;
}

/* 2. Tagline - Appears Second */
.intro-tagline {
    opacity: 0;
    animation: introFadeInUp 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: 1s;
}

/* 3. The Rest (Nav, BG, Bio, Buttons) - Appears Last */
.intro-delayed {
    opacity: 0;
    animation: introSimpleFade 2s ease-out forwards;
    animation-delay: 1.5s;
}

/* Specific slightly upward fade for content text */
.intro-content-delayed {
    opacity: 0;
    animation: introSimpleFade 2s ease-out forwards;
    animation-delay: 1.75s;
}

/* =========================================
   LAZY LOAD CASCADE ANIMATION
   ========================================= */

@keyframes fadeUpStagger {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-up-stagger {
    opacity: 0;
    animation: fadeUpStagger 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* =========================================
   CUSTOM CURSOR
   ========================================= */

/* Hide default cursor on desktop via class added by JS */
.no-cursor,
.no-cursor a,
.no-cursor button,
.no-cursor .cursor-pointer {
    cursor: none !important;
}

#custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 12px;
    height: 12px;
    background-color: white;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    /* transform initialized in JS for performance */
    transition: width 0.3s cubic-bezier(0.25, 1, 0.5, 1),
        height 0.3s cubic-bezier(0.25, 1, 0.5, 1),
        background-color 0.3s ease,
        mix-blend-mode 0.3s ease,
        opacity 0.3s ease;
    opacity: 0;
    mix-blend-mode: difference;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    color: transparent;
    font-weight: 700;
    letter-spacing: 0.1em;
    font-family: 'Lato', sans-serif;
    will-change: transform;
}

#custom-cursor.hover-project {
    width: 80px;
    height: 80px;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    mix-blend-mode: normal;
    font-size: 0.65rem;
    color: white;
}

/* Hide cursor on touch devices */
@media (pointer: coarse) {
    #custom-cursor {
        display: none !important;
    }

    body,
    a,
    button,
    .cursor-pointer {
        cursor: auto !important;
    }
}

/* =========================================
   SLIDESHOW METADATA
   ========================================= */

#slide-metadata {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 10;
    /* Above background, below nav/modals */
    text-align: right;
    font-family: 'Lato', sans-serif;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: hsl(var(--muted-foreground));
    opacity: 0;
    /* Hidden by default, toggled via JS */
    transition: opacity 1s ease-in-out;
    pointer-events: none;
    /* Don't block clicks */
}

#slide-metadata.visible {
    opacity: 1;
    /* Reset to 1 so the element itself is visible */
}

#slide-metadata .meta-label {
    display: block;
    margin-bottom: 0.25rem;
    color: hsla(var(--muted-foreground), 0.75);
    /* 25% transparent */
}

#slide-metadata .meta-value {
    color: hsla(var(--foreground), 0.75);
    /* 25% transparent */
    font-weight: 400;
}

/* =========================================
   PLYR CUSTOMIZATION (Sleek B&W)
   ========================================= */

:root {
    --plyr-color-main: #ffffff;
    --plyr-video-control-color: #ffffff;
    --plyr-video-control-background-hover: rgba(255, 255, 255, 0.1);
    
    /* Thin Progress Bar */
    --plyr-range-track-height: 2px;
    --plyr-range-thumb-height: 0px; /* Hide the big dot */
    --plyr-range-fill-background: #ffffff;
    
    /* Control Bar appearance */
    --plyr-video-controls-background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.5));
    --plyr-control-spacing: 12px;
}

/* Elegant Overlaid Play Button */
.plyr__control--overlaid {
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 50% !important;
    width: 80px !important;
    height: 80px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    aspect-ratio: 1 / 1 !important;
    transform: translate(-50%, -50%);
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.plyr__control--overlaid:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    transform: translate(-50%, -50%) scale(1.1);
}

.plyr__control--overlaid svg {
    width: 20px;
    height: 20px;
    fill: #ffffff;
    margin-left: 2px;
}

/* Show thumb on hover of the progress bar if needed, or keep it hidden */
.plyr__progress input[type=range]:hover::-webkit-slider-thumb {
    transform: scale(1.5);
    background: #ffffff;
}

/* Make progress bar even thinner when not hovering */
.plyr__progress {
    height: 2px;
    transition: height 0.3s ease;
}

.plyr--full-ui input[type=range] {
    cursor: none; 
}

/* Restore default cursor on Plyr controls if custom cursor is awkward */
.plyr--full-ui .plyr__controls,
.plyr--full-ui .plyr__control--overlaid {
    cursor: auto !important;
}