:root {
    --bg-color: #050505;
    --text-primary: #ededed;
    --text-secondary: #777777;
    --font-main: 'Inter', sans-serif;
}

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

@keyframes ambientPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; } /* Much subtler dip */
}

body {
    background-color: #050505; /* Deep, cinematic black */
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Apply the gentle pulse to all typography */
.brand, .nav a, .project-title, .project-director, .project-detail-title, .project-detail-director {
    animation: ambientPulse 5s ease-in-out infinite;
    will-change: opacity; /* Forces GPU hardware acceleration for buttery smooth transitions */
    transform: translateZ(0); /* Secondary hardware acceleration trigger */
}

/* Stagger static elements for a random, organic heartbeat effect */
.brand { animation-duration: 7s; animation-delay: -2.3s; }
.nav a:nth-child(1) { animation-duration: 6s; animation-delay: -1.1s; }
.nav a:nth-child(2) { animation-duration: 8s; animation-delay: -4.5s; }
.nav a:nth-child(3) { animation-duration: 5.5s; animation-delay: -0.5s; }
.nav a:nth-child(4) { animation-duration: 7.5s; animation-delay: -3.2s; }
.nav a:nth-child(5) { animation-duration: 6.5s; animation-delay: -5s; }
.nav a:nth-child(6) { animation-duration: 7s; animation-delay: -2.8s; }

.project-detail-title { animation-duration: 7s; animation-delay: -1.4s; }
.project-detail-director { animation-duration: 6s; animation-delay: -3.7s; }

.header {
    padding: 2.5rem 3rem 3rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 100;
    pointer-events: none;
    transition: transform 0.3s ease-in-out;
}

.header-hidden {
    transform: translateY(-100%);
}

.header::before {
    content: '';
    position: absolute;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: linear-gradient(to bottom, rgba(5,5,5,0.6) 0%, rgba(5,5,5,0) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    -webkit-mask-image: linear-gradient(to bottom, black 10%, transparent 85%);
    mask-image: linear-gradient(to bottom, black 10%, transparent 85%);
    z-index: -1;
    pointer-events: none;
}

.header a {
    pointer-events: auto;
}

.brand {
    display: flex;
    flex-direction: column;
}

.name {
    font-size: 1.15rem; /* Up ~5% from 1.1rem */
    font-weight: 800;
    letter-spacing: 0.05em;
    text-decoration: none;
    color: white;
    text-transform: uppercase;
}

.title {
    font-size: 0.7rem; /* Up from 0.65rem */
    font-weight: 400;
    color: #aaaaaa;
    margin-top: 0.2rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.nav {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.nav a {
    color: white;
    text-decoration: none;
    font-size: 0.7rem; /* Up from 0.65rem */
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: color 0.3s ease;
}

.nav a:hover {
    color: #777777;
}

.nav a.active {
    background-color: #fff;
    color: #000 !important;
    border-radius: 50px;
    padding: 0.25rem 0.8rem;
    margin: -0.25rem 0; /* Keep horizontal spacing stable */
    font-weight: 700;
}

/* Instagram Nav Link */
.ig-link {
    display: flex;
    align-items: center;
    color: #777777;
    transition: color 0.3s ease;
    margin-left: -1.5rem; /* Pull it tight to the CONTACT link */
    margin-top: 0.15rem;   /* Push it slightly down to the bottom right */
}

.ig-link:hover {
    color: #ffffff;
}

.ig-link svg {
    width: 0.75rem;
    height: 0.75rem;
}

/* Hero Section */
.hero {
    height: 100vh;
    width: 100%;
    position: relative;
    overflow: hidden;
    background-color: #000;
}

.hero-vimeo {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 56.25vw; /* 16:9 Aspect Ratio */
    min-height: 100vh;
    min-width: 177.77vh; /* 16:9 Aspect Ratio */
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
}

.hero-poster {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 56.25vw;
    min-height: 100vh;
    min-width: 177.77vh;
    transform: translate(-50%, -50%);
    object-fit: cover;
    pointer-events: none;
    z-index: 2; /* Sits exactly on top of the iframe to mask the jitter */
    animation: fadeOutPoster 0.8s ease forwards 1s; /* Fades out smoothly after 1 second */
}

@keyframes fadeOutPoster {
    from { opacity: 1; }
    to { opacity: 0; visibility: hidden; }
}


/* Ensure the iframe always covers the entire screen without black bars */
@media (min-aspect-ratio: 16/9) {
    .hero-vimeo, .hero-poster {
        height: 56.25vw; /* 100vw * 9/16 */
    }
}
@media (max-aspect-ratio: 16/9) {
    .hero-vimeo {
        width: 177.78vh; /* 100vh * 16/9 */
    }
}

/* Scroll Arrow */
.scroll-arrow {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    z-index: 10;
    cursor: pointer;
    transition: color 0.3s ease;
}

.scroll-arrow:hover {
    color: rgba(255, 255, 255, 1);
}

/* Portfolio Grid */
.portfolio {
    padding: 6rem 2rem 5rem;
    min-height: 100vh;
}

.subpage-portfolio {
    padding-top: 12.8rem; /* Final perfect sweet spot */
}

.section-title {
    max-width: 1200px;
    margin: 0 auto 1.5rem;
    font-size: 0.8rem; /* Up 15% from 0.7rem */
    font-weight: 500;
    color: #aaaaaa;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.grid {
    display: flex;
    flex-direction: column;
    gap: 2.4rem; /* Reduced by ~20% from 3rem */
    max-width: 1200px;
    margin: 0 auto;
}

.grid-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background-color: transparent;
}

.project-images {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem; /* Gap between the 3 images in the same row */
    width: 100%;
}

.image-wrapper {
    position: relative;
    overflow: hidden;
    /* Let the new borderless images define their own natural aspect ratio */
}

/* Specific override for No Time to force 4:3 */
.project-no-time .image-wrapper {
    aspect-ratio: 4 / 3;
}

.project-no-time .grid-img {
    height: 100%;
    object-fit: cover;
}

/* Image layers */
.grid-img {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none; /* Prevents browser tooltips and selection */
    user-select: none;
}


/* Add pointer cursor to show items are clickable */
.grid-item {
    cursor: pointer;
}

/* Overlay Title on hover */
.project-info {
    position: relative;
    width: 100%;
    padding: 1rem 0;
    opacity: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: opacity 0.4s ease;
}

.grid-item:hover .project-info {
    opacity: 1;
}

.project-title {
    font-size: 0.8rem; /* Up from 0.75rem */
    font-weight: 600;
    text-transform: uppercase;
    color: #cccccc;
    letter-spacing: 0.05em;
}

.project-director {
    font-size: 0.7rem; /* Up from 0.65rem */
    font-weight: 400;
    color: #777777;
    letter-spacing: 0.05em;
}

@media (max-width: 768px) {
    /* Always show project titles on mobile since there is no hover */
    .project-info {
        opacity: 1;
        padding: 1rem 0.5rem;
    }

    /* Horizontal scroll carousel for the 3 row images on iPhone */
    .project-images {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: 0.5rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Hide scrollbar Firefox */
    }
    
    .project-images::-webkit-scrollbar {
        display: none; /* Hide scrollbar Safari/Chrome */
    }

    .image-wrapper {
        flex: 0 0 85%; /* 85% width lets the next image peek in to hint at scrolling */
        scroll-snap-align: center;
    }

    /* 2 columns for gallery on mobile */
    .project-gallery {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    /* Compact header so it doesn't block the screen */
    .header {
        flex-direction: column;
        align-items: center;
        gap: 0.8rem;
        padding: 1rem;
    }
    
    /* Darker black cloud for mobile header */
    .header::before {
        background: linear-gradient(to bottom, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.8) 50%, rgba(0,0,0,0) 100%);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }
    
    .brand {
        align-items: center;
    }
    
    .name {
        font-size: 1.05rem;
    }

    .nav {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
        gap: 1.2rem; /* slightly larger gap for the pill */
    }

    .nav a {
        font-size: 0.65rem;
    }
    
    .section-title {
        display: none !important;
    }

    .ig-link {
        margin-left: -0.6rem; /* Adjust for tighter mobile gaps */
    }

    /* Reduce spacing */
    .portfolio {
        padding: 7rem 1rem 3rem;
    }

    .subpage-portfolio {
        padding-top: 9rem; /* Give breathing room after hiding section-title */
    }

    /* Project Detail Pages */
    .project-detail-header {
        margin-bottom: 2rem;
    }

    .project-detail-stack {
        gap: 1rem; /* Tighter image stacking on mobile */
    }
}

/* Project Detail Page Styles */
.project-detail-section {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.project-detail-header {
    text-align: center;
    margin-bottom: 2.5rem; /* Reduced from 4rem to pull video closer to title */
}

.project-detail-title {
    font-size: 0.9rem; /* Up from 0.85rem */
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #ffffff;
    margin-bottom: 0.5rem;
}

.project-detail-director {
    font-size: 0.8rem; /* Up from 0.75rem */
    color: #888888;
    letter-spacing: 0.05em;
    font-weight: 400;
}

.project-detail-stack {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 2rem;
}

.project-detail-img {
    width: 100%;
    height: auto;
    display: block;
    will-change: transform;
}

/* 4-column Gallery */
.project-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 4rem; /* Spacing below the main video/hero image */
    width: 100%;
}

.gallery-img {
    width: 100%;
    height: auto;
    display: block;
    cursor: zoom-in;
    transition: opacity 0.3s ease;
}

.gallery-img:hover {
    opacity: 0.7;
}

/* Lightbox overlay */
.lightbox {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(5, 5, 5, 0.95);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
    cursor: zoom-out;
}

.lightbox img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    transform: scale(0.98);
    transition: transform 0.4s ease;
}

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

/* --- CINEMATIC GLOBAL FEATURES --- */

/* 1. Film Grain */
.film-grain {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    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.85" numOctaves="3" stitchTiles="stitch"/%3E%3C/filter%3E%3Crect width="100%25" height="100%25" filter="url(%23noiseFilter)"/%3E%3C/svg%3E');
    animation: grainAnimation 0.3s steps(1) infinite;
}

@keyframes grainAnimation {
    0%, 100% { background-position: 0 0; }
    20% { background-position: -5% 10%; }
    40% { background-position: 10% -5%; }
    60% { background-position: 5% 15%; }
    80% { background-position: -10% -10%; }
}


/* 3. Page Transitions */
.page-transition {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background-color: #050505; /* Pure black */
    z-index: 9998; /* Just under cursor/grain */
    pointer-events: none;
    transition: opacity 0.5s ease-in-out;
    opacity: 1;
}

.page-transition.ready {
    opacity: 0;
}

/* Vimeo Video Wrapper */
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    width: 100%;
    overflow: hidden;
    background-color: #000; /* Prevent white flashes before iframe loads */
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* --- CONTACT PAGE --- */
.contact-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 9rem; /* Moved up slightly */
    padding-bottom: 8rem;
}

.contact-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4rem;
    max-width: 500px;
    width: 100%;
}

.contact-image-wrapper {
    width: 320px;
    max-width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.contact-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%);
}

.contact-info {
    text-align: center;
    font-size: 0.7rem;
    color: #cccccc;
    letter-spacing: 0.05em;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    text-transform: uppercase;
}

.contact-ig-link {
    color: #777777;
    transition: color 0.3s ease;
    display: inline-flex;
    justify-content: center;
    margin-top: 0.5rem; /* pull it slightly closer to the text above */
}

.contact-ig-link:hover {
    color: #ffffff;
}

.contact-ig-link svg {
    width: 1.2rem;
    height: 1.2rem;
}

/* Credits Section */
.credits-container {
    width: 100%;
    max-width: 800px;
    margin-top: 3rem; /* Tighter to contact info */
    display: flex;
    flex-direction: column;
    gap: 15rem; /* Massive gap to push credits below the fold */
    padding: 0 2rem;
    text-align: center; /* Center everything like the image above */
}

.credits-section {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.credits-title {
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    color: #ffffff;
}

.credits-text {
    font-size: 0.75rem;
    color: #888888;
    line-height: 1.5;
}

.italic-list {
    font-style: italic;
    color: #999999;
}

.credits-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem; /* Tighter gap */
}

.credits-subtitle {
    font-size: 0.8rem;
    font-weight: 500;
    color: #bbbbbb;
    margin-bottom: 0.2rem;
    margin-top: 0.5rem;
}

.credits-group p {
    font-size: 0.7rem;
    color: #777777;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}


