/* Shared media styles: cover-media (image + looping video swap), gallery, lightbox */

/* ---------- Cover Media (image + autoplay muted video) ---------- */
.cover-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;          /* gives the wrapper an intrinsic height */
    overflow: hidden;
    background: #0e1116;
    border-radius: inherit;
}
.cover-media > .cover-media__image,
.cover-media > .cover-media__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Single-page contexts: let the cover claim the container's full size */
.single-blog__featured-image .cover-media,
.single-content__image .cover-media {
    aspect-ratio: 16 / 9;
}
.cover-media > .cover-media__video {
    z-index: 2;
    opacity: 0;
    transition: opacity 600ms ease;
    pointer-events: none;
}
.cover-media.is-playing > .cover-media__video {
    opacity: 1;
}

/* ---------- Media Gallery Grid ---------- */
.media-gallery {
    margin: 48px 0;
}
.media-gallery__title {
    font-family: 'Lexend', sans-serif;
    font-size: clamp(1.4rem, 2.2vw, 1.9rem);
    font-weight: 700;
    margin-bottom: 20px;
    color: #1a1a1a;
}
.media-gallery__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.media-gallery__item {
    position: relative;
    aspect-ratio: 1 / 1;
    border: 0;
    padding: 0;
    border-radius: 10px;
    overflow: hidden;
    background: #ececec;
    cursor: pointer;
    transition: transform 200ms ease, box-shadow 200ms ease;
}
.media-gallery__item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
.media-gallery__item img,
.media-gallery__item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.media-gallery__item.is-video::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0,0,0,0.4), rgba(0,0,0,0.05) 50%);
    pointer-events: none;
}
.media-gallery__play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0,0,0,0.6);
    z-index: 1;
}

/* ---------- Lightbox ---------- */
.media-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
.media-lightbox[hidden] {
    display: none;
}
.media-lightbox__stage {
    max-width: min(1100px, 95vw);
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.media-lightbox__stage img,
.media-lightbox__stage video {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 6px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}
.media-lightbox__close {
    position: absolute;
    top: 18px;
    right: 22px;
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 2.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 4px;
    transition: background 150ms ease;
}
.media-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ---------- Listing card cover (image+video) ---------- */
.card-cover {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

/* Card containers that previously relied on the <img>'s aspect-ratio need it here now */
.ev-archive-card__media .card-cover {
    aspect-ratio: 16 / 10;
}
.blog-card__image .card-cover {
    aspect-ratio: 16 / 10;
}

/* Home sports slider — wrapper absolutely fills the .discipline-card__link,
   sits behind the overlay + content (which paint above it in DOM order).
   The existing :hover scale rule on .discipline-card__image still applies. */
.discipline-card__media.card-cover {
    position: absolute;
    inset: 0;
    border-radius: inherit;
}
.card-cover__img,
.card-cover__vid {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.card-cover__vid {
    opacity: 0;
    transition: opacity 400ms ease;
    pointer-events: none;
}
.card-cover.is-playing .card-cover__vid {
    opacity: 1;
}
