/* =====================================================================
   Bricks custom element — Before / After Slider
   Root class: .brxe-tc-before-after-slider (auto-added by Bricks)
   All child classes use the `tc-bas__` prefix to avoid collisions with
   Bootstrap / theme / WooCommerce styles (`.badge`, `.overlay`, `.divider`,
   `.handle`, `.img-layer` are otherwise very common class names).
   ===================================================================== */

.brxe-tc-before-after-slider {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 500px;
  overflow: hidden;
  outline: none;
  display: block; /* override any flex/grid inherited from Bricks defaults */
}

.brxe-tc-before-after-slider,
.brxe-tc-before-after-slider *,
.brxe-tc-before-after-slider *::before,
.brxe-tc-before-after-slider *::after {
  box-sizing: border-box;
}

/* ── Image layers ─────────────────────────────────────────────────── */
.tc-bas__layer {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
}

.tc-bas__layer > img,
.tc-bas__img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
  border: 0;
}

.tc-bas__layer--after  { z-index: 1; }

.tc-bas__layer--before {
  z-index: 2;
  clip-path: inset(0 70% 0 0); /* overridden inline by PHP + at runtime by JS */
}

/* Fallback block shown before an image is chosen so the element has visible
   structure in the Bricks builder canvas. */
.tc-bas__img--empty {
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, .05) 0 12px,
    rgba(255, 255, 255, .12) 12px 24px
  );
}
.tc-bas__layer--after  .tc-bas__img--empty { background-color: #2a2a2a; }
.tc-bas__layer--before .tc-bas__img--empty { background-color: #4a4a4a; }

/* ── Divider ─────────────────────────────────────────────────────── */
.tc-bas__divider {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 10;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 12px rgba(0, 0, 0, .65);
  left: 30%;
  pointer-events: none;
  transform: translateX(-50%);
}

/* ── Handle ─────────────────────────────────────────────────────── */
.tc-bas__handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  background: rgba(255, 255, 255, .18);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 2px solid rgba(255, 255, 255, .9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #fff;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .6));
}

.tc-bas__handle svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ── Badges ─────────────────────────────────────────────────────── */
.tc-bas__badge {
  position: absolute;
  top: 24px;
  z-index: 30;
  padding: 6px 16px;
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 3px;
  pointer-events: none;
  margin: 0;
  display: inline-block;
  line-height: 1.2;
  user-select: none;
}
.tc-bas__badge--before { right: 24px; }
.tc-bas__badge--after  { left:  24px; }

/* ── Overlay ─────────────────────────────────────────────────────── */
.tc-bas__overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  pointer-events: none;
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, .72) 0%,
    rgba(0, 0, 0, .38) 40%,
    transparent 65%
  );
}

.tc-bas__overlay-content {
  max-width: 500px;
  padding: 40px 48px;
  color: #fff;
  margin-left: 5vw;
  /* Re-enable interaction for nested Bricks children (buttons, links, etc.) */
  pointer-events: auto;
}

/* ── Small screens ───────────────────────────────────────────────── */
@media (max-width: 600px) {
  .tc-bas__overlay {
    align-items: flex-end;
    background: linear-gradient(
      to top,
      rgba(0, 0, 0, .82) 0%,
      rgba(0, 0, 0, .3) 55%,
      transparent 85%
    );
  }
  .tc-bas__overlay-content {
    margin: 0;
    padding: 28px 22px 44px;
    text-align: center;
    max-width: 100%;
  }
}
