/*
 * Image Gallery cards + lightbox (homepage slider and /gallery).
 * Markup: web/elements/gallery-card.php. Script: assets/js/wva-gallery.js.
 */

/* ---------- Card ---------- */
.wva-gcard {
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12), 0 1px 2px rgba(16, 24, 40, 0.06);
    cursor: zoom-in;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    text-align: left;
}

.wva-gcard:hover,
.wva-gcard:focus-visible {
    box-shadow: 0 10px 24px rgba(16, 24, 40, 0.16);
    transform: translateY(-2px);
    outline: none;
}

.wva-gcard:focus-visible {
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.45);
}

/* Fixed 16:9 box; the whole photo is shown (contain) over a blurred copy of itself. */
.wva-gcard-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #e9edf3;
}

@supports not (aspect-ratio: 16 / 9) {
    .wva-gcard-media {
        height: 0;
        padding-top: 56.25%;
    }
}

.wva-gcard-blur {
    position: absolute;
    inset: -24px;
    background-size: cover;
    background-position: center;
    filter: blur(18px) saturate(1.15);
    transform: scale(1.08);
    opacity: 0.85;
}

.wva-gcard-img {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
    display: block;
    transition: transform 0.35s ease;
}

.wva-gcard:hover .wva-gcard-img {
    transform: scale(1.02);
}

/* Title 1 line, description max 3 lines: every card is the same height. */
.wva-gcard-body {
    padding: 14px 16px 16px;
    flex: 1 1 auto;
}

.wva-gcard-title {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wva-gcard-desc {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.45;
    color: #666;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: calc(1.45em * 3);
    max-height: calc(1.45em * 3);
}

/* ---------- Homepage slider ---------- */
.wva-gallery-section {
    padding: 60px 0;
    overflow: hidden;
}

/* Owl measures the container; cards fill their slide exactly (3 / 2 / 1). */
.wva-gallery-slider.owl-carousel .owl-stage {
    display: flex;
}

.wva-gallery-slider.owl-carousel .owl-item {
    display: flex;
    padding: 6px 0 10px;
}

.wva-gallery-slider.owl-carousel .owl-item > .wva-gcard {
    width: 100%;
}

/* Before Owl starts (or without JS): a clean 3 / 2 / 1 grid, never wider than the container. */
.wva-gallery-slider:not(.owl-loaded) {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.wva-gallery-slider:not(.owl-loaded) > .wva-gcard:nth-child(n + 4) {
    display: none;
}

@media (max-width: 991.98px) {
    .wva-gallery-slider:not(.owl-loaded) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .wva-gallery-slider:not(.owl-loaded) > .wva-gcard:nth-child(n + 3) {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .wva-gallery-slider:not(.owl-loaded) {
        grid-template-columns: minmax(0, 1fr);
    }

    .wva-gallery-slider:not(.owl-loaded) > .wva-gcard:nth-child(n + 2) {
        display: none;
    }
}

/* ---------- Full gallery page grid ---------- */
.wva-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

@media (max-width: 991.98px) {
    .wva-gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    .wva-gallery-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 18px;
    }
}

/* ---------- Lightbox ---------- */
.wva-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(8, 12, 20, 0.92);
    padding: 56px 64px 24px;
}

.wva-lightbox.is-open {
    display: flex;
}

.wva-lightbox-figure {
    margin: 0;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wva-lightbox-img {
    max-width: 100%;
    max-height: calc(100vh - 150px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    background: #111;
}

.wva-lightbox-caption {
    margin-top: 14px;
    max-width: 900px;
    color: #f1f3f6;
    text-align: center;
    font-size: 15px;
    line-height: 1.5;
}

.wva-lightbox-caption strong {
    display: block;
    font-size: 17px;
    margin-bottom: 2px;
}

.wva-lightbox-caption span {
    color: #c3c9d3;
}

.wva-lightbox-btn {
    position: absolute;
    border: 0;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    font-size: 26px;
    line-height: 46px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s ease;
}

.wva-lightbox-btn:hover,
.wva-lightbox-btn:focus-visible {
    background: rgba(255, 255, 255, 0.28);
    outline: none;
}

.wva-lightbox-close {
    top: 12px;
    right: 14px;
}

.wva-lightbox-prev {
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.wva-lightbox-next {
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.wva-lightbox-count {
    position: absolute;
    top: 22px;
    left: 20px;
    color: #c3c9d3;
    font-size: 13px;
}

@media (max-width: 767.98px) {
    .wva-lightbox {
        padding: 56px 10px 16px;
    }

    .wva-lightbox-prev,
    .wva-lightbox-next {
        top: auto;
        bottom: 14px;
        transform: none;
    }

    .wva-lightbox-img {
        max-height: calc(100vh - 190px);
    }

    .wva-lightbox-caption {
        margin-bottom: 56px;
        font-size: 14px;
    }
}

body.wva-lightbox-open {
    overflow: hidden;
}

/* Slider dots (Owl's theme stylesheet is not loaded on the homepage). */
.wva-gallery-slider.owl-carousel .owl-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}

.wva-gallery-slider.owl-carousel .owl-dots.disabled {
    display: none;
}

.wva-gallery-slider.owl-carousel button.owl-dot {
    width: 9px;
    height: 9px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #c9d0db;
    transition: width 0.2s ease, background 0.2s ease;
}

.wva-gallery-slider.owl-carousel button.owl-dot.active {
    width: 22px;
    border-radius: 5px;
    background: var(--color-primary, #1d3a70);
}

.wva-gallery-section .course-view-all {
    margin-top: 28px;
}
