/* =========================================================================
   GALLERY.CSS - Reusable video gallery patterns for Filmmaker Pages
   ========================================================================= */

body.film-gallery-page {
    background-color: var(--film-bg, #04090b);
    background-image: radial-gradient(circle at top center, rgba(42, 107, 124, 0.12), transparent 42%);
    color: #fff;
}

/* Header Area */
.gallery-header {
    max-width: 1140px;
    margin: 0 auto;
    padding: clamp(2.75rem, 7vw, 4.5rem) 2rem clamp(2.25rem, 5vw, 3.5rem);
    position: relative;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.gallery-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 2rem;
    transition: color 0.3s ease;
}

.gallery-back-link:hover {
    color: var(--film-teal-light, #2a6b7c);
}

.gallery-title {
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-weight: 300;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.gallery-intro {
    color: rgba(255,255,255,0.6);
    font-size: 1.1rem;
    max-width: 38rem;
    line-height: 1.6;
}

/* Portfolio Section (Main Container) */
.film-portfolio {
    --gallery-gap: clamp(1rem, 2vw, 1.5rem);
    --gallery-card-radius: 1.35rem;
    padding: clamp(2.25rem, 5vw, 3.25rem) 2rem clamp(4.5rem, 9vw, 6rem);
    position: relative;
    max-width: 1140px;
    margin: 0 auto;
}

/* Navigation Chips */
.portfolio-chips {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
    flex-wrap: wrap;
}

.portfolio-chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-family: inherit;
    min-width: 0;
    box-sizing: border-box;
}

.portfolio-chip:hover,
.portfolio-chip.active {
    background: rgba(42, 107, 124, 0.2);
    border-color: var(--film-teal-light, #2a6b7c);
    color: #fff;
}

.portfolio-content {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.portfolio-content.active {
    display: block;
}

.portfolio-content.active:is(#portfolio-vert, #portfolio-horiz) {
    display: grid;
}

/* Grids */
.portfolio-grid-vert {
    display: grid;
    grid-template-columns: minmax(0, 0.96fr) minmax(0, 1.08fr) minmax(0, 0.96fr);
    gap: var(--gallery-gap);
}

.portfolio-grid-horiz {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: var(--gallery-gap);
}

.portfolio-grid-vert,
.portfolio-grid-horiz {
    width: 100%;
    margin: 0 auto;
    padding: clamp(1rem, 2.8vw, 1.75rem);
    border-radius: 1.9rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0.012)),
        radial-gradient(circle at top, rgba(42, 107, 124, 0.08), transparent 55%);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.18);
}

.portfolio-grid-vert {
    max-width: 980px;
}

.portfolio-grid-horiz {
    max-width: 1020px;
}

.portfolio-grid-horiz .video-card:first-child {
    grid-column: 1 / -1;
}

/* Facade pattern */
.video-card {
    display: flex;
    flex-direction: column;
    gap: 0.72rem;
    transition: transform 0.35s ease;
}

.video-card:hover {
    transform: translateY(-6px);
}

.video-label {
    font-size: 0.76rem;
    color: rgba(255, 255, 255, 0.74);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    padding-left: 0.65rem;
    border-left: 1px solid var(--film-teal-light, #2a6b7c);
}

.video-facade {
    position: relative;
    width: 100%;
    background:
        linear-gradient(180deg, rgba(21, 28, 31, 0.96), rgba(6, 9, 10, 0.98));
    border-radius: var(--gallery-card-radius);
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 22px 45px rgba(0, 0, 0, 0.24);
    isolation: isolate;
    transition: border-color 0.35s ease, box-shadow 0.35s ease, transform 0.35s ease;
}

.video-facade::before,
.video-facade::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.video-facade::before {
    inset: 1px;
    border-radius: calc(var(--gallery-card-radius) - 1px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    opacity: 0.55;
    z-index: 1;
}

.video-facade::after {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.5));
    z-index: 1;
}

.video-facade.vert {
    aspect-ratio: 9 / 16;
}

.video-facade.horiz {
    aspect-ratio: 16 / 9;
}

.facade-thumb {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0.78;
    transition: opacity 0.3s ease, transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.video-card:hover .facade-thumb,
.video-facade:focus-visible .facade-thumb {
    opacity: 0.58;
    transform: scale(1.03);
}

.play-button {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 68px; height: 68px;
    background: rgba(27, 84, 98, 0.72);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(4px);
    box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.04);
    z-index: 2;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.play-button::after {
    content: '';
    width: 0; 
    height: 0; 
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-left: 16px solid #fff;
    margin-left: 4px;
}

.video-card:hover .play-button,
.video-facade:focus-visible .play-button {
    background: var(--film-teal-light, #2a6b7c);
    transform: translate(-50%, -50%) scale(1.1);
}

.video-card:hover .video-facade,
.video-facade:focus-visible {
    border-color: rgba(42, 107, 124, 0.5);
    box-shadow: 0 28px 58px rgba(0, 0, 0, 0.32);
    transform: translateY(-2px);
    outline: none;
}

.video-facade iframe {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    border: none;
    z-index: 2;
}

/* Delivery Text block */
.deliverables-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.038), rgba(255, 255, 255, 0.02)),
        radial-gradient(circle at top, rgba(42, 107, 124, 0.08), transparent 60%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.7rem;
    padding: clamp(1.75rem, 4vw, 3rem);
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.8;
    max-width: 860px;
    margin: 0 auto;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.16);
}

.deliverables-card strong {
    color: #fff;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
    .gallery-title {
        font-size: 2.5rem;
    }
    .gallery-header {
        padding: 2.25rem 1.5rem 1.75rem;
    }
    .film-portfolio {
        padding: 2rem 1.5rem 4rem;
    }
    .portfolio-chips {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.8rem;
        justify-content: stretch;
    }
    .portfolio-chip {
        white-space: normal;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 3.35rem;
        text-align: center;
        font-size: 0.8rem;
        line-height: 1.3;
        padding: 0.8rem 1rem;
    }
    .portfolio-chip:last-child {
        grid-column: 1 / -1;
    }
    .portfolio-grid-vert,
    .portfolio-grid-horiz {
        grid-template-columns: 1fr;
        padding: 0;
        border: none;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        gap: 1.1rem;
    }
    .portfolio-grid-horiz .video-card:first-child {
        grid-column: auto;
    }
    .video-card {
        gap: 0.65rem;
        transform: none !important;
    }
    .video-facade {
        border-radius: 1rem;
    }
    .play-button {
        width: 64px;
        height: 64px;
    }
    .deliverables-card {
        padding: 1.5rem;
    }
}

@media (max-width: 520px) {
    .portfolio-chips {
        grid-template-columns: 1fr;
    }

    .portfolio-chip:last-child {
        grid-column: auto;
    }
}
