/* Примеры работ: только два фото — «после» крупно и «до» полароидом поверх.
   Белая рамка и тень вокруг обоих, фон страницы белый.
   Карусель (app.js) не трогаем: те же data-examples-*, .review-card, шаг = ширина карточки + gap. */

#examples .examples-carousel {
  --examples-gap: 3.5rem;
}

#examples .examples-viewport {
  /* сбоку небольшой запас под тень «до», по краю она плавно гаснет маской;
     снизу запас под тень большого фото (смещение 28px + размытие 48px) */
  padding: 1rem 1.75rem 4.5rem;
  margin: -1rem 0 -4.5rem;
  /* зазор между карточками (3.5rem) больше бокового запаса (1.75rem) плюс выступ
     полароида: соседняя карточка в покое целиком за краем и не выглядывает */
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 1.75rem,
    #000 calc(100% - 1.75rem),
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 1.75rem,
    #000 calc(100% - 1.75rem),
    transparent 100%
  );
}

/* карточка исчезает: остаются только фото */
#examples .review-card {
  align-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

#examples .review-pair {
  display: block;
  width: min(80%, 270px);
  margin: 0 auto;
  padding: 0;
}

#examples .review-after img,
#examples .review-before img {
  border: 6px solid #fff;
  border-radius: 22px;
  filter: none;
  background: #fff;
}

#examples .review-after img {
  width: 100%;
  box-shadow:
    0 0 0 1px rgb(15 23 42 / 6%),
    0 28px 48px -14px rgb(15 23 42 / 38%);
}

#examples .review-before {
  position: absolute;
  left: -17%;
  bottom: 1.5rem;
  z-index: 1;
  width: 44%;
  transform: rotate(-5deg);
  transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
}

#examples .review-before {
  cursor: pointer;
}

/* без серого прямоугольника от нажатия на Android и без выделения фото */
#examples .review-pair,
#examples .review-pair * {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

#examples .review-pair img {
  -webkit-user-drag: none;
}

/* «до» выезжает на место «после» (--swap-* считает app.js) */
#examples .review-pair.is-swapped .review-before {
  z-index: 3;
  transform: translate(var(--swap-x, 0), var(--swap-y, 0)) scale(var(--swap-s, 1));
  transition: transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* после увеличения рамка и скругление такие же, как у «после» (6px и 22px) */
#examples .review-pair.is-swapped .review-before img {
  padding: calc(6px / var(--swap-s, 1));
  border-radius: calc(22px / var(--swap-s, 1));
}

#examples .review-after img,
#examples .review-after figcaption {
  transition: opacity 0.4s ease;
}

#examples .review-pair.is-swapped .review-after img,
#examples .review-pair.is-swapped .review-after figcaption {
  opacity: 0;
}

/* плашка «До» на увеличенном фото растёт слабее самого фото: чистое увеличение
   плашки 1.26x, вокруг левого нижнего угла фото; сдвиг вправо 0.72rem и вверх
   подстроены под --swap-s, чтобы на экране они не зависели от увеличения */
#examples .review-before figcaption {
  transform-origin: -0.55rem calc(100% - 0.55rem + 1px);
  transition: transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
}

#examples .review-pair.is-swapped .review-before figcaption {
  transform:
    translate(
      calc(0.72rem / var(--swap-s, 1)),
      calc(0.26px / var(--swap-s, 1))
    )
    scale(calc(1.26 / var(--swap-s, 1)));
}

@media (prefers-reduced-motion: reduce) {
  #examples .review-pair.is-swapped .review-before {
    transition: none;
  }
}

#examples .review-before img {
  /* белая рамка — padding на белом фоне: границы браузер округляет до целых px,
     и при масштабировании рамка не совпала бы с «после» */
  border: 0;
  padding: 5px;
  box-sizing: border-box;
  border-radius: 16px;
  transition:
    padding 0.55s cubic-bezier(0.22, 0.61, 0.36, 1),
    border-radius 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
  box-shadow:
    0 0 0 1px rgb(15 23 42 / 6%),
    0 18px 34px -8px rgb(15 23 42 / 42%);
}

/* подпись «После» — синяя пилюля без рамки, внутри большого фото в правом верхнем углу */
#examples .review-after figcaption {
  left: auto;
  /* внутри фото, в правом верхнем углу: 6px белой рамки + отступ от угла */
  right: calc(6px + 0.25rem);
  top: calc(6px + 0.25rem);
  bottom: auto;
  box-sizing: border-box;
  min-height: 0;
  /* высота заглавной П и строчных центрируется по-разному, поэтому отступы
     подобраны по середине между центром капители и центром x-высоты */
  padding: calc(0.2rem + 1px) 0.5rem calc(0.25rem - 1px);
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 12px -4px rgb(0 70 160 / 40%);
  backdrop-filter: none;
  font-size: 0.66rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  z-index: 1;
}

/* подпись «До» в стиле плашки «Начните здесь»: пилюля с обводкой той же ширины, что и белая рамка фото */
#examples .review-before figcaption {
  left: 0.55rem;
  bottom: calc(-0.55rem + 1px);
  box-sizing: border-box;
  min-height: 0;
  padding: 0.08rem 0.22rem 0;
  border: 5px solid #fff;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 6px 12px -4px rgb(15 23 42 / 30%);
  backdrop-filter: none;
  font-size: 0.66rem;
  font-weight: 700;
  /* строка ниже кегля: белое поле короче, слово при этом опущено на 1px */
  line-height: 0.75;
  text-align: center;
}

/* ПК: по три примера в ряд (perView в app.js понимает 1, 2 и 3) */
@media (min-width: 1000px) {
  #examples .examples-carousel {
    --examples-view: 3;
  }
}

@media (max-width: 640px) {
  /* лента на всю ширину экрана: при свайпе фото доезжают до самого края,
     без белых полос слева и справа (маска по краям здесь не нужна) */
  #examples .examples-viewport {
    width: 100vw;
    margin-inline: calc(50% - 50vw);
    padding-inline: 11.75vw;
    -webkit-mask-image: none;
    mask-image: none;
  }

  /* центр — по фото «после»; «до» выступает слева и на центровку не влияет,
     поэтому выступает меньше, чтобы не вылезать за край экрана */
  #examples .review-pair {
    width: min(84%, 320px);
    margin: 0 auto;
  }

  #examples .review-before {
    left: -13%;
  }
}

/* точки ниже, вместе с кнопкой; активная вытянута в пилюлю */
#examples .examples-dots {
  padding-top: 1.75rem;
  gap: 0.5rem;
}

#examples .examples-dot {
  width: 0.5rem;
  height: 0.5rem;
  transition: width 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

#examples .examples-dot::before {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  transition: background-color 0.25s ease;
}

#examples .examples-dot.is-on {
  width: 1.75rem;
}

#examples .examples-dot.is-on::before {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  #examples .examples-dot {
    transition: none;
  }
}

/* стрелки: синий «сквиркл» с белой рамкой, чуть наклонён, как полароид «До» */
#examples .examples-arrow {
  --tilt: -4deg;
  position: relative;
  width: 2.9rem;
  height: 2.9rem;
  border: 3px solid #fff;
  border-radius: 15px;
  background: var(--accent);
  background-clip: padding-box;
  color: #fff;
  box-shadow:
    0 0 0 1px rgb(0 113 227 / 18%),
    0 14px 24px -10px rgb(0 113 227 / 60%);
  transform: rotate(var(--tilt));
  transition:
    transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1),
    box-shadow 0.3s ease;
}

#examples .examples-arrow-next {
  --tilt: 4deg;
}

/* шеврон рисуем рамкой, чтобы не зависеть от старой иконки */
#examples .examples-arrow::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border: solid currentColor;
  border-width: 0 0 3px 3px;
  border-radius: 2px;
}

#examples .examples-arrow-prev::before {
  transform: translateX(1.5px) rotate(45deg);
}

#examples .examples-arrow-next::before {
  transform: translateX(-1.5px) rotate(-135deg);
}

#examples .examples-arrow:hover {
  opacity: 1;
  transform: rotate(0) translateY(-3px);
  background: #1a82f0;
  background-clip: padding-box;
  box-shadow:
    0 0 0 1px rgb(0 113 227 / 22%),
    0 18px 28px -10px rgb(0 113 227 / 70%);
}

#examples .examples-arrow:active {
  transform: rotate(0) scale(0.93);
}

#examples .examples-arrow:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

@media (max-width: 860px) {
  #examples .examples-arrow {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #examples .examples-arrow {
    transition: none;
  }
}

/* ползунок под фото: активная пилюля в синем градиенте кнопки сайта */
#examples .examples-dot.is-on::before {
  background: linear-gradient(135deg, #3d9bff, var(--accent) 55%, #0058b8);
}
