/* ============================================================
   DreamFix — sekcja „Przed i po" (premium comparison slider)
   Ciemna paleta, spójna z resztą strony. Suwak sterowany jedną
   zmienną --pos (0–100%) na .ba__card; ruszają się tylko
   clip-path / transform / opacity — GPU-friendly, 60 FPS.
   ============================================================ */

.ba {
  --pos: 50%;
  /* ciemna paleta jak reszta strony (wcześniej sekcja była jedyną jasną) */
  --ba-bg: var(--bg-alt);
  --ba-ink: var(--text);
  --ba-mute: var(--text-mute);
  --ba-line: var(--line);
  position: relative;
  background: var(--ba-bg);
  color: var(--ba-ink);
  padding: clamp(72px, 9vw, 130px) 0;
}

.ba__wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- nagłówek ---------- */
.ba__head {
  max-width: 640px;
  margin: 0 auto clamp(40px, 5vw, 64px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.ba__label {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--blue);
}
.ba__title {
  margin: 0;
  font-size: clamp(38px, 6vw, 68px);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1;
}
.ba__amp {
  font-family: 'Instrument Serif', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
}
.ba__desc {
  margin: 0;
  max-width: 440px;
  color: var(--ba-mute);
  font-size: clamp(15px, 1.5vw, 17px);
  line-height: 1.65;
}

/* ---------- karta porównania ---------- */
.ba__card {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  aspect-ratio: 3 / 4;
  border-radius: 28px;
  overflow: hidden;
  background: var(--card-alt);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .2), 0 34px 80px -24px rgba(0, 0, 0, .7);
  cursor: ew-resize;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;           /* przeciąganie palcem obsługujemy w JS */
  outline: none;
}
.ba__card:focus-visible {
  box-shadow: 0 0 0 3px var(--ba-bg), 0 0 0 6px var(--blue), 0 34px 80px -24px rgba(0, 0, 0, .7);
}

.ba__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  -webkit-user-drag: none;
  user-select: none;
  transition: opacity .5s var(--ease);
}

/* warstwa „przed" — przycięta od prawej do pozycji suwaka */
.ba__clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
  clip-path: inset(0 calc(100% - var(--pos)) 0 0);
  will-change: clip-path;
}

/* ---------- etykiety PRZED / PO ---------- */
.ba__tag {
  position: absolute;
  bottom: 18px;
  z-index: 3;
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(20, 20, 18, .38);
  border: 1px solid rgba(255, 255, 255, .28);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
}
.ba__tag--before { left: 18px; }
.ba__tag--after { right: 18px; }

/* ---------- suwak: linia + uchwyt ---------- */
.ba__divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  z-index: 4;
  width: 2px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .06), 0 0 18px rgba(255, 255, 255, .55);
  pointer-events: none;
  transition: box-shadow .3s var(--ease);
}

.ba__handle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60px;
  height: 60px;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 50%;
  /* „szkło" bez backdrop-filter (reguła projektu) — półprzezroczysta biel
     z obrysem i cieniem czyta się jak mrożone szkło, a nie obciąża GPU */
  background: rgba(255, 255, 255, .62);
  border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .22), inset 0 1px 1px rgba(255, 255, 255, .9);
  color: #2a2a26;
  transition: transform .35s cubic-bezier(.34, 1.32, .48, 1), box-shadow .3s var(--ease);
}
.ba__handle svg { width: 17px; height: 17px; }

/* pulsujący pierścień (subtelny) */
.ba__handle::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .6);
  opacity: 0;
  animation: ba-pulse 2.6s var(--ease) infinite;
}
@keyframes ba-pulse {
  0% { transform: scale(.9); opacity: .5; }
  70%, 100% { transform: scale(1.35); opacity: 0; }
}

/* hover: mocniejsza poświata, większy uchwyt */
.ba__card:hover .ba__divider,
.ba__card.is-active .ba__divider {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .06), 0 0 28px rgba(255, 255, 255, .85);
}
.ba__card:hover .ba__handle {
  transform: translate(-50%, -50%) scale(1.08);
}
.ba__card.is-dragging .ba__img,
.ba__card.is-dragging .ba__clip { transition: none; }
.ba__card.is-dragging .ba__handle::after { animation: none; opacity: 0; }

.ba__caption {
  margin: 22px auto 0;
  text-align: center;
  color: var(--ba-mute);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: .01em;
}

/* ---------- crossfade przy podmianie ---------- */
.ba__card.is-swapping .ba__img { opacity: 0; }

/* ---------- przycisk „pełny ekran" na dużej karcie ---------- */
.ba__stage {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}
.ba__expand {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 5;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .5);
  background: rgba(20, 20, 18, .38);
  color: #fff;
  cursor: pointer;
  transition: background .25s var(--ease), transform .25s var(--ease);
}
.ba__expand:hover { background: rgba(20, 20, 18, .6); transform: scale(1.06); }
.ba__expand svg { width: 19px; height: 19px; }

/* ---------- taśma miniatur pod kartą: strzałki po bokach ---------- */
.ba__strip-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: clamp(36px, 4vw, 56px) auto 0;
}
.ba__strip {
  position: relative;
  width: 100%;
  max-width: 560px;              /* ta sama szerokość co karta */
  min-width: 0;
}
.ba__strip-viewport {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;                 /* chowamy pasek — nawigacja strzałkami */
  -webkit-overflow-scrolling: touch;
  /* pionowy zapas: przy overflow-y:hidden cień i uniesienie kafelka na hover
     były przycinane — padding daje im miejsce (poziomy 0, by nie ruszać scrollWidth) */
  padding: 14px 0 40px;
}
.ba__strip-viewport::-webkit-scrollbar { display: none; }
.ba__track {
  display: flex;
  width: max-content;
  gap: 14px;
}

/* strzałki po bokach taśmy */
.ba__strip-arrow {
  width: 46px;
  height: 46px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.ba__strip-arrow:hover {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.ba__strip-arrow:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.ba__strip-arrow svg { width: 20px; height: 20px; }

/* gradientowe krawędzie — poziomo */
.ba__strip-fade {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 48px;
  z-index: 2;
  pointer-events: none;
}
.ba__strip-fade--a { left: 0; background: linear-gradient(90deg, var(--ba-bg), transparent); }
.ba__strip-fade--b { right: 0; background: linear-gradient(270deg, var(--ba-bg), transparent); }

.ba__thumb {
  position: relative;
  flex: none;
  width: 132px;
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  overflow: hidden;
  padding: 0;
  border: none;
  cursor: pointer;
  background: var(--card-alt);
  box-shadow: 0 12px 28px -14px rgba(0, 0, 0, .6);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.ba__thumb:hover,
.ba__thumb:focus-visible {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px -16px rgba(0, 0, 0, .7);
  outline: none;
}
.ba__thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s var(--ease);
}
.ba__thumb:hover img { transform: scale(1.04); }
.ba__thumb .ba__clip { clip-path: inset(0 50% 0 0); will-change: auto; }
.ba__thumb-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, .8);
  z-index: 2;
}
.ba__thumb-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 22px 10px 10px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  line-height: 1.25;
  background: linear-gradient(180deg, transparent, rgba(15, 15, 13, .78));
}

/* ---------- pełnoekranowy podgląd ---------- */
.ba__full {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: clamp(16px, 3vw, 40px);
  overscroll-behavior: contain;
}
.ba__full[hidden] { display: none; }
.ba__full-backdrop {
  position: absolute;
  inset: 0;
  background: #0b0b0d;
  opacity: 0;
  transition: opacity .4s var(--ease);
}
.ba__full.is-open .ba__full-backdrop { opacity: .97; }

.ba__card--full {
  position: relative;
  z-index: 2;
  width: auto;
  max-width: min(92vw, 66vh);   /* portret 3:4 → wysokość rządzi szerokością */
  height: min(82vh, calc(92vw * 4 / 3));
  aspect-ratio: 3 / 4;
  margin: 0;
  opacity: 0;
  transform: scale(.96);
  transition: opacity .45s var(--ease), transform .45s var(--ease);
}
.ba__full.is-open .ba__card--full { opacity: 1; transform: none; }
.ba__card--full.is-swapping .ba__img { opacity: 0; }

.ba__full-close {
  position: absolute;
  top: clamp(14px, 2.5vw, 26px);
  right: clamp(14px, 2.5vw, 26px);
  z-index: 4;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  transition: background .2s var(--ease);
}
.ba__full-close:hover { background: rgba(255, 255, 255, .2); }

.ba__full-counter {
  position: absolute;
  top: clamp(18px, 2.5vw, 30px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  color: rgba(255, 255, 255, .75);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .14em;
  font-variant-numeric: tabular-nums;
}

.ba__full-nav {
  position: absolute;
  top: 50%;
  z-index: 4;
  margin-top: -30px;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .07);
  color: #fff;
  cursor: pointer;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.ba__full-nav:hover { background: rgba(255, 255, 255, .18); }
.ba__full-nav svg { width: 26px; height: 26px; }
.ba__full-nav--prev { left: clamp(12px, 3vw, 40px); }
.ba__full-nav--next { right: clamp(12px, 3vw, 40px); }

.ba__full-caption {
  position: relative;
  z-index: 2;
  color: rgba(255, 255, 255, .85);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .ba__handle::after { animation: none; opacity: 0; }
  .ba__img, .ba__thumb, .ba__thumb img, .ba__card--full { transition: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 560px) {
  .ba__handle { width: 68px; height: 68px; }   /* większy cel pod palec */
  .ba__handle svg { width: 19px; height: 19px; }
  /* mobile: chowamy taśmę miniatur — strzałki przełączają duże zdjęcie */
  .ba__strip { display: none; }
  .ba__strip-row { gap: 32px; margin-top: clamp(22px, 6vw, 34px); }
  .ba__strip-arrow { width: 52px; height: 52px; }
  .ba__thumb { width: 116px; }
  .ba__strip-fade { width: 32px; }
  .ba__card--full { max-width: 92vw; height: min(74vh, calc(92vw * 4 / 3)); }
  .ba__full-nav { width: 52px; height: 52px; top: auto; bottom: 18px; margin-top: 0; }
  .ba__full-nav--prev { left: calc(50% - 64px); }
  .ba__full-nav--next { right: calc(50% - 64px); }
}
