*,
*::before,
*::after {
  box-sizing: border-box;
}

/* запасной шрифт для «20», если Agdasima не загрузилась: системный жирный
   гротеск, уменьшенный до похожей ширины, чтобы цифра не вылезала за экран */
@font-face {
  font-family: "Agdasima Fallback";
  font-weight: 700;
  src: local("Arial Bold"), local("Arial-BoldMT"), local("HelveticaNeue-Bold"), local("Roboto Bold"), local("Roboto-Bold");
  size-adjust: 80%;
}

:root {
  --red: #ff0909;
  --red-dark: #9f0000;
  --red-footer: #870000;
  --btn: #c5392b;
  --accent: #e0483a;
  --text: #dbdbdb;
  --muted: #8c8c8c;
  --line: rgba(255, 255, 255, 0.12);
  --font: "Montserrat", Arial, sans-serif;
  --font-ui: "Inter", Arial, sans-serif;
  --gutter: clamp(16px, 6.6vw, 96px);
}

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: #000;
  color: #fff;
  font-family: var(--font);
  font-weight: 600;
  -webkit-font-smoothing: antialiased;
}

h1, h2, p, dl, dd {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* ---------- Фон ---------- */

.page {
  position: relative;
  overflow: hidden;
}

.page > *:not(.page__bg) {
  position: relative;
  z-index: 1;
}

.page__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url("../img/bg.jpg") no-repeat;
  /* в макете фото 2129px шириной, сдвинуто на -65/-146px при ширине 1440;
     второе значение — чтобы фото не кончалось раньше, чем фон уйдет в черный */
  background-size: auto max(290.7vw, calc(var(--hero-h) + 1700px));
  background-position: -4.5vw -10.1vw;
}

/* затемнение начинается сразу под первым экраном, сам hero не темнеет */
.page__bg::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: var(--hero-h);
  bottom: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0.55) clamp(300px, 40vw, 600px),
    #000 clamp(600px, 100vw, 1500px)
  );
}

/* ---------- Первый экран ---------- */

:root {
  --hero-h: max(100vh, 560px);
  /* размеры текста первого экрана зависят и от ширины, и от высоты окна */
  --fs-title: clamp(30px, min(5.56vw, 7vh), 80px);
  --fs-text: clamp(15px, min(2.08vw, 2.7vh), 30px);
}

@supports (height: 100svh) {
  :root {
    --hero-h: max(100svh, 560px);
  }
}

.hero {
  display: flex;
  flex-direction: column;
  height: var(--hero-h);
}

/* ---------- Шапка ---------- */

.header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: clamp(16px, min(3.75vw, 5vh), 54px);
}

.logo {
  font-size: clamp(24px, 2.78vw, 40px);
  line-height: 1.22;
  color: var(--red-dark);
}

.logo--footer {
  color: var(--red-footer);
}

.header__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(150px, 20.4vw, 294px);
  height: clamp(40px, 3.9vw, 56px);
  padding: 0 clamp(12px, 1.2vw, 17px);
  border: 1px solid #fff;
  border-radius: 10px;
  font-size: clamp(16px, 2.08vw, 30px);
  color: #d4d4d4;
  white-space: nowrap;
  flex: none;
  transition: background-color .2s, color .2s;
}

.header__btn:hover {
  background: #fff;
  color: #000;
}

/* ---------- Заголовок ---------- */

.hero__content {
  flex: none;
  padding-top: clamp(24px, min(10.3vw, 8vh), 148px);
}

.hero__title {
  font-weight: 600;
  font-size: var(--fs-title);
  line-height: 1.22;
}

.hero__text {
  font-size: var(--fs-text);
  line-height: 1.22;
  color: var(--text);
  /* переносы строк из текста в админке */
  white-space: pre-line;
}

.hero__title + .hero__text {
  margin-top: clamp(16px, min(6.3vw, 4.5vh), 91px);
}

.hero__text + .hero__text {
  margin-top: 1.22em;
}

/* «Официальные дилеры» + логотип */
.hero__dealer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: calc(var(--fs-text) * 1.22);
  font-size: var(--fs-text);
  line-height: 1.22;
  color: var(--text);
}

.hero__dealer-logo {
  display: block;
  width: auto;
  height: calc(var(--fs-text) * 1.15);
}

.hero__dealer + .hero__text {
  margin-top: calc(var(--fs-text) * 1.22);
}

/* ---------- 20 лет ---------- */

/* занимает всё, что осталось от экрана; цифра подстраивается под это место */
.years {
  flex: 1 1 0;
  min-height: 0;
  container-type: size;
  display: flex;
  align-items: flex-end;
  column-gap: clamp(8px, 0.7vw, 10px);
  /* отступ от текста над цифрой — чтобы «28» не сливалась с «Работаем с 2005 года» */
  padding-top: clamp(28px, 6vh, 80px);
  padding-bottom: clamp(16px, 4vh, 60px);
  padding-left: clamp(16px, 4.2vw, 61px);
}

.years__num {
  font-family: "Agdasima", "Agdasima Fallback", var(--font);
  font-weight: 700;
  /* для браузеров без container query units (Safari до 16) — примерно по окну */
  font-size: clamp(120px, min(30vw, 38vh), 600px);
  line-height: 0.745;
  color: #ddd;
  position: relative;
}

@supports (height: 1cqh) {
  .years__num {
    /* высота цифр = 0.745em, ширина одной цифры ≈ 0.455em (--digits задает
       index.php по числу из админки), справа место под подпись */
    font-size: min(
      1100px,
      calc(100cqh / 0.745),
      calc((100cqw - 9 * var(--fs-text) - 24px) / (0.455 * var(--digits, 2)))
    );
  }
}

/* «20» держит ширину и читается скринридером, счетчик рисуется поверх,
   чтобы подпись не прыгала, пока меняются цифры */
.years__ghost {
  opacity: 0;
}

.years__count {
  position: absolute;
  right: 0;
  bottom: 0;
}

.years__caption {
  display: flex;
  flex-direction: column;
  padding-bottom: 0.4vw;
  color: var(--text);
  line-height: 1.22;
  white-space: nowrap;
}

.years__unit {
  font-size: var(--fs-title);
  line-height: 1;
}

.years__text {
  font-size: var(--fs-text);
}

/* ---------- Контакты ---------- */

.contacts {
  padding-top: clamp(56px, 7.5vw, 108px);
}

.contacts__card {
  border: 1px solid #fff;
  border-radius: clamp(24px, 4.17vw, 60px);
  padding: clamp(24px, 4.1vw, 59px) clamp(16px, 5.5vw, 79px) clamp(28px, 5.5vw, 80px) clamp(16px, 2.7vw, 39px);
}

.section-title {
  font-weight: 600;
  font-size: clamp(26px, 2.78vw, 40px);
  line-height: 1.22;
  color: var(--red);
}

.contacts__grid {
  display: grid;
  grid-template-columns: 572fr 612fr;
  gap: clamp(24px, 2.6vw, 38px);
  margin-top: clamp(24px, 4.2vw, 61px);
  font-family: var(--font-ui);
}

/* список контактов */

.contacts__list {
  align-self: start;
  padding: 0 29px;
  background: rgba(0, 0, 0, 0.55);
}

.contacts__item {
  padding: 37px 0 38px;
  border-bottom: 1px solid var(--line);
}

.contacts__item dt {
  font-size: clamp(14px, 1.3vw, 19px);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.contacts__item dd {
  margin-top: 8px;
  font-size: clamp(17px, 1.53vw, 22px);
  font-weight: 400;
  color: #fff;
}

.contacts__item a:hover {
  color: var(--red);
}

/* форма */

.form {
  position: relative;
  display: flex;
  flex-direction: column;
}

.form__title,
.form__label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.form__field {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 32px;
}

.form__title + .form__field {
  margin-top: 42px;
}

.form__input {
  width: 100%;
  height: 64px;
  padding: 0 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font: 400 16px/1.4 var(--font-ui);
  outline: none;
  transition: border-color .2s, background-color .2s;
}

.form__input::placeholder {
  color: #5d5d5d;
}

.form__input:focus {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
}

.form__input.is-invalid {
  border-color: var(--btn);
}

.form__textarea {
  height: 168px;
  padding-top: 18px;
  padding-bottom: 18px;
  resize: vertical;
}

/* поле-ловушка для спам-ботов */
.form__trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form__submit {
  height: 66px;
  margin-top: 32px;
  border: 0;
  background: var(--btn);
  color: #fff;
  font: 700 15px var(--font-ui);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color .2s;
}

.form__submit:disabled {
  opacity: 0.6;
  cursor: progress;
}

.form__submit:hover:not(:disabled) {
  background: #d9412f;
}

.form__status {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

/* ---------- Партнеры ---------- */

.partners {
  padding-top: clamp(64px, 13.4vw, 193px);
  padding-bottom: clamp(64px, 12vw, 180px);
}

.partners__list {
  /* фон-плашка выступает влево, текст стоит ровно под заголовком,
     линии тянутся до правого края контейнера */
  margin: clamp(24px, 3.3vw, 48px) 0 0 -29px;
  padding: 0 0 0 29px;
  list-style: none;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.35));
  font-family: var(--font-ui);
}

.partners__item {
  border-bottom: 1px solid var(--line);
}

.partners__btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: clamp(18px, 1.7vw, 24px) 0;
  border: 0;
  background: none;
  color: #fff;
  font: 400 clamp(17px, 1.8vw, 26px)/1.4 var(--font-ui);
  text-align: left;
  cursor: pointer;
  transition: color .25s;
}

/* стрелка справа — подсказка, что пункт кликабельный */
.partners__btn::after {
  content: "→";
  content: "→" / "";
  flex: none;
  opacity: 0.35;
  transition: opacity .25s, transform .25s var(--ease-out);
}

/* первый партнер подсвечен; при наведении подсветка переходит на пункт под курсором */
.partners__item:first-child .partners__btn,
.partners__list:hover .partners__btn:hover,
.partners__btn:focus-visible {
  color: var(--accent);
}

.partners__list:hover .partners__btn:not(:hover) {
  color: #fff;
}

.partners__btn:hover::after,
.partners__btn:focus-visible::after {
  opacity: 1;
  transform: translateX(-6px);
}

.partners__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Модальное окно партнера ---------- */

html.modal-open {
  overflow: hidden;
}

.modal {
  width: min(640px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 0;
  border: 1px solid #fff;
  border-radius: clamp(24px, 3vw, 40px);
  background: #0b0b0b;
  color: #fff;
  overflow: auto;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal[open] {
  animation: modal-in 0.4s var(--ease-out);
}

.modal[open]::backdrop {
  animation: fade-in 0.4s var(--ease-out);
}

.modal.is-closing {
  animation: modal-out 0.25s ease-in forwards;
}

.modal.is-closing::backdrop {
  animation: fade-out 0.25s ease-in forwards;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
}

@keyframes modal-out {
  to {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

.modal__body {
  position: relative;
  padding: clamp(28px, 4vw, 52px) clamp(20px, 4vw, 52px) clamp(24px, 3.5vw, 44px);
  font-family: var(--font-ui);
  font-weight: 400;
}

.modal__close {
  position: absolute;
  top: clamp(16px, 2vw, 24px);
  right: clamp(16px, 2vw, 24px);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: none;
  color: #fff;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}

.modal__close:hover,
.modal__close:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.modal__title {
  margin: 0;
  padding-right: 56px;
  font: 600 clamp(26px, 2.78vw, 40px)/1.22 var(--font);
  color: var(--red);
}

.modal__text {
  margin-top: 16px;
  white-space: pre-line;
  font-size: clamp(15px, 1.25vw, 18px);
  line-height: 1.55;
  color: var(--text);
}

.modal__list {
  margin-top: clamp(20px, 2.5vw, 32px);
}

.modal__item {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.modal__item:first-child {
  border-top: 1px solid var(--line);
}

.modal__item dt {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.modal__item dd {
  margin-top: 6px;
  font-size: clamp(17px, 1.53vw, 22px);
}

.modal__item a {
  transition: color .2s;
}

.modal__item a:hover,
.modal__item a:focus-visible {
  color: var(--accent);
}

/* окно «Заявка отправлена» */
.modal--success {
  width: min(460px, calc(100% - 32px));
}

.modal--success .modal__body {
  text-align: center;
}

.modal__icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 4px auto 20px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
}

/* крестик стоит выше иконки, поэтому отступ под него заголовку не нужен */
.modal--success .modal__title {
  padding: 0;
  font-size: clamp(24px, 2.3vw, 32px);
}

.modal__ok {
  width: 100%;
  height: 58px;
  margin-top: 28px;
  border: 0;
  background: var(--btn);
  color: #fff;
  font: 700 15px var(--font-ui);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color .2s;
}

.modal__ok:hover {
  background: #d9412f;
}

.modal__ok:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* ---------- Подвал ---------- */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 32px;
  padding-top: 0;
  padding-bottom: clamp(32px, 3.9vw, 56px);
}

.footer__copy,
.footer__policy {
  font-family: var(--font-ui);
  font-size: clamp(14px, 1.25vw, 18px);
  font-weight: 400;
  color: #7a7a7a;
}

.footer__policy {
  text-decoration: underline;
  text-decoration-color: rgba(122, 122, 122, 0.5);
  text-underline-offset: 4px;
  transition: color .2s, text-decoration-color .2s;
}

.footer__policy:hover,
.footer__policy:focus-visible {
  color: #fff;
  text-decoration-color: currentColor;
  outline: none;
}

/* ---------- Уведомление о cookie ---------- */

.cookie {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 24px;
  width: min(480px, calc(100% - 48px));
  padding: 22px 22px 22px 28px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  color: #3d3d3d;
  font: 500 15px/1.45 var(--font);
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .4s var(--ease-out), transform .4s var(--ease-out);
}

.cookie[hidden] {
  display: none;
}

.cookie.is-shown {
  opacity: 1;
  transform: none;
}

.cookie__text {
  flex: 1;
}

.cookie__link {
  font-weight: 700;
  color: #111;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color .2s;
}

.cookie__link:hover,
.cookie__link:focus-visible {
  text-decoration-color: currentColor;
  outline: none;
}

.cookie__btn {
  flex: none;
  min-width: 92px;
  height: 46px;
  padding: 0 24px;
  border: 0;
  border-radius: 16px;
  background: #111;
  color: #fff;
  font: 700 15px var(--font);
  cursor: pointer;
  transition: background-color .2s;
}

.cookie__btn:hover {
  background: #333;
}

.cookie__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 600px) {
  .cookie {
    right: 12px;
    bottom: 12px;
    gap: 16px;
    width: calc(100% - 24px);
    padding: 16px 16px 16px 20px;
    font-size: 14px;
  }

  .cookie__btn {
    min-width: 80px;
    height: 42px;
    padding: 0 18px;
  }
}

@media print {
  .cookie {
    display: none;
  }
}

/* ---------- Анимации ---------- */

:root {
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* фон при загрузке проявляется из темноты и чуть отъезжает */
.js .page__bg {
  transform-origin: 50% 0;
  animation: bg-in 2.4s var(--ease-out) both;
}

@keyframes bg-in {
  from {
    opacity: 0;
    transform: scale(1.08);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* появление при прокрутке: класс .is-visible ставит js/main.js,
   --d задает задержку для поочередного появления */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(40px);
  transition:
    opacity 0.9s var(--ease-out) var(--d, 0s),
    transform 0.9s var(--ease-out) var(--d, 0s);
}

.js [data-reveal="down"] {
  transform: translateY(-24px);
}

.js [data-reveal="fade"] {
  transform: none;
}

.js [data-reveal].is-visible,
.js [data-reveal]:focus-within {
  opacity: 1;
  transform: none;
}


/* заголовок выезжает построчно из-под маски */
.reveal-line {
  display: block;
  overflow: hidden;
}

/* режем только по вертикали, чтобы на очень узком экране не обрезался конец строки */
@supports (overflow: clip) {
  .reveal-line {
    overflow: visible clip;
  }
}

.reveal-line > span {
  display: block;
}

.js [data-reveal="lines"] {
  opacity: 1;
  transform: none;
}

.js [data-reveal="lines"] .reveal-line > span {
  transform: translateY(110%);
  transition: transform 1s var(--ease-out) var(--d, 0s);
}

.js [data-reveal="lines"].is-visible .reveal-line > span {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .js .page__bg {
    animation: none;
  }

  .cookie {
    transition: none;
  }

  .js [data-reveal],
  .js [data-reveal="lines"] .reveal-line > span {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .modal[open],
  .modal[open]::backdrop,
  .modal.is-closing,
  .modal.is-closing::backdrop {
    animation: none;
  }
}

/* при печати показываем всё, даже то, до чего не докрутили */
@media print {
  .js .page__bg {
    animation: none;
  }

  .js [data-reveal],
  .js [data-reveal="lines"] .reveal-line > span {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ---------- Адаптив ---------- */

@media (max-width: 900px) {
  .contacts__grid {
    grid-template-columns: 1fr;
  }

  /* одинаковые отступы слева и справа: текст контактов и форма начинаются
     и заканчиваются на одной линии, темная подложка списка — до краев карточки */
  .contacts__card {
    --pad-x: clamp(16px, 4vw, 32px);
    padding: clamp(24px, 4vw, 40px) var(--pad-x) clamp(28px, 4vw, 40px);
  }

  .contacts__list {
    margin: 0 calc(-1 * var(--pad-x));
    padding: 0 var(--pad-x);
  }
}

@media (max-width: 600px) {
  .page__bg {
    background-size: auto calc(var(--hero-h) + 700px);
    background-position: 30% -60px;
  }

  .page__bg::after {
    background: linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0) 0,
      rgba(0, 0, 0, 0.6) 250px,
      #000 600px
    );
  }

  :root {
    --fs-title: clamp(22px, 8.5vw, 40px);
    --fs-text: clamp(15px, 4.3vw, 18px);
  }

  .logo {
    font-size: 22px;
  }

  .header__btn {
    min-width: 0;
    height: 38px;
    font-size: 14px;
  }

  /* на телефоне подпись под цифрой — так «20» получается крупнее */
  .years {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
  }

  .years__num {
    font-size: clamp(120px, min(85vw, 40vh), 500px);
  }

  @supports (height: 1cqh) {
    .years__num {
      font-size: min(calc((100cqh - 84px) / 0.745), calc(100cqw / (0.455 * var(--digits, 2))));
    }
  }

  .years__caption {
    padding-bottom: 0;
    margin-top: 12px;
  }

  /* переносы строк из админки нужны на компьютере; на телефоне строки
     и так переносятся по ширине экрана — лишний перенос дает рваный край */
  .hero__text {
    white-space: normal;
  }

  .partners__list {
    margin-left: -16px;
    margin-right: -16px;
    padding: 0 16px;
  }

  .contacts__item {
    padding: 22px 0;
  }

  .form__input {
    height: 54px;
    padding: 0 16px;
  }

  .form__textarea {
    height: 140px;
    padding-top: 14px;
  }

  .form__submit {
    height: 58px;
  }
}

/* совсем узкие экраны (320px): шапка помещается в одну строку */
@media (max-width: 359px) {
  .logo {
    font-size: 19px;
  }

  .header {
    gap: 10px;
  }

  .header__btn {
    padding: 0 10px;
    font-size: 13px;
  }
}
