/* ==========================================================================
   САШОК ДОВЕЗЁТ — СТИЛИ САЙТА
   Токены описаны в DESIGN.md. Новые значения цветов/отступов не заводить —
   только переиспользовать переменные ниже.
   ========================================================================== */

/* Шрифт Onest (вариативный, веса 400–600) — локально, без Google Fonts.
   Наборы символов как у Google: браузер качает только нужные файлы */
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('assets/fonts/onest-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('assets/fonts/onest-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('assets/fonts/onest-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('assets/fonts/onest-math.woff2') format('woff2');
  unicode-range: U+0391-03A1, U+03A3-03A9, U+03B1-03C9, U+2016-2017, U+2034-2038, U+203C, U+2070-2071, U+2074-209F, U+2100-2112, U+2114-2115, U+2117-2121, U+2123-214F, U+2190, U+2192, U+2194-21AE, U+21B0-21E5, U+2200-22FF;
}
@font-face {
  font-family: 'Onest';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('assets/fonts/onest-symbols.woff2') format('woff2');
  unicode-range: U+2150-218F, U+2300-243F, U+2460-24FF, U+25A0-27BF, U+2B00-2BFF;
}

:root {
  /* Цвет */
  --ink: #121314;
  --ink-2: #1b1d20;
  --paper: #f5f3ef;
  --paper-2: #ebe8e2;
  --white: #ffffff;
  --muted: #5f6368;
  --muted-dark: #9a9ea5;
  --line: rgba(18, 19, 20, 0.12);
  --line-dark: rgba(255, 255, 255, 0.12);
  --accent: #c04e18;
  --accent-hover: #a8430f;
  --accent-bright: #e06a26;

  /* Типографика */
  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --fs-xs: 0.8125rem;
  --fs-sm: 0.9375rem;
  --fs-base: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: clamp(1.75rem, 1.3rem + 1.6vw, 2.5rem);
  --fs-3xl: clamp(2.25rem, 1.4rem + 3.2vw, 4rem);

  /* Отступы */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;
  --s-10: 128px;
  --section-y: clamp(var(--s-8), 9vw, var(--s-10));
  --container: 1200px;
  --gutter: clamp(20px, 4vw, 32px);
  --header-h: 72px;

  /* Скругления */
  --r-sm: 6px;
  --r-md: 12px;

  /* Движение */
  --dur: 150ms;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-slide: 320ms;
  --dur-reveal: 900ms;
  --dur-media: 1400ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --stagger: 80ms;
}

*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  background: var(--ink);
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

ul, ol {
  list-style: none;
}

button, input, select {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
}

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ==========================================================================
   Общие элементы
   ========================================================================== */

.eyebrow {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow::before {
  content: '';
  width: 24px;
  height: 2px;
  background: var(--accent);
  flex-shrink: 0;
}

.eyebrow--dark {
  color: var(--muted-dark);
}

.eyebrow--dark::before {
  background: var(--accent-bright);
}

.section {
  padding-block: var(--section-y);
}

.section--paper {
  background: var(--paper);
}

.section--paper-2 {
  background: var(--paper-2);
}

.section--ink {
  background: var(--ink);
  color: var(--white);
}

.section--ruled {
  padding-top: 0;
}

.section--ruled > .container {
  padding-top: var(--section-y);
  border-top: 1px solid var(--line);
  max-width: var(--container);
  padding-inline: 0;
  width: calc(100% - var(--gutter) * 2);
}

.section-head {
  max-width: 760px;
  margin-bottom: var(--s-7);
}

.section-head--row {
  max-width: none;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: var(--s-7);
  align-items: end;
}

.section-title {
  font-size: var(--fs-2xl);
}

.section-lead {
  margin-top: var(--s-4);
  font-size: var(--fs-lg);
  line-height: 1.5;
  color: var(--muted);
}

.section-head--row .section-lead {
  margin-top: 0;
}

.section--ink .section-lead {
  color: var(--muted-dark);
}

/* Кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 48px;
  padding: var(--s-3) var(--s-5);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              color var(--dur) var(--ease),
              transform var(--dur) var(--ease);
}

.btn:active {
  transform: translateY(1px);
}

/* Стрелка в главных кнопках: на hover подаётся вперёд */
.btn__arrow {
  flex-shrink: 0;
  transition: translate var(--dur) var(--ease);
}

.btn:hover .btn__arrow {
  translate: var(--s-1) 0;
}

.btn--sm {
  min-height: 40px;
  padding: var(--s-2) var(--s-4);
}

.btn--block {
  width: 100%;
}

.btn--accent {
  background: var(--accent);
  color: var(--white);
}

.btn--accent:hover {
  background: var(--accent-hover);
}

.btn--dark {
  background: var(--ink);
  color: var(--white);
}

.btn--dark:hover {
  background: var(--ink-2);
}

.btn--outline {
  border-color: var(--line);
  color: var(--ink);
}

.btn--outline:hover {
  border-color: var(--ink);
}

.btn--light {
  background: var(--white);
  color: var(--ink);
}

.btn--light:hover {
  background: var(--paper-2);
}

.btn--ghost-dark {
  border-color: var(--line-dark);
  color: var(--white);
}

.btn--ghost-dark:hover {
  border-color: var(--white);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
}

/* ==========================================================================
   Шапка
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--ink);
  color: var(--white);
  border-bottom: 1px solid var(--line-dark);
}

/* Сколько страницы пройдено */
.site-header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent-bright);
  transform: scaleX(var(--scroll, 0));
  transform-origin: left;
  pointer-events: none;
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  text-decoration: none;
  flex-shrink: 0;
}

.brand__mark {
  width: 6px;
  height: 32px;
  border-radius: 2px;
  background: var(--accent-bright);
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand__name {
  font-size: var(--fs-base);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand__sub {
  font-size: var(--fs-xs);
  color: var(--muted-dark);
}

.site-nav {
  display: flex;
  gap: var(--s-1);
  margin-inline: auto;
}

.site-nav__link {
  position: relative;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--muted-dark);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}

.site-nav__link:hover,
.site-nav__link.is-active {
  color: var(--white);
}

.site-nav__link::after {
  content: '';
  position: absolute;
  left: var(--s-3);
  right: var(--s-3);
  bottom: 0;
  height: 2px;
  background: var(--accent-bright);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-slide) var(--ease-out);
}

.site-nav__link.is-active::after {
  transform: scaleX(1);
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  flex-shrink: 0;
}

.header-phone {
  font-size: var(--fs-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  white-space: nowrap;
}

.header-phone:hover {
  color: var(--accent-bright);
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-dark);
  border-radius: var(--r-sm);
  background: none;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.nav-toggle span {
  width: 18px;
  height: 2px;
  background: var(--white);
  transition: transform var(--dur) var(--ease);
}

.site-header.is-open .nav-toggle span:first-child {
  transform: translateY(4px) rotate(45deg);
}

.site-header.is-open .nav-toggle span:last-child {
  transform: translateY(-4px) rotate(-45deg);
}

/* ==========================================================================
   Первый экран
   ========================================================================== */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  min-height: clamp(560px, calc(100svh - var(--header-h) - 120px), 820px);
  background: var(--ink);
  color: var(--white);
}

.hero__content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: var(--s-9);
  padding-right: var(--s-8);
  padding-left: max(var(--gutter), calc((100vw - var(--container)) / 2));
}

.hero__title {
  font-size: var(--fs-3xl);
  line-height: 1.04;
  letter-spacing: -0.03em;
  max-width: 13ch;
}

.hero__lead {
  margin-top: var(--s-5);
  max-width: 34rem;
  font-size: var(--fs-lg);
  line-height: 1.5;
  color: var(--muted-dark);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-top: var(--s-6);
}

.hero__media {
  position: relative;
  overflow: hidden;
}

.hero__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Кабина в кадре целиком, прицеп уходит под затемнение слева */
  object-position: 77% 50%;
}

/* Мягкий стык фото с тёмной колонкой */
.hero__media::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 32%;
  background: linear-gradient(90deg, var(--ink) 0%, rgba(18, 19, 20, 0.55) 40%, transparent 100%);
  z-index: 1;
}

/* Ключевые цифры */
.facts {
  background: var(--ink);
  color: var(--white);
  border-top: 1px solid var(--line-dark);
}

.facts__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.fact {
  padding: var(--s-5) var(--s-5) var(--s-6);
  border-left: 1px solid var(--line-dark);
}

.fact:first-child {
  border-left: 0;
  padding-left: 0;
}

.fact__label {
  font-size: var(--fs-xs);
  color: var(--muted-dark);
}

.fact__value {
  margin-top: var(--s-1);
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ==========================================================================
   Водитель
   ========================================================================== */

.split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: var(--s-9);
  align-items: start;
}

.prose p + p {
  margin-top: var(--s-4);
}

.prose p {
  color: var(--muted);
}

.prose .lead {
  font-size: var(--fs-lg);
  line-height: 1.5;
  color: var(--ink);
}

.signature {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-block: var(--s-6);
  padding-top: var(--s-6);
  border-top: 1px solid var(--line);
}

.signature__avatar {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--white);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.signature__text {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.signature__name {
  font-weight: 600;
}

.signature__role {
  font-size: var(--fs-sm);
  color: var(--muted);
}

/* ==========================================================================
   Машина
   ========================================================================== */

.truck {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s-8);
  align-items: stretch;
}

.truck__photo {
  position: relative;
  min-height: 460px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--ink-2);
}

.truck__photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 30% 50%;
}

.specs {
  align-self: center;
  border-top: 1px solid var(--line-dark);
}

.specs__row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: var(--s-5);
  padding-block: var(--s-4);
}

/* Нижняя линия строки — отдельным слоем, чтобы её можно было прорисовать */
.specs__row::after,
.contact-list__item::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--line-dark);
}

.specs__row dt {
  font-size: var(--fs-sm);
  color: var(--muted-dark);
}

.specs__row dd {
  font-weight: 500;
}

.options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-4);
  margin-top: var(--s-8);
}

.option {
  padding: var(--s-5);
  border-radius: var(--r-md);
  background: var(--ink-2);
  border: 1px solid var(--line-dark);
}

.option__title {
  font-size: var(--fs-lg);
  letter-spacing: -0.01em;
}

.option__text {
  margin-top: var(--s-2);
  font-size: var(--fs-sm);
  color: var(--muted-dark);
}

/* ==========================================================================
   Маршрут
   ========================================================================== */

.route {
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: var(--s-4);
  padding-top: var(--s-6);
}

/* Линия трассы: подложка и пройденная часть (её длину задаёт script.js).
   Обрывается в центре последней точки; без JS — по сетке из 8 колонок */
.route::before,
.route::after {
  content: '';
  position: absolute;
  top: 7px;
  left: 0;
  right: var(--route-end, calc((100% - 7 * var(--s-4)) / 8 - 8px));
  height: 2px;
  background: var(--line);
}

.route::after {
  background: var(--ink);
  transform: scaleX(var(--progress, 1));
  transform-origin: left;
}

.route__stop {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.route__stop::before {
  content: '';
  position: absolute;
  top: calc(-1 * var(--s-6));
  left: 0;
  width: 16px;
  height: 16px;
  z-index: 1;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--ink);
}

.route__stop--edge::before {
  background: var(--accent);
  border-color: var(--accent);
}

.route__city {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.route__km {
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}

.route__note {
  font-size: var(--fs-xs);
  color: var(--muted);
}

/* Грузовик на линии: показывается, только пока script.js ведёт маршрут */
.route-wrap {
  position: relative;
}

.route-truck {
  display: none;
}

.route-truck__body,
.route-truck__wheel {
  fill: var(--ink);
}

.route-truck__cab {
  fill: var(--accent);
}

.route-truck__glass {
  fill: var(--paper);
}

.route-truck__wheel {
  stroke: var(--paper);
  stroke-width: 1;
}

.route-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-4);
  margin-top: var(--s-8);
}

.route-stats__item {
  padding: var(--s-5);
  border-radius: var(--r-md);
  background: var(--white);
  border: 1px solid var(--line);
}

.route-stats__item dt {
  font-size: var(--fs-sm);
  color: var(--muted);
}

.route-stats__item dd {
  margin-top: var(--s-1);
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Гарантии
   ========================================================================== */

.guarantees {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-7) var(--s-8);
}

.guarantee {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: var(--s-5);
}

.guarantee__num {
  grid-row: span 2;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1.9;
}

.guarantee__title {
  font-size: var(--fs-lg);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.guarantee__text {
  margin-top: var(--s-2);
  color: var(--muted);
}

/* ==========================================================================
   Калькулятор
   ========================================================================== */

.calc {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--line);
}

.calc__form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-5);
  padding: var(--s-7);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.field--wide {
  grid-column: 1 / -1;
}

.field__label {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--muted);
}

.field__label--row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.field__label--row strong {
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.field__control {
  width: 100%;
  min-height: 48px;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper);
  font-size: var(--fs-base);
  transition: border-color var(--dur) var(--ease);
}

.field__control:hover {
  border-color: var(--muted);
}

.field__control:focus {
  outline: none;
  border-color: var(--ink);
}

select.field__control {
  appearance: none;
  padding-right: var(--s-7);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%23121314' stroke-width='1.5'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s-4) center;
  cursor: pointer;
}

.range {
  width: 100%;
  margin-top: var(--s-2);
  accent-color: var(--accent);
  cursor: pointer;
}

.range__scale {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.calc__result {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--s-6);
  padding: var(--s-7);
  background: var(--ink);
  color: var(--white);
}

.calc__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-4);
  padding-block: var(--s-3);
  border-bottom: 1px solid var(--line-dark);
}

.calc__row dt {
  font-size: var(--fs-sm);
  color: var(--muted-dark);
}

.calc__row dd {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.calc__row--total {
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-1);
  padding-top: var(--s-5);
  border-bottom: 0;
}

.calc__row--total dd {
  font-size: var(--fs-2xl);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.calc__send {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

/* ==========================================================================
   Финал: Владивосток
   ========================================================================== */

.finale {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: clamp(420px, 70vh, 680px);
  overflow: hidden;
  background: var(--ink);
  color: var(--white);
}

.finale__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 40%;
}

.finale::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 35%, rgba(18, 19, 20, 0.85) 100%);
}

.finale__content {
  position: relative;
  z-index: 1;
  padding-bottom: var(--s-8);
}

.finale__title {
  max-width: 24ch;
  font-size: var(--fs-2xl);
}

.finale__caption {
  position: absolute;
  z-index: 1;
  right: var(--gutter);
  bottom: var(--s-4);
  font-size: var(--fs-xs);
  color: var(--muted-dark);
}

/* ==========================================================================
   Контакты и заявка
   ========================================================================== */

.contacts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s-9);
  align-items: start;
}

.contact-list {
  margin-top: var(--s-7);
  border-top: 1px solid var(--line-dark);
}

.contact-list__item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: var(--s-5);
  padding-block: var(--s-4);
}

.contact-list__item dt {
  font-size: var(--fs-sm);
  color: var(--muted-dark);
}

.contact-list__item dd {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.contact-list__item a {
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}

.contact-list__item a:hover {
  color: var(--accent-bright);
}

.booking {
  padding: var(--s-7);
  border-radius: var(--r-md);
  background: var(--ink-2);
  border: 1px solid var(--line-dark);
}

.booking__form {
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}

.booking__title {
  font-size: var(--fs-xl);
}

.booking .field__label {
  color: var(--muted-dark);
}

.booking .field__control {
  background: var(--ink);
  border-color: var(--line-dark);
  color: var(--white);
}

.booking .field__control::placeholder {
  color: var(--muted);
}

.booking .field__control:hover {
  border-color: var(--muted);
}

.booking .field__control:focus {
  border-color: var(--white);
}

.booking__hint {
  margin-top: calc(-1 * var(--s-2));
  font-size: var(--fs-xs);
  color: var(--muted-dark);
}

.booking__success {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.booking__form[hidden],
.booking__success[hidden] {
  display: none;
}

.booking__success p {
  color: var(--muted-dark);
}

.booking__success a {
  color: var(--white);
  white-space: nowrap;
}

.booking__check {
  color: var(--accent-bright);
}

/* ==========================================================================
   Подвал и мобильная панель
   ========================================================================== */

.site-footer {
  background: var(--ink);
  color: var(--muted-dark);
  border-top: 1px solid var(--line-dark);
  font-size: var(--fs-sm);
}

.site-footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-4);
  padding-block: var(--s-5);
}

.site-footer__top {
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}

.site-footer__top:hover {
  color: var(--white);
}

/* Авторы и лицензии фото */
.site-footer__credits {
  padding-bottom: var(--s-5);
  font-size: var(--fs-xs);
  line-height: 1.5;
}

.site-footer__credits a {
  text-underline-offset: 2px;
  transition: color var(--dur) var(--ease);
}

.site-footer__credits a:hover {
  color: var(--white);
}

.mobile-bar {
  display: none;
}

/* ==========================================================================
   Анимации
   Разметка: data-reveal / data-split / data-count / data-parallax,
   запуск — script.js. Скрытые состояния есть только при включённом JS
   (класс .js на <html>) и без prefers-reduced-motion.
   ========================================================================== */

/* Заголовок, разбитый на слова: каждое слово — окно с маской */
.split-word {
  display: inline-block;
  padding: 0.12em 0.06em 0.16em;
  margin: -0.12em -0.06em -0.16em;
  clip-path: inset(0);
}

.split-word > span {
  display: inline-block;
}

@media (prefers-reduced-motion: no-preference) {
  /* Блоки: проявление со сдвигом снизу */
  .js [data-reveal]:not([data-reveal="media"]):not(.is-in) {
    opacity: 0;
  }

  .js [data-reveal].is-in {
    animation: reveal-up var(--dur-reveal) var(--ease-out) backwards;
    animation-delay: var(--delay, 0ms);
  }

  /* Короткая метка над заголовком дорисовывается слева */
  .js .eyebrow[data-reveal].is-in::before {
    transform-origin: left;
    animation: grow-x var(--dur-reveal) var(--ease-out) backwards;
    animation-delay: calc(var(--delay, 0ms) + 120ms);
  }

  /* Строки характеристик и контактов: линия под строкой прорисовывается слева */
  .js .specs__row.is-in::after,
  .js .contact-list__item.is-in::after {
    transform-origin: left;
    animation: grow-x var(--dur-media) var(--ease-out) backwards;
    animation-delay: var(--delay, 0ms);
  }

  /* Первый экран уходит при прокрутке: текст поднимается и гаснет.
     На телефоне текст стоит под фото — там не двигаем */
  @media (min-width: 961px) {
    .js .hero__content {
      translate: 0 calc(var(--hero-out, 0) * -1 * var(--s-9));
      opacity: calc(1 - var(--hero-out, 0) * 0.8);
    }
  }

  /* Заголовки: слова выезжают из-под маски */
  .js [data-split]:not(.is-in) .split-word > span {
    transform: translate3d(0, 120%, 0);
  }

  .js [data-split].is-in .split-word > span {
    animation: reveal-word var(--dur-reveal) var(--ease-out) backwards;
    animation-delay: calc(var(--delay, 0ms) + var(--w, 0) * 40ms);
  }

  /* Фото: шторка слева направо и медленное приближение кадра */
  .js [data-reveal="media"]:not(.is-in) {
    clip-path: inset(0 100% 0 0);
  }

  .js [data-reveal="media"].is-in {
    animation: reveal-clip var(--dur-media) var(--ease-out) backwards;
    animation-delay: var(--delay, 0ms);
  }

  .js [data-reveal="media"].is-in img {
    animation: media-zoom var(--dur-media) var(--ease-out) backwards;
    animation-delay: var(--delay, 0ms);
  }

  /* Фон финального экрана: проявление из темноты с отъездом камеры */
  .js [data-reveal="zoom"].is-in {
    animation: reveal-zoom var(--dur-media) var(--ease-out) backwards;
    animation-delay: var(--delay, 0ms);
  }

  /* Параллакс: сдвиг задаёт script.js через --parallax */
  .js [data-parallax] {
    translate: 0 var(--parallax, 0px);
    will-change: translate;
  }

  /* Запас кадра под сдвиг: ±7% высоты */
  .js .truck__photo img,
  .js .finale__img {
    scale: 1.15;
  }

  /* Маршрут: впереди лежащие города приглушены, пройденные загораются */
  .route.is-tracking .route__stop::before {
    transition: background-color var(--dur-slide) var(--ease-out),
                border-color var(--dur-slide) var(--ease-out);
  }

  .route.is-tracking .route__stop > * {
    transition: opacity var(--dur-slide) var(--ease-out);
  }

  .route.is-tracking .route__stop:not(.is-passed)::before {
    background: var(--paper);
    border-color: var(--line);
  }

  .route.is-tracking .route__stop:not(.is-passed) > * {
    opacity: 0.35;
  }

  .route.is-tracking .route__stop.is-passed::before {
    animation: dot-pop var(--dur-reveal) var(--ease-out);
  }

  /* Грузовик едет по линии: нос — голова прорисованной части, колёса на линии */
  .route.is-tracking + .route-truck {
    display: block;
    position: absolute;
    z-index: 2;
    top: 8px;
    left: 0;
    translate: calc(var(--progress, 0) * var(--route-len, 0px)) 0;
  }

  .route-truck svg {
    position: absolute;
    right: 0;
    top: -21px;
  }

  /* Мобильное меню */
  .site-header.is-open .site-nav {
    animation: menu-in var(--dur-slide) var(--ease-out);
  }

  /* Заявка отправлена: галочка дорисовывается */
  .booking__success:not([hidden]) {
    animation: reveal-up var(--dur-reveal) var(--ease-out) backwards;
  }

  .booking__success:not([hidden]) .booking__check circle {
    animation: draw 700ms var(--ease-out) 150ms backwards;
  }

  .booking__success:not([hidden]) .booking__check path {
    animation: draw 500ms var(--ease-out) 600ms backwards;
  }
}

@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translate3d(0, var(--s-5), 0);
  }
}

@keyframes reveal-word {
  from {
    transform: translate3d(0, 120%, 0);
  }
}

@keyframes grow-x {
  from {
    transform: scaleX(0);
  }
}

@keyframes reveal-clip {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes media-zoom {
  from {
    scale: 1.3;
  }
}

@keyframes reveal-zoom {
  from {
    opacity: 0;
    scale: 1.35;
  }
}

@keyframes dot-pop {
  40% {
    transform: scale(1.35);
  }
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translate3d(0, calc(-1 * var(--s-2)), 0);
  }
}

/* Пунктир только на время отрисовки: после неё линия сплошная, без шва */
@keyframes draw {
  from {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
  }
  to {
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
  }
}

/* ==========================================================================
   Адаптив
   ========================================================================== */

@media (max-width: 1100px) {
  .header-phone {
    display: none;
  }

  .site-nav__link {
    padding-inline: var(--s-2);
  }

  .site-nav__link::after {
    left: var(--s-2);
    right: var(--s-2);
  }
}

@media (max-width: 960px) {
  :root {
    --header-h: 64px;
  }

  .nav-toggle {
    display: flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: var(--s-2) var(--gutter) var(--s-5);
    background: var(--ink);
    border-bottom: 1px solid var(--line-dark);
  }

  .site-header.is-open .site-nav {
    display: flex;
  }

  .site-nav__link {
    padding: var(--s-3) 0;
    font-size: var(--fs-base);
    border-bottom: 1px solid var(--line-dark);
    border-radius: 0;
  }

  .site-nav__link::after {
    display: none;
  }

  .site-header__actions {
    margin-left: auto;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .hero__media {
    order: -1;
    aspect-ratio: 16 / 10;
  }

  .hero__media::before {
    inset: auto 0 0 0;
    width: auto;
    height: 30%;
    background: linear-gradient(0deg, var(--ink), transparent);
  }

  .hero__content {
    padding: var(--s-6) var(--gutter) var(--s-8);
  }

  .facts__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fact {
    padding: var(--s-4) var(--s-4) var(--s-5);
  }

  .fact:nth-child(odd) {
    border-left: 0;
    padding-left: 0;
  }

  .fact:nth-child(n + 3) {
    border-top: 1px solid var(--line-dark);
  }

  .split,
  .truck,
  .contacts,
  .section-head--row {
    grid-template-columns: 1fr;
    gap: var(--s-7);
  }

  .truck__photo {
    min-height: 0;
    aspect-ratio: 4 / 3;
  }

  .options,
  .route-stats {
    grid-template-columns: 1fr;
  }

  /* Маршрут — вертикально */
  .route {
    grid-template-columns: 1fr;
    gap: var(--s-5);
    padding-top: 0;
    padding-left: var(--s-7);
  }

  .route::before,
  .route::after {
    top: 8px;
    bottom: var(--route-end, 8px);
    left: 7px;
    right: auto;
    width: 2px;
    height: auto;
  }

  .route::after {
    transform: scaleY(var(--progress, 1));
    transform-origin: top;
  }

  /* Грузовик едет вниз: поворот вокруг носа, крышей вправо от линии */
  .route.is-tracking + .route-truck {
    left: 8px;
    translate: 0 calc(var(--progress, 0) * var(--route-len, 0px));
  }

  .route-truck svg {
    rotate: 90deg;
    transform-origin: 100% 21px;
  }

  .route__stop {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: var(--s-4);
  }

  .route__stop::before {
    top: 4px;
    left: calc(-1 * var(--s-7));
  }

  .route__km {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
  }

  .route__note {
    grid-column: 1 / -1;
  }

  .guarantees {
    grid-template-columns: 1fr;
    gap: var(--s-6);
  }

  .calc {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .site-header__actions .btn {
    display: none;
  }

  .calc__form,
  .calc__result,
  .booking {
    padding: var(--s-5);
  }

  .calc__form {
    grid-template-columns: 1fr;
  }

  .hero__actions .btn,
  .btn-row .btn {
    flex: 1 1 auto;
  }

  .specs__row,
  .contact-list__item {
    grid-template-columns: 1fr;
    gap: var(--s-1);
  }

  .finale__caption {
    left: var(--gutter);
    right: auto;
  }

  .site-footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .mobile-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-2);
    padding: var(--s-3) var(--gutter) calc(var(--s-3) + env(safe-area-inset-bottom));
    background: var(--ink);
    border-top: 1px solid var(--line-dark);
  }

  /* Панель выезжает, когда кнопки первого экрана ушли за верх экрана */
  .js .mobile-bar {
    transform: translate3d(0, 100%, 0);
    visibility: hidden;
    transition: transform var(--dur-slide) var(--ease-out),
                visibility 0s linear var(--dur-slide);
  }

  .js .mobile-bar.is-shown {
    transform: none;
    visibility: visible;
    transition: transform var(--dur-slide) var(--ease-out);
  }

  body {
    padding-bottom: 72px;
  }
}

/* ==========================================================================
   Вводная анимация: фотореалистичная фура с надписью «Сашок довезёт»
   ========================================================================== */
.intro-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: transparent;
  pointer-events: none;
  overflow: hidden;
  opacity: 1;
  visibility: visible;
  transition: opacity 500ms cubic-bezier(0.16, 1, 0.3, 1),
              visibility 500ms;
}

.intro-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Обертка фуры: движение слева направо поверх контента страницы */
.intro-screen__truck-wrap {
  position: absolute;
  top: 52%;
  left: 0;
  width: clamp(750px, 78vw, 1280px);
  transform: translate3d(-105%, -50%, 0);
  will-change: transform;
  pointer-events: none;
  opacity: 0;
}

/* Запуск движения фуры после готовности изображения или без JS */
html:not(.js) .intro-screen__truck-wrap,
.intro-screen__truck-wrap.is-driving {
  opacity: 1;
  animation: truckDrive 3.4s cubic-bezier(0.22, 0.1, 0.25, 1) forwards;
}

.intro-truck {
  position: relative;
  display: block;
  width: 100%;
}

.intro-truck__img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.65));
  user-select: none;
  -webkit-user-drag: none;
}

/* Вращающиеся колеса (5 осей: 3 полуприцеп, 1 ведущая тягача, 1 рулевая) */
.intro-truck__wheels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.intro-wheel {
  position: absolute;
  top: 86.11%;
  width: 6.415%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: wheelSpin 0.35s linear infinite;
  will-change: transform;
}

/* 3 оси полуприцепа */
.intro-wheel--1 { left: 17.35%; }
.intro-wheel--2 { left: 25.58%; }
.intro-wheel--3 { left: 33.80%; }
/* 1 ведущая ось тягача */
.intro-wheel--4 { left: 64.64%; }
/* 1 рулевая ось тягача */
.intro-wheel--5 { left: 88.90%; }

@keyframes wheelSpin {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Фары и луч света, моргающие при движении (кабина справа, луч направлен вперёд) */
.intro-truck__headlights {
  position: absolute;
  left: 98.5%;
  top: 66.7%;
  transform: translateY(-50%);
  width: clamp(240px, 30vw, 420px);
  height: clamp(90px, 12vw, 150px);
  pointer-events: none;
  animation: headlightsBlink 3.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.intro-truck__beam {
  position: absolute;
  inset: 0;
  clip-path: polygon(0 44%, 100% 0%, 100% 100%, 0 56%);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 240, 190, 0.65) 20%,
    rgba(255, 200, 120, 0.25) 60%,
    transparent 100%
  );
  filter: blur(6px);
}

.intro-truck__flare {
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, rgba(255, 245, 200, 0.9) 40%, transparent 75%);
  filter: blur(2px);
}

@keyframes truckDrive {
  0% {
    transform: translate3d(-105%, -50%, 0);
  }
  12% {
    transform: translate3d(-50%, -50%, 0);
  }
  32% {
    transform: translate3d(-10%, -50%, 0);
  }
  52% {
    transform: translate3d(15%, -50%, 0);
  }
  75% {
    transform: translate3d(55%, -50%, 0);
  }
  100% {
    transform: translate3d(105vw, -50%, 0);
  }
}

@keyframes headlightsBlink {
  0%, 10% {
    opacity: 0;
  }
  14% {
    opacity: 1;
    filter: drop-shadow(0 0 16px rgba(255, 240, 180, 0.95));
  }
  18% {
    opacity: 0.1;
    filter: none;
  }
  23% {
    opacity: 1;
    filter: drop-shadow(0 0 24px rgba(255, 245, 200, 1));
  }
  28% {
    opacity: 0.2;
    filter: none;
  }
  35%, 88% {
    opacity: 0.85;
    filter: drop-shadow(0 0 12px rgba(255, 230, 160, 0.6));
  }
  98%, 100% {
    opacity: 0;
  }
}

/* Кнопка пропуска */
.intro-screen__skip {
  position: absolute;
  top: clamp(16px, 3vw, 32px);
  right: clamp(16px, 3vw, 32px);
  z-index: 10;
  pointer-events: auto;
  background: rgba(18, 19, 20, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--white);
  font-family: var(--font);
  font-size: var(--fs-xs);
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  backdrop-filter: blur(8px);
}

.intro-screen__skip:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--white);
}

@media (max-width: 768px) {
  .intro-screen__truck-wrap {
    width: clamp(520px, 120vw, 850px);
    top: 56%;
  }

  .intro-truck__headlights {
    left: 98%;
    width: 200px;
    height: 80px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .intro-screen {
    display: none !important;
  }

  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
