/* One tri-slider that can have 1 or 2 (or more) right columns */
.tri-slider {
  width: 100%;
  display: grid;

  /* First column is the big left slider */
  grid-template-columns: 2fr;

  /* Any extra children after the first become additional columns (1fr each) */
  grid-auto-flow: column;
  grid-auto-columns: 1fr;

  gap: 8px;
  align-items: stretch;
}

/* Right column stacks two equal-height rows */
.col--right {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  height: 100%;
}

/* Slider component */
.ba {
  position: relative;
  width: 100%;
  overflow: hidden;
  user-select: none;
  touch-action: none;
  box-shadow: 0 6px 24px rgba(0,0,0,.15);
  border-radius: 10px;
  height: 100%;               /* row or JS will provide height */
}

/* Groups: full overlay layers (image + label) */
.ba__group {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.ba__group--before { z-index: 0; }
.ba__group--after  { z-index: 1; will-change: clip-path; }

/* Images still fill the group */
.ba__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-position: center;
  pointer-events: none;
}
.ba[data-fit="contain"] .ba__img { object-fit: contain; background: none; }
.ba[data-fit="cover"]   .ba__img { object-fit: cover; }

/* Labels (inside groups, so they get clipped with them) */
.ba__label {
  position: absolute;
  bottom: 8px;
  padding: 4px 8px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  background: rgba(0,0,0,0.5);
  border-radius: 4px;
  pointer-events: none;
}
.ba__label--before { left: 8px; }
.ba__label--after  { right: 8px; }

/* default (left/big) */
.col--left  .ba .ba__label { font-size: 0.95rem; padding: 4px 8px; }

/* smaller labels for right column sliders */
.col--right .ba .ba__label { font-size: 0.75rem; padding: 3px 6px; border-radius: 3px; }

/* Per-slider fit */
.ba[data-fit="contain"] .ba__img { object-fit: contain; background: none; }
.ba[data-fit="cover"]   .ba__img { object-fit: cover; }

/* After on top; show only right side (clip left) */
.ba__img--after {
  z-index: 1;
  clip-path: inset(0 0 0 50%);
}

/* Handle */
.ba__handle {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 100%;
  background: #fff;

  /* reset button defaults */
  border-top: none;
  border-bottom: none;
  border-left: 1px solid #0003;
  border-right: 1px solid #0003;
  padding: 0;
  margin: 0;
  box-sizing: content-box;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  cursor: ew-resize;
  z-index: 2;
}
.ba__handle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 8px rgba(0,0,0,.35);
}
.ba__handle:focus { outline: 2px solid #4a90e2; outline-offset: 2px; }
