/* gallery.css — the image gallery on the game pages, replacing slick-carousel.

   Slick cost three CDN requests (slick.css, slick-theme.css, slick.min.js) and a jQuery
   dependency to do very little: 3 slides across, 1 below 1000px, no dots. It also needed inline
   hacks on every page that used it, because its arrows sit ±25px OUTSIDE the slider and had to be
   pushed back inside the column with `margin-left: 30px`. This does the same job in CSS
   scroll-snap with no library at all, and the arrows sit in reserved gutters by design.

   Behaviour matches the review and Instagram carousels deliberately — same chevron, same gutters
   on desktop, same nothing-but-a-peeking-next-image on a phone. The thumbnails still carry
   `data-fslightbox`, so the lightbox is untouched. */

.ec-gal-wrap {
    position: relative;
}

.ec-gal-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.ec-gal-track::-webkit-scrollbar {
    display: none;
}

.ec-gal-item {
    flex: 0 0 calc(33.3333% - 8px);
    scroll-snap-align: start;
    display: block;
    /* The naturals are 320x260. Pinning the ratio keeps every thumbnail the same height even
       if a future image is cropped differently — slick let them set their own height. */
    aspect-ratio: 320 / 260;
    overflow: hidden;
    border-radius: 6px;
    background: #eceff1;
}

@supports not (aspect-ratio: 320 / 260) {
    .ec-gal-item {
        height: 0;
        padding-bottom: 81.25%;
    }
}

.ec-gal-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ec-gal-item:focus-visible {
    outline: 3px solid #4285f4;
    outline-offset: 3px;
}

/* ---- arrows + dots --------------------------------------------------------------- */

.ec-gal-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid #d5d9de;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .10);
    color: #222629;
    cursor: pointer;
    padding: 0;
}

/* Stroked chevron as a CSS mask — third copy of this block (reviews.css, instagram.css). The
   viewBox is cropped tight to the chevron so `contain` scales the shape to the full box; inside
   a square viewBox it would only fill the middle quarter and look undersized. */
.ec-gal-arrow::before {
    content: "";
    display: block;
    width: 18px;
    height: 18px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 18' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.9 1.9L8.1 9L1.9 16.1'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 18' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1.9 1.9L8.1 9L1.9 16.1'/%3E%3C/svg%3E") center / contain no-repeat;
}

.ec-gal-prev::before {
    transform: scaleX(-1);
}

.ec-gal-prev {
    left: -12px;
}

.ec-gal-next {
    right: -12px;
}

.ec-gal-arrow:hover:not(:disabled) {
    background: #f2f4f6;
}

.ec-gal-arrow:focus-visible {
    outline: 3px solid #4285f4;
    outline-offset: 2px;
}

/* At the first/last page — dimmed, not hidden. See reviews.css for the reasoning. */
.ec-gal-arrow:disabled {
    opacity: .3;
    box-shadow: none;
    cursor: default;
}

.ec-gal-arrow[hidden] {
    display: none;
}

.ec-gal-dots {
    display: flex;
    justify-content: center;
    gap: 7px;
    padding-top: 14px;
}

/* keeps the row's height when there is only one page, so the gap below does not jump */
.ec-gal-dots[hidden] {
    display: flex;
    visibility: hidden;
}

.ec-gal-dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #ccd2d8;
    cursor: pointer;
}

.ec-gal-dot[aria-current="true"] {
    background: #222629;
}

/* ---- dark sections --------------------------------------------------------------- */

/* The teamevent gallery sits on #1d1d1b. The default active dot is #222629, which is all but
   invisible there, and the loading placeholder would flash light grey behind every thumbnail.
   The arrows need nothing: a white circle reads fine on a dark ground. */
.ec-gal-dark .ec-gal-item {
    background: #2b2b29;
}

.ec-gal-dark .ec-gal-dot {
    background: rgba(255, 255, 255, .35);
}

/* The site accent — the same #ffd166 as .btn.btn-secondary. White would also have been legible
   here, but the accent is what the rest of the site uses to mark the live thing. */
.ec-gal-dark .ec-gal-dot[aria-current="true"] {
    background: #ffd166;
}

/* ---- responsive ------------------------------------------------------------------ */

/* Desktop: arrows in their own gutters rather than over the thumbnails. Narrower than the
   44px the full-width carousels use, because this gallery sits in a col-lg-7 and every pixel
   of gutter comes straight out of an already-narrow thumbnail. */
@media (min-width: 992px) {
    .ec-gal-wrap {
        padding: 0 40px;
    }

    .ec-gal-prev {
        left: 0;
    }

    .ec-gal-next {
        right: 0;
    }
}

@media (max-width: 991px) {
    .ec-gal-item {
        flex-basis: calc(50% - 6px);
    }
}

@media (max-width: 575px) {
    /* a sliver of the next image is what tells people it swipes */
    .ec-gal-item {
        flex-basis: calc(78% - 6px);
    }

    .ec-gal-arrow,
    .ec-gal-dots,
    .ec-gal-dots[hidden] {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ec-gal-track {
        scroll-behavior: auto;
    }
}
