/* ==========================================================================
   Section: Transformations – Before/After (Metamorfozy)
   Reusable page-builder section.
   BEM root: .tr   /   BA slider: .ba   /   Card: .tr-card
   ========================================================================== */

/* ── Section wrapper ── */
.tr {
  padding: var(--space-10) 0;
  background: #fff;
}

.tr--surface {
  background: var(--color-surface);
}

/* ── Section header: heading left, CTA right ── */
.tr__header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  align-items: start;
  margin-bottom: var(--space-8);
}

.tr__header-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.tr__badge {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid var(--color-border);
  border-radius: 99px;
  font-size: 13px;
  color: var(--color-text-soft);
  width: fit-content;
}

.tr__heading {
  font-size: clamp(26px, 3vw, 40px);
  font-weight: 800;
  color: var(--color-dark);
  line-height: 1.2;
  margin: 0;
}

.tr__intro {
  font-size: 15px;
  line-height: 1.75;
  color: var(--color-text);
  margin: 0;
}

.tr__header-right {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding-top: var(--space-2);
}

.tr__cta-buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.tr__all-link {
  font-size: 13px;
  color: var(--color-text-soft);
  text-decoration: none;
  transition: color var(--transition-base);
}

.tr__all-link:hover {
  color: var(--color-accent);
}

/* ── Cards grid: 3 columns ── */
.tr__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

/* ── Individual card ── */
.tr-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition-base);
}

.tr-card:hover {
  border-color: #d1d5db;
}

/* ── Before/After drag slider ── */
.ba {
  position: relative;
  overflow: hidden;
  height: 180px;
  cursor: col-resize;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.ba__base,
.ba__reveal {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

img.ba__base,
img.ba__reveal {
  object-fit: cover;
}

/* "After" image starts half-revealed */
.ba__reveal {
  clip-path: inset(0 0 0 50%);
}

.ba__base--placeholder {
  background: var(--color-dark);
}

.ba__reveal--placeholder {
  background: var(--color-surface);
}

/* Draggable divider line + button */
.ba__handle {
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  width: 2px;
  background: #fff;
  transform: translateX(-50%);
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.ba__handle-btn {
  /* Minimum 44×44 touch target (Emil Kowalski: functional requirements first) */
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-dark);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  will-change: left;
}

/* "Przed" / "Po" labels */
.ba__label {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(0, 0, 0, 0.35);
  padding: 3px 8px;
  border-radius: 99px;
  z-index: 5;
  pointer-events: none;
}

.ba__label--po {
  left: auto;
  right: var(--space-2);
  color: var(--color-dark);
  background: rgba(255, 255, 255, 0.85);
}

/* ── Card content ── */
.tr-card__content {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  flex: 1;
}

.tr-card__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-dark);
  margin: 0;
  line-height: 1.3;
}

.tr-card__text {
  font-size: 13px;
  line-height: 1.65;
  color: var(--color-text-soft);
  margin: 0;
  flex: 1;
}

/* Meta list: Wada / Metoda / Czas / Wiek */
.tr-card__meta {
  list-style: none;
  padding: var(--space-3) 0 0;
  margin: 0;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tr-card__meta li {
  font-size: 12px;
  color: var(--color-text-soft);
  line-height: 1.4;
}

.tr-card__meta li span {
  font-weight: 600;
  color: var(--color-dark);
}

.tr-card__link {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
  margin-top: auto;
  display: inline-block;
}

.tr-card__link:hover {
  text-decoration: underline;
}

/* ── Bottom CTA bar ── */
.tr__bottom-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  padding: var(--space-6) var(--space-7);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.tr__bottom-cta-text {
  font-size: 15px;
  line-height: 1.7;
  color: var(--color-text);
  margin: 0;
  max-width: 620px;
}

/* ── Responsive ── */

/* 2-col grid at tablet widths */
@media (max-width: 1100px) {
  .tr__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Single column on mobile */
@media (max-width: 768px) {
  .tr {
    padding: var(--space-8) 0;
  }

  .tr__header {
    grid-template-columns: 1fr;
    gap: var(--space-5);
    margin-bottom: var(--space-6);
  }

  .tr__grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .tr__bottom-cta {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: var(--space-4);
    padding: var(--space-5);
  }

  .tr__bottom-cta .button-primary {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
}

/* Increase slider height a little on larger screens for better usability */
@media (min-width: 1024px) {
  .ba {
    height: 220px;
  }
}

/* Reduced motion: keep slider functional but skip any future animations */
@media (prefers-reduced-motion: reduce) {
  .ba__handle-btn {
    transition: none;
  }
}
