/* Easy Before After Slider: shared by the admin preview, /preview, the theme
   block and the embed. Every rule is scoped under .eba so nothing leaks into
   the theme; merchants override with the same variables. */

.eba {
  --eba-accent: #146ef5;
  --eba-handle: #ffffff;
  --eba-label-bg: rgba(0, 0, 0, 0.6);
  --eba-label-color: #ffffff;
  --eba-handle-size: 44px;
  --eba-divider: 3px;
  --eba-radius: 12px;
  --eba-max: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  max-width: var(--eba-max);
  font-family: inherit;
  color: inherit;
}
.eba *, .eba *::before, .eba *::after { box-sizing: inherit; }
.eba__heading { margin: 0 0 0.75rem; font-size: 1.5rem; line-height: 1.2; }

/* Gallery track: one pair per "page", swiped with the nav below it. */
.eba__track { display: flex; overflow: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; }
.eba__track::-webkit-scrollbar { display: none; }
.eba--gallery .eba__track { overflow-x: auto; }
.eba__pair { flex: 0 0 100%; min-width: 0; margin: 0; scroll-snap-align: start; }

/* The comparison frame. The after layer defines the height (or the aspect
   ratio does); the before layer sits on top and is clipped at --eba-pos. */
.eba__frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--eba-radius);
  background: #ececef;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  cursor: ew-resize;
}
.eba--vertical .eba__frame { cursor: ns-resize; }
.eba__layer--after { position: relative; height: 100%; }
.eba__layer--before { position: absolute; inset: 0; }
.eba__frame--auto .eba__layer--after { height: auto; }
.eba__media { display: block; width: 100%; height: 100%; object-fit: var(--eba-fit, cover); transition: transform 0.4s ease; }
.eba__frame--auto .eba__layer--after .eba__media { height: auto; }
.eba__media--empty { min-height: 100%; background: repeating-linear-gradient(45deg, #e4e4e8 0 12px, #f2f2f5 12px 24px); }
.eba--horizontal .eba__layer--before { clip-path: inset(0 calc(100% - var(--eba-pos, 50%)) 0 0); }
.eba--vertical .eba__layer--before { clip-path: inset(0 0 calc(100% - var(--eba-pos, 50%)) 0); }
.eba--zoom .eba__frame:hover .eba__media { transform: scale(1.05); }

/* Hosted video iframes never take pointer events; the shared play button and
   the handle do. */
.eba__media--embed { border: 0; pointer-events: none; }
.eba__play {
  position: absolute; z-index: 5; right: 12px; bottom: 12px; width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center; padding: 0;
  border: 0; border-radius: 50%; background: var(--eba-handle); color: var(--eba-accent);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); cursor: pointer; touch-action: auto;
}
.eba__play:focus-visible { outline: 3px solid var(--eba-accent); outline-offset: 3px; }
.eba__play[data-state="playing"] .eba__icon-play, .eba__play[data-state="paused"] .eba__icon-pause { display: none; }

/* PDF pairs: the browser's viewer, white behind it; on phones and other coarse
   pointers the merchant's preview image replaces it when one is set. */
.eba__media--pdf { background: #fff; }
.eba__media--pdf-poster { display: none; }
@media (max-width: 767px), (pointer: coarse) {
  .eba__layer:has(.eba__media--pdf-poster) .eba__media--pdf { display: none; }
  .eba__layer:has(.eba__media--pdf-poster) .eba__media--pdf-poster { display: block; }
}

/* Divider and handle */
.eba__divider { position: absolute; z-index: 3; pointer-events: none; background: var(--eba-handle); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12); }
.eba--horizontal .eba__divider { top: 0; bottom: 0; left: var(--eba-pos, 50%); width: var(--eba-divider); transform: translateX(-50%); }
.eba--vertical .eba__divider { left: 0; right: 0; top: var(--eba-pos, 50%); height: var(--eba-divider); transform: translateY(-50%); }
.eba__handle {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: var(--eba-handle-size); height: var(--eba-handle-size);
  display: flex; align-items: center; justify-content: center; padding: 0; margin: 0;
  border: 0; border-radius: 50%; background: var(--eba-handle); color: var(--eba-accent);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); cursor: inherit; pointer-events: auto; touch-action: none;
}
.eba__handle svg { width: 50%; height: 50%; }
.eba--vertical .eba__handle svg { transform: rotate(90deg); }
.eba__handle:focus-visible { outline: 3px solid var(--eba-accent); outline-offset: 3px; }
.eba--handle-square .eba__handle { border-radius: 8px; }
.eba--handle-pill .eba__handle { border-radius: 999px; width: calc(var(--eba-handle-size) * 1.5); }
.eba--vertical.eba--handle-pill .eba__handle { width: var(--eba-handle-size); height: calc(var(--eba-handle-size) * 1.5); }
.eba--handle-bar .eba__handle { width: 14px; height: calc(var(--eba-handle-size) * 1.6); border-radius: 7px; }
.eba--vertical.eba--handle-bar .eba__handle { width: calc(var(--eba-handle-size) * 1.6); height: 14px; }
.eba--handle-bar .eba__handle svg { display: none; }
.eba--handle-arrows .eba__handle { background: transparent; box-shadow: none; color: var(--eba-handle); filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6)); }
.eba--handle-arrows .eba__handle svg { width: 80%; height: 80%; }

/* Labels */
.eba__label {
  position: absolute; z-index: 2; top: 12px; padding: 4px 10px; border-radius: 999px;
  background: var(--eba-label-bg); color: var(--eba-label-color);
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.4;
  pointer-events: none;
}
.eba__label--before { left: 12px; }
.eba__label--after { right: 12px; }
.eba--labels-bottom .eba__label { top: auto; bottom: 12px; }
/* Top/bottom sliders: the labels mark the halves, so Before is always at the
   top and After at the bottom whatever the label position setting says; the
   setting only moves them between the left and right edge. */
.eba--vertical .eba__label--before { top: 12px; bottom: auto; left: 12px; right: auto; }
.eba--vertical .eba__label--after { top: auto; bottom: 12px; left: auto; right: 12px; }
.eba--vertical.eba--labels-bottom .eba__label--before { left: auto; right: 12px; }
.eba--vertical.eba--labels-bottom .eba__label--after { left: 12px; right: auto; }

/* Hotspots */
.eba__hotspot {
  position: absolute; z-index: 4; width: 22px; height: 22px; margin: -11px 0 0 -11px; padding: 0;
  border: 2px solid #fff; border-radius: 50%; background: var(--eba-accent);
  box-shadow: 0 0 0 4px rgba(20, 110, 245, 0.25); cursor: pointer; touch-action: auto;
}
.eba__hotspot[hidden] { display: none; }
.eba__tooltip {
  position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  max-width: 220px; padding: 6px 10px; border-radius: 6px; background: #111; color: #fff;
  font-size: 0.8rem; line-height: 1.35; white-space: normal; width: max-content; text-align: left;
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
}
.eba__hotspot:hover .eba__tooltip, .eba__hotspot:focus-visible .eba__tooltip, .eba__hotspot.is-open .eba__tooltip { opacity: 1; }

/* Captions, text, call to action */
.eba__caption { margin: 0.5rem 0 0; font-size: 0.9rem; opacity: 0.8; }
.eba__text { margin: 0.75rem 0 0; }
.eba__cta { display: inline-block; margin-top: 0.75rem; color: var(--eba-accent); font-weight: 600; text-decoration: underline; }
.eba--cta-button .eba__cta { background: var(--eba-accent); color: #fff; padding: 0.6rem 1.2rem; border-radius: 999px; text-decoration: none; }

/* Gallery nav */
.eba__nav { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 0.75rem; }
.eba__prev, .eba__next { width: 36px; height: 36px; border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 50%; background: #fff; color: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0; }
.eba__dots { display: flex; gap: 8px; }
.eba__dot { width: 8px; height: 8px; border: 0; border-radius: 50%; padding: 0; background: rgba(0, 0, 0, 0.25); cursor: pointer; }
.eba__dot.is-active { background: var(--eba-accent); }

/* Presets write the individual settings in the editor; only Outline needs a
   rule of its own, for the frame outline. */
.eba--preset-outline .eba__frame { outline: 2px solid var(--eba-accent); outline-offset: -2px; }
.eba--preset-outline .eba__divider { box-shadow: none; }

/* Entrance animation */
.eba--anim-fade { opacity: 0; transition: opacity 0.6s ease; }
.eba--anim-rise { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.eba--anim-fade.is-visible, .eba--anim-rise.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .eba--anim-fade, .eba--anim-rise { opacity: 1; transform: none; transition: none; }
  .eba__media { transition: none; }
}

/* Theme block wrapper and its placeholder before the script runs */
.easy-before-after-block { padding-top: var(--eba-block-pt, 0); padding-bottom: var(--eba-block-pb, 0); }
.easy-before-after-block--empty p { margin: 0; padding: 1rem; border: 1px dashed rgba(0, 0, 0, 0.2); border-radius: 8px; opacity: 0.7; text-align: center; }
.eba-skeleton { aspect-ratio: 4 / 3; max-width: 100%; border-radius: 12px; background: linear-gradient(90deg, #ececef 0%, #f6f6f8 50%, #ececef 100%); background-size: 200% 100%; animation: eba-shimmer 1.4s linear infinite; }
@keyframes eba-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .eba-skeleton { animation: none; } }
