/* ===== (04) Before & After — Figma 3333:14531 =====
 * Frame 1308×726 centred in the 1812 container; floating checklists overlap it.
 */

.ba { padding: 140px 0; background: #000; color: #fff; overflow: hidden; }

.ba__stage { position: relative; margin-top: 72px; }

.ba__compare {
  --x: 36.7%;
  position: relative;
  /* 1308 / 1812 at full size. On narrower screens the frame shrinks instead of the
     side cards sliding further over it: each card (329px) keeps the design's 77px
     overlap, so neither card reaches the faces in the screenshots. */
  width: min(72.185%, calc(100% - 504px));
  margin-inline: auto;
  touch-action: pan-y;
  cursor: ew-resize;
  user-select: none;
}
.ba__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1308 / 726;
  border-radius: 24px;
  overflow: hidden;
  background: #1b1f23;
  touch-action: pan-y;
  cursor: ew-resize;
  user-select: none;
}
.ba__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; pointer-events: none; }
.ba__before { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--x)) 0 0); }
.ba__line {
  position: absolute; top: 0; bottom: 0;
  left: var(--x); width: 3px; margin-left: -1.5px;
  background: #fff;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}
.ba__knob {
  position: absolute;
  z-index: 3; /* above the side cards, so it can be grabbed at either edge */
  left: var(--x); top: 50%;
  width: 48px; height: 48px;
  transform: translate(-50%, -50%);
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.3);
  cursor: grab;
  transition: transform 0.25s var(--ease-out);
}
.ba__knob svg { width: 24px; height: 24px; }
.ba__knob:hover { transform: translate(-50%, -50%) scale(1.1); }
.ba__compare.is-dragging .ba__knob { cursor: grabbing; transform: translate(-50%, -50%) scale(0.92); }
/* Gentle hint: the knob pulses until the visitor first drags it. */
@media (prefers-reduced-motion: no-preference) {
  .ba__compare:not(.is-touched):not(.is-peeking) .ba__knob { animation: knob-pulse 2.4s var(--ease-out) infinite; }
}
@keyframes knob-pulse {
  0%, 100% { box-shadow: 0 0 24px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(249, 61, 13, 0.55); }
  60% { box-shadow: 0 0 24px rgba(0, 0, 0, 0.3), 0 0 0 16px rgba(249, 61, 13, 0); }
}

.ba-card {
  position: absolute;
  z-index: 2;
  width: 329px;
  padding: 32px;
  display: flex; flex-direction: column; gap: 24px;
  border-radius: 24px;
  background: rgba(16, 16, 16, 0.7);
  backdrop-filter: blur(50px);
  -webkit-backdrop-filter: blur(50px);
}
.ba-card--before { left: 0; top: 64px; }
.ba-card--after { right: 0; bottom: 58px; }
.ba-card__title { font-size: 24px; line-height: 1; letter-spacing: -0.01em; color: #fafaf9; }
.ba-card__list { display: flex; flex-direction: column; }
.ba-card__list li {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  font-size: 16px; line-height: 1.4; letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.7);
}
.ba-card__list li + li { margin-top: 14px; }
.ba-card__list li + li::before {
  content: "";
  position: absolute; left: 9px; top: -12px;
  width: 2px; height: 10px;
  background: rgba(255, 255, 255, 0.7);
}
.ba-card__list--after li + li::before { background: #d8dce0; }
.ba-card__icon { flex: none; display: grid; width: 20px; height: 20px; }
.ba-card__icon svg { width: 20px; height: 20px; }

/* Cards drift in from the sides once the section is revealed. */
@media (prefers-reduced-motion: no-preference) {
  .js .ba-card { opacity: 0; transition: opacity 0.9s var(--ease-out) 0.35s, transform 0.9s var(--ease-out) 0.35s; }
  .js .ba-card--before { transform: translateX(-24px); }
  .js .ba-card--after { transform: translateX(24px); }
  .js .ba__stage.is-revealed .ba-card { opacity: 1; transform: none; }
}

/* Below ~1640px the frame would be under ~1030px wide, and the floating cards would reach
   the profile photos and name: show the cards under the slider instead. */
@media (max-width: 1639px) {
  .ba__compare { width: 100%; }
  .ba-card { position: relative; inset: auto; width: auto; margin-top: 16px; }
  .ba__stage { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
  .ba__compare { grid-column: 1 / -1; }
}
@media (max-width: 1024px) { .ba { padding: 96px 0; } .ba__stage { margin-top: 48px; } }
/* phones: keep the screenshot's own proportions so no part of the profile is cropped */
@media (max-width: 640px) { .ba__stage { grid-template-columns: 1fr; } .ba__frame { aspect-ratio: 1308 / 726; border-radius: 14px; } .ba__knob { width: 44px; height: 44px; } .ba__knob svg { width: 18px; height: 18px; } }
