/* Moved from inline <style> in includes/part.gallery.cfm. */

/* min-width:0 all the way down. Every one of these is a flex/grid item, and
   the default automatic minimum size means an item can't be narrower than its
   own content - so the thumbnail strip (12 x 80px = ~1050px on a Turbosmart
   part) propagated its width up through the gallery into the page grid and
   squeezed the basket column. The strip scrolls; it must be allowed to be
   narrower than the sum of its thumbnails. */
.part-gallery { display: flex; flex-direction: column; gap: 12px; width: 100%; min-width: 0; max-width: 100%; }
.part-gallery__main { position: relative; width: 100%; min-width: 0; background: #fff; }
.part-gallery__slide { display: none; width: 100%; }
.part-gallery__slide.is-active { display: block; }
.part-gallery__slide img { width: 100%; max-height: 480px; height: auto; object-fit: contain; display: block; margin: 0 auto; }
/* only the 60px micro rendition exists: 2x at most, centred on a quiet
   ground, rather than one tiny file stretched to 480px of pixels */
.part-gallery__slide img.is-tiny { width: auto; max-width: 120px; max-height: 120px; margin: 60px auto; background: #f6f6f6; padding: 16px; box-sizing: content-box; }

.part-gallery__nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 40px; height: 40px; border-radius: 50%;
    border: 1px solid #d5d5d5; background: rgba(255,255,255,.92);
    cursor: pointer; z-index: 2; font-size: 20px; line-height: 1;
    color: #333; display: flex; align-items: center; justify-content: center;
    transition: border-color .15s ease;
}
.part-gallery__nav:hover { border-color: #555; }
.part-gallery__nav--prev { left: 8px; }
.part-gallery__nav--next { right: 8px; }

/* "3 / 12" badge on the main image, so the size of the set is obvious before
   you touch anything. Hidden by the JS for a single-image gallery. */
.part-gallery__counter {
    position: absolute; right: 8px; bottom: 8px; z-index: 2;
    background: rgba(0,0,0,.62); color: #fff;
    font-size: 14px; line-height: 1; font-variant-numeric: tabular-nums;
    padding: 6px 10px; border-radius: 20px; pointer-events: none;
}

/* Thumbnail strip: a horizontal scroller with its own arrows.
   .part-gallery__strip is the positioning context for those arrows and the
   edge fades; the <ul> inside it is the thing that actually scrolls. */
.part-gallery__strip { position: relative; min-width: 0; }
.part-gallery__thumbs {
    display: flex; flex-direction: row; gap: 8px; list-style: none;
    margin: 0; padding: 2px 0 6px 0; min-width: 0;
    overflow-x: auto; overflow-y: hidden;
    scroll-behavior: smooth; scroll-snap-type: x proximity;
    scrollbar-width: thin; scrollbar-color: #c2c2c2 transparent;
}
.part-gallery__thumbs::-webkit-scrollbar { height: 6px; }
.part-gallery__thumbs::-webkit-scrollbar-track { background: transparent; }
.part-gallery__thumbs::-webkit-scrollbar-thumb { background: #c8c8c8; border-radius: 3px; }
.part-gallery__thumbs:hover::-webkit-scrollbar-thumb { background: #a5a5a5; }
.part-gallery__thumbs li { flex: 0 0 80px; margin: 0; padding: 0; scroll-snap-align: start; }
.part-gallery__thumb {
    display: block; width: 100%; padding: 0; background: #fff;
    border: 2px solid #e3e3e3; border-radius: 2px; cursor: pointer;
    overflow: hidden; transition: border-color .15s ease, opacity .15s ease;
    opacity: .75;
}
.part-gallery__thumb img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: contain; }
.part-gallery__thumb:hover, .part-gallery__thumb:focus { opacity: 1; border-color: #6e1287; outline: none; }
.part-gallery__thumb.is-active { opacity: 1; border-color: #6e1287; box-shadow: 0 0 0 1px #6e1287 inset; }

/* Strip arrows. Hidden (by the JS, via .is-hidden) when the strip isn't
   overflowing or when it's already scrolled to that end, so they only ever
   appear when there is something more to see. */
.part-gallery__strip-nav {
    position: absolute; top: calc(50% - 4px); transform: translateY(-50%);
    width: 30px; height: 30px; border-radius: 50%;
    border: 1px solid #d5d5d5; background: rgba(255,255,255,.95);
    box-shadow: 0 1px 4px rgba(0,0,0,.18);
    cursor: pointer; z-index: 3; font-size: 17px; line-height: 1;
    color: #333; display: flex; align-items: center; justify-content: center;
    padding: 0; transition: border-color .15s ease, opacity .15s ease;
}
.part-gallery__strip-nav:hover { border-color: #6e1287; color: #6e1287; }
.part-gallery__strip-nav--prev { left: 0; }
.part-gallery__strip-nav--next { right: 0; }
.part-gallery__strip-nav.is-hidden { display: none; }

/* Fades that sit under the arrows and signal "there's more this way".
   Toggled by the same JS that toggles the arrows. */
.part-gallery__strip::before,
.part-gallery__strip::after {
    content: ""; position: absolute; top: 0; bottom: 6px; width: 40px;
    z-index: 2; pointer-events: none; opacity: 0; transition: opacity .15s ease;
}
.part-gallery__strip::before { left: 0; background: linear-gradient(to right, #fff 25%, rgba(255,255,255,0)); }
.part-gallery__strip::after  { right: 0; background: linear-gradient(to left,  #fff 25%, rgba(255,255,255,0)); }
.part-gallery__strip.can-scroll-prev::before { opacity: 1; }
.part-gallery__strip.can-scroll-next::after  { opacity: 1; }

@media (max-width: 480px) {
    .part-gallery__thumbs li { flex: 0 0 64px; }
    /* Touch devices swipe the strip; the arrows just cover thumbnails. */
    .part-gallery__strip-nav { display: none; }
    .part-gallery__strip::before, .part-gallery__strip::after { width: 24px; }
}
