/* =========================================
   CORE CONFIGURATION & THEME
   ========================================= */
:root {
    --bg-sand: #d7cdba;
    --accent-red: #ff0000;
    --text-dark: #111111;
    --founder-color: #aa1111;         /* kept for legacy but not used */
    --placeholder-gray: #c4b9a3;
    --font-main: 'Arial Black', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-sand);
    color: var(--text-dark);
    font-family: var(--font-main);
    overscroll-behavior: none;
    overflow: hidden;
}

body, a, button, input, select, textarea, .archive-item, .credit-name {
    cursor: none !important;
}

/* =========================================
   OMNIPRESENT FIXED LOGO – TOP CENTER
   ========================================= */
#logo-container {
    position: fixed;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5000;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#festival-logo {
    height: 100px;
    width: auto;
    display: block;
}

/* =========================================
   LAYOUT – FULL VIEWPORT, NO SCROLL
   ========================================= */
#app-wrapper {
    width: 100vw;
    height: calc(100vh - 60px - env(safe-area-inset-bottom));
    position: relative;
    overflow: hidden;
    padding-top: 45px;
}

.view-section {
    display: none;
    height: 100%;
    padding: 0 20px 20px 20px;
    overflow: hidden;
    flex-direction: column;
}

.view-section.active {
    display: flex;
}

/* =========================================
   SECTION HEADERS
   ========================================= */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 0;
    z-index: 10;
    flex-shrink: 0;
    min-height: 55px;
}

h1 {
    font-size: clamp(2.2rem, 7vw, 5rem);
    font-weight: 900;
    line-height: 0.8;
    letter-spacing: -0.06em;
    text-transform: uppercase;
    margin: 0;
    padding-top: 0;
}

/* =========================================
   FILMS CONTROLS (random + autoplay)
   ========================================= */
.films-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.autoplay-btn {
    background: var(--text-dark);
    color: var(--bg-sand);
    border: none;
    padding: 8px 12px;
    font-family: var(--font-main);
    font-size: 0.65rem;
    font-weight: 900;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.15s, transform 0.2s;
    flex-shrink: 0;
    border-radius: 2px;
}
.autoplay-btn:hover {
    background: var(--accent-red);
    transform: scale(0.95);
}
.autoplay-btn.active {
    background: var(--accent-red);
}

/* =========================================
   JAGGED STAR BUTTON
   ========================================= */
.jagged-star-btn {
    background: var(--text-dark);
    color: var(--bg-sand);
    border: none;
    width: 90px;
    height: 90px;
    min-width: 90px;
    font-family: var(--font-main);
    font-size: 0.6rem;
    font-weight: 900;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px;
    clip-path: polygon(50% 0%, 63% 13%, 85% 15%, 85% 37%, 100% 50%, 85% 63%, 85% 85%, 63% 85%, 50% 100%, 37% 85%, 15% 85%, 15% 63%, 0% 50%, 15% 37%, 15% 15%, 37% 13%);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.1s ease;
    flex-shrink: 0;
    cursor: pointer;
}

.jagged-star-btn span {
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.jagged-star-btn.clicked {
    background-color: var(--accent-red);
    transform: scale(0.9) rotate(45deg);
}

/* Mobile‑only bottom buttons (hidden on desktop) */
.mobile-shuffle-btn {
    display: none !important;
}

/* =========================================
   MODULE 1: FILMS – CENTERED PLAYER (TRUE 16:9)
   ========================================= */
.player-wrapper {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5px 0 15px 0;
    min-height: 0;
}

.film-wrapper {
    width: 70%;                    /* controls the width on desktop */
    max-width: 100%;               /* prevent overflow */
    display: flex;
    flex-direction: column;
    align-items: flex-end;         /* caption right aligned */
}

/* The player box – always 16:9, constrained by available height */
#film-player-container {
    width: 100%;
    /* aspect-ratio creates the 16:9 shape */
    aspect-ratio: 16 / 9;
    position: relative;
    background: var(--text-dark);
    flex-shrink: 0;
    overflow: hidden;
    /* limit to never be taller than 85% of the viewport height minus the bottom nav and headers */
    max-height: calc( (100vh - 60px - env(safe-area-inset-bottom) - 120px) * 0.85 );
}

/* The iframe (or placeholder) must fill the container */
#film-player-container iframe,
#film-player-container #video-placeholder,
#film-player-container #yt-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

#video-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-red);
    font-size: 1.2rem;
    background: var(--text-dark);
}

#film-caption {
    width: 100%;
    text-align: right;
    background: transparent;
    color: var(--accent-red);
    font-family: var(--font-main);
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    padding: 4px 0 0 0;
    text-transform: uppercase;
    pointer-events: none;
    line-height: 1.2;
    min-height: 1.6em;
    flex-shrink: 0;
    transition: opacity 0.2s ease;
}

/* =========================================
   MODULE 2: PHOTOS – DESKTOP MASONRY
   ========================================= */
.masonry-grid {
    flex: 1;
    width: 100%;
    column-count: 4;
    column-gap: 15px;
    overflow: hidden;
    padding-bottom: 5px;
    min-height: 0;
    align-content: start;
}

@media (max-width: 1200px) { .masonry-grid { column-count: 4; } }
@media (max-width: 992px)  { .masonry-grid { column-count: 3; } }

.archive-item {
    break-inside: avoid;
    margin-bottom: 15px;
    position: relative;
    background: var(--placeholder-gray);
    border: 2px solid var(--text-dark);
    overflow: hidden;
    line-height: 0;
    width: 100%;
    display: block;
    will-change: transform;
}

.archive-item img {
    width: 100%;
    height: auto;
    display: block;
    decoding: async;
}

.archive-item .mobile-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.7);
    color: var(--bg-sand);
    padding: 6px 10px;
    font-size: 0.7rem;
    font-weight: 900;
    text-align: right;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: color 0.15s ease;
    pointer-events: none;
    box-sizing: border-box;
    line-height: 1.2;
}

@media (hover: hover) {
    .archive-item:hover .mobile-caption {
        color: var(--accent-red);
    }
}

/* =========================================
   LIGHTBOX
   ========================================= */
#lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(215, 205, 186, 0.97);
    z-index: 6000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    cursor: pointer;
}

.lightbox-hidden { display: none !important; }

#lightbox-content {
    width: 100%;
    max-width: 85vh;
    max-height: 75vh;
    background: var(--placeholder-gray);
    border: 4px solid var(--text-dark);
    box-shadow: 15px 15px 0px var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#lightbox-content img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

#lightbox-close {
    margin-top: 30px;
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--accent-red);
    border: 3px solid var(--accent-red);
    padding: 10px 25px;
    background: transparent;
    cursor: pointer;
    transition: 0.15s;
    outline: none;
}
#lightbox-close:hover,
#lightbox-close:focus {
    background: var(--accent-red);
    color: var(--bg-sand);
}

/* =========================================
   MODULE 3: CREDITS – CENTRED, NO SPECIAL COLOR
   ========================================= */
.full-viewport-section {
    padding-bottom: 0px !important;
}

#credits-marquee-container {
    width: 100%;
    flex: 1;
    position: relative;
    overflow: hidden;
    border: 4px solid var(--text-dark);
    border-bottom: none;
    background: rgba(0,0,0,0.02);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
}

#credits-marquee-track {
    position: absolute;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;               /* horizontal centre */
    gap: 30px;
    padding: 40px 0;
    will-change: transform;
}

.credit-name {
    font-size: clamp(1.6rem, 5vw, 3.5rem);
    text-transform: uppercase;
    text-decoration: none;
    color: var(--text-dark);           /* uniform colour for all */
    letter-spacing: -0.04em;
    user-select: none;
    display: inline-block;
    transition: color 0.1s ease;
    text-align: center;                /* centre text */
}

/* Founder now looks identical */
.credit-name.founder {
    /* no special styling */
}

.credit-name:hover {
    color: var(--accent-red);
}

/* =========================================
   MODULE 4: ABOUT
   ========================================= */
.about-editorial {
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 0;
    width: 100%;
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}

.lead-text {
    font-size: clamp(1.2rem, 3vw, 2.4rem);
    line-height: 1.1;
    letter-spacing: -0.04em;
    margin-bottom: 15px;
    color: var(--text-dark);
    padding-top: 0;
    width: 100%;
}

.glitch-word {
    display: inline-block;
    padding: 0 4px;
}

.scramble-word {
    color: var(--accent-red);
    display: inline-block;
}

.about-row {
    display: flex;
    gap: 25px;
    margin-bottom: 25px;
    align-items: flex-start;
}

.about-row.reverse { flex-direction: row-reverse; }

.about-text-block {
    flex: 1;
    font-family: sans-serif;
    font-weight: bold;
    font-size: 0.95rem;
    line-height: 1.5;
}

.brutalist-quote {
    font-family: var(--font-main);
    color: var(--accent-red);
    font-size: 1.8rem;
    line-height: 0.95;
    letter-spacing: -0.04em;
    margin: 15px 0;
    border-left: 8px solid var(--text-dark);
    padding-left: 15px;
}

.editorial-image-wrapper {
    background: var(--placeholder-gray);
    border: 3px solid var(--text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.editorial-image-wrapper.vertical-placeholder { width: 250px; aspect-ratio: 2/3; }
.editorial-image-wrapper.horizontal-placeholder { width: 350px; aspect-ratio: 3/2; }

@media (max-width: 768px) {
    .about-row, .about-row.reverse { flex-direction: column; }
    .editorial-image-wrapper.vertical-placeholder,
    .editorial-image-wrapper.horizontal-placeholder { width: 100%; }
}

/* =========================================
   UI NAVIGATION
   ========================================= */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: calc(60px + env(safe-area-inset-bottom));
    background-color: var(--bg-sand);
    border-top: 4px solid var(--text-dark);
    display: flex;
    justify-content: space-between;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 4000;
}

.nav-btn {
    flex: 1;
    background: transparent;
    border: none;
    border-right: 2px solid var(--text-dark);
    color: var(--text-dark);
    font-family: var(--font-main);
    font-size: clamp(0.7rem, 2.2vw, 1rem);
    font-weight: 900;
    user-select: none;
    cursor: pointer;
}

.nav-btn:last-child { border-right: none; }
.nav-btn.active { background-color: var(--accent-red); color: var(--bg-sand); }

/* =========================================
   CUSTOM CURSOR
   ========================================= */
#custom-cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 15px;
    height: 15px;
    background-color: var(--accent-red);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    mix-blend-mode: difference;
    display: none;
    transition: transform 0.15s ease;
}

#custom-cursor.cursor-normal {
    mix-blend-mode: normal !important;
}

@media (hover: hover) and (pointer: fine) {
    #custom-cursor { display: block; }
}

/* =========================================
   ANIMATIONS
   ========================================= */
@keyframes arcadeJolt {
    0% { transform: translate(0, 0) rotate(0deg); }
    20% { transform: translate(-8px, 4px) rotate(-0.5deg); }
    40% { transform: translate(6px, -6px) rotate(1deg); }
    60% { transform: translate(-4px, -2px) rotate(-0.2deg); }
    80% { transform: translate(4px, 4px) rotate(0.5deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}
.jolt-active { animation: arcadeJolt 0.22s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }

@keyframes typographicVibration {
    0% { transform: translate(0, 0); }
    20% { transform: translate(-3px, 2px); }
    40% { transform: translate(3px, -2px); }
    60% { transform: translate(-2px, -1px); }
    80% { transform: translate(2px, 2px); }
    100% { transform: translate(0, 0); }
}
.vibrate-active { animation: typographicVibration 0.08s infinite linear; color: var(--accent-red) !important; }

/* =========================================
   GOOFY EASTER EGGS
   ========================================= */
#hotdog-egg.visible {
    opacity: 1 !important;
}

/* =========================================
   MOBILE STYLES
   ========================================= */
@media (max-width: 768px) {
    #logo-container {
        top: 2px;
    }
    
    #festival-logo {
        height: 70px;
    }
    
    #app-wrapper {
        padding-top: 35px;
    }
    
    .view-section {
        padding: 0 12px 12px 12px;
    }
    
    .section-header {
        min-height: 45px;
        margin-bottom: 0;
        flex-wrap: wrap;
    }
    
    h1 {
        font-size: clamp(1.8rem, 10vw, 3rem);
    }
    
    .films-controls {
        flex-direction: column;
        gap: 4px;
        align-items: flex-end;
    }
    
    .autoplay-btn {
        font-size: 0.55rem;
        padding: 6px 8px;
    }
    
    .jagged-star-btn {
        width: 75px;
        height: 75px;
        min-width: 75px;
        font-size: 0.55rem;
    }
    
    /* Hide desktop random button, show mobile one */
    #btn-random-film {
        display: none !important;
    }
    
    #btn-random-film-mobile {
        display: flex !important;
        margin: 12px auto 5px auto;
        width: 85px;
        height: 85px;
        min-width: 85px;
        font-size: 0.55rem;
    }
    
    /* Hide desktop photos shuffle, show mobile */
    #btn-shuffle-photos {
        display: none !important;
    }
    
    .mobile-shuffle-btn {
        display: flex !important;
        margin: 12px auto 5px auto;
        width: 85px;
        height: 85px;
        min-width: 85px;
        font-size: 0.55rem;
    }
    
    /* Photos grid – vertical scroll */
    #archive-grid {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 12px;
        overflow-y: auto;
        padding-bottom: 10px;
        align-content: flex-start;
        height: auto;
        min-height: 0;
    }
    
    .archive-item {
        width: 100%;
        height: auto;
        aspect-ratio: auto !important;
        flex-shrink: 0;
    }
    
    .archive-item img {
        width: 100%;
        height: auto;
        max-height: 400px;
        object-fit: contain;
    }
    
    .archive-item .mobile-caption {
        font-size: 0.6rem;
        padding: 4px 8px;
    }
    
    .film-wrapper {
        width: 95%;                  /* mobile uses almost full width */
    }
    
    .player-wrapper {
        padding: 5px 0 10px 0;
    }
    
    #film-caption {
        font-size: 0.7rem;
        min-height: 1.4em;
    }
    
    .about-editorial {
        padding-right: 0;
    }
    
    .lead-text {
        font-size: 1.1rem;
    }
}