/* ==========================================================================
   Galeria Cinema — Media Center Styles
   ========================================================================== */

/* ── Global Cinema Overrides ─────────────────────────────────────────────── */

body.cinema-galeria,
body:not(.home):not(.front-page).cinema-galeria {
    background: #1A1210 !important;
    color: #e0d5cc;
}

body.cinema-galeria .page-entry,
body.cinema-galeria .page-header,
body.cinema-galeria .page-hero {
    display: none;
}

body.cinema-galeria .site-header {
    background: rgba(26, 18, 16, 0.92) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

body.cinema-galeria .site-footer {
    display: none;
}

/* ── Cinema Wrap — Full-screen Layout ────────────────────────────────────── */

.cinema-wrap {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
    padding-top: 0; /* tuż pod menu */
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

.cinema-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 1.5rem 1rem 2rem 1.25rem;
    background: rgba(20, 14, 10, 0.95);
    border-right: 1px solid rgba(212, 155, 75, 0.12);
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 155, 75, 0.3) transparent;
}

.cinema-sidebar::-webkit-scrollbar {
    width: 4px;
}
.cinema-sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.cinema-sidebar::-webkit-scrollbar-thumb {
    background: rgba(212, 155, 75, 0.3);
    border-radius: 2px;
}

.cinema-sidebar__title {
    display: none;
}

.cinema-sidebar__empty {
    color: rgba(224, 213, 204, 0.4);
    font-size: 1.05rem;
}

/* ── Timeline ────────────────────────────────────────────────────────────── */

.cinema-timeline {
    position: relative;
}

.cinema-timeline__year {
    margin-bottom: 1.5rem;
}

.cinema-timeline__year-title {
    font-family: var(--font-heading, 'Kumbh Sans', sans-serif);
    font-size: 1.45rem;
    font-weight: 800;
    color: #D49B4B;
    margin: 0 0 0.75rem;
    letter-spacing: 0.03em;
}

.cinema-timeline__list {
    list-style: none;
    margin: 0;
    padding: 0 0 0 12px;
    border-left: 2px solid rgba(212, 155, 75, 0.15);
}

.cinema-timeline__item {
    position: relative;
    margin-bottom: 4px;
}

.cinema-timeline__dot {
    position: absolute;
    left: -18px;
    top: 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(212, 155, 75, 0.4);
    transition: all 0.3s ease;
}

.cinema-timeline__item:hover .cinema-timeline__dot,
.cinema-timeline__item.active .cinema-timeline__dot {
    background: #D49B4B;
    box-shadow: 0 0 8px rgba(212, 155, 75, 0.5);
    transform: scale(1.3);
}

.cinema-timeline__item a {
    display: block;
    padding: 6px 10px;
    border-radius: 6px;
    text-decoration: none;
    color: rgba(224, 213, 204, 0.7);
    transition: all 0.25s ease;
}

.cinema-timeline__item a:hover,
.cinema-timeline__item.active a {
    background: rgba(212, 155, 75, 0.1);
    color: #fff;
}

.cinema-timeline__date {
    display: block;
    font-size: 0.92rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(212, 155, 75, 0.6);
    margin-bottom: 1px;
}

.cinema-timeline__title {
    display: block;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.3;
}

/* ── Main Area ───────────────────────────────────────────────────────────── */

.cinema-main {
    padding: 2rem 2.5rem 3rem;
    min-height: calc(100vh - 100px);
}

/* ── Album Grid (Masonry-like) ───────────────────────────────────────────── */

.cinema-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    grid-auto-rows: 200px;
    grid-auto-flow: dense;
    gap: 14px;
}

/* ── Album Card ──────────────────────────────────────────────────────────── */

.cinema-card {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    color: #fff;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.cinema-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.cinema-card--landscape {
    grid-column: span 2;
}

.cinema-card--portrait {
    grid-row: span 2;
}

.cinema-card__image {
    position: absolute;
    inset: 0;
}

.cinema-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease, filter 0.5s ease;
}

.cinema-card:hover .cinema-card__image img {
    transform: scale(1.06);
    filter: brightness(1.1);
}

.cinema-card__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(40, 30, 25, 0.8);
    color: rgba(212, 155, 75, 0.3);
}

/* Text overlay at bottom — inline frosted glass per line */
.cinema-card__overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 8px;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.cinema-card__date {
    display: inline;
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #D49B4B;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 2px 6px;
    border-radius: 3px;
    margin-bottom: 2px;
    line-height: 1.6;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.cinema-card__info {
    display: inline-block;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 3px 6px;
    border-radius: 3px;
}

.cinema-card__title {
    font-family: var(--font-heading, 'Kumbh Sans', sans-serif);
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.cinema-card__season {
    display: block;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 1px;
    font-style: italic;
}

/* Card hover glow */
.cinema-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    pointer-events: none;
}

.cinema-card:hover::after {
    border-color: rgba(212, 155, 75, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(212, 155, 75, 0.15);
}

/* ── Empty State ─────────────────────────────────────────────────────────── */

.cinema-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    color: rgba(224, 213, 204, 0.3);
    text-align: center;
}
.cinema-empty svg {
    margin-bottom: 1rem;
    opacity: 0.2;
    fill: #D49B4B;
}
.cinema-empty h3 {
    font-size: 1.7rem;
    color: rgba(224, 213, 204, 0.5);
    margin: 0 0 0.5rem;
}
.cinema-empty p {
    font-size: 1.1rem;
}

/* ==========================================================================
   Cinema Viewer — Full-screen Photo Browser
   ========================================================================== */

.cinema-viewer {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(10, 8, 6, 0.97);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.cinema-viewer.active {
    opacity: 1;
    visibility: visible;
}

/* ── Viewer Header ───────────────────────────────────────────────────────── */

.cinema-viewer__header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding: 0.75rem 2rem 0.5rem;
    flex-shrink: 0;
}

.cinema-viewer__info {
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
}

.cinema-viewer__title {
    font-family: var(--font-heading, 'Kumbh Sans', sans-serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    line-height: 1.3;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.cinema-viewer__meta {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.cinema-viewer__date {
    font-size: 1rem;
    color: #D49B4B;
    font-weight: 600;
}

.cinema-viewer__season {
    font-size: 0.92rem;
    color: rgba(224, 213, 204, 0.45);
    font-style: italic;
}

.cinema-viewer__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-radius: 50%;
    font-size: 1.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.2s ease;
    z-index: 10;
}
.cinema-viewer__close:hover {
    background: rgba(212, 155, 75, 0.3);
    transform: scale(1.1);
}

/* ── Photo Stage ─────────────────────────────────────────────────────────── */

.cinema-viewer__stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0 4rem;
    min-height: 0;
}

.cinema-viewer__frame {
    position: relative;
    max-width: 85vw;
    max-height: calc(100vh - 160px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cinema-viewer__frame img {
    max-width: 85vw;
    max-height: calc(100vh - 160px);
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid rgba(212, 155, 75, 0.2);
    box-shadow:
        0 0 40px rgba(0, 0, 0, 0.5),
        0 0 80px rgba(0, 0, 0, 0.3),
        inset 0 0 0 1px rgba(212, 155, 75, 0.08);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.cinema-viewer__frame img.loading {
    opacity: 0.3;
    transform: scale(0.97);
}

.cinema-viewer__counter {
    position: absolute;
    bottom: 8px;
    right: 8px;
    font-size: 0.9rem;
    color: rgba(224, 213, 204, 0.4);
    background: rgba(0, 0, 0, 0.5);
    padding: 3px 10px;
    border-radius: 12px;
}

/* ── Navigation Arrows ───────────────────────────────────────────────────── */

.cinema-viewer__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    font-size: 1.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 5;
}
.cinema-viewer__nav:hover {
    background: rgba(212, 155, 75, 0.25);
    color: #fff;
    transform: translateY(-50%) scale(1.1);
}
.cinema-viewer__nav--prev {
    left: 1rem;
}
.cinema-viewer__nav--next {
    right: 1rem;
}

/* ── Thumbnail Strip ─────────────────────────────────────────────────────── */

.cinema-viewer__strip {
    flex-shrink: 0;
    height: 90px;
    padding: 10px 2rem;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    align-items: center;
    justify-content: center;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 155, 75, 0.2) transparent;
}
.cinema-viewer__strip::-webkit-scrollbar {
    height: 3px;
}
.cinema-viewer__strip::-webkit-scrollbar-thumb {
    background: rgba(212, 155, 75, 0.2);
    border-radius: 2px;
}

.cinema-viewer__thumb {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.45;
    transition: all 0.3s ease;
}
.cinema-viewer__thumb:hover {
    opacity: 0.8;
}
.cinema-viewer__thumb.active {
    opacity: 1;
    border-color: #D49B4B;
    box-shadow: 0 0 12px rgba(212, 155, 75, 0.4);
}
.cinema-viewer__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Viewer Loader ───────────────────────────────────────────────────────── */

.cinema-viewer__loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(212, 155, 75, 0.15);
    border-top-color: #D49B4B;
    border-radius: 50%;
    animation: cinema-spin 0.8s linear infinite;
}

@keyframes cinema-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ==========================================================================
   Animations
   ========================================================================== */

/* Staggered card entrance */
.cinema-card:nth-child(1) { transition-delay: 0.05s; }
.cinema-card:nth-child(2) { transition-delay: 0.1s; }
.cinema-card:nth-child(3) { transition-delay: 0.15s; }
.cinema-card:nth-child(4) { transition-delay: 0.2s; }
.cinema-card:nth-child(5) { transition-delay: 0.25s; }
.cinema-card:nth-child(6) { transition-delay: 0.3s; }
.cinema-card:nth-child(7) { transition-delay: 0.35s; }
.cinema-card:nth-child(8) { transition-delay: 0.4s; }
.cinema-card:nth-child(9) { transition-delay: 0.45s; }
.cinema-card:nth-child(10) { transition-delay: 0.5s; }

/* Viewer photo transition */
.cinema-viewer__frame img.entering {
    animation: cinemaPhotoIn 0.4s ease forwards;
}

@keyframes cinemaPhotoIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateX(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateX(0);
    }
}

@keyframes cinemaPhotoInReverse {
    from {
        opacity: 0;
        transform: scale(0.95) translateX(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateX(0);
    }
}

/* Viewer open animation */
.cinema-viewer.opening {
    animation: cinemaViewerOpen 0.4s ease forwards;
}

@keyframes cinemaViewerOpen {
    from {
        opacity: 0;
        backdrop-filter: blur(0);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(4px);
    }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1280px) {
    .cinema-wrap {
        grid-template-columns: 1fr;
        padding-top: 0;
    }

    .cinema-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 10000;
        border-right: 1px solid rgba(212, 155, 75, 0.2);
        transition: left 0.35s ease;
        padding: 1.5rem 1.25rem;
    }

    .cinema-sidebar.open {
        left: 0;
    }

    .cinema-sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 9999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.35s ease, visibility 0.35s ease;
    }

    .cinema-sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .cinema-sidebar-toggle {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        position: fixed;
        top: 80px;
        left: 1rem;
        z-index: 9998;
        padding: 8px 16px;
        background: rgba(20, 14, 10, 0.9);
        color: #D49B4B;
        border: 1px solid rgba(212, 155, 75, 0.3);
        border-radius: 20px;
        font-size: 0.85rem;
        font-weight: 600;
        cursor: pointer;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        transition: all 0.3s ease;
    }

    .cinema-sidebar-toggle:hover {
        background: rgba(212, 155, 75, 0.2);
    }

    .cinema-sidebar-toggle svg {
        fill: #D49B4B;
    }

    .cinema-main {
        padding: 1.5rem;
    }

    .cinema-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        grid-auto-rows: 180px;
    }
}

@media (max-width: 768px) {
    .cinema-main {
        padding: 1rem;
    }

    .cinema-grid {
        grid-template-columns: 1fr 1fr;
        grid-auto-rows: 160px;
        gap: 8px;
    }

    .cinema-card--landscape {
        grid-column: span 2;
    }

    .cinema-card--portrait {
        grid-row: span 2;
    }

    .cinema-card__title {
        font-size: 1.05rem;
    }

    /* Viewer mobile */
    .cinema-viewer__stage {
        padding: 0 0.5rem;
    }

    .cinema-viewer__nav {
        width: 40px;
        height: 40px;
        font-size: 1.4rem;
    }
    .cinema-viewer__nav--prev { left: 0.25rem; }
    .cinema-viewer__nav--next { right: 0.25rem; }

    .cinema-viewer__header {
        padding: 0.75rem 1rem 0.5rem;
    }

    .cinema-viewer__title {
        font-size: 1.3rem;
    }

    .cinema-viewer__strip {
        height: 70px;
        padding: 6px 0.5rem;
    }

    .cinema-viewer__thumb {
        width: 50px;
        height: 50px;
    }

    .cinema-viewer__frame img {
        max-width: 100vw;
        max-height: calc(100vh - 180px);
    }
}

/* ── Card Highlight (sidebar scroll-to) ──────────────────────────────────── */

.cinema-card--highlight {
    animation: cardHighlight 10s ease;
}

@keyframes cardHighlight {
    0%   { box-shadow: 0 0 0 0 rgba(212, 155, 75, 0); }
    15%  { box-shadow: 0 0 0 6px rgba(255, 155, 75, 0.8), 0 0 30px rgba(212, 155, 75, 0.7); }
    100% { box-shadow: 0 0 0 0 rgba(212, 155, 75, 0); }
}

/* ── Load More ──────────────────────────────────────────────────────────── */

.cinema-load-more-wrap {
    text-align: center;
    padding: 2.5rem 0 1rem;
}

.cinema-load-more {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 32px;
    background: rgba(212, 155, 75, 0.15);
    color: #D49B4B;
    border: 1px solid rgba(212, 155, 75, 0.3);
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cinema-load-more:hover {
    background: rgba(212, 155, 75, 0.3);
    color: #fff;
}

.cinema-load-more__spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(212, 155, 75, 0.3);
    border-top-color: #D49B4B;
    border-radius: 50%;
    animation: cinema-spin 0.6s linear infinite;
}

.cinema-load-more[data-loading="true"] .cinema-load-more__spinner {
    display: inline-block;
}

/* ── Mobile Sidebar Toggle ──────────────────────────────────────────────── */

.cinema-sidebar-toggle {
    display: none; /* shown on mobile */
}

.cinema-sidebar-overlay {
    display: none;
}

/* ── Single Album Back Link ───────────────────────────────────────────────── */

.cinema-single-back {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    z-index: 99999;
}

.cinema-single-back__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: rgba(212, 155, 75, 0.15);
    color: #D49B4B;
    text-decoration: none;
    border-radius: 24px;
    font-size: 1.05rem;
    font-weight: 600;
    border: 1px solid rgba(212, 155, 75, 0.25);
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
}

.cinema-single-back__link:hover {
    background: rgba(212, 155, 75, 0.3);
    color: #fff;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .cinema-card,
    .cinema-card__image img,
    .cinema-viewer,
    .cinema-viewer__frame img {
        transition: none !important;
        animation: none !important;
    }
    .cinema-card {
        opacity: 1;
        transform: none;
    }
}
