/* --- GALLERY PAGE - CINEMATIC PINBOARD ARCHIVE --- */

/* RESET & BASE */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: #080808;
    color: #e0e0e0;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* GRAIN OVERLAY */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMDAiIGhlaWdodD0iMzAwIj48ZmlsdGVyIGlkPSJmIj48ZmVUdXJidWxlbmNlIHR5cGU9ImZyYWN0YWxOb2lzZSIgYmFzZUZyZXF1ZW5jeT0iLjc0IiBudW1PY3RhdmVzPSIzIiAvPjwvZmlsdGVyPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbHRlcj0idXJsKCNmKSIgb3BhY2l0eT0iMC4wNCIgLz48L3N2Zz4=');
    pointer-events: none;
    z-index: 999;
    opacity: 0.3;
    mix-blend-mode: overlay;
}

/* --- REDESIGNED GALLERY HEADER - Always visible --- */
.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 3rem;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #fff;
}

/* --- LOGO IMAGE --- */
.logo-image {
    height: 35px;
    width: auto;
    max-width: 150px;
    display: block;
    object-fit: contain;
}

.logo-text {
    font-size: 1.1rem;
    letter-spacing: 0.2em;
    font-weight: 400;
    text-transform: uppercase;
}

.logo-dot {
    font-size: 0.8rem;
    color: #888;
    animation: pulse 3s infinite;
}

.header-right nav ul {
    display: flex;
    list-style: none;
    gap: 2.5rem;
}

.nav-link {
    text-decoration: none;
    color: #fff;
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    font-weight: 300;
    transition: all 0.3s ease;
    position: relative;
    padding: 0.5rem 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 1px;
    background: #fff;
    transition: width 0.3s ease;
}

.nav-link:hover {
    opacity: 1;
    color: #fff;
}

.nav-link:hover::after {
    width: 100%;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* GALLERY INTRO - CINEMATIC */
.gallery-intro {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 8rem 4rem 4rem 4rem;
    position: relative;
    background: linear-gradient(180deg, #030303 0%, #0a0a0a 100%);
    overflow: hidden;
}

.film-strip {
    position: absolute;
    top: 20%;
    right: 5%;
    display: flex;
    gap: 0.5rem;
    opacity: 0.1;
    transform: rotate(15deg);
}

.film-perf {
    width: 20px;
    height: 30px;
    background: #fff;
    border-radius: 2px;
    animation: filmFlicker 3s infinite;
}

.film-perf:nth-child(2) { animation-delay: 0.5s; }
.film-perf:nth-child(3) { animation-delay: 1s; }
.film-perf:nth-child(4) { animation-delay: 1.5s; }
.film-perf:nth-child(5) { animation-delay: 2s; }

@keyframes filmFlicker {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.3; }
}

.intro-text {
    max-width: 800px;
    position: relative;
    z-index: 5;
}

.intro-title {
    font-size: clamp(4rem, 12vw, 8rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 0.85;
    text-transform: uppercase;
    margin-bottom: 1rem;
    position: relative;
}

.intro-title span {
    color: transparent;
    -webkit-text-stroke: 2px rgba(255,255,255,0.3);
    font-weight: 100;
    animation: textFlicker 4s infinite;
}

@keyframes textFlicker {
    0%, 100% { opacity: 1; }
    25% { opacity: 0.8; text-shadow: 0 0 10px rgba(255,255,255,0.3); }
    75% { opacity: 0.9; }
}

.intro-subtitle {
    font-size: 1rem;
    letter-spacing: 0.4em;
    color: #666;
    margin-bottom: 2rem;
    font-weight: 300;
    text-transform: uppercase;
}

.intro-description {
    max-width: 600px;
    font-size: 1.2rem;
    color: #888;
    font-weight: 200;
    line-height: 1.8;
    margin-bottom: 3rem;
}

.glitch-text {
    color: #fff;
    font-style: italic;
    position: relative;
    display: inline-block;
}

.glitch-text::before,
.glitch-text::after {
    content: 'Not all footage survives.';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.5;
}

.glitch-text::before {
    color: #ff00ff;
    z-index: -1;
    transform: translate(-2px, -2px);
}

.glitch-text::after {
    color: #00ffff;
    z-index: -2;
    transform: translate(2px, 2px);
}

/* VIEWING CHAMBER */
.viewing-chamber {
    margin-top: 3rem;
    position: relative;
    z-index: 5;
}

.chamber-label {
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    color: #444;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.viewing-modes {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.mode-btn {
    background: transparent;
    border: none;
    color: #666;
    font-size: 0.9rem;
    letter-spacing: 0.2em;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    padding: 0.8rem 1.5rem;
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid transparent;
}

.mode-icon {
    font-size: 1.2rem;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.mode-text {
    font-weight: 300;
}

.mode-count {
    font-size: 0.7rem;
    color: #333;
    background: rgba(255,255,255,0.03);
    padding: 0.2rem 0.5rem;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.02);
}

.mode-btn:hover .mode-icon {
    opacity: 1;
    transform: scale(1.2);
}

.mode-btn.active-mode {
    color: #fff;
    border-color: #fff;
    background: rgba(255,255,255,0.05);
}

.mode-btn.active-mode .mode-count {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.viewfinder-line {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #fff, transparent);
    margin-top: 2rem;
    opacity: 0.3;
    animation: scanline 8s linear infinite;
}

@keyframes scanline {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* MASONRY GRID - PINBOARD STYLE */
.gallery-container {
    padding: 2rem 4rem 4rem 4rem;
    max-width: 1800px;
    margin: 0 auto;
}

.masonry-grid {
    column-count: 4;
    column-gap: 1.5rem;
    position: relative;
}

.masonry-item {
    break-inside: avoid;
    margin-bottom: 1.5rem;
    position: relative;
    cursor: pointer;
    opacity: 0;
    transform: translateY(30px);
    animation: itemAppear 0.8s forwards;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    border: 1px solid rgba(255,255,255,0.02);
    background: #0a0a0a;
}

.masonry-item.visible {
    opacity: 1;
    transform: translateY(0);
}

@keyframes itemAppear {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.masonry-item:nth-child(3n+1) { height: auto; }
.masonry-item:nth-child(3n+2) { height: auto; }
.masonry-item:nth-child(3n+3) { height: auto; }

.masonry-item img,
.masonry-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: grayscale(0.8) contrast(1.1);
    transition: all 0.8s cubic-bezier(0.23, 1, 0.32, 1);
    background: #0a0a0a;
}

/* Film grain overlay on hover */
.masonry-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, 
        transparent 30%, 
        rgba(255,255,255,0.02) 50%, 
        transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.masonry-item:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: rgba(255,255,255,0.1);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    z-index: 10;
}

.masonry-item:hover img,
.masonry-item:hover video {
    filter: grayscale(0.4) contrast(1.2);
}

.masonry-item:hover::after {
    opacity: 1;
}

/* Media badge - film strip style */
.media-badge {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    color: #fff;
    padding: 0.3rem 0.8rem;
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    border: 1px solid rgba(255,255,255,0.2);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease;
    z-index: 5;
    text-transform: uppercase;
}

.masonry-item:hover .media-badge {
    opacity: 1;
    transform: translateY(0);
}

/* Video indicator */
.masonry-item.video-item::before {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 2rem;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.4s ease;
    text-shadow: 0 0 20px rgba(0,0,0,0.5);
    background: rgba(0,0,0,0.3);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.3);
}

.masonry-item.video-item:hover::before {
    opacity: 1;
}

/* CINEMATIC FOOTER */
.cinema-footer {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 2rem 4rem;
    background: #030303;
    border-top: 1px solid #222;
    margin-top: 2rem;
}

.footer-left, .footer-right {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.footer-left { align-items: flex-start; }
.footer-right { align-items: flex-end; }

.footer-label {
    font-size: 0.6rem;
    letter-spacing: 0.3em;
    color: #444;
    text-transform: uppercase;
}

.footer-value {
    font-size: 1.2rem;
    font-weight: 100;
    color: #888;
    font-family: monospace;
}

.footer-center {
    position: relative;
    text-align: center;
}

.film-grain {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(255,255,255,0.05), transparent);
    filter: blur(20px);
    animation: grainPulse 4s infinite;
}

@keyframes grainPulse {
    0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.2); }
}

.footer-marquee {
    font-size: 0.8rem;
    letter-spacing: 0.5em;
    color: #333;
    white-space: nowrap;
    animation: footerMarquee 20s linear infinite;
}

@keyframes footerMarquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* CINEMA LIGHTBOX */
.cinema-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.98);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
}

.cinema-lightbox.active {
    display: flex;
}

.lightbox-stage {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-content {
    position: relative;
}

.lightbox-content img,
.lightbox-content video {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
}

.lightbox-close {
    position: absolute;
    top: -2rem;
    right: -2rem;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    z-index: 1001;
    opacity: 0.5;
    transition: opacity 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
}

.lightbox-close:hover {
    opacity: 1;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 3rem;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.3s ease;
    padding: 2rem;
    z-index: 1001;
    text-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.lightbox-prev:hover,
.lightbox-next:hover {
    opacity: 1;
}

.lightbox-prev { left: -4rem; }
.lightbox-next { right: -4rem; }

.lightbox-caption {
    position: absolute;
    bottom: -3rem;
    left: 0;
    width: 100%;
    text-align: center;
    color: #888;
    font-size: 0.9rem;
    letter-spacing: 0.2em;
    font-weight: 300;
}

.lightbox-metadata {
    position: absolute;
    top: -3rem;
    left: 0;
    color: #444;
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    font-family: monospace;
}

.lightbox-grain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMDAiIGhlaWdodD0iMzAwIj48ZmlsdGVyIGlkPSJmIj48ZmVUdXJidWxlbmNlIHR5cGU9ImZyYWN0YWxOb2lzZSIgYmFzZUZyZXF1ZW5jeT0iLjc0IiBudW1PY3RhdmVzPSIzIiAvPjwvZmlsdGVyPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbHRlcj0idXJsKCNmKSIgb3BhY2l0eT0iMC4wMiIgLz48L3N2Zz4=');
    pointer-events: none;
    z-index: 1002;
    opacity: 0.3;
}

/* RUNWAY STRIP */
.runway-strip {
    width: 100%;
    overflow: hidden;
    background: #000;
    padding: 1rem 0;
    border-top: 1px solid #222;
    border-bottom: 1px solid #222;
    margin: 2rem 0;
    transform: skewY(-1deg);
}

.strip-content {
    display: inline-block;
    white-space: nowrap;
    animation: runwayScroll 30s linear infinite;
    font-size: 0.9rem;
    letter-spacing: 0.5em;
    color: #333;
    font-weight: 300;
}

@keyframes runwayScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* LOADING STATE */
.gallery-loading {
    text-align: center;
    padding: 4rem;
    color: #444;
    letter-spacing: 0.3em;
    font-size: 0.9rem;
    grid-column: 1 / -1;
}

/* ERROR HANDLING */
.image-error {
    background: #0a0a0a;
    border: 1px solid #222;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.error-placeholder {
    text-align: center;
    color: #333;
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    width: 100%;
    padding: 2rem;
}

.error-placeholder span {
    display: block;
    margin: 0.5rem 0;
}

.error-placeholder span:first-child {
    color: #444;
    font-size: 0.7rem;
}

.error-placeholder span:last-child {
    color: #222;
    font-size: 0.6rem;
    border-top: 1px solid #222;
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}

/* RESPONSIVE */
@media (max-width: 1200px) {
    .masonry-grid {
        column-count: 3;
    }
}

@media (max-width: 900px) {
    .gallery-header {
        padding: 1rem 1.5rem;
    }
    
    .header-right nav ul {
        gap: 1.2rem;
    }
    
    .logo-image {
        height: 28px;
        max-width: 100px;
    }
    
    .logo-text {
        font-size: 1rem;
    }
    
    .nav-link {
        font-size: 0.7rem;
    }
    
    .masonry-grid {
        column-count: 2;
    }
    
    .gallery-intro {
        padding: 6rem 1.5rem 2rem 1.5rem;
    }
    
    .viewing-modes {
        gap: 1rem;
    }
    
    .mode-btn {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }
    
    .lightbox-prev { left: -2rem; }
    .lightbox-next { right: -2rem; }
    
    .cinema-footer {
        padding: 1.5rem;
        grid-template-columns: 1fr;
        gap: 1rem;
        text-align: center;
    }
    
    .footer-left, .footer-right {
        align-items: center;
    }
}

@media (max-width: 600px) {
    .header-right nav ul {
        gap: 0.8rem;
    }
    
    .nav-link {
        letter-spacing: 0.1em;
    }
    
    .logo-image {
        height: 22px;
        max-width: 80px;
    }
    
    .masonry-grid {
        column-count: 1;
    }
    
    .intro-title {
        font-size: 3rem;
    }
    
    .film-strip {
        display: none;
    }
    
    .viewing-modes {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .mode-btn {
        width: 100%;
        justify-content: space-between;
    }
}