/* =========================================
   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 is open */
body.modal-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 (middle)
   ========================================= */
#smart-nav-container {
    position: fixed;
    top: 200px; 
    left: 30px; 
    bottom: auto;
    z-index: 2147483646; 
    display: flex;
    flex-direction: column;
    align-items: flex-start; 
    transition: opacity 0.3s ease, transform 0.3s ease;
}

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;
}

.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; 
    opacity: 0.6; 
    /*filter: grayscale(80%);*/
    transition: all 0.6s ease-in-out;
    /*will-change: filter;*/
}

.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 (Total 21s) --- */
.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 (Total 28s) --- */
.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 (Total 35s) --- */
.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 (Total 42s) --- */
.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 (FIXED: Z-INDEX)
   ========================================= */
.full-width-iframe::before { 
    content: ""; 
    position: absolute; 
    top: -150%; right: -150%; bottom: -150%; left: -150%; 
    z-index: 5; 
    pointer-events: none;
}

@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 OVERRIDES
   ========================================= */
@media only screen and (max-width: 768px) {
    .hud-container { left: 15px; top: 20px; }
    
    #smart-nav-container { 
        top: 80px; 
        left: 15px; 
        bottom: auto;
    }
    
    .nav-item { font-size: 1.1rem; }
    
    #close-modal-btn { top: 20px; right: 20px; width: 50px; height: 50px; }
    #close-modal-btn svg { width: 26px; height: 26px; }
    
    .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; }
}

/* =========================================
   9. SCROLL PERFORMANCE (The JANK Fix)
   ========================================= */
body.is-scrolling .slide-item, 
body.is-scrolling [class*="gradient-"]::before {
    animation-play-state: paused !important;
    pointer-events: none; 
}

/* =========================================
   10. PHOTOSWIPE GALLERY INTEGRATION (TYPE B)
   ========================================= */
.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; /* Fixed height for cleanliness */
}
.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);
}

/* =========================================
   11. PHOTOSWIPE UI CUSTOMIZATION
   ========================================= */
.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; }

/* Close button matches site style */
.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;
    animation: pswpBtnEnter 0.4s ease forwards;
    animation-delay: 0.1s;
    opacity: 0 !important; 
    transform: scale(0.5) rotate(-90deg);
    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;
}

@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;
}
.pswp__button--close svg { display: none; }

@media only screen and (max-width: 768px) {
    .pswp__button--close {
        top: 20px !important;
        right: 20px !important;
        width: 50px !important;
        height: 50px !important;
        background-size: 26px;
    }
}

/* =========================================
   12. 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;
}

/* Cinematic Image Container */
.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%);
}

/* Hover Effects */
.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;
}