/* before-after section — scoped under .ba-wrap (CLBP-38).
   Design: design/leaves/glavnaya/09-before-after.html (frame 7837:412 desktop + 8068:5700 mobile).
   Skipped: *, html/body resets, box-sizing, color body — already in tokens.css / hero.css.
   Token swaps: #333333→var(--ink), #FFFFFF→var(--white), #B5B0AC→var(--placeholder),
     border-radius:12px→var(--r-card), fs-h2/lh-h2, fs-para/lh-para, fs-micro/lh-micro,
     fs-body/lh-body, fs-nav/lh-nav (16px/22.4px exact match on .ba-card__sum).
   Kept as literal: padding values, gap, grid dims, card-title lh 29.6px (token lh-lead=28px). */

/* ── Section wrapper ───────────────────────────────────────────────────── */
.ba-wrap {
  background: var(--white);
  padding: 110px 140px 86px;
}

.ba-wrap .ba-title {
  margin: 0 0 40px;
  font-weight: 400;
  font-size: var(--fs-h2);
  line-height: var(--lh-h2);
  color: var(--ink);
}

.ba-wrap .ba-desc {
  margin: 0 0 24px;
  max-width: 764px;
  font-weight: 400;
  font-size: var(--fs-para);
  line-height: var(--lh-para);
  color: var(--ink);
}

/* ── Card grid ─────────────────────────────────────────────────────────── */
.ba-wrap .ba-grid {
  display: grid;
  grid-template-columns: repeat(3, 367px);
  gap: 40px 30px;
  justify-content: start;
}

.ba-wrap .ba-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ba-wrap .ba-card__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Interactive before/after slider ──────────────────────────────────── */
/* Model: after = full base layer; before = overlay clipped to left --pos% */
.ba-wrap .ba-slider {
  position: relative;
  aspect-ratio: 367 / 305;
  overflow: hidden;
  background: var(--white);
  touch-action: none;   /* ponytail: suppress scroll on touch so pointer capture fires cleanly */
  cursor: col-resize;
  user-select: none;
}

.ba-wrap .ba-after,
.ba-wrap .ba-before {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* clip-path approach: resize with --pos CSS var, zero JS layout recalc */
.ba-wrap .ba-before {
  clip-path: inset(0 calc(100% - var(--pos, 50%)) 0 0);
}

.ba-wrap .ba-handle {
  position: absolute;
  top: 0;
  left: var(--pos, 50%);
  height: 100%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px; /* touch target size */
  cursor: col-resize;
}

.ba-wrap .ba-handle img {
  height: 100%;
  width: auto;
  pointer-events: none;
  user-select: none;
  display: block;
}

.ba-wrap .ba-handle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Pill label ────────────────────────────────────────────────────────── */
.ba-wrap .ba-pill {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  background: var(--white);
  border-radius: var(--r-card);
  padding: 8px 12px;
  font-weight: 400;
  font-size: var(--fs-micro);
  line-height: var(--lh-micro);
  color: var(--ink);
  pointer-events: none;
}

/* ── Card content ──────────────────────────────────────────────────────── */
.ba-wrap .ba-card__title {
  margin: 0;
  font-weight: 500;
  font-size: var(--fs-lead); /* 20px */
  line-height: 29.6px;       /* design literal; token lh-lead=28px differs */
  color: var(--ink);
}

.ba-wrap .ba-card__details {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ba-wrap .ba-block {
  display: flex;
  flex-direction: column;
}

.ba-wrap .ba-block__label {
  font-weight: 400;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--placeholder);
}

.ba-wrap .ba-block__text {
  margin: 0;
  font-weight: 400;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
}

.ba-wrap .ba-clamp3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ba-wrap .ba-card__sum {
  background: var(--ink);
  border-radius: var(--r-card);
  padding: 8px 12px;
  font-weight: 400;
  font-size: var(--fs-nav);  /* 16px / 22.4px — exact match with design */
  line-height: var(--lh-nav);
  color: var(--white);
}

/* ── Mobile (max-width: 767px) ─────────────────────────────────────────── */
@media (max-width: 767px) {
  .ba-wrap {
    padding: 64px 28px;
  }

  .ba-wrap .ba-title {
    font-size: 24px;
    line-height: 26.4px;
    margin-bottom: 24px;
  }

  .ba-wrap .ba-desc {
    max-width: 320px;
    margin-bottom: 32px;
  }

  .ba-wrap .ba-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .ba-wrap .ba-pill {
    flex-direction: column;
    align-items: flex-start;
  }

  .ba-wrap .ba-pill__sep {
    display: none;
  }
}
