/**
 * The gallery slider.
 *
 * The layout is steered by CSS variables on .bv-galleri-stage, which the widget writes per
 * breakpoint (see Bv_Gallery::POSITIONS). The defaults here are the thumbnails below.
 *
 * Everything is scoped with .bv-galleri in front, which beats `.elementor img` and the
 * button styles of the theme and the Elementor kit, while the widget's own selectors
 * ({{WRAPPER}} …) still beat this.
 */

.bv-galleri {
  --bv-g-arrow-offset: 16px;
  --bv-g-dot: 8px;
  --bv-g-dot-active: 24px;
  --bv-g-speed: 500ms;
  position: relative;
  box-sizing: border-box;
}

.bv-galleri *,
.bv-galleri *::before,
.bv-galleri *::after {
  box-sizing: border-box;
}

/* ---------------------------------------------------------------------
 * Stage: the main image and the thumbnails
 * ------------------------------------------------------------------ */

.bv-galleri-stage {
  --bv-g-dir: column;
  --bv-g-axis: x;
  --bv-g-display: block;
  --bv-g-position: relative;
  --bv-g-basis: auto;
  --bv-g-track: relative;
  --bv-g-track-dir: row;
  --bv-g-overlay: 0;
  --bv-g-n: 5;
  --bv-g-gap: 10px;
  --bv-g-thumb-gap: 8px;
  position: relative;
  display: flex;
  flex-direction: var(--bv-g-dir);
  gap: var(--bv-g-gap);
}

.bv-galleri-main {
  /* How far up what sits at the bottom of the image must go to clear a strip lying on it */
  --bv-g-lift: calc(var(--bv-g-overlay) * var(--bv-g-thumbs-h, 0px));
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

.bv-galleri-viewport {
  position: relative;
  overflow: hidden;
  aspect-ratio: var(--bv-g-ratio, 3 / 2);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  /* Keeps the rounded corners clipping the track while it moves */
  isolation: isolate;
}

.bv-galleri--zoomable .bv-galleri-viewport {
  cursor: zoom-in;
}

.bv-galleri.is-dragging .bv-galleri-viewport {
  cursor: grabbing;
}

.bv-galleri-track {
  display: flex;
  height: 100%;
  gap: var(--bv-g-slide-gap, 0px);
  will-change: transform;
}

.bv-galleri .bv-galleri-slide {
  position: relative;
  flex: 0 0 100%;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
}

.bv-galleri .bv-galleri-img {
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  object-fit: cover;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Fade: the slides lie on top of each other */

.bv-galleri--fade .bv-galleri-track {
  position: relative;
  display: block;
}

.bv-galleri--fade .bv-galleri-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--bv-g-speed) ease;
}

.bv-galleri--fade .bv-galleri-slide.is-active {
  z-index: 1;
  opacity: 1;
}

/* ---------------------------------------------------------------------
 * Thumbnails
 * ------------------------------------------------------------------ */

.bv-galleri-thumbs {
  position: var(--bv-g-position);
  /* Relative with all offsets at 0 moves nothing; absolute puts it over the image */
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  display: var(--bv-g-display);
  flex: 0 0 var(--bv-g-basis);
  min-width: 0;
  min-height: 0;
  padding: calc(var(--bv-g-overlay) * var(--bv-g-overlay-pad, 16px));
}

/* The fade behind a strip that lies on the image */
.bv-galleri-thumbs::before {
  content: "";
  position: absolute;
  inset: -40px 0 0;
  z-index: -1;
  background: linear-gradient(to top, var(--bv-g-overlay-bg, rgba(0, 0, 0, 0.55)), transparent);
  opacity: var(--bv-g-overlay);
  pointer-events: none;
}

.bv-galleri-thumbs-track {
  /* Absolute beside the image, so a long strip cannot make the stage taller */
  position: var(--bv-g-track);
  inset: 0;
  display: flex;
  flex-direction: var(--bv-g-track-dir);
  gap: var(--bv-g-thumb-gap);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.bv-galleri-thumbs-track::-webkit-scrollbar {
  display: none;
}

.bv-galleri-thumbs-track.is-dragging {
  cursor: grabbing;
}

.bv-galleri .bv-galleri-thumb {
  position: relative;
  display: block;
  flex: 0 0 calc((100% - (var(--bv-g-n) - 1) * var(--bv-g-thumb-gap)) / var(--bv-g-n));
  min-width: 0;
  min-height: 0;
  /* Beside the image the height comes from the count, so the ratio is left out there */
  aspect-ratio: var(--bv-g-thumb-ar, var(--bv-g-thumb-ratio, 4 / 3));
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 6px;
  background: none;
  box-shadow: none;
  color: inherit;
  line-height: 0;
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.bv-galleri .bv-galleri-thumb:hover,
.bv-galleri .bv-galleri-thumb:focus {
  background: none;
  opacity: 0.85;
}

.bv-galleri .bv-galleri-thumb.is-active {
  border-color: currentColor;
  opacity: 1;
}

.bv-galleri .bv-galleri-thumb:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -4px;
}

.bv-galleri .bv-galleri-thumb-img {
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: 4px;
  box-shadow: none;
  object-fit: cover;
  -webkit-user-drag: none;
  pointer-events: none;
  transition: transform 0.3s ease;
}

/* ---------------------------------------------------------------------
 * Arrows
 * ------------------------------------------------------------------ */

.bv-galleri-arrows {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.bv-galleri .bv-galleri-arrow {
  position: absolute;
  top: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0 solid transparent;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  color: #111;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  transform: translateY(-50%);
  transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.bv-galleri .bv-galleri-arrow:hover,
.bv-galleri .bv-galleri-arrow:focus {
  background-color: #fff;
  color: #111;
}

.bv-galleri .bv-galleri-arrow:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.bv-galleri .bv-galleri-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.bv-galleri-arrow svg,
.bv-galleri-arrow i {
  display: block;
  width: 1em;
  height: 1em;
  font-size: inherit;
}

.bv-galleri-arrow--prev {
  left: var(--bv-g-arrow-offset);
}

.bv-galleri-arrow--next {
  right: var(--bv-g-arrow-offset);
}

/* Grouped: the two side by side in a corner */

.bv-galleri--arrows-bottom-right .bv-galleri-arrows,
.bv-galleri--arrows-bottom-left .bv-galleri-arrows,
.bv-galleri--arrows-bottom-center .bv-galleri-arrows {
  inset: auto;
  bottom: calc(var(--bv-g-arrow-offset) + var(--bv-g-lift));
  display: flex;
  gap: 8px;
}

.bv-galleri--arrows-bottom-right .bv-galleri-arrows {
  right: var(--bv-g-arrow-offset);
}

.bv-galleri--arrows-bottom-left .bv-galleri-arrows {
  left: var(--bv-g-arrow-offset);
}

.bv-galleri--arrows-bottom-center .bv-galleri-arrows {
  left: 50%;
  transform: translateX(-50%);
}

.bv-galleri--arrows-bottom-right .bv-galleri-arrow,
.bv-galleri--arrows-bottom-left .bv-galleri-arrow,
.bv-galleri--arrows-bottom-center .bv-galleri-arrow {
  position: static;
  transform: none;
}

/* Only on hover, except where there is no hover */

@media (hover: hover) {
  .bv-galleri--arrows-hover .bv-galleri-arrow,
  .bv-galleri--arrows-hover .bv-galleri-arrow:disabled {
    opacity: 0;
  }

  .bv-galleri--arrows-hover .bv-galleri-main:hover .bv-galleri-arrow,
  .bv-galleri--arrows-hover .bv-galleri-main:focus-within .bv-galleri-arrow {
    opacity: 1;
  }

  .bv-galleri--arrows-hover .bv-galleri-main:hover .bv-galleri-arrow:disabled,
  .bv-galleri--arrows-hover .bv-galleri-main:focus-within .bv-galleri-arrow:disabled {
    opacity: 0.35;
  }
}

/* ---------------------------------------------------------------------
 * Counter, expand, dots, progress
 * ------------------------------------------------------------------ */

.bv-galleri-counter {
  position: absolute;
  z-index: 4;
  display: flex;
  gap: 0.3em;
  padding: 4px 10px;
  border-radius: 999px;
  background-color: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  pointer-events: none;
}

.bv-galleri--counter-top-left .bv-galleri-counter {
  top: 16px;
  left: 16px;
}

.bv-galleri--counter-top-right .bv-galleri-counter {
  top: 16px;
  right: 16px;
}

.bv-galleri--counter-bottom-left .bv-galleri-counter {
  bottom: calc(16px + var(--bv-g-lift));
  left: 16px;
}

.bv-galleri--counter-bottom-right .bv-galleri-counter {
  right: 16px;
  bottom: calc(16px + var(--bv-g-lift));
}

.bv-galleri .bv-galleri-expand {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.bv-galleri .bv-galleri-expand:hover,
.bv-galleri .bv-galleri-expand:focus {
  background-color: rgba(0, 0, 0, 0.7);
  color: #fff;
}

.bv-galleri-expand svg {
  display: block;
  width: 1em;
  height: 1em;
}

/* The counter takes the corner the button would otherwise have */
.bv-galleri--counter-top-right .bv-galleri-expand {
  right: auto;
  left: 16px;
}

.bv-galleri-dots {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.bv-galleri-main > .bv-galleri-dots {
  position: absolute;
  right: 16px;
  bottom: calc(16px + var(--bv-g-lift));
  left: 16px;
  z-index: 4;
  pointer-events: none;
}

.bv-galleri > .bv-galleri-dots {
  margin-top: 14px;
}

.bv-galleri .bv-galleri-dot {
  display: block;
  width: var(--bv-g-dot);
  height: var(--bv-g-dot);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background-color: rgba(0, 0, 0, 0.25);
  box-shadow: none;
  cursor: pointer;
  pointer-events: auto;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.bv-galleri-main > .bv-galleri-dots .bv-galleri-dot {
  background-color: rgba(255, 255, 255, 0.55);
}

.bv-galleri .bv-galleri-dot.is-active {
  width: var(--bv-g-dot-active);
  background-color: #111;
}

.bv-galleri-main > .bv-galleri-dots .bv-galleri-dot.is-active {
  background-color: #fff;
}

/* Placed by --bv-g-progress-x/-y/-w, which the widget sets; the alignment and the edge it
 * sits at are declarations from the widget that use the same variables */
.bv-galleri-progress {
  position: absolute;
  bottom: var(--bv-g-progress-y, 0px);
  left: var(--bv-g-progress-x, 0px);
  z-index: 5;
  width: min(var(--bv-g-progress-w, 100%), calc(100% - 2 * var(--bv-g-progress-x, 0px)));
  height: 3px;
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.3);
  pointer-events: none;
}

/* Moved in from the left rather than scaled, so a rounded end keeps its shape */
.bv-galleri-progress-bar {
  display: block;
  width: 100%;
  height: 100%;
  background-color: #fff;
  transform: translateX(-100%);
}

/* ---------------------------------------------------------------------
 * Captions
 * ------------------------------------------------------------------ */

.bv-galleri .bv-galleri-caption {
  position: absolute;
  right: 0;
  bottom: var(--bv-g-lift);
  left: 0;
  z-index: 2;
  margin: 0;
  padding: 40px 20px 16px;
  background: linear-gradient(to top, var(--bv-g-caption-bg, rgba(0, 0, 0, 0.6)), transparent);
  color: #fff;
  font-size: 15px;
  line-height: 1.4;
  pointer-events: none;
}

.bv-galleri-caption-below {
  min-height: 1.4em;
  padding: 10px 0 0;
  background: var(--bv-g-caption-bg, transparent);
  line-height: 1.4;
}

.bv-galleri-caption-below:empty {
  display: none;
}

/* ---------------------------------------------------------------------
 * Editor hint
 * ------------------------------------------------------------------ */

.bv-galleri-tom {
  padding: 40px 20px;
  border: 2px dashed rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  color: rgba(0, 0, 0, 0.6);
  font-size: 14px;
  text-align: center;
}

/* ---------------------------------------------------------------------
 * Lightbox
 * ------------------------------------------------------------------ */

html.bv-galleri-laast,
html.bv-galleri-laast body {
  overflow: hidden;
}

.bv-galleri-lightbox {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  padding: 16px;
  background-color: var(--bv-g-lb-bg, rgba(12, 12, 12, 0.96));
  color: var(--bv-g-lb-color, #fff);
  opacity: 0;
  visibility: hidden;
  /* Hidden only once it has faded out */
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}

/* Visible at once, so the close button can take focus in the same frame as it opens */
.bv-galleri-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease, visibility 0s;
}

.bv-galleri-lightbox .bv-galleri--lightbox {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  width: 100%;
}

.bv-galleri-lightbox-bar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
}

.bv-galleri-lightbox-counter {
  display: flex;
  gap: 0.3em;
  padding-left: 4px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}

.bv-galleri--lightbox .bv-galleri-stage {
  --bv-g-dir: column;
  --bv-g-axis: x;
  --bv-g-display: block;
  --bv-g-position: relative;
  --bv-g-basis: auto;
  --bv-g-track: relative;
  --bv-g-track-dir: row;
  --bv-g-overlay: 0;
  --bv-g-gap: 12px;
  --bv-g-thumb-gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
}

.bv-galleri--lightbox .bv-galleri-main {
  display: flex;
  flex-direction: column;
}

.bv-galleri--lightbox .bv-galleri-viewport {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  aspect-ratio: auto;
  --bv-g-slide-gap: 24px;
}

.bv-galleri--lightbox .bv-galleri-img {
  object-fit: contain;
}

.bv-galleri--lightbox .bv-galleri-slide {
  display: flex;
  align-items: center;
  justify-content: center;
}

.bv-galleri--lightbox .bv-galleri-slide .bv-galleri-img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  pointer-events: auto;
}

.bv-galleri-lightbox .bv-galleri-arrow,
.bv-galleri-lightbox .bv-galleri-lightbox-close {
  background-color: var(--bv-g-lb-button-bg, rgba(255, 255, 255, 0.12));
  box-shadow: none;
  color: inherit;
}

.bv-galleri-lightbox .bv-galleri-arrow:hover,
.bv-galleri-lightbox .bv-galleri-arrow:focus,
.bv-galleri-lightbox .bv-galleri-lightbox-close:hover,
.bv-galleri-lightbox .bv-galleri-lightbox-close:focus {
  background-color: var(--bv-g-lb-button-bg, rgba(255, 255, 255, 0.22));
  color: inherit;
}

.bv-galleri-lightbox .bv-galleri-lightbox-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
}

.bv-galleri-lightbox-close svg {
  display: block;
  width: 1em;
  height: 1em;
}

.bv-galleri-lightbox .bv-galleri-lightbox-close:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.bv-galleri--lightbox .bv-galleri-thumbs {
  flex: 0 0 auto;
}

.bv-galleri--lightbox .bv-galleri-thumb {
  flex: 0 0 76px;
  aspect-ratio: 4 / 3;
}

/* Centred while they fit; the auto margins give way once the strip scrolls */
.bv-galleri--lightbox .bv-galleri-thumb:first-child {
  margin-left: auto;
}

.bv-galleri--lightbox .bv-galleri-thumb:last-child {
  margin-right: auto;
}

.bv-galleri--lightbox .bv-galleri-thumb.is-active {
  border-color: var(--bv-g-lb-active, #fff);
}

.bv-galleri--lightbox .bv-galleri-caption-below {
  flex: 0 0 auto;
  padding: 0;
  background: none;
  font-size: 14px;
  text-align: center;
  opacity: 0.85;
}

@media (max-width: 767px) {
  .bv-galleri-lightbox {
    padding: 8px;
  }

  .bv-galleri-lightbox .bv-galleri-arrow {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }

  .bv-galleri--lightbox .bv-galleri-thumb {
    flex-basis: 60px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bv-galleri *,
  .bv-galleri-lightbox {
    transition-duration: 0s !important;
  }
}
