/* === REEF 3D PRODUCT IMAGE CAROUSEL === */

/* The card image becomes a button when the product has more than one
   photo. It is a button, not a div with a click handler, so it is
   keyboard reachable and announces itself to a screen reader. */
.product-media {
  display: block;
  position: relative;
  width: 100%;
  padding: 0;
  border: 0;
  margin: 0;
  background: #e8e0d4;
  cursor: zoom-in;
  line-height: 0;
}

.product-media .product-img {
  display: block;
}

/* The count badge sits in the corner of the image. It tells the
   visitor there is more to see before they click. */
.product-photo-count {
  position: absolute;
  right: 0.6rem;
  bottom: 0.6rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(10, 74, 110, 0.82);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.product-media:hover .product-photo-count,
.product-media:focus-visible .product-photo-count {
  background: rgba(255, 107, 53, 0.92);
}

/* A visible focus ring. The button has no default outline once the
   border is removed, so it is drawn explicitly. */
.product-media:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: -3px;
}

/* ---- the lightbox ---- */

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  background: rgba(6, 26, 38, 0.92);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.gallery-lightbox[hidden] {
  display: none;
}

.gallery-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 900px;
  min-height: 0;
  flex: 1;
}

.gallery-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  background: #0d2a3a;
}

/* The video slide. It is shown in the same stage as the photos, with
   the same size rules, so the carousel does not jump when the slide
   changes. */
.gallery-stage video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  background: #0d2a3a;
}

.gallery-stage img[hidden],
.gallery-stage video[hidden] {
  display: none;
}

/* The close button sits in the top right of the lightbox, not over
   the image, so it never covers the product. */
.gallery-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.gallery-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.gallery-close:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 2px;
}

/* The previous and next arrows. They are large enough to hit on a
   phone and sit outside the image on wide screens. */
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.gallery-nav:hover {
  background: rgba(255, 255, 255, 0.28);
}

.gallery-nav:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 2px;
}

.gallery-nav--prev {
  left: 0.25rem;
}

.gallery-nav--next {
  right: 0.25rem;
}

/* Hidden when there is only one photo to show. */
.gallery-nav[hidden] {
  display: none;
}

.gallery-caption {
  color: #d8e6ee;
  font-size: 0.9rem;
  text-align: center;
  min-height: 1.4em;
  margin: 0;
}

.gallery-counter {
  color: #8fb4c7;
  font-size: 0.8rem;
  text-align: center;
  margin: 0;
}

/* The thumbnails. Clicking one jumps to that photo. */
.gallery-thumbs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gallery-thumbs button {
  width: 56px;
  height: 56px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  background: none;
  cursor: pointer;
  opacity: 0.6;
}

.gallery-thumbs button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* A video slide cannot be shown as a thumbnail image, so the poster
   frame is used with a play badge on top of it. */
.gallery-thumbs button {
  position: relative;
}

.gallery-thumb-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

.gallery-thumb-blank {
  display: block;
  width: 100%;
  height: 100%;
  background: #0d2a3a;
}

.gallery-thumbs button:hover {
  opacity: 0.9;
}

.gallery-thumbs button[aria-current="true"] {
  border-color: var(--coral);
  opacity: 1;
}

.gallery-thumbs button:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 2px;
}

@media (max-width: 600px) {
  .gallery-nav {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 1.2rem;
  }

  .gallery-thumbs button {
    width: 44px;
    height: 44px;
  }
}
