/*Header*/

.header__top-services {
  margin-top: 20px;
}

.logo img {
  width: 50px;
}

.header__services-desc {
  margin-bottom: 30px;
}

.header__title-services {
  font-size: 80px;
  font-weight: 500;
  line-height: 96px;
  text-align: center;
  margin-bottom: 50px;
  animation: hero-rise 1s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}

.header__wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-top: 0;
}

.header__hero-services {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

.header__subtitle {
  line-height: 26px;
  opacity: 0.82;
  font-weight: 400;
}

.header__subtitle::after {
  content: "";
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%); /* центрируем линию */
  width: min(1280px, calc(100% - 40px));
  height: 1px;
  background-color: var(--color-black);
  opacity: 0.5;
}

/*Carousel*/

.service__gallery {
  margin: 100px 0;
}

.gallery__carousel {
  display: flex;
  overflow-x: auto;
  gap: 16px;
  padding: 0 10px;
  scrollbar-width: none;
}

.gallery__slide {
  flex-shrink: 0; /* ← слайды НЕ сжимаются */
  width: 420px;
  height: 600px;
  scroll-snap-align: center;
}

.gallery__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 2px;

  animation-name: carousel;
  animation-timing-function: linear;
  animation-fill-mode: both;
  animation-timeline: view(inline);
  animation-range: entry 0% exit 100%;
}

/*Description*/

.description__grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 60px;
  align-items: start;
}

.description__right {
  position: sticky;
  top: 20px;
}

.description__title,
.description__left-steps {
  line-height: 26px;
}

.description__left p {
  line-height: 26px;
}

.steps__title {
  font-weight: 700;
}

.description__left-steps h5 {
  margin-bottom: 20px;
}

.steps__list {
  counter-reset: my-counter;
}

.steps__item {
  counter-increment: my-counter;
  padding-left: 40px;
  padding-bottom: 30px;
  position: relative;
}

.steps__item::before {
  position: absolute;
  content: counter(my-counter);
  height: 30px;
  font-size: 16px;
  font-weight: 400;
  display: flex;
  align-items: center;
  left: 15px;
}

.description__right h3 {
  padding-left: 10px;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.8px;
  line-height: 36px;
  margin-bottom: 20px;
}

/*Form*/

.form {
  padding-top: 150px;
}

.form__title {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 80px;
}

.form__title h2 {
  font-size: 80px;
  font-weight: 500;
  line-height: 96px;
}

.form__title-right {
  max-width: 420px;
}

.form__subtitle {
  font-weight: 500;
  line-height: 26px;
  margin-bottom: 12px;
}

.form__desc {
  line-height: 26px;
  opacity: 0.82;
}

.form__contact {
  max-width: 500px;
  margin: 0 auto;
  padding: 40px;
  background-color: #fff;
  border: 1px solid rgba(27, 25, 23, 0.15);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.form__row {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form__field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form__label {
  font-weight: 500;
  line-height: 23px;
}

.form__input {
  padding: 14px 16px;
  border: 1px solid rgba(27, 25, 23, 0.2);
  border-radius: 2px;
  background: transparent;
  font-family: inherit;
  font-size: 16px;
  color: inherit;
  transition: border-color 0.3s ease;
}

.form__input:focus {
  outline: none;
  border-color: #c2551e; /* оранжевый акцент при фокусе */
}

.form__input::placeholder {
  color: rgba(27, 25, 23, 0.4);
}

.form__textarea {
  min-height: 140px;
  resize: vertical; /* тянется только по вертикали */
}

.form__submit {
  padding: 16px 48px;
  background-color: #c2551e;
  color: #fff;
  border: none;
  border-radius: 2px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.form__submit:hover {
  background-color: #a8431a;
}

.form__state {
  display: none;
}

.form__consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 18px;
  opacity: 0.75;
  cursor: pointer;
  margin-top: 16px;
}

.form__consent-input {
  margin-top: 2px;
  flex: 0 0 16px;
  cursor: pointer;
}

.form__consent a {
  color: #c2551e;
  text-decoration: underline;
}

.form__input:focus {
  outline: none;
  border-color: #c2551e; /* оранжевый акцент при фокусе */
}

.form__input::placeholder {
  color: rgba(27, 25, 23, 0.4);
}

.form__state--active {
  display: flex;
  flex-direction: column;
  gap: 30px;
  animation: fade-in 0.4s ease;
}

/* Иконка успеха */
.form__success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkmark {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: block;
  stroke-width: 2;
  stroke: #c2551e;
  stroke-miterlimit: 10;
  box-shadow: inset 0px 0px 0px #c2551e;
  animation:
    checkmark-fill 0.4s ease-in-out 0.4s forwards,
    checkmark-scale 0.3s ease-in-out 0.9s both;
}

.checkmark__circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-width: 2;
  stroke-miterlimit: 10;
  stroke: #c2551e;
  fill: none;
  animation: checkmark-stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark__check {
  transform-origin: 50% 50%;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: checkmark-stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

/* Круг рисуется первым */
@keyframes checkmark-stroke {
  to {
    stroke-dashoffset: 0;
  }
}

/* Круг заполняется цветом */
@keyframes checkmark-fill {
  to {
    box-shadow: inset 0px 0px 0px 80px rgba(194, 85, 30, 0.1);
  }
}

/* Лёгкий bounce в конце */
@keyframes checkmark-scale {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.form__success {
  align-items: center;
  text-align: center;
  padding: 40px;
  background-color: #fff;
  border: 1px solid rgba(27, 25, 23, 0.15);
  border-radius: 2px;
  max-width: 500px;
  margin: 0 auto;
}

.form__success-title {
  font-size: 28px;
  font-weight: 500;
  line-height: 36px;
  margin-bottom: 8px;
}

.form__success-text {
  line-height: 26px;
  opacity: 0.82;
  margin-bottom: 20px;
}

.form__success-reset {
  padding: 12px 24px;
  background-color: transparent;
  color: #c2551e;
  border: 1px solid #c2551e;
  border-radius: 2px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

.form__success-reset:hover {
  background-color: #c2551e;
  color: #fff;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/*Benefits*/

.benefits {
  margin-bottom: 100px;
}

.benefits__wrapper {
  max-width: 800px;
  background-color: #c2551e;
  color: var(--color-white);
  padding: 16px 24px;
  border-radius: 2px;
}

.benefits__title {
  font-weight: 600;
  line-height: 26px;
  margin-bottom: 16px;
}

.benefits__desc-title {
  position: relative;
  padding-left: 24px;
}

.benefits__desc-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--color-white);
}

.benefits__desc-subtitle {
  margin-bottom: 10px;
  opacity: 0.8;
}

.gallery__slide {
  position: relative; /* ← добавь эту строку к существующим стилям */
}

.gallery__slide-btn {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  z-index: 2; /* поверх картинки */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Иконка лупы с плюсом (появляется при наведении) */
.gallery__slide-btn-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(194, 85, 30, 0.9);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

.gallery__slide-btn:hover .gallery__slide-btn-icon {
  opacity: 1;
  transform: scale(1);
}

/* Focus для клавиатурной навигации */
.gallery__slide-btn:focus-visible {
  outline: 2px solid #c2551e;
  outline-offset: -2px;
}

.gallery__slide-btn:focus-visible .gallery__slide-btn-icon {
  opacity: 1;
  transform: scale(1);
}

/*Modal*/
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s;
}

/* Когда открыта */
.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

/* Скрываем полностью когда hidden (для браузеров) */
.lightbox[hidden] {
  display: none !important;
}

/* Тёмный фон */
.lightbox__overlay {
  position: absolute;
  inset: 0;
  background: rgba(27, 25, 23, 0.92);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  cursor: pointer;
}

.lightbox__content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  z-index: 1;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.lightbox.is-open .lightbox__content {
  transform: scale(1) translateY(0);
}

.lightbox__image {
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  display: block;
}

.lightbox__caption {
  color: #fff;
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
  max-width: 600px;
  margin: 0;
  opacity: 0.85;
}

.lightbox__close {
  position: absolute;
  top: -50px;
  right: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.3s ease,
    transform 0.3s ease;
  z-index: 10;
}

.lightbox__close:hover {
  background: rgba(194, 85, 30, 0.9);
  border-color: #c2551e;
  transform: rotate(90deg);
}

.lightbox__close:focus-visible {
  outline: 2px solid #c2551e;
  outline-offset: 2px;
}

/*Animation*/

@keyframes carousel {
  from {
    object-position: 100% 50%;
  }

  to {
    object-position: 0% 50%;
  }
}

@keyframes hero-rise {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/*Adaptive*/

/* Планшеты и небольшие десктопы */
@media (max-width: 1200px) {
  .header__title-services {
    font-size: 64px;
    line-height: 76px;
  }

  .gallery__slide {
    width: 360px;
    height: 520px;
  }

  .description__grid {
    grid-template-columns: 1fr 380px;
    gap: 40px;
  }
}

/* Планшеты */
@media (max-width: 992px) {
  /* ===== Header ===== */
  .header__title-services {
    font-size: 48px;
    line-height: 58px;
    margin-bottom: 30px;
  }

  .header__subtitle::after {
    bottom: 30px;
  }

  /* ===== Карусель ===== */
  .service__gallery {
    margin: 60px 0;
  }

  .gallery__carousel {
    gap: 12px;
    padding: 0;
  }

  .gallery__slide {
    width: 300px;
    height: 440px;
  }

  /* ===== Описание: одна колонка ===== */
  .description__grid {
    grid-template-columns: 1fr;
    gap: 60px;
  }

  /* Убираем sticky — на планшете форма будет снизу */
  .description__right {
    position: static;
  }

  .form__contact {
    max-width: 500px;
  }

  /* ===== Преимущества ===== */
  .benefits__wrapper {
    padding: 16px 20px;
  }

  .lightbox__close {
    top: -44px;
    width: 36px;
    height: 36px;
  }

  .lightbox__caption {
    font-size: 14px;
  }
}

/* Мобильные устройства */
@media (max-width: 768px) {
  /* ===== Header ===== */
  .header__hero-services {
    padding: 40px 0;
  }

  .header__title-services {
    font-size: 36px;
    line-height: 44px;
    margin-bottom: 24px;
  }

  .header__subtitle {
    text-align: center;
  }

  .header__subtitle::after {
    bottom: 20px;
  }

  /* ===== Карусель ===== */
  .service__gallery {
    margin: 40px 0;
  }

  .gallery__slide {
    width: 280px;
    height: 400px;
  }

  /* Отключаем анимацию parallax-object-position на мобилке
     (на маленьких экранах эффект не виден, а производительность страдает) */
  .gallery__slide img {
    animation: none;
    object-position: center;
  }

  /* ===== Описание ===== */
  .description__grid {
    gap: 40px;
  }

  .description__right h3 {
    font-size: 22px;
    line-height: 32px;
    padding-left: 0;
  }

  .form__contact {
    max-width: 100%;
    padding: 24px;
    gap: 24px;
  }

  .steps__item {
    padding-left: 32px;
    padding-bottom: 24px;
  }

  /* ===== Преимущества ===== */
  .benefits {
    margin-bottom: 60px;
  }

  .benefits__wrapper {
    padding: 16px;
    max-width: 100%;
  }

  .benefits__desc-subtitle {
    font-size: 15px;
    line-height: 24px;
  }

  .lightbox {
    padding: 16px;
    align-items: center;
  }

  .lightbox__content {
    max-width: 100%;
    max-height: 85vh;
    gap: 12px;
  }

  .lightbox__image {
    max-height: 70vh;
    border-radius: 8px;
  }

  .lightbox__close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(27, 25, 23, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .lightbox__caption {
    font-size: 13px;
    padding: 0 8px;
  }
}

/* Маленькие мобильные (iPhone SE и подобные) */
@media (max-width: 576px) {
  /* ===== Header ===== */
  .header__title-services {
    font-size: 28px;
    line-height: 36px;
    margin-bottom: 16px;
  }

  .header__services-desc {
    margin-bottom: 20px;
  }

  .header__subtitle {
    font-size: 14px;
    line-height: 22px;
  }

  .header__subtitle::after {
    bottom: 10px;
  }

  /* ===== Карусель: вертикальная вместо горизонтальной ===== */
  .service__gallery {
    margin: 30px 0;
  }

  .gallery__carousel {
    display: flex;
    flex-direction: row; /* горизонтально */
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory; /* примагничивание к слайдам */
    -webkit-overflow-scrolling: touch; /* плавность на iOS */
    padding: 0 16px 16px; /* отступ снизу под индикатор */
    scrollbar-width: none; /* скрыть скроллбар (Firefox) */
  }

  .gallery__carousel::-webkit-scrollbar {
    display: none; /* скрыть скроллбар (Chrome/Safari) */
  }
  .gallery__slide {
    width: 70vw;
    height: auto;
    aspect-ratio: 3 / 4; /* вертикальные пропорции фото */
    flex-shrink: 0;
    scroll-snap-align: center; /* центрируем при остановке */
  }

  /* ===== Описание ===== */
  .steps__item {
    padding-left: 28px;
  }

  .steps__item::before {
    left: 8px;
    font-size: 14px;
  }

  .form__contact {
    padding: 20px 16px;
    gap: 20px;
  }

  .form__input {
    padding: 12px 14px;
    font-size: 15px;
  }

  .form__submit {
    padding: 14px 32px;
    font-size: 15px;
    width: 100%;
  }

  /* ===== Преимущества ===== */
  .benefits__wrapper {
    padding: 14px 12px;
  }

  .benefits__desc-title {
    font-size: 15px;
    padding-left: 20px;
  }

  .benefits__desc-title::before {
    width: 8px;
    height: 8px;
  }

  .lightbox__close {
    top: -60px;
  }
}

@media (max-width: 480px) {
  .lightbox {
    padding: 12px;
  }

  .lightbox__image {
    max-height: 65vh;
  }
}

/* Отключение hover-эффектов на тач-устройствах */
@media (hover: none) {
  /* Иконка лупы в карусели — не показываем при "hover" */
  .gallery__slide-btn:hover .gallery__slide-btn-icon {
    opacity: 0;
    transform: scale(0.8);
  }

  /* Крестик модалки — не поворачиваем */
  .lightbox__close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: none;
  }

  /* Hover-эффекты карточек услуг (если есть) */
  .victory-film:hover {
    transform: none;
    border-color: rgba(255, 255, 255, 0.12);
  }

  .victory-film:hover img {
    transform: none;
    filter: grayscale(45%);
  }

  .polk-group-card:hover {
    transform: none;
  }

  .polk-group-card:hover .polk-group-card__cover img {
    transform: none;
    filter: grayscale(40%);
  }

  /* Стрелки на группах всегда видны */
  .polk-group-card__arrow {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox,
  .lightbox__content,
  .lightbox__close {
    transition-duration: 0.01ms !important;
  }

  .lightbox__close:hover {
    transform: none;
  }
}
