/* Carousel controls added on top of the existing carousel.css. */
.carousel[data-carousel-keyboard]:focus-visible {
  outline: 3px solid var(--q2-link, #4775a7);
  outline-offset: 3px;
}

.carousel__tools {
  position: absolute;
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: 4.75rem;
  z-index: 45;
  display: flex;
  gap: 0.5rem;
}

.carousel__tool {
  display: grid;
  width: 2.35rem;
  min-width: 0;
  height: 2.35rem;
  padding: 0;
  margin: 0;
  place-items: center;
  color: #fff;
  background: rgba(8, 9, 11, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  box-shadow: 0 0.2rem 0.7rem rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.carousel__tool:hover,
.carousel__tool:focus-visible {
  color: #fff;
  background: rgba(36, 36, 68, 0.95);
  transform: scale(1.06);
}

.carousel__tool--info span {
  font-family: Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  font-style: italic;
  line-height: 1;
}

.carousel__tool--expand span {
  font-size: 1.4rem;
  line-height: 1;
}

.carousel__tool--info[aria-expanded="false"] {
  opacity: 0.7;
}

.carousel__metadata[hidden] {
  display: none !important;
}

/* Hide carousel chrome until mouse hover or keyboard focus on pointer devices.
   Touch devices keep every control visible because they cannot hover reliably. */
@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
  .carousel__controls,
  .carousel__indicators,
  .carousel__tools {
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.18s ease, visibility 0s linear 0.18s;
  }

  .carousel:hover .carousel__controls,
  .carousel:hover .carousel__indicators,
  .carousel:hover .carousel__tools,
  .carousel:focus-within .carousel__controls,
  .carousel:focus-within .carousel__indicators,
  .carousel:focus-within .carousel__tools {
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
  }
}

/* Full-screen lightbox. */
.fsg-lightbox {
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  padding: 0;
  margin: 0;
  overflow: hidden;
  color: #fff;
  background: #08090b;
  border: 0;
}

.fsg-lightbox::backdrop {
  background: #08090b;
}

.fsg-lightbox[open] {
  display: block;
}

.fsg-lightbox__figure {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  padding: 0;
  margin: 0;
}

.fsg-lightbox__image {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  object-position: center;
}

.fsg-lightbox__caption {
  position: fixed;
  right: 5rem;
  bottom: max(1rem, env(safe-area-inset-bottom));
  left: 5rem;
  z-index: 2;
  width: fit-content;
  max-width: calc(100vw - 10rem);
  padding: 0.45rem 0.7rem;
  margin-inline: auto;
  color: #fff;
  font-size: 0.85rem;
  line-height: 1.35;
  text-align: center;
  background: rgba(8, 9, 11, 0.82);
  border-radius: 0.4rem;
}

.fsg-lightbox__caption:empty {
  display: none;
}

.fsg-lightbox__close,
.fsg-lightbox__nav {
  position: fixed;
  z-index: 3;
  display: grid;
  width: 2.75rem;
  min-width: 0;
  height: 2.75rem;
  padding: 0;
  margin: 0;
  place-items: center;
  color: #fff;
  line-height: 1;
  background: rgba(8, 9, 11, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  cursor: pointer;
}

.fsg-lightbox__close:hover,
.fsg-lightbox__close:focus-visible,
.fsg-lightbox__nav:hover,
.fsg-lightbox__nav:focus-visible {
  color: #fff;
  background: rgba(36, 36, 68, 0.95);
}

.fsg-lightbox__close {
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  font-size: 1.9rem;
}

.fsg-lightbox__nav {
  top: 50%;
  font-size: 2rem;
  transform: translateY(-50%);
}

.fsg-lightbox__nav--previous {
  left: max(0.75rem, env(safe-area-inset-left));
}

.fsg-lightbox__nav--next {
  right: max(0.75rem, env(safe-area-inset-right));
}

.fsg-lightbox__nav[hidden] {
  display: none;
}

body.has-open-lightbox {
  overflow: hidden;
}

@media (max-width: 767px) {
  .carousel__tools {
    right: max(0.5rem, env(safe-area-inset-right));
    bottom: 3.75rem;
  }

  .carousel__metadata {
    right: max(0.5rem, env(safe-area-inset-right));
    bottom: 6.5rem;
    left: auto;
    width: min(16rem, calc(100% - 1rem));
    max-height: 32%;
    padding: 0.5rem 0.6rem;
    overflow: auto;
    color: #fff;
    background: rgba(8, 9, 11, 0.94);
    border-color: rgba(255, 255, 255, 0.32);
    opacity: 1;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .carousel__metadata-title {
    font-size: 0.8rem;
    line-height: 1.25;
  }

  .carousel__metadata-description {
    display: none;
  }

  .carousel__metadata-details {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.68rem;
    line-height: 1.25;
  }

  .carousel__metadata-source {
    margin-top: 0.25rem;
    font-size: 0.68rem;
  }

  .fsg-lightbox__caption {
    right: 4.25rem;
    left: 4.25rem;
    max-width: calc(100vw - 8.5rem);
    font-size: 0.75rem;
  }

  .fsg-lightbox__nav {
    width: 2.4rem;
    height: 2.4rem;
  }
}
