/* Lightbox Carousel */
.lightbox-carousel {
  --lightbox-carousel-gap: 24px;
  --lightbox-carousel-slide-width: calc((100% - 2 * var(--lightbox-carousel-gap)) / 3);
  --lightbox-carousel-active-scale: 1.08;
  --lightbox-carousel-arrow-size: 38px;
  /* Keep the entire control 12px outside the centred, scaled desktop slide. */
  --lightbox-carousel-arrow-offset: calc(
    (100% - var(--lightbox-carousel-slide-width) * var(--lightbox-carousel-active-scale)) / 2 - var(--lightbox-carousel-arrow-size) - 12px
  );
  --lightbox-carousel-padding: clamp(36px, 6vw, 90px);
  position: relative;
  padding: var(--lightbox-carousel-padding) 0;
  overflow: hidden;
}

.tabbed-tables + .lightbox-carousel.lightbox-carousel--full-bleed {
  padding-top: 0;
}

.lightbox-carousel__diagonal-background {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.lightbox-carousel__diagonal-background svg {
  display: block;
  width: 100%;
  height: 100%;
}

.lightbox-carousel__diagonal-background polygon {
  fill: var(--blue);
}

.lightbox-carousel__diagonal-background--bottom {
  transform: rotate(180deg);
}

.lightbox-carousel > .grid-container,
.lightbox-carousel > .lightbox-carousel__navigation {
  position: relative;
  z-index: 1;
}

.lightbox-carousel--diagonal-top .lightbox-carousel__heading {
  color: var(--white);
}

.lightbox-carousel__heading {
  margin-top: 0;
  color: var(--black);
  font-size: 24px;
}

.lightbox-carousel__frame {
  position: relative;
  display: flex;
  align-items: center;
}

.lightbox-carousel__track {
  width: 100%;
  padding: 28px 0;
  /* Clip neighbouring slides horizontally without cutting off image shadows. */
  overflow-x: clip;
  overflow-y: visible;
  touch-action: pan-y;
}

.lightbox-carousel__track-list {
  display: flex;
  gap: var(--lightbox-carousel-gap);
  transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.lightbox-carousel__slide {
  flex: 0 0 var(--lightbox-carousel-slide-width);
  min-width: 0;
  margin: 0;
  opacity: 0.55;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.lightbox-carousel__image-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.lightbox-carousel__image-button img {
  box-shadow: 0 17px 31px color-mix(in srgb, var(--black) 26%, transparent);
}

.lightbox-carousel__caption {
  margin: 16px 0 0;
  overflow-wrap: anywhere;
  opacity: 0;
  transition: opacity 180ms ease;
  text-align: center;
}

.lightbox-carousel__slide.is-active .lightbox-carousel__caption {
  opacity: 1;
}

.lightbox-carousel__slide.is-active {
  opacity: 1;
  transform: scale(var(--lightbox-carousel-active-scale));
}

.lightbox-carousel__image,
.lightbox-carousel__lightbox-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(58vw, 620px);
  object-fit: contain;
}

.lightbox-carousel__arrow {
  position: absolute;
  top: var(--lightbox-carousel-arrow-top, 50%);
  transform: translateY(-50%);
  z-index: 1;
  display: grid;
  width: var(--lightbox-carousel-arrow-size);
  height: var(--lightbox-carousel-arrow-size);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  place-items: center;
  background: var(--white);
  box-shadow: 0 2px 10px rgb(0 0 0 / 18%);
  transition: background-color 180ms ease;
}

.lightbox-carousel__arrow img,
.lightbox-carousel__dialog-arrow img {
  display: block;
  width: 20px;
  height: auto;
}

.lightbox-carousel__arrow img {
  filter: brightness(0.4) grayscale(1) sepia(1) hue-rotate(190deg) saturate(4) contrast(5);
}

.lightbox-carousel__arrow--previous img,
.lightbox-carousel__dialog-arrow--previous img {
  transform: rotate(90deg);
}
.lightbox-carousel__arrow--next img,
.lightbox-carousel__dialog-arrow--next img {
  transform: rotate(-90deg);
}
.lightbox-carousel__arrow:hover {
  background: var(--blue);
}
.lightbox-carousel__arrow:hover img {
  filter: none;
}

.lightbox-carousel__arrow--previous {
  left: var(--lightbox-carousel-arrow-offset);
}
.lightbox-carousel__arrow--next {
  right: var(--lightbox-carousel-arrow-offset);
}

.lightbox-carousel__navigation {
  display: flex;
  justify-content: center;
}
.lightbox-carousel__bullets {
  display: flex;
  gap: 14px;
  padding-top: 16px;
}

.lightbox-carousel__bullet {
  width: 12px;
  height: 12px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #c7c7c7;
}

.lightbox-carousel__bullet.is-active {
  background: var(--blue);
}

.lightbox-carousel__dialog {
  width: 100vw;
  max-width: none;
  height: 100vh;
  /* Follow Safari's viewport as its browser toolbar expands or retracts. */
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 70px max(24px, 5vw) 30px;
  border: 0;
  background: #1a1436db;
  backdrop-filter: sepia(1) hue-rotate(190deg) blur(3px);
  color: var(--white);
}

.lightbox-carousel__dialog::backdrop {
  background: transparent;
}
.lightbox-carousel__dialog-toolbar {
  position: absolute;
  top: 20px;
  right: max(24px, 5vw);
  left: max(24px, 5vw);
  display: flex;
  justify-content: space-between;
}
.lightbox-carousel__dialog-toolbar button {
  min-width: 42px;
  min-height: 42px;
  margin: 0;
  border: 0;
  background: transparent;
  color: var(--white);
  font-size: 28px;
}
.lightbox-carousel__dialog-toolbar .lightbox-carousel__dialog-arrow {
  display: grid;
  border: 1px solid rgb(255 255 255 / 45%);
  border-radius: 50%;
  place-items: center;
}
.lightbox-carousel__dialog-toolbar .lightbox-carousel__dialog-arrow:hover {
  background: rgb(255 255 255 / 15%);
}
.lightbox-carousel__dialog-toolbar button:focus,
.lightbox-carousel__dialog-toolbar button:focus-visible {
  outline: none;
}
.lightbox-carousel__dialog-toolbar .lightbox-carousel__close {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  text-transform: uppercase;
  font-size: 14px !important;
  background: var(--blue);
  color: var(--white);
  border-radius: 999px;
  transition: none;
}
.lightbox-carousel__dialog-toolbar .lightbox-carousel__close:hover {
  background: var(--dark-blue);
  color: var(--white);
}
.lightbox-carousel__close svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
.lightbox-carousel__lightbox-track {
  height: 100%;
  touch-action: pan-y;
}
.lightbox-carousel__lightbox-slide {
  display: grid;
  height: 100%;
  margin: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 16px;
  place-items: center;
}
.lightbox-carousel__lightbox-slide[hidden] {
  display: none;
}
.lightbox-carousel__lightbox-image {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: calc(100vh - 210px);
  max-height: calc(100dvh - 210px);
  transition:
    filter 220ms ease,
    opacity 220ms ease;
}
.lightbox-carousel__lightbox-image.is-upgrading {
  filter: blur(8px);
  opacity: 0.72;
}
.lightbox-carousel__lightbox-slide figcaption {
  align-self: stretch;
  min-height: 42px;
  text-align: center;
}

.lightbox-carousel__track:focus {
  outline: none;
}

.lightbox-carousel button:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
.lightbox-carousel__dialog button:focus-visible {
  outline-color: var(--white);
}
/* Keep initial focus on Close; keyboard input restores its visible indicator. */
.lightbox-carousel__dialog.is-initial-focus .lightbox-carousel__close:focus {
  outline: none;
}

@media screen and (max-width: 49.99875em) {
  .lightbox-carousel .grid-container {
    padding-right: 0;
    padding-left: 0;
  }
  .lightbox-carousel__heading {
    margin-right: 0;
    margin-left: 0;
    font-size: 20px;
  }
  .lightbox-carousel__track-list {
    gap: 0;
  }
  .lightbox-carousel__slide {
    flex-basis: 86vw;
    opacity: 0.3;
  }
  .lightbox-carousel__slide.is-active {
    transform: none;
    opacity: 1;
  }
  .lightbox-carousel__image {
    max-height: 70vw;
  }
  .lightbox-carousel__arrow {
    display: none;
  }
}

/* Keep the active desktop image aligned with the container, with neighbours
   extending into the page gutters. The section clips at the viewport edges. */
@media screen and (min-width: 50em) {
  .lightbox-carousel--full-bleed {
    --lightbox-carousel-arrow-offset: 12px;
  }
  .lightbox-carousel--full-bleed .lightbox-carousel__track {
    overflow: visible;
  }
  .lightbox-carousel--full-bleed .lightbox-carousel__track-list {
    align-items: center;
  }
  .lightbox-carousel--full-bleed .lightbox-carousel__slide {
    flex-basis: 100%;
  }
  .lightbox-carousel--full-bleed .lightbox-carousel__slide.is-active {
    transform: none;
  }
  .lightbox-carousel--full-bleed .lightbox-carousel__image {
    max-height: none;
  }
  .lightbox-carousel--full-bleed > .lightbox-carousel__navigation {
    position: absolute;
    right: 0;
    bottom: calc(var(--lightbox-carousel-padding) + 48px);
    left: 0;
  }
  .lightbox-carousel--full-bleed .lightbox-carousel__bullets {
    padding-top: 0;
  }
  .lightbox-carousel--full-bleed .lightbox-carousel__bullet:not(.is-active) {
    background: var(--white);
  }
}

/* The 78rem container plus room for both controls and their outside gaps. */
@media screen and (min-width: 84em) {
  .lightbox-carousel--full-bleed {
    --lightbox-carousel-arrow-offset: calc(-1 * (var(--lightbox-carousel-arrow-size) + 12px));
  }
}
