/* ==========================================================================
   GALLERY SUBPAGE & LIGHTBOX
   ========================================================================== */

.gallery-subpage-body {
    background-color: #020202;
    background-image: linear-gradient(rgba(0, 0, 0, 0.94), rgba(0, 0, 0, 0.94)), url('1.png');
    background-size: cover;
    background-attachment: fixed;
    color: #e0e0e0;
    min-height: 100vh;
}

.gallery-stage {
    position: relative;
    z-index: 10;
    max-width: 1400px;
    margin: 0 auto;
    padding: 140px 25px 80px 25px;
    display: flex;
    flex-direction: column;
}

.gallery-header {
    border-bottom: 2px solid #222;
    padding-bottom: 25px;
    margin-bottom: 50px;
}

.gallery-main-title {
    font-family: 'Inter', sans-serif;
    font-size: 1.8rem;
    font-weight: 300;
    letter-spacing: 6px;
    color: #ffffff;
    line-height: 1;
}

/* NIEREGULARNA SIATKA (AUTO-FIT + DENSE PACKING) */
.gallery-masonry-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 260px;
    grid-auto-flow: dense;
    gap: 25px;
    width: 100%;
}

/* Zróżnicowane kafelki */
.gallery-item {
    position: relative;
    overflow: hidden;
    background: #080808;
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
}

.gallery-item.item-wide {
    grid-column: span 2;
}

.gallery-item.item-tall {
    grid-row: span 2;
}

.gallery-item.item-large {
    grid-column: span 2;
    grid-row: span 2;
}

/* ZDJĘCIA: DOMYŚLNIE WYSZARZONE, PO HOVERZE W KOLORZE */
.gallery-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: grayscale(40%) brightness(0.92) contrast(1.05);
    opacity: 0.9;
    transition: filter 0.4s ease, opacity 0.4s ease, transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.gallery-item:hover {
    border-color: rgba(255, 255, 255, 0.35);
}

.gallery-item:hover .gallery-img {
    filter: grayscale(0%) brightness(1.02) contrast(1.05);
    opacity: 1;
    transform: scale(1.04);
}

/* LIGHTBOX (MODAL POWIĘKSZENIA) */
.gallery-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 30px;
    box-sizing: border-box;
}

.gallery-lightbox.is-open {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-img-wrap {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-lightbox.is-open .lightbox-img-wrap {
    transform: scale(1);
}

#lightbox-img {
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.95);
}

.lightbox-close-btn {
    position: absolute;
    top: 30px;
    right: 40px;
    background: transparent;
    border: none;
    color: #888;
    font-family: 'Space Mono', monospace;
    font-size: 1.2rem;
    letter-spacing: 2px;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    z-index: 2010;
}
.lightbox-close-btn:hover {
    color: #fff;
    transform: scale(1.1);
}

@media (max-width: 950px) {
    .gallery-masonry-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 220px;
    }
    .gallery-item.item-large {
        grid-column: span 2;
        grid-row: span 1;
    }
}

@media (max-width: 600px) {
    .gallery-masonry-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 240px;
    }
    .gallery-item.item-wide,
    .gallery-item.item-tall,
    .gallery-item.item-large {
        grid-column: span 1;
        grid-row: span 1;
    }
}
.gallery-item.focus-top .gallery-img {
    object-position: top center;
}

/* Wymuszenie kadrowania od dołu */
.gallery-item.focus-bottom .gallery-img {
    object-position: bottom center;
}
/* NAVIGATION */
.main-nav {
    position: fixed;
    top: 0; left: 0; width: 100%;
    padding: 12px 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    z-index: 100;
    
    /* Półprzezroczysty czarny pasek z rozmyciem tła pod spodem */
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    
    /* Delikatne odcięcie dolnej krawędzi w klimacie brutalizmu */
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.main-nav a {
    font-family: 'Space Mono', monospace;
    color: #888;
    text-decoration: none;
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: color 0.3s;
}

.main-nav a:hover {
    color: #fff;
}

/* PRZEŁĄCZNIK JĘZYKA / LANGUAGE SWITCHER */
.lang-switcher {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 15px;
    padding: 3px 9px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.03);
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    user-select: none;
}

.lang-switcher a {
    color: #777;
    text-decoration: none;
    font-size: 0.75rem !important;
    letter-spacing: 1.5px !important;
    padding: 2px 4px;
    transition: color 0.2s ease;
}

.lang-switcher a:hover {
    color: #fff !important;
}

.lang-switcher .lang-active {
    color: #fff !important;
    font-weight: 700;
}

.lang-switcher .lang-sep {
    color: rgba(255, 255, 255, 0.25);
    font-size: 0.7rem;
}


.lightbox-nav-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(10, 10, 10, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #888;
    width: 56px;
    height: 56px;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 2.2rem;
    font-weight: 300;
    line-height: 0;
    box-sizing: border-box;
    overflow: visible;
    cursor: pointer;
    user-select: none;
    transition: all 0.25s ease;
    z-index: 2020;
}
.lightbox-nav-btn:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(20, 20, 20, 0.9);
    transform: translateY(-50%) scale(1.08);
}
.lightbox-prev {
    left: 40px;
    padding-right: 3px; /* optyczne wyśrodkowanie lewego dzióbka */
}

.lightbox-next {
    right: 40px;
    padding-left: 3px;  /* optyczne wyśrodkowanie prawego dzióbka */
}

@media (max-width: 900px) {
    .lightbox-nav-btn {
        width: 44px;
        height: 44px;
        font-size: 1.6rem;
    }
    .lightbox-prev {
        left: 15px;
    }
    .lightbox-next {
        right: 15px;
    }
}

.mobile-nav-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 20px;                     /* Po lewej stronie zamiast na środku */
    transform: none;               /* Usunięcie starego translateX(-50%) */
    width: 44px;
    height: 44px;
    background: rgba(12, 12, 12, 0.92); /* Ciemne, głębokie tło */
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 4px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 3000;
    cursor: pointer;
    
    padding: 0;
    margin: 0;
    font-size: 0;
    line-height: 0;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    box-sizing: border-box;

    place-content: center;
    gap: 4px;                      /* Zmniejszony odstęp, by 3 kreski idealnie leżały */
    touch-action: manipulation;
    transition: background 0.25s ease, border-color 0.25s ease;
}

.mobile-nav-toggle:hover {
    border-color: #ffffff;
    background: rgba(22, 22, 22, 0.98);
}

.nav-toggle-bar {
    width: 20px;
    height: 2px;
    background-color: #ffffff;
    display: block;
    pointer-events: none;
    border-radius: 1px;
    transform-origin: center;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}
/* Animacja w krzyżyk [X] dla 3 kresek: środkowa znika, skrajne tworzą ramiona */
.mobile-nav-toggle.is-active .nav-toggle-bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.mobile-nav-toggle.is-active .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.mobile-nav-toggle.is-active .nav-toggle-bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

@media (max-width: 768px) {
    .mobile-nav-toggle {
        display: grid !important;
    }

    .main-nav {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background: rgba(0, 0, 0, 0.97) !important;
        backdrop-filter: blur(15px) !important;
        -webkit-backdrop-filter: blur(15px) !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 18px !important;
        z-index: 2800 !important;
        padding: 80px 20px 40px 20px !important;
        box-sizing: border-box !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
        transform: translateY(-8px) !important;
        transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s !important;
    }

    
    .main-nav .lang-switcher {
        margin-left: 0 !important;
        margin-top: 15px !important;
        padding: 8px 18px !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
    }
    .main-nav .lang-switcher a,
    .main-nav .lang-switcher .lang-active {
        font-size: 1.1rem !important;
        letter-spacing: 3px !important;
    }

    .main-nav.is-open {
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transform: translateY(0) !important;
    }

    .main-nav a {
        font-family: 'Space Mono', monospace !important;
        font-size: 1.1rem !important;
        letter-spacing: 3px !important;
        color: #999 !important;
        text-decoration: none !important;
        text-transform: uppercase !important;
        padding: 6px 12px !important;
        transition: color 0.2s ease !important;
    }

    .main-nav a:hover,
    .main-nav a:active {
        color: #fff !important;
    }
}

@media (max-width: 950px) {
    #trailer {
        /* Wartość określa, o ile wyżej ma się zatrzymać scroll */
        scroll-margin-top: 150px; 
    }
}