/**
 * GHVM Gallery — modern filter chips + photo grid
 * Works with Isotope + lightGallery (keeps .isotop-filter / .isotope-item / #animated-thumbnials).
 */
.ghvm-gallery {
    --ghvm-gal-teal: var(--color-primary, #1ab69d);
    --ghvm-gal-teal-deep: #0f8f7a;
    --ghvm-gal-coral: var(--color-secondary, #ee4a62);
    --ghvm-gal-ink: var(--color-heading, #181818);
    --ghvm-gal-muted: #6b7385;
    --ghvm-gal-stage: #f3f8f7;
    --ghvm-gal-ease: cubic-bezier(0.22, 1, 0.36, 1);
    background:
        radial-gradient(ellipse 70% 40% at 0% 0%, rgba(26, 182, 157, 0.08), transparent 55%),
        radial-gradient(ellipse 50% 35% at 100% 10%, rgba(238, 74, 98, 0.05), transparent 50%),
        #fafcfb;
    padding-top: 56px !important;
    padding-bottom: 72px !important;
}

.ghvm-gallery .container {
    max-width: 1240px;
}

.ghvm-gallery-head {
    text-align: center;
    margin-bottom: 28px;
}

.ghvm-gallery-head .ghvm-section-chip,
.ghvm-gallery-head .ghvm-spotlight-chip {
    margin-bottom: 12px;
}

.ghvm-gallery-head .title {
    margin: 0 0 8px;
    font-family: var(--font-secondary);
    font-size: clamp(26px, 3vw, 36px);
    font-weight: 800;
    color: var(--ghvm-gal-ink);
    line-height: 1.2;
}

.ghvm-gallery-head .ghvm-gallery-sub {
    margin: 0;
    color: var(--ghvm-gal-muted);
    font-size: 15px;
}

.ghvm-gallery-shell {
    background: #fff;
    border: 1px solid rgba(20, 32, 43, 0.07);
    border-radius: 24px;
    padding: 20px 20px 28px;
    box-shadow: 0 16px 40px rgba(20, 32, 43, 0.06);
}

/* ---- Filters ---- */
.ghvm-gallery .isotop-button.isotop-filter,
.ghvm-gallery .ghvm-filter-bar {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center;
    justify-content: flex-start !important;
    gap: 8px;
    margin: 0 0 22px !important;
    padding: 4px 2px 10px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(26, 182, 157, 0.35) transparent;
    scroll-snap-type: x proximity;
}

.ghvm-gallery .isotop-button.isotop-filter::-webkit-scrollbar {
    height: 5px;
}

.ghvm-gallery .isotop-button.isotop-filter::-webkit-scrollbar-thumb {
    background: rgba(26, 182, 157, 0.35);
    border-radius: 999px;
}

.ghvm-gallery .isotop-button.isotop-filter button,
.ghvm-gallery .ghvm-filter-bar button {
    flex: 0 0 auto;
    scroll-snap-align: start;
    height: 40px !important;
    min-height: 40px !important;
    margin: 0 !important;
    padding: 0 16px !important;
    border-radius: 999px !important;
    border: 1px solid rgba(20, 32, 43, 0.1) !important;
    background: #fff !important;
    color: var(--ghvm-gal-ink) !important;
    font-size: 13px !important;
    font-weight: 650 !important;
    font-family: var(--font-primary);
    text-transform: none !important;
    letter-spacing: 0.01em;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(20, 32, 43, 0.04);
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s var(--ghvm-gal-ease), box-shadow 0.18s ease;
}

.ghvm-gallery .isotop-button.isotop-filter button .filter-text {
    text-transform: none !important;
}

.ghvm-gallery .isotop-button.isotop-filter button:hover {
    border-color: rgba(26, 182, 157, 0.45) !important;
    color: var(--ghvm-gal-teal-deep) !important;
    transform: translateY(-1px);
}

.ghvm-gallery .isotop-button.isotop-filter button.is-checked,
.ghvm-gallery .isotop-button.isotop-filter button.is-checked:hover {
    background: linear-gradient(135deg, var(--ghvm-gal-teal), var(--ghvm-gal-teal-deep)) !important;
    border-color: transparent !important;
    color: #fff !important;
    box-shadow: 0 8px 18px rgba(15, 143, 122, 0.28);
}

/* Kill theme underline (::after) that cuts through pill chips */
.ghvm-gallery .isotop-button button::after,
.ghvm-gallery .isotop-button.button-transparent button::after,
.ghvm-gallery .isotop-button button:hover::after,
.ghvm-gallery .isotop-button button.is-checked::after,
.ghvm-gallery .isotop-button.button-transparent button:hover::after,
.ghvm-gallery .isotop-button.button-transparent button.is-checked::after {
    content: none !important;
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    border: none !important;
    background: none !important;
}

/* ---- Grid cards ---- */
.ghvm-gallery .isotope-list.gallery-grid-wrap {
    margin: 0 !important;
}

.ghvm-gallery #animated-thumbnials,
.ghvm-gallery .gallery-grid-wrap > #animated-thumbnials {
    display: block;
}

.ghvm-gallery .edu-gallery-grid.isotope-item,
.ghvm-gallery a.edu-gallery-grid.isotope-item {
    width: calc(33.333% - 16px) !important;
    margin: 8px !important;
    padding: 0 !important;
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(20, 32, 43, 0.06);
    box-shadow: 0 8px 22px rgba(20, 32, 43, 0.06);
    /* Never transition transform — Isotope animates position with transform */
    transition: box-shadow 0.22s ease, border-color 0.22s ease;
    text-decoration: none !important;
}

.ghvm-gallery .edu-gallery-grid.isotope-item:hover {
    box-shadow: 0 16px 36px rgba(20, 32, 43, 0.12);
    border-color: rgba(26, 182, 157, 0.28);
}

.ghvm-gallery .edu-gallery-grid .thumbnail {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 0 !important;
    margin: 0 !important;
    background: var(--ghvm-gal-stage);
}

.ghvm-gallery .edu-gallery-grid .thumbnail::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 45%, rgba(15, 24, 32, 0.55) 100%) !important;
    border-radius: 0 !important;
    opacity: 0;
    transition: opacity 0.22s ease;
    z-index: 1;
    pointer-events: none;
}

.ghvm-gallery .edu-gallery-grid:hover .thumbnail::before {
    opacity: 1;
}

.ghvm-gallery #masonry-gallery::after,
.ghvm-gallery #animated-thumbnials::after {
    content: "";
    display: table;
    clear: both;
}

.ghvm-gallery .edu-gallery-grid .thumbnail img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    border-radius: 0 !important;
    transition: transform 0.45s var(--ghvm-gal-ease);
}

.ghvm-gallery .edu-gallery-grid:hover .thumbnail img {
    transform: scale(1.06);
}

.ghvm-gallery .edu-gallery-grid .zoom-icon,
.ghvm-gallery .edu-gallery-grid .ghvm-gallery-zoom {
    position: absolute !important;
    top: auto !important;
    left: auto !important;
    right: 14px !important;
    bottom: 14px !important;
    z-index: 2;
    width: 40px !important;
    height: 40px !important;
    line-height: 40px !important;
    border-radius: 50%;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    background: #fff !important;
    color: var(--ghvm-gal-teal-deep) !important;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
    opacity: 0;
    transform: translateY(8px) !important;
    transition: opacity 0.2s ease, transform 0.2s var(--ghvm-gal-ease);
    pointer-events: none;
}

.ghvm-gallery .edu-gallery-grid:hover .zoom-icon,
.ghvm-gallery .edu-gallery-grid:hover .ghvm-gallery-zoom {
    opacity: 1 !important;
    transform: translateY(0) !important;
    top: auto !important;
}

.ghvm-gallery .edu-gallery-grid .ghvm-gallery-caption {
    position: absolute;
    left: 14px;
    right: 58px;
    bottom: 14px;
    z-index: 2;
    margin: 0;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.2s ease, transform 0.2s var(--ghvm-gal-ease);
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ghvm-gallery .edu-gallery-grid:hover .ghvm-gallery-caption {
    opacity: 1;
    transform: translateY(0);
}

.ghvm-gallery-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--ghvm-gal-muted);
}

.ghvm-gallery-empty i {
    font-size: 36px;
    color: var(--ghvm-gal-teal);
    display: block;
    margin-bottom: 10px;
}

/* Sticky filter on scroll (desktop/tablet) */
@media (min-width: 768px) {
    .ghvm-gallery .ghvm-filter-sticky.is-stuck {
        position: sticky;
        top: 84px;
        z-index: 20;
        background: rgba(255, 255, 255, 0.94);
        backdrop-filter: blur(10px);
        margin: -8px -8px 16px;
        padding: 10px 8px 12px;
        border-radius: 14px;
        box-shadow: 0 8px 24px rgba(20, 32, 43, 0.08);
    }
}

@media (max-width: 991px) {
    .ghvm-gallery .edu-gallery-grid.isotope-item,
    .ghvm-gallery a.edu-gallery-grid.isotope-item {
        width: calc(50% - 12px) !important;
        margin: 6px !important;
        border-radius: 14px;
    }

    .ghvm-gallery-shell {
        padding: 14px 12px 18px;
        border-radius: 18px;
    }

    .ghvm-gallery .isotop-button.isotop-filter button {
        height: 36px !important;
        min-height: 36px !important;
        padding: 0 14px !important;
        font-size: 12.5px !important;
    }

    /* Always show caption hint on touch */
    .ghvm-gallery .edu-gallery-grid .zoom-icon {
        opacity: 1 !important;
        transform: none !important;
        width: 34px !important;
        height: 34px !important;
        line-height: 34px !important;
        right: 10px !important;
        bottom: 10px !important;
    }

    .ghvm-gallery .edu-gallery-grid .thumbnail::before {
        opacity: 0.55;
    }

    .ghvm-gallery .edu-gallery-grid .ghvm-gallery-caption {
        opacity: 1;
        transform: none;
        font-size: 12px;
        left: 10px;
        right: 48px;
        bottom: 10px;
    }
}

@media (max-width: 575px) {
    .ghvm-gallery .edu-gallery-grid.isotope-item,
    .ghvm-gallery a.edu-gallery-grid.isotope-item {
        width: calc(50% - 10px) !important;
        margin: 5px !important;
    }

    .ghvm-gallery .edu-gallery-grid .thumbnail {
        aspect-ratio: 1 / 1;
    }

    .ghvm-gallery-head {
        margin-bottom: 18px;
        text-align: left;
    }

    .ghvm-gallery-head .title {
        font-size: 24px;
    }
}

/* Masonry detail galleries (achievement / academic) */
.ghvm-gallery .edu-gallery-grid.masonry-item,
.ghvm-gallery a.edu-gallery-grid.masonry-item {
    width: calc(33.333% - 16px) !important;
    margin: 8px !important;
    padding: 0 !important;
    float: left;
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(20, 32, 43, 0.06);
    box-shadow: 0 8px 22px rgba(20, 32, 43, 0.06);
    transition: box-shadow 0.22s ease;
}

.ghvm-gallery .edu-gallery-grid.masonry-item:hover {
    box-shadow: 0 16px 36px rgba(20, 32, 43, 0.12);
}

@media (max-width: 991px) {
    .ghvm-gallery .edu-gallery-grid.masonry-item,
    .ghvm-gallery a.edu-gallery-grid.masonry-item {
        width: calc(50% - 12px) !important;
        margin: 6px !important;
    }
}

/* Sister pages without .ghvm-gallery wrapper still get mild polish via area class */
.edu-gallery-area:not(.ghvm-gallery) .isotop-button.isotop-filter {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 24px;
}
