.reviews-section {
  text-align: center;
  width: 100%;
  position: relative;
  overflow: hidden; /* чтобы заголовок не обрезался */
  padding-top: 80px;
  min-height: 400px;
  z-index: 0;
}

.reviews-section .form-group label {
  position: absolute;
  top: 50%;
  left: 12px;
  font-size: 1rem;
  color: #32758f;
  pointer-events: none;
  transition: 0.3s ease;
  transform: translateY(-50%);
}

.reviews-title {
  position: absolute;
  top: 0.8em;
  left: 15%;
  font-size: 2.6em;
  font-weight: 600;
  padding: 14px 24px;
  color: #013f6cc7;
  border-radius: 60px;
  background: hsla(201, 100%, 87%, 0.451);
  backdrop-filter: blur(10px) saturate(1.3);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
  border: 1px solid #dcf3ffb9;
  white-space: nowrap;
  z-index: 12;
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reviews-title.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.reviews-background-cropper {
  position: absolute;
  top: 80px; /* совпадает с верхом контейнера */
  left: 0;
  width: 100%;
  height: 400px; /* высота видимой области */
  overflow: hidden; /* обрезаем всё, что выходит за рамки */
  z-index: 0; /* ниже карточек */
}

.reviews-background {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 600px;
  background: url('/static/static_media/reviews.jpg') center/cover no-repeat fixed;
  will-change: transform;
  transform: translateZ(0); /* аппаратное ускорение */
  pointer-events: none;
}

.reviews-wrapper {
  position: relative;
  box-shadow: inset 0 1px 4px #00000034, inset 0 -1px 4px #00000034;
  height: 400px;
  border: 1px solid #ffffffd6;
  width: 102%;
  left: -2px;
}

.reviews-container {
  width: 100%;
  height: 400px;
  display: flex;
  gap: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  background-color: transparent;
  transition: transform 1s ease;
  margin-bottom: 50px;
  position: relative;
  box-sizing: border-box;
  justify-content: flex-start;
  align-items: center;
  scroll-behavior: smooth;
  padding: 0 40px;
  z-index: 2;
}


.reviews-container::-webkit-scrollbar {
  display: none;
}

.review-card {
  flex: 0 0 auto;
  will-change: transform, opacity, scale, box-shadow;
  margin-top: 20px;
  margin-bottom: 20px;
  min-width: 350px;
  height: 270px;
  border-radius: 65px;
  aspect-ratio: 1/5;
  scroll-snap-align: center;
  opacity: 0;
  transform: translateY(30px) translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
  transition: opacity 0.5s ease, transform 0.35s ease, scale 0.35s ease-in-out, box-shadow 0.5s ease-in-out;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 30px;

  background: #8cd7ff73;
  backdrop-filter: blur(10px) saturate(1.3);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
  border: 1px solid #dcf3ffb9;
  z-index: 2;
  text-decoration: none;
  color: inherit;
}

.reviews-container .review-card:last-child {
  margin-left: 20px;
}

.review-card.show {
  opacity: 1;
  transform: translateY(0);
}

.review-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.017);
}

.review-card:active {
  transform: translateY(-4px) scale(0.98);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); /* Пружинистый эффект */
}

/* Хедер с фото и именем */
.review-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-bottom: 8px;
}

.review-header::after {
  content: "";
  position: absolute;
  margin-top: 80px;
  left: 10%;
  width: 80%;
  height: 1px;
  background: #d7f4ff73;
}

/* Фото в круге */
.review-logo {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background-color: #fff;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.review-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Имя в овале */
.review-name {
  color: #01406c;
  font-weight: 600;
  font-size: 1.8rem;
  padding: 6px 8px;
  border-radius: 25px;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.review-title {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  font-size: 1.05rem;
  font-style: italic;
  color: #335380;
  margin-top: -20px;
  white-space: nowrap;
}

/* Появление титла при наведении на карточку */
.review-card:hover .review-title {
  opacity: 1;
  transform: translateY(0);
}


.review-text-box {
  background-color: #d7f4ff73;
  border-radius: 35px;
  padding: 14px 18px;
  color: #32758f;
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: left;
  margin-top: auto;
  height: 60%;
  overflow: auto;
}

@media (orientation: portrait) {
  /* Секция */
  .reviews-section {
    position: relative;
  }

  /* Обёртка — именно она задаёт ободок/скругления и внутр. тени,
     при этом обрезает фон (overflow:hidden) так, чтобы картинка совпадала с краями */
  .reviews-wrapper {
    position: relative;
    width: 100%;
    left: 0;
    height: auto;
    height: 100%;
    overflow: hidden !important; /* обрезаем фон по краю ободка */
    box-shadow: none; /* внешний shadow убираем — всё через inset */
    border: 1px solid #ffffffd6;
    background-clip: padding-box;
    z-index: 2;
  }

  /* Внутренние тени, которые "падают" на фон (картинку).
     ::before накладывается поверх фонового изображения, но под карточками. */
  .reviews-wrapper::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    z-index: 3;
    /* два inset слоя — сверху и снизу — чтобы тени читаемо лежали на картинке */
    box-shadow:
      inset 0 18px 40px rgba(0, 0, 0, 0.18),
      inset 0 -14px 36px rgba(0, 0, 0, 0.12);
  }

  .reviews-title {
    position: absolute;
    top: 0.8em;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2.6em;
    font-weight: 600;
    padding: 14px 24px;
    color: #013f6cc7;
    border-radius: 60px;
    background: hsla(201, 100%, 87%, 0.451);
    backdrop-filter: blur(10px) saturate(1.3);
    -webkit-backdrop-filter: blur(10px) saturate(1.3);
    border: 1px solid #dcf3ffb9;
    white-space: nowrap;
    z-index: 12;
    opacity: 0;
    transition: none !important;
  }

  /* Cropper занимает всю обёртку и точно совпадает по краям */
  .reviews-background-cropper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1; /* фон под тенью и карточками */
    border-radius: inherit;
  }

  /* Фон — полностью заполняет cropper; под ободком (обрезается wrapper'ом) */
  .reviews-background {
    position: absolute;
    top: 80px;
    left: 0;
    width: 100%;
    height: 450px;
    background-image: url('/static/static_media/reviews.jpg');
    transform: none !important;
    transition: none !important;
    will-change: auto !important;
    background-attachment: scroll !important; /* чтобы не было fixed-поведения */
    background-position: center center !important;
    background-size: cover !important;
  }

  /* Контейнер карточек — горизонтальный скролл (плавный), карточки расположены в ряд.
     При этом контейнер выше тени (z-index) чтобы карточки были над тенью. */
  .reviews-container {
    width: 100%;
    display: flex;
    gap: 14px;
    padding: 18px 14px;
    box-sizing: border-box;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    z-index: 5; /* поверх тени и фона */
  }

  .reviews-container::-webkit-scrollbar {
    display: none;
  }

  .review-card {
    flex: 0 0 auto;
    min-width: 220px;
    max-width: 340px;
    width: calc(62vw); /* адаптивная ширина — удобно для разных телефонов */
    aspect-ratio: 4 / 3; /* <-- требуемое соотношение 4:3 */
    opacity: 1;
  }

  .reviews-container .review-card:last-child {
    margin-right: 18px;
  }

  .review-card.show {
    opacity: 1;
    transform: none;
  }

  .review-card:hover,
  .review-card:active {
    transform: none;
    box-shadow: 0 8px 26px rgba(0,0,0,0.08);
  }

  /* Заголовок карточки — всегда виден, без анимаций, переносимый при необходимости */
  .review-title {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    font-size: 1.0rem;
    font-style: italic;
    color: #335380;
    margin-top: 6px;
    white-space: normal; /* разрешаем перенос на мобильных */
  }

  /* Хедер с фото/именем — делаем компактнее, чтобы влезало в 4:3 */
  .review-header {
    gap: 8px;
    margin-bottom: 6px;
    justify-content: flex-start;
    align-items: center;
    position: relative;
  }

  .review-header::after {
    /* тонкая разделительная линия уехала — на мобилке не нужна, скрываем */
    display: none;
  }
}