/* BEFORE & AFTER PAGE */

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.before-after-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.44fr);
  align-items: end;
  gap: 64px;
  padding-top: 96px;
  padding-bottom: 72px;
}

.before-after-hero h1 {
  max-width: 850px;
  margin-bottom: 0;
}

.before-after-intro {
  max-width: 520px;
  margin-bottom: 10px;
  color: var(--muted, #a1a1a1);
  font-size: 1.03rem;
}

.before-after-section {
  padding-bottom: 120px;
}

.transformation-list {
  display: grid;
  gap: 82px;
}

.transformation-card {
  display: grid;
  grid-template-columns: minmax(240px, 0.38fr) minmax(0, 1fr);
  align-items: start;
  gap: 58px;
  padding-top: 56px;
  border-top: 1px solid var(--line, #2a2a2a);
}

.transformation-copy {
  position: sticky;
  top: 120px;
}

.project-number {
  margin-bottom: 18px;
  color: var(--muted, #a1a1a1);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.transformation-copy h2 {
  margin-bottom: 20px;
  font-size: clamp(2.5rem, 4.6vw, 4.35rem);
}

.transformation-copy > p:last-child {
  max-width: 420px;
  margin-bottom: 0;
  color: var(--muted, #a1a1a1);
}

/* Slider container */

.comparison {
  --position: 50%;

  position: relative;
  width: 100%;
  margin: 0;
  overflow: hidden;

  border: 1px solid var(--line, #2a2a2a);
  border-radius: var(--radius, 24px);
  background: var(--panel, #141414);

  aspect-ratio: 4 / 3;
  isolation: isolate;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.comparison-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;

  display: grid;
  place-items: center;

  color: var(--muted, #a1a1a1);
  background: var(--panel, #141414);

  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.comparison-image {
  position: absolute;
  inset: 0;
  z-index: 1;

  display: block;
  width: 100%;
  height: 100%;

  object-fit: cover;
  object-position: center;

  pointer-events: none;
}

.comparison-before-wrap {
  position: absolute;
  inset: 0;
  z-index: 2;

  overflow: hidden;

  clip-path: inset(
    0 calc(100% - var(--position)) 0 0
  );
    will-change: clip-path;
transform: translateZ(0);
}

.comparison-before {
  z-index: 2;
}

/* Before / After labels */

.comparison-label {
  position: absolute;
  top: 18px;
  z-index: 4;

  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 13px;

  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;

  color: #ffffff;
  background: rgba(11, 11, 11, 0.72);

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;

  pointer-events: none;

opacity: 0;
transform: translateY(-5px) scale(0.86);
transition:
  opacity 160ms ease,
  transform 200ms cubic-bezier(0.22, 1, 0.36, 1),
  background 160ms ease;

will-change: opacity, transform;
}

.comparison-label-before {
  left: 18px;
  transform-origin: top left;
}

.comparison-label-after {
  right: 18px;
  transform-origin: top right;
}

.comparison-label.is-active {
  opacity: 1;
  transform: translateY(0) scale(1);
  background: rgba(11, 11, 11, 0.9);
  animation: comparison-label-pop 220ms
    cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes comparison-label-pop {
  0% {
    opacity: 0;
    transform: translateY(-5px) scale(0.84);
  }

  65% {
    opacity: 1;
    transform: translateY(0) scale(1.08);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Slider line */

.comparison-divider {
  position: absolute;
    will-change: left;
  top: 0;
  bottom: 0;
  left: var(--position);
  z-index: 4;

  width: 2px;

  background: rgba(255, 255, 255, 0.95);
  transform: translateX(-50%);

  pointer-events: none;
}

.comparison-handle {
  position: absolute;
  top: 50%;
  left: 50%;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  width: 52px;
  height: 52px;

  border: 2px solid #ffffff;
  border-radius: 50%;

  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);

  transform: translate(-50%, -50%);
}

.handle-arrow {
  width: 0;
  height: 0;

  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}

.handle-arrow-left {
  border-right: 7px solid #0b0b0b;
}

.handle-arrow-right {
  border-left: 7px solid #0b0b0b;
}

/* Invisible range input controls slider */

.comparison-range {
  position: absolute;
  inset: 0;
  z-index: 5;

  width: 100%;
  height: 100%;

  margin: 0;
  padding: 0;
  border: 0;

  background: transparent;

  cursor: ew-resize;
  opacity: 0;

  appearance: none;
  -webkit-appearance: none;
}

.comparison-range:focus-visible {
  opacity: 1;
  outline: 2px solid #ffffff;
  outline-offset: -4px;
}

.comparison-range::-webkit-slider-runnable-track {
  width: 100%;
  height: 100%;
  background: transparent;
}

.comparison-range::-webkit-slider-thumb {
  width: 52px;
  height: 100%;

  border: 0;
  background: transparent;

  cursor: ew-resize;

  appearance: none;
  -webkit-appearance: none;
}

.comparison-range::-moz-range-track {
  width: 100%;
  height: 100%;

  border: 0;
  background: transparent;
}

.comparison-range::-moz-range-thumb {
  width: 52px;
  height: 100%;

  border: 0;
  border-radius: 0;
  background: transparent;

  cursor: ew-resize;
}

/* Bottom call-to-action */

.gallery-cta {
  padding: 90px 0;
  color: #0b0b0b;
  background: #ffffff;
}

.gallery-cta h2 {
  max-width: 800px;
  margin-bottom: 30px;
  color: #0b0b0b;
}

.gallery-cta .eyebrow {
  color: #606060;
}

/* Consistent desktop comparison sizing */

@media (min-width: 961px) {
  .transformation-card {
    grid-template-columns: minmax(220px, 300px) minmax(0, 650px);
    justify-content: center;
    gap: 48px;
  }

  .comparison {
    width: 100%;
    max-width: 650px;
    height: auto;
    aspect-ratio: 4 / 3;
    justify-self: end;
  }
}

/* Tablet */

@media (max-width: 960px) {
  .before-after-hero {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-top: 72px;
    padding-bottom: 58px;
  }

  .before-after-intro {
    margin-bottom: 0;
  }

  .transformation-card {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .transformation-copy {
    position: static;
  }

  .transformation-copy > p:last-child {
    max-width: 620px;
  }
}

/* Mobile */

@media (max-width: 680px) {
  .before-after-hero {
    padding-top: 56px;
    padding-bottom: 44px;
  }

  .before-after-section {
    padding-bottom: 86px;
  }

  .transformation-list {
    gap: 62px;
  }

  .transformation-card {
    gap: 24px;
    padding-top: 38px;
  }

  .transformation-copy h2 {
    font-size: clamp(2.45rem, 12vw, 3.55rem);
  }

  .comparison {
    aspect-ratio: 4 / 4;
  }

  .comparison-label {
    top: 12px;
    min-height: 30px;
    padding: 0 10px;
    font-size: 0.61rem;
  }

  .comparison-label-before {
    left: 12px;
  }

  .comparison-label-after {
    right: 12px;
  }

  .comparison-handle {
    width: 46px;
    height: 46px;
  }

  .gallery-cta {
    padding: 68px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .comparison-label.is-active {
    animation: none;
  }

  .comparison-label,
  .comparison-before-wrap,
  .comparison-divider {
    transition: none;
    will-change: auto;
  }
}