/* Full-screen dark overlay — flex-centres its content */
#vcs-popup {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 99999999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  transition: 300ms ease-in-out;
}
#vcs-popup .shortcode-container,
#vcs-popup .elementor-widget-container {
  display: none;
}
#vcs-popup.hide {
  display: none;
}
#vcs-popup.view .popup-container {
  animation: vcs-zoom-in-zoom-out 300ms ease;
}
#vcs-popup.view .popup-container::before {
  /* loading spinner */
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 40px;
  height: 40px;
  margin: 0;
  content: "";
  border-color: #fff transparent #fff transparent;
  border-style: solid;
  border-width: 2px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: vcs-dual-ring-anime 1000ms linear infinite;
}

/* Buffering spinner — for video popups, the .view-state spinner above
 * disappears the moment we switch to .loaded, but the cloned <video>
 * elements then render BLACK frames for several seconds while the network
 * downloads enough bytes for readyState >= 2.  v2.0.53: bridge that gap
 * with an overlay so the user knows something is happening.
 *
 * v2.0.59 — spinner now lives on the #vcs-popup overlay itself (full-
 * viewport dark background) and the .popup-wrapper is hidden during
 * buffering, so the user sees a clean centred spinner *before* the
 * popup content appears, instead of the spinner being trapped inside a
 * popup-shaped box. */
#vcs-popup.vcs-buffering::after {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 100000;
  display: block;
  width: 48px;
  height: 48px;
  content: "";
  border-color: #fff transparent #fff transparent;
  border-style: solid;
  border-width: 3px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: vcs-dual-ring-anime 1000ms linear infinite;
  pointer-events: none;
}
#vcs-popup.vcs-buffering .popup-wrapper {
  /* visibility: hidden keeps the wrapper laid out so vcs_imageCompare
   * can measure the container during buffering — without it, the
   * container has width 0 and image dims collapse. */
  visibility: hidden;
}
/* v2.0.60 — visibility is the one CSS property descendants can override.
 * Theme / framework rules apparently set `visibility: visible` on
 * popup-close, leaving an X floating in front of the spinner.  Force
 * the close button off the layout entirely while buffering. */
#vcs-popup.vcs-buffering .popup-close {
  display: none !important;
}

/* The lightbox box that wraps the slider — sized to the content.
 * v2.0.60 — REVERTED v2.0.59's `width: auto` which produced a
 * circular sizing dependency (wrapper sized to content, but the
 * <img> child is position: absolute so it contributes nothing) →
 * wrapper collapsed to width 0 and the whole popup failed to render.
 * Confirmed via [VCS-DIAG] dump showing client=0x455 for both
 * popup-wrapper and popup-container in v2.0.59.  Wrapper width is
 * now corrected to hug the image via JS in popup.js after
 * vcs_imageCompare has computed the fitted dims. */
#vcs-popup .popup-wrapper {
  position: relative;
  z-index: 1000000;
  box-sizing: border-box;
  width: 90vw;
  max-width: 1920px;
  transition: 300ms ease-in-out;
}

/*
 * Close button sits on top of the image in the top-right corner.
 * v2.0.64 — selector relaxed from `.popup-wrapper .popup-close` to plain
 * `#vcs-popup .popup-close` because popup.js now moves the close button
 * INTO the .vcs-image-compare-container (so it anchors to the visible
 * content's top-right rather than the wider wrapper's top-right).
 * z-index raised so it stays above the slider handle (z-index 100) and
 * before/after images.
 */
#vcs-popup .popup-close {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 1000;
  display: block;
  padding: 25px;
  line-height: 0;
  color: #fff;
  cursor: pointer;
  transition: 0.5s;
}
#vcs-popup .popup-close:hover, #vcs-popup .popup-close:focus, #vcs-popup .popup-close:active {
  color: #f00;
}
#vcs-popup .popup-close * {
  pointer-events: none;
}

/* Container wraps the slider content — no longer full-screen */
#vcs-popup .popup-wrapper .popup-container {
  position: relative;
  width: 100%;
  overflow: hidden;
}
#vcs-popup .popup-wrapper .popup-container .popup-button,
#vcs-popup .popup-wrapper .popup-container .vcs-image-compare-wrapper {
  display: none;
}

/* Loaded state — reveal slider content */
#vcs-popup.loaded .popup-wrapper .popup-container > :first-child {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
@media screen and (max-width: 1280px) {
  #vcs-popup.loaded .popup-wrapper .popup-container > :first-child .shortcode-container,
  #vcs-popup.loaded .popup-wrapper .popup-container > :first-child .elementor-widget-container {
    display: flex;
    justify-content: center;
    align-items: center;
  }
}
#vcs-popup.loaded .popup-wrapper .popup-container .shortcode-container,
#vcs-popup.loaded .popup-wrapper .popup-container .elementor-widget-container {
  display: block;
  width: 100%;
}
#vcs-popup.loaded .popup-wrapper .popup-container .vcs-image-compare-wrapper {
  display: flex;
  justify-content: center;
}
#vcs-popup.loaded .popup-wrapper .popup-container .vcs-image-compare-wrapper,
#vcs-popup.loaded .popup-wrapper .popup-container .vcs-image-compare-wrapper .vcs-image-compare-container,
#vcs-popup.loaded .popup-wrapper .popup-container .vcs-image-compare-wrapper img {
  width: 100%;
}
#vcs-popup.loaded .popup-wrapper .popup-container .vcs-image-compare-wrapper .vcs-image-compare-container {
  max-width: inherit;
  animation: vcs-zoom-in-zoom-out 300ms ease;
}

/* Hide caption inside popup — caption belongs below the inline slider only */
#vcs-popup .vcs-caption-wrapper {
  display: none;
}

@keyframes vcs-zoom-in-zoom-out {
  0% {
    transform: scale(0.3, 0.3);
  }
  100% {
    transform: scale(1, 1);
  }
}
@keyframes vcs-dual-ring-anime {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
/* Hide the expand/popup button on mobile — popup is disabled on small screens */
@media screen and (max-width: 768px) {
  .vcs-container .popup-button,
  .vcs-triple-container .popup-button {
    display: none !important;
  }
}

/*
 * v2.0.63 — REMOVED `max-width: unset !important` for .vcs-container in popup.
 * That rule was overriding the inline `max-width` that vcs_imageCompare's
 * `adjustSliderWidth` (line 527 of jquery.vcs-image-compare.js) sets to the
 * fitted width.  With the rule, the container stayed full popup-wrapper width
 * (1928 px) while the img was correctly fitted to e.g. 1087 px — visible as
 * grey space to the right of the image (the .vcs-image-compare-wrapper has
 * `display: flex; justify-content: center` so a properly-sized container
 * gets centred automatically).
 */
#vcs-popup.loaded .vcs-container {
  width: 100%;
}
/*
 * v2.0.57 — REMOVED two rules that were squashing the popup image:
 *   #vcs-popup .vcs-image-add-height { height: 100% !important }
 *   #vcs-popup.loaded .vcs-container img { width: 100% !important }
 * They overrode the inline width/height that vcs_imageCompare's
 * popup-loaded fitting block sets, forcing the img to fill the
 * container at the wrong aspect (1920x432 instead of fitted dims).
 * Diagnosed via [VCS-DIAG] dumps in v2.0.55-56 logs.
 */
