/*
 * Сквозной маршрут самолёта и живые блоки главной страницы.
 * Всё анимируется через transform/opacity; при «уменьшении движения»
 * блоки показываются в спокойном статичном виде.
 */

/* ═══ Прогресс маршрута в шапке ═══ */
.flight-progress {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  pointer-events: none;
}
.flight-progress__bar {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(173, 138, 88, 0.15), #ad8a58);
  transform: scaleX(var(--flight-progress, 0));
  transform-origin: left center;
}
.flight-progress__plane {
  position: absolute;
  top: -6px;
  left: 0;
  width: 18px;
  height: 14px;
  color: #d8bf91;
  transform: translateX(calc(var(--flight-progress, 0) * (100vw - 18px)));
  opacity: calc(min(1, var(--flight-progress, 0) * 40));
}
.flight-progress__plane svg { display: block; width: 100%; height: 100%; }

/* ═══ Проявление заголовков и текста при прокрутке ═══ */
.flight-js [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 34px, 0);
  transition:
    opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
    transform 1.1s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(var(--reveal-i, 0) * 90ms);
}
.flight-js [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}
.flight-js [data-reveal="mask"] {
  clip-path: inset(0 0 100% 0);
  transform: translate3d(0, 28px, 0);
  filter: none;
  transition:
    clip-path 1.15s cubic-bezier(0.16, 1, 0.3, 1),
    transform 1.15s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.6s ease;
}
.flight-js [data-reveal="mask"].is-revealed { clip-path: inset(0 0 -20% 0); }

/* ═══ Кнопка первого экрана: стрелка в отдельной капсуле ═══ */
html body .hc-hero__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 10px 10px 30px;
  border-radius: 999px;
  transition:
    border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    background-color 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.hc-hero__btn-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: rgba(173, 138, 88, 0.22);
  color: #f3e5c8;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.4s ease;
}
.hc-hero__btn-icon svg { width: 16px; height: 16px; }
html body .hc-hero__btn:hover .hc-hero__btn-icon {
  background: rgba(173, 138, 88, 0.42);
  transform: translateY(3px) scale(1.06);
}
html body .hc-hero__btn:active { transform: scale(0.98); }

/* Точки, из которых идёт пар за самолётом первого экрана */
.hc-hero__plane-body { position: relative; }
.hc-hero__anchor { position: absolute; width: 2px; height: 2px; }

/* Пепел в последних блоках главной */
.hp-memorial-story, .hp-memorial-crew, .hp-memorial-quote, .hp-memorial-footer { position: relative; isolation: isolate; }

/* Инверсионный след самолёта на первом экране */
.hc-hero__trail {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.hc-hero__trail path { fill: none; stroke-linecap: round; }
.hc-hero__trail-glow { stroke: rgba(225, 222, 214, 0.08); stroke-width: 9; }
.hc-hero__trail-line { stroke: rgba(236, 232, 224, 0.32); stroke-width: 1.4; }

/* ═══ Хронология: маршрут с самолётом над карточками ═══ */
.hp-route {
  position: relative;
  max-width: 1100px;
  height: 64px;
  margin: -40px auto 46px;
}
.hp-route__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.hp-route__base { fill: none; stroke: rgba(143, 166, 191, 0.28); stroke-width: 1.2; stroke-dasharray: 3 7; }
.hp-route__done { fill: none; stroke: #ad8a58; stroke-width: 1.6; }
.hp-route__point { fill: #161618; stroke: rgba(143, 166, 191, 0.5); stroke-width: 1.4; transition: fill 0.5s ease, stroke 0.5s ease; }
.hp-route__point.is-passed { fill: #ad8a58; stroke: #ad8a58; }
.hp-route__label {
  fill: rgba(185, 198, 212, 0.75);
  font: 600 12px/1 "Montserrat", Arial, sans-serif;
  letter-spacing: 0.14em;
  text-anchor: middle;
  transition: fill 0.5s ease;
}
.hp-route__label.is-passed { fill: #d8bf91; }
.hp-route__plane {
  position: absolute;
  top: 0;
  left: 0;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  color: #e6dfd2;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
  will-change: transform;
}
.hp-route__plane svg { width: 100%; height: 100%; display: block; }

.hp-c { transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1); }
.hp-c.is-lit .hp-c__img { filter: grayscale(0%) contrast(1.06) brightness(0.92); }
.hp-c.is-lit .hp-c__step { color: #d8bf91 !important; }
.hp-c.is-lit .hp-c__visual { box-shadow: 0 0 0 1px rgba(173, 138, 88, 0.45), 0 24px 50px -24px rgba(173, 138, 88, 0.35); }
.hp-c:hover { transform: translateY(-6px); }

/* ═══ История поисков: самолёт на линии времени ═══ */
.flight-js .hp-timeline__line-fill {
  height: 100% !important;
  transform: scaleY(var(--track-progress, 0));
  transform-origin: top center;
  transition: none !important;
}
.hp-timeline__plane {
  position: absolute;
  top: 0;
  left: 20px;
  z-index: 3;
  width: 30px;
  height: 30px;
  margin-left: -14px;
  color: #e7cf9f;
  transform: translateY(calc(var(--track-progress, 0) * var(--track-height, 0px) - 15px)) rotate(90deg);
  filter: drop-shadow(0 4px 10px rgba(184, 115, 51, 0.45));
  pointer-events: none;
}
.hp-timeline__plane svg { width: 100%; height: 100%; display: block; }
.flight-js .hp-timeline__dot { transition: background 0.4s ease, box-shadow 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.flight-js .hp-timeline__dot:not(.is-passed) { background: #161618 !important; box-shadow: none !important; }
.flight-js .hp-timeline__dot.is-passed { transform: scale(1.25); }

/* Фото в линии времени: пары снимков и мягкое проявление */
.hp-timeline__media-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-width: 560px;
  margin-top: 20px;
}
.hp-timeline__media-row .hp-timeline__media { max-width: none; margin-top: 0; }
.hp-timeline__media img { aspect-ratio: 4 / 3; object-fit: cover; }
.hp-timeline__media { transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.hp-timeline__media:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px rgba(184, 115, 51, 0.4), 0 18px 40px rgba(0, 0, 0, 0.5); }
@media (max-width: 540px) {
  .hp-timeline__media-row { grid-template-columns: 1fr; }
}

/* ═══ Экипаж: мягкое проявление портретов ═══ */
.hp-crew__portrait,
.hp-memorial-crew__photo { transition: box-shadow 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.hp-crew__member-link:hover .hp-crew__portrait,
.hp-memorial-crew__link:hover .hp-memorial-crew__photo { box-shadow: 0 0 0 1px rgba(173, 138, 88, 0.5), 0 30px 60px -30px rgba(0, 0, 0, 0.8); }

/* ═══ Финальная сцена: фотореалистичный пролёт над облаками ═══ */
.hp-flight {
  position: relative;
  height: 320vh;
  background: #0b0e12;
  color: #f0ece3;
}
.hp-flight__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: #6f8fb3;
}
.hp-flight__sky {
  position: absolute;
  inset: -4% -8% -4% 0;
  background: url("assets/flight-sky.jpg") center 55% / cover no-repeat;
  filter: saturate(0.82) contrast(1.04) brightness(0.92);
  transform: scale(1.14);
  transform-origin: 40% 50%;
  will-change: transform;
}
.hp-flight__clouds {
  position: absolute;
  left: 0;
  width: 300vw;
  background: url("assets/flight-clouds-front.png") left bottom / auto 100% repeat-x;
  pointer-events: none;
  will-change: transform;
}
.hp-flight__clouds--mid {
  bottom: -2%;
  height: 46%;
  opacity: 0.75;
  filter: saturate(0.8) brightness(0.96);
}
.hp-flight__clouds--near {
  bottom: -14%;
  z-index: 3;
  height: 72%;
  opacity: 0.85;
  filter: saturate(0.75);
}
.flight-vapor {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.hp-flight__plane {
  position: absolute;
  top: 36%;
  left: 0;
  z-index: 2;
  width: clamp(320px, 42vw, 640px);
  opacity: 0;
  will-change: transform;
  filter: drop-shadow(0 18px 24px rgba(20, 34, 52, 0.28));
}
.hp-flight__plane-img { display: block; width: 100%; height: auto; }
.hp-flight__anchor {
  position: absolute;
  left: 58%;
  top: 76%;
  width: 2px;
  height: 2px;
}
/* Кинематографичная тонировка: края и переходы в тёмный фон сайта */
.hp-flight__grade {
  position: absolute;
  inset: 0;
  z-index: 4;
  opacity: 0.15;
  background:
    radial-gradient(ellipse 75% 65% at 50% 46%, rgba(9, 13, 18, 0.35), rgba(9, 13, 18, 0.92)),
    rgba(9, 13, 18, 0.35);
  pointer-events: none;
}
.hp-flight__stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  background:
    linear-gradient(180deg, #0b0e12 0%, rgba(11, 14, 18, 0) 16%, rgba(11, 14, 18, 0) 82%, #0b0e12 100%),
    radial-gradient(ellipse 90% 80% at 50% 50%, transparent 55%, rgba(9, 13, 18, 0.45) 100%);
  pointer-events: none;
}
.hp-flight__stage > .site-ash {
  z-index: 5 !important;
  opacity: var(--ash, 0);
}
.hp-flight__content {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.6);
}

html body .hp-flight .hp-memorial-hero__eyebrow,
html body .hp-flight .hp-memorial-hero__title { opacity: 1; animation: none; }
html body .hp-flight .hp-memorial-hero__title { max-width: 900px; text-wrap: balance; }
.hp-flight__cue {
  position: absolute;
  bottom: 36px;
  left: 50%;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: rgba(240, 236, 227, 0.72);
  font: 500 12px/1 "Montserrat", Arial, sans-serif;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  transform: translateX(-50%);
}
.hp-flight__cue::after {
  content: "";
  width: 1px;
  height: 44px;
  background: linear-gradient(#c8a45c, transparent);
  animation: hp-flight-cue 2.4s cubic-bezier(0.16, 1, 0.3, 1) infinite;
  transform-origin: top;
}
@keyframes hp-flight-cue { 0% { transform: scaleY(0); opacity: 1; } 70% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

@media (max-width: 820px) {
  .hp-flight { height: 260vh; }
  .hp-flight__plane { width: 86vw; top: 38%; }
  .hp-flight__sky { background-position: 38% 55%; }
  .hp-route { display: none; }
  .hp-timeline__plane { left: 12px; }
}

@media (max-width: 540px) {
  .hp-timeline__plane { left: 7px; width: 24px; height: 24px; margin-left: -11px; }
}

@media (prefers-reduced-motion: reduce) {
  .flight-js [data-reveal] { opacity: 1; transform: none; filter: none; clip-path: none; transition: none; }
  .hp-flight { height: auto; }
  .hp-flight__stage { position: relative; min-height: 100vh; }
  .hp-flight__content { opacity: 1; }
  .hp-flight__cue { display: none; }
  .hp-flight__plane { opacity: 1; }
  .hp-flight__grade { opacity: 0.6; }
  .hp-route__plane, .hp-timeline__plane { display: none; }
}

/* ═══ Первый экран: пауза на рассказе «26 июня 1941 года…» ═══ */
html body .hc-hero__wrapper { height: 300vh !important; }
@media (max-width: 820px) {
  html body .hc-hero__wrapper { height: 270vh !important; height: 270svh !important; }
}

/* ═══ Телефоны: финальная сцена — исходная спокойная картинка ═══ */
@media (max-width: 820px) {
  .hp-flight { height: auto; }
  .hp-flight__stage {
    position: relative;
    height: auto;
    min-height: 85vh;
    min-height: 85svh;
    background: #161618;
  }
  .hp-flight__sky {
    inset: 0;
    background-image: url("assets/memorial-photo.webp");
    background-position: 40% center;
    filter: grayscale(40%) contrast(1.1);
    opacity: 0.35;
    transform: none !important;
  }
  .hp-flight__clouds,
  .hp-flight__plane,
  .hp-flight__grade,
  .hp-flight__cue,
  .hp-flight__stage > .flight-vapor { display: none !important; }
  .hp-flight__stage::after { background: linear-gradient(180deg, #0b0e12 0%, transparent 18%, transparent 82%, #0b0e12 100%); }
  .hp-flight__content {
    position: relative;
    min-height: 85vh;
    min-height: 85svh;
    padding: 60px 20px;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
  .hp-flight__stage > .site-ash { opacity: 1; }

  /* Шапка без размытия фона: на телефонах это заметно ускоряет прокрутку */
  .memory-header { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(7, 10, 14, 0.94); }
}