/* =========================================
   1. RESET & BASICS
   ========================================= */
html { 
    font-smooth: always; 
    -webkit-font-smoothing: antialiased; 
    -moz-osx-font-smoothing: grayscale; 
    scroll-behavior: smooth; 
    font-size: 1rem; 
}

body {
    background: #d3d3d3;
    color: #111;
    font-family: 'Lato', sans-serif;
    font-weight: 300;
    line-height: 1.7;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* Lock body when modal/nav is open */
body.modal-is-active, body.nav-is-active { overflow: hidden; }

a { color: #ff004a; text-decoration: none; transition: color 0.2s ease; }
a:hover { color: #fff; }

h1, h2, h3, h4, h5, h6 {
    font-family: 'Oswald', sans-serif;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
}

img { max-width: 100%; height: auto; vertical-align: top; object-fit: cover; }

/* =========================================
   2. HUD (Top Left Logo)
   ========================================= */
.hud-container {
    position: fixed;
    top: 30px;
    left: 30px;
    z-index: 190000;
    font-family: 'Oswald', sans-serif;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1.4rem;
    color: #fff;
    text-shadow: 0px 0px 4px rgba(0,0,0,0.9);
    transition: opacity 0.4s ease;
    pointer-events: auto;
}
.hud-container a { color: #fff; text-decoration: none; font-weight: bold; }
body.modal-is-active .hud-container { opacity: 0; pointer-events: none; }

/* =========================================
   3. NAVIGATION (Desktop Default)
   ========================================= */
#smart-nav-container {
    position: fixed;
    top: 200px; 
    left: 30px; 
    bottom: auto;
    z-index: 200000; /* Layer: Below Burger, Equal/Above Overlay */
    display: flex;
    flex-direction: column;
    align-items: flex-start; 
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

body.modal-is-active #smart-nav-container {
    opacity: 0;
    transform: translateX(-20px);
    pointer-events: none;
}

#smart-label-list {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: left;
    pointer-events: auto;
}

.nav-item {
    font-family: 'Oswald', sans-serif;
    font-weight: 300;
    letter-spacing: 1px;
    font-size: 1.3rem;
    line-height: 1.6;
    color: #ffffff; 
    opacity: 1;     
    text-transform: uppercase; 
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 0px 1px 5px rgba(0,0,0,0.9);
    border-left: 3px solid transparent; 
    padding-left: 10px;
}

/* Hide Home Icon inside list on Desktop */
#nav-home-link { display: none; }

.nav-item.is-active {
    color: #ffffff !important;
    font-weight: 500;
    border-left: 3px solid #ff004a; 
    padding-left: 15px; 
    transform: scale(1.05);
    transform-origin: left center;
}

#nav-statement, #nav-cv { color: #fff; opacity: 1; }

.nav-separator {
    height: 1px;
    width: 50px;
    background: rgba(255,255,255,0.6);
    margin: 15px 0 15px 10px;
}

/* =========================================
   4. VIDEO / ARTWORK WRAPPERS
   ========================================= */
.container { margin: 0 auto; padding: 0; max-width: 100%; }

.video-wrapper {
    position: relative; 
    width: 100vw; 
    height: auto; 
    overflow: hidden; 
    left: calc(-50vw + 50%); 
    box-sizing: border-box; 
    display: block;
    cursor: pointer !important; 
    opacity: 0.6; 
    transition: all 0.6s ease-in-out;
}

.video-wrapper.is-focus { opacity: 1; filter: grayscale(0%); }
.video-wrapper:hover { opacity: 1; }

.full-width-iframe { 
    width: 100vw; 
    height: 56vw; 
    position: relative; 
    left: calc(-50vw + 50%); 
    box-sizing: border-box; 
}

.video-background { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }
.video-style { border: 0; top: 0; left: 0; width: 100%; height: 100%; position: relative; overflow: hidden; object-fit: cover; }

/* =========================================
   5. SLIDESHOW ANIMATIONS
   ========================================= */
.slideshow-wrapper-js { width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 2; }
.slideshow-js { width: 100%; height: 100%; overflow: hidden; position: relative; }

.slide-item {
    width: 100%;
    height: 100%;
    position: absolute;
    opacity: 0;
    will-change: opacity;
}
.slide-item img { width: 100%; height: 100%; object-fit: cover; }

/* --- 3 SLIDES --- */
.slide-3 { animation: fade3 21s infinite; }
.slide-3:nth-child(1) { animation-delay: 0s; }
.slide-3:nth-child(2) { animation-delay: 7s; }
.slide-3:nth-child(3) { animation-delay: 14s; }

@keyframes fade3 {
    0% { opacity: 0; }
    5% { opacity: 1; }
    33.33% { opacity: 1; }
    38.33% { opacity: 0; }
    100% { opacity: 0; }
}

/* --- 4 SLIDES --- */
.slide-4 { animation: fade4 28s infinite; }
.slide-4:nth-child(1) { animation-delay: 0s; }
.slide-4:nth-child(2) { animation-delay: 7s; }
.slide-4:nth-child(3) { animation-delay: 14s; }
.slide-4:nth-child(4) { animation-delay: 21s; }

@keyframes fade4 {
    0% { opacity: 0; }
    4% { opacity: 1; }
    25% { opacity: 1; }
    29% { opacity: 0; }
    100% { opacity: 0; }
}

/* --- 5 SLIDES --- */
.slide-5 { animation: fade5 35s infinite; }
.slide-5:nth-child(1) { animation-delay: 0s; }
.slide-5:nth-child(2) { animation-delay: 7s; }
.slide-5:nth-child(3) { animation-delay: 14s; }
.slide-5:nth-child(4) { animation-delay: 21s; }
.slide-5:nth-child(5) { animation-delay: 28s; }

@keyframes fade5 {
    0% { opacity: 0; }
    3% { opacity: 1; }
    20% { opacity: 1; }
    23% { opacity: 0; }
    100% { opacity: 0; }
}

/* --- 6 SLIDES --- */
.slide-6 { animation: fade6 42s infinite; }
.slide-6:nth-child(1) { animation-delay: 0s; }
.slide-6:nth-child(2) { animation-delay: 7s; }
.slide-6:nth-child(3) { animation-delay: 14s; }
.slide-6:nth-child(4) { animation-delay: 21s; }
.slide-6:nth-child(5) { animation-delay: 28s; }
.slide-6:nth-child(6) { animation-delay: 35s; }

@keyframes fade6 {
    0% { opacity: 0; }
    2.5% { opacity: 1; }
    16.66% { opacity: 1; }
    19.16% { opacity: 0; }
    100% { opacity: 0; }
}

/* =========================================
   GRADIENTS
   ========================================= */
.full-width-iframe::before { 
    content: ""; 
    position: absolute; 
    top: -150%; right: -150%; bottom: -150%; left: -150%; 
    z-index: 5; 
    pointer-events: none !important; 
}

@keyframes rotateGradient { 
    0% { transform: rotate(0); } 
    100% { transform: rotate(360deg); } 
}

.gradient-stillimage::before { 
    background: linear-gradient(45deg, rgba(255, 0, 255, 0.6), #ff0); 
    opacity: 0.5; 
    animation: rotateGradient 240s linear infinite; 
}
.gradient-4::before { 
    background: linear-gradient(to top right, red, #00d4fc 72.27%); 
    opacity: 0.5; 
    animation: rotateGradient 220s linear infinite; 
}
.gradient-null::before { 
    background: linear-gradient(to top right, #ff00dd00 24.79%, #ff414100 35.71%, #d6fc0100 69.75%); 
    opacity: 0.5; 
    animation: rotateGradient 220s linear infinite; 
}

/* =========================================
   6. MODALS
   ========================================= */
#close-modal-btn {
    position: fixed;
    top: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2147483647; 
    background-color: #fff;
    box-shadow: 0 2px 15px rgba(0,0,0,0.2);
    transition: all 0.4s ease;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.5) rotate(-90deg);
}
#close-modal-btn:hover { background-color: #ff004a; }
#close-modal-btn svg { width: 32px; height: 32px; color: #333; transition: color 0.3s; }
#close-modal-btn:hover svg { color: #fff; }

body.modal-is-active #close-modal-btn {
    opacity: 1;
    visibility: visible;
    transform: scale(1) rotate(0deg);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.98);
    z-index: 200000;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s;
    padding-bottom: 100px;
}
.modal-overlay.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }

.modal-content {
    max-width: 1200px;
    margin: 80px auto; 
    padding: 20px 5%;
    font-size: 1.2rem;
    font-family: 'Lato', sans-serif; 
    color: #008CBA; 
}
.modal-content-full { max-width: 100%; width: 100%; padding: 20px 0; }
.modal-content-full > h3, .modal-content-full > p, .modal-content-full > hr, .modal-content-full > .gallery-grid, .modal-content-full > .link-poster-wrapper {
    max-width: 1200px;
    margin-left: auto; margin-right: auto;
    padding-left: 5%; padding-right: 5%;
}

.modal-title { margin-bottom: 30px; color: #000; text-transform: uppercase; }
.modal-subtitle-center { text-align: center; margin-bottom: 20px; color: #000; }
.modal-divider { margin: 40px 0; }

.cv-heading { color: #777; margin-top: 2rem; margin-bottom: 1rem; font-size: 1rem; }
.cv-entry { margin-bottom: 0.5rem; line-height: 1.6; color: #333; }
.cv-year { font-weight: bold; margin-right: 10px; color: #111; }

/* =========================================
   7. FOOTER
   ========================================= */
.footer {
    border-top: 1px solid #dedede;
    padding: 2.5rem 4%;
    text-align: center;
    opacity: 0.5;
    font-size: 0.8rem;
    padding-bottom: 100px;
}
.footer__copyright { color: #888; font-size: 0.7rem; padding: 1rem 0; }

/* =========================================
   8. MOBILE HEADER (BURGER + HOME)
   ========================================= */
.burger-menu {
    display: none; /* Hidden on Desktop */
    position: fixed;
    top: 30px;
    right: 30px;
    width: 40px;
    height: 30px;
    /* CRITICAL: Force this to be the highest layer */
    z-index: 2147483647 !important; 
    cursor: pointer;
    flex-direction: column;
    justify-content: space-between;
}

.burger-bar {
    width: 100%;
    height: 3px;
    background-color: #fff; /* Default: White */
    box-shadow: 0 1px 3px rgba(0,0,0,0.8);
    transition: all 0.3s ease;
    border-radius: 2px;
}

/* Home Icon Styling */
.home-icon-btn {
    display: none; /* Desktop Hidden */
    position: fixed;
    top: 30px;
    right: 90px;
    width: 30px;
    height: 30px;
    z-index: 2147483647 !important; 
    cursor: pointer;
    color: #fff; 
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.8));
    transition: color 0.3s ease;
}
.home-icon-btn svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

/* 
   COLOR STATE LOGIC:
   1. Default: White (Shadows)
   2. Modal Open: Black (No Shadows)
   3. Menu Open: Black (No Shadows)
*/

body.modal-is-active .burger-bar,
body.nav-is-active .burger-bar { 
    background-color: #000000 !important; 
    box-shadow: none !important;
}

body.modal-is-active .home-icon-btn,
body.nav-is-active .home-icon-btn { 
    color: #111 !important; 
    filter: none !important;
}

/* Transform to X if Nav OR Modal is active */
body.nav-is-active .burger-bar:nth-child(1),
body.modal-is-active .burger-bar:nth-child(1) { 
    transform: translateY(13px) rotate(45deg); 
}

body.nav-is-active .burger-bar:nth-child(2),
body.modal-is-active .burger-bar:nth-child(2) { 
    opacity: 0; 
}

body.nav-is-active .burger-bar:nth-child(3),
body.modal-is-active .burger-bar:nth-child(3) { 
    transform: translateY(-13px) rotate(-45deg); 
}

/* =========================================
   9. MOBILE OVERRIDES
   ========================================= */
@media only screen and (max-width: 768px) {
    /* 1. Show Header Items */
    .burger-menu, .home-icon-btn { display: flex; }

    /* 2. Hide Desktop Close Button */
    #close-modal-btn { display: none !important; }
    
    /* 3. HUD Adjustments */
    .hud-container { left: 20px; top: 30px; }
    
    /* 4. Full Screen Overlay Nav */
    #smart-nav-container {
        position: fixed;
        top: 0; left: 0;
        width: 100%; height: 100vh;
        background-color: rgba(255,255,255,0.98); 
        align-items: center;
        justify-content: center;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: all 0.4s ease;
        padding: 0;
        /* CRITICAL: Must be lower than burger-menu (which is ...647) */
        z-index: 200000; 
    }
    
    body.nav-is-active #smart-nav-container {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    
    #smart-label-list { text-align: center; }
    
    /* Remove Home Icon from list (using fixed icon instead) */
    #nav-home-link { display: none !important; }
    
    .nav-item {
        font-size: 1.6rem;
        margin-bottom: 20px;
        color: #111 !important; /* Black Text */
        opacity: 0.8;
        border-left: none;
        padding-left: 0;
        text-shadow: none; 
    }
    
    .nav-item.is-active {
        color: #ff004a !important;
        opacity: 1;
        border-left: none;
        padding-left: 0;
        transform: scale(1.1);
    }
    
    .nav-separator {
        width: 50px;
        height: 1px;
        background: #ccc; 
        margin: 20px auto;
    }

    .video-wrapper { height: 120vw; }
    .full-width-iframe { left: 0; width: 100%; height: 100%; }
    .slideshow-js { height: 100%; left: 0; position: absolute; object-fit: cover; }
    .video-style { object-fit: cover; transform: scale(1.2); }
    
    .modal-content { margin-top: 60px; }
    .link-poster-wrapper { grid-template-columns: 1fr; }
}

/* =========================================
   10. SCROLL PERFORMANCE
   ========================================= */
body.is-scrolling .slide-item, 
body.is-scrolling [class*="gradient-"]::before {
    animation-play-state: paused !important;
}

/* =========================================
   11. PHOTOSWIPE GALLERY INTEGRATION
   ========================================= */
.pswp-gallery.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
    margin-bottom: 50px;
}
.gallery-item {
    overflow: hidden;
    border-radius: 2px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}
.gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.gallery-item a {
    display: block;
    width: 100%;
    height: 200px; 
}
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: grayscale(20%);
    transition: filter 0.3s ease, transform 0.3s ease;
}
.gallery-item:hover img {
    filter: grayscale(0%);
    transform: scale(1.05);
}

/* =========================================
   12. PHOTOSWIPE UI CUSTOMIZATION (DESKTOP)
   ========================================= */
.pswp { z-index: 2147483647 !important; }
.pswp__bg { background: rgba(255, 255, 255, 0.98) !important; opacity: 1 !important; }
.pswp__top-bar { background: none !important; }
.pswp__button--zoom { display: none !important; }

/* Desktop: Round Button */
.pswp__button--close {
    background-color: #fff !important;
    width: 60px !important;
    height: 60px !important;
    border-radius: 50%;
    position: fixed !important;
    top: 30px !important;
    right: 30px !important;
    opacity: 1 !important;
    box-shadow: 0 2px 15px rgba(0,0,0,0.2);
    margin: 0 !important;
    padding: 0 !important;
    transform: scale(0.5) rotate(-90deg);
    animation: pswpBtnEnter 0.4s ease forwards;
    animation-delay: 0.1s;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23333333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 18L18 6M6 6l12 12'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 32px !important;
}

@keyframes pswpBtnEnter {
    0% { opacity: 0; transform: scale(0.5) rotate(-90deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.pswp__button--close:hover {
    background-color: #ff004a !important;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 18L18 6M6 6l12 12'%3E%3C/path%3E%3C/svg%3E") !important;
    background-size: 32px !important;
}

.pswp__button--close svg { display: none !important; }

/* =========================================
   12b. PHOTOSWIPE MOBILE OVERRIDE (X Button)
   ========================================= */
@media only screen and (max-width: 768px) {
    .pswp__button--close {
        /* Reset Desktop Styles */
        background-color: transparent !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        background-image: none !important;
        
        /* Position exactly like Burger */
        top: 30px !important;
        right: 30px !important;
        width: 40px !important;
        height: 30px !important;
        
        transform: none !important;
        animation: none !important;
        display: block; 
    }

    /* Create X Lines */
    .pswp__button--close::before,
    .pswp__button--close::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 0;
        width: 100%;
        height: 3px;
        background-color: #111; /* Black */
        border-radius: 2px;
        margin-top: -1.5px;
    }

    .pswp__button--close::before { transform: rotate(45deg); }
    .pswp__button--close::after { transform: rotate(-45deg); }
    
    .pswp__button--close:hover { background-color: transparent !important; }
}

/* =========================================
   13. POSTER LINKS (TYPE A)
   ========================================= */
.link-poster-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    margin-top: 40px;
    padding-bottom: 40px;
}

.link-poster-item {
    display: block;
    text-decoration: none;
    cursor: pointer;
}

.poster-img-container {
    width: 100%;
    aspect-ratio: 16 / 9; 
    overflow: hidden;
    margin-bottom: 15px;
    border-radius: 2px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    background-color: #e0e0e0;
    position: relative;
}

.poster-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1), filter 0.3s ease;
    filter: grayscale(20%);
}

.link-poster-item:hover .poster-img-container img {
    transform: scale(1.05);
    filter: grayscale(0%);
}

.poster-caption {
    display: block;
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 1.1rem;
    color: #333;
    text-align: center;
    transition: color 0.3s ease;
}

.link-poster-item:hover .poster-caption {
    color: #ff004a;
}

/* =========================================
   14. TEXT TITLE CARDS
   ========================================= */
.title-card-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.title-card-text {
    font-family: 'Oswald', sans-serif;
    font-size: 5vw; 
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 5px;
    opacity: 0.8;
    text-shadow: 0 0 20px rgba(0,0,0,0.5);
    pointer-events: none;
}

@media only screen and (max-width: 768px) {
    .title-card-text { font-size: 3rem; }
}

/* =========================================
   15. CURSOR ENFORCEMENT
   ========================================= */
.video-wrapper, 
.full-width-iframe, 
.slideshow-wrapper-js, 
.slideshow-js, 
.slide-item,
.video-background {
    cursor: pointer !important;
    pointer-events: auto !important;
}

.full-width-iframe::before,
[class*="gradient-"]::before {
    pointer-events: none !important;
}