/* ================================================
   Video Gallery — Mixed Ratio Grid + Swipe Player
   ================================================ */

/* ---------- Section ---------- */
.video-gallery-section {
    padding: 80px 0;
}

/* ---------- Mixed-ratio grid (CSS Grid — no column clipping on shadows) ---------- */
.video-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    align-items: start;
}

@media (min-width: 576px) {
    .video-gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
}

@media (min-width: 992px) {
    .video-gallery-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; }
}

/* ---------- Individual card ---------- */
.video-card {
    margin-bottom: 0;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    background: #111;
    position: relative;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    outline: none;
    /* Contain stacking context so siblings aren't affected */
    isolation: isolate;
}

@media (min-width: 576px) {
    .video-card { margin-bottom: 12px; }
}

.video-card:hover,
.video-card:focus {
    /* translateY instead of scale — scale overflows CSS columns boundaries */
    transform: translateY(-4px);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.4);
}

/* ---------- Thumbnail with native aspect ratio ---------- */
.video-thumbnail {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.video-thumbnail.ratio-portrait  { aspect-ratio: 9 / 16; }
.video-thumbnail.ratio-landscape { aspect-ratio: 16 / 9; }

.video-thumbnail img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.video-card:hover .video-thumbnail img,
.video-card:focus .video-thumbnail img {
    transform: scale(1.05);
}

/* ---------- Play overlay ---------- */
.play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.18);
    transition: background 0.25s ease;
}

.video-card:hover .play-overlay,
.video-card:focus .play-overlay {
    background: rgba(0, 0, 0, 0.38);
}

.play-btn {
    width: 46px;
    height: 46px;
    background: rgba(255, 0, 0, 0.85);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease;
    flex-shrink: 0;
}

@media (max-width: 575px) {
    .play-btn { width: 36px; height: 36px; }
    .play-btn i { font-size: 15px; }
}

.video-card:hover .play-btn,
.video-card:focus .play-btn {
    transform: scale(1.2);
    background: #ff0000;
}

.play-btn i {
    color: #fff;
    font-size: 20px;
    line-height: 1;
}

/* ---------- Card title ---------- */
.video-card-title {
    padding: 7px 10px 8px;
    margin: 0;
    font-size: 12px;
    color: #eee;
    background: #111;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ================================================
   Fullscreen Swipe Player
   ================================================ */

.video-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.92);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.video-modal-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

.video-player-modal {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.video-player-modal.active {
    opacity: 1;
    pointer-events: all;
}

/* ---------- Close button ---------- */
.video-player-close {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 10003;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    padding: 0;
    line-height: 1;
}

.video-player-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

[dir="rtl"] .video-player-close {
    right: auto;
    left: 14px;
}

/* ---------- Swiper container ---------- */
.video-swiper {
    width: 100%;
    height: 100vh;
}

.video-swiper .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

/* ---------- Slide content ---------- */
.video-slide-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 60px 16px 48px;
    box-sizing: border-box;
    max-height: 100vh;
}

/* ---------- iframe wrapper — respects native ratio ---------- */
.video-iframe-wrapper {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
}

/* Portrait reels: height-first sizing so they fill the viewport height */
.video-iframe-wrapper.ratio-portrait {
    height: calc(100vh - 120px);
    width: calc((100vh - 120px) * 9 / 16);
    max-width: calc(100vw - 32px);
    aspect-ratio: 9 / 16;
}

/* Landscape videos: width-first, capped at readable max */
.video-iframe-wrapper.ratio-landscape {
    width: 100%;
    max-width: min(900px, calc(100vw - 32px));
    aspect-ratio: 16 / 9;
}

.video-iframe-wrapper iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* ---------- Slide title ---------- */
.slide-video-title {
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
    margin: 12px 0 0;
    font-size: 14px;
    font-weight: 500;
    max-width: 600px;
}

/* ---------- Swiper nav arrows (vertical mode shows them on sides) ---------- */
.video-swiper-prev,
.video-swiper-next {
    color: #fff !important;
}

.video-swiper-prev::after,
.video-swiper-next::after {
    font-size: 22px !important;
}

/* ---------- Mobile tweaks ---------- */
@media (max-width: 575px) {
    .video-gallery-grid {
        columns: 2;
        column-gap: 8px;
    }

    .video-card { border-radius: 8px; }

    .video-slide-container { padding: 52px 12px 40px; }

    .video-iframe-wrapper.ratio-portrait {
        height: calc(100vh - 100px);
        width: calc((100vh - 100px) * 9 / 16);
    }
}
