/* ============================================================
   06 — КИНЕМАТОГРАФИЧНЫЕ ФОНЫ (сток Unsplash, assets/img/bg/)
   sm/ — мобильные версии (~900px), scripts/optimize-bg.py
   ============================================================ */

/* --- Hero: дым + протектор, лёгкий Ken Burns --- */
.hero__bg {
  background-image: url("../img/bg/hero-tire-smoke.jpg");
  background-position: 68% 42%;
  background-size: cover;
}
.hero__bg-image {
  position: absolute;
  inset: -4%;
  width: 108%;
  height: 108%;
  object-fit: cover;
  object-position: 68% 42%;
  z-index: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .hero__bg-image {
    animation: cineKenBurns 22s ease-in-out infinite alternate;
  }
}
@keyframes cineKenBurns {
  from { transform: scale(1.03) translate3d(0, 0, 0); }
  to   { transform: scale(1.1) translate3d(-1.2%, -0.6%, 0); }
}
.hero__bg::after {
  background:
    linear-gradient(105deg, rgba(8, 7, 6, 0.96) 0%, rgba(8, 7, 6, 0.72) 42%, rgba(8, 7, 6, 0.18) 68%, rgba(8, 7, 6, 0.45) 100%),
    linear-gradient(0deg, var(--ink) 0%, rgba(8, 7, 6, 0) 28%),
    radial-gradient(ellipse 80% 60% at 85% 50%, rgba(226, 20, 20, 0.12), transparent 55%);
}

/* --- Hero visual --- */
.hero__photo-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  max-height: 480px;
  border: 2px solid var(--line-strong);
  box-shadow: var(--shadow-hard);
  overflow: hidden;
  background: var(--ink-2);
}
.hero__photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 50%;
  filter: contrast(1.06) saturate(0.88) brightness(0.94);
  transition: transform 0.6s var(--ease-out), filter 0.4s ease;
}
.hero__photo-frame:hover img {
  transform: scale(1.04);
  filter: contrast(1.08) saturate(0.9) brightness(0.92);
}
.hero__photo-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, rgba(11, 10, 9, 0.82) 0%, transparent 50%),
    linear-gradient(105deg, rgba(11, 10, 9, 0.35) 0%, transparent 55%);
  pointer-events: none;
}
.hero__photo-caption {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bone-dim);
}

/* --- Секции с фоновым фото --- */
.section--cine,
.final-cta--cine,
.footer--cine {
  --cine-edge-h: clamp(3rem, 2rem + 5vw, 7rem);
}

.section--cine {
  isolation: isolate;
  overflow: hidden;
  contain: paint;
}
.section--cine > .wrap {
  position: relative;
  z-index: 2;
}

/* Фон: плавное появление при скролле (класс is-bg-in ставит JS) */
.section--cine::before,
.final-cta--cine::before,
.footer--cine::before {
  content: "";
  position: absolute;
  inset: -2%;
  z-index: 0;
  background-image: var(--cine-bg, none);
  background-size: cover;
  background-position: var(--cine-pos, center);
  background-repeat: no-repeat;
  transform: scale(1.07);
  filter: saturate(var(--cine-sat, 0.92)) contrast(1.06);
  opacity: 0;
  transition:
    opacity 1.1s var(--ease-out),
    transform 1.4s var(--ease-out);
}
.section--cine.is-bg-in::before,
.final-cta--cine.is-bg-in::before,
.footer--cine.is-bg-in::before {
  opacity: 1;
  transform: scale(1.04);
}

/* Оверлей + мягкие «швы» сверху/снизу между секциями */
.section--cine::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    var(--cine-overlay),
    linear-gradient(0deg, var(--ink) 0%, transparent var(--cine-edge-h)),
    linear-gradient(180deg, var(--ink) 0%, transparent var(--cine-edge-h));
}

.section--cine-services {
  --cine-bg: url("../img/bg/bg-tire-shop.jpg");
  --cine-bg-sm: url("../img/bg/sm/bg-tire-shop.jpg");
  --cine-pos: center 35%;
  --cine-overlay:
    linear-gradient(90deg, rgba(11, 10, 9, 0.92) 0%, rgba(11, 10, 9, 0.78) 42%, rgba(11, 10, 9, 0.35) 100%);
}
.section--cine-services .card {
  background: rgba(19, 17, 16, 0.88);
}

.section--cine-advantages {
  --cine-bg: url("../img/bg/bg-highway-night.jpg");
  --cine-bg-sm: url("../img/bg/sm/bg-highway-night.jpg");
  --cine-pos: center 55%;
  --cine-sat: 0.9;
  --cine-overlay:
    linear-gradient(90deg, rgba(11, 10, 9, 0.9) 0%, rgba(11, 10, 9, 0.72) 48%, rgba(11, 10, 9, 0.25) 100%),
    linear-gradient(180deg, rgba(11, 10, 9, 0.45) 0%, transparent 28%, rgba(11, 10, 9, 0.5) 100%);
}
.section--cine-advantages .feature {
  background: rgba(19, 17, 16, 0.82);
  border: 1px solid var(--line);
  padding: 1.4rem;
}

.section--cine-process {
  --cine-bg: url("../img/bg/bg-tread-rugged.jpg");
  --cine-bg-sm: url("../img/bg/sm/bg-tread-rugged.jpg");
  --cine-pos: center 50%;
  --cine-overlay:
    linear-gradient(180deg, rgba(11, 10, 9, 0.82) 0%, rgba(11, 10, 9, 0.58) 45%, rgba(11, 10, 9, 0.85) 100%),
    radial-gradient(ellipse 70% 50% at 50% 100%, rgba(226, 20, 20, 0.1), transparent);
}
.section--cine-process .process__step {
  background: rgba(19, 17, 16, 0.85);
  border: 1px solid var(--line);
}

.section--cine-gallery {
  --cine-bg: url("../img/bg/bg-car-lift.jpg");
  --cine-bg-sm: url("../img/bg/sm/bg-car-lift.jpg");
  --cine-pos: center 38%;
  --cine-sat: 0.88;
  --cine-overlay:
    linear-gradient(0deg, rgba(11, 10, 9, 0.88) 0%, rgba(11, 10, 9, 0.5) 42%, rgba(11, 10, 9, 0.78) 100%);
}
.section--cine-gallery .gallery image-slot,
.section--cine-gallery .gallery .shot {
  background: rgba(19, 17, 16, 0.78);
  border: 1px solid var(--line);
}

.section--cine-trust {
  --cine-bg: url("../img/bg/bg-wheel-moody.jpg");
  --cine-bg-sm: url("../img/bg/sm/bg-wheel-moody.jpg");
  --cine-pos: 72% center;
  --cine-overlay:
    linear-gradient(90deg, rgba(11, 10, 9, 0.92) 0%, rgba(11, 10, 9, 0.62) 50%, rgba(11, 10, 9, 0.3) 100%);
}
.section--cine-trust .trust__panel,
.section--cine-trust .card {
  background: rgba(19, 17, 16, 0.84);
}

.section--cine-location {
  --cine-bg: url("../img/bg/bg-city-road-night.jpg");
  --cine-bg-sm: url("../img/bg/sm/bg-city-road-night.jpg");
  --cine-pos: center 42%;
  --cine-sat: 0.9;
  --cine-overlay:
    linear-gradient(105deg, rgba(11, 10, 9, 0.9) 0%, rgba(11, 10, 9, 0.55) 55%, rgba(11, 10, 9, 0.2) 100%);
}
.section--cine-location .location__map-mini {
  box-shadow: var(--shadow-hard);
}

.section--cine-contacts {
  --cine-bg: url("../img/bg/bg-mechanic-work.jpg");
  --cine-bg-sm: url("../img/bg/sm/bg-mechanic-work.jpg");
  --cine-pos: 75% center;
  --cine-sat: 0.9;
  --cine-overlay:
    linear-gradient(90deg, rgba(11, 10, 9, 0.94) 0%, rgba(11, 10, 9, 0.78) 45%, rgba(11, 10, 9, 0.35) 100%);
}
.section--cine-contacts .info-row {
  background: rgba(19, 17, 16, 0.5);
  padding-inline: 0.6rem;
  margin-inline: -0.6rem;
  border-radius: 0;
}

.final-cta--cine {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  --cine-edge-h: clamp(2.5rem, 1.5rem + 4vw, 5rem);
}
.final-cta--cine::before {
  background-image: url("../img/bg/bg-wheel-red.jpg");
  background-position: 55% center;
  filter: saturate(0.95) contrast(1.08);
}
.final-cta--cine::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(157, 13, 13, 0.88) 0%, rgba(226, 20, 20, 0.82) 45%, rgba(11, 10, 9, 0.65) 100%),
    radial-gradient(ellipse 60% 80% at 80% 50%, rgba(0, 0, 0, 0.3), transparent),
    linear-gradient(0deg, var(--ink) 0%, transparent var(--cine-edge-h)),
    linear-gradient(180deg, var(--ink) 0%, transparent var(--cine-edge-h));
}
.final-cta--cine > .wrap {
  position: relative;
  z-index: 2;
}

.footer--cine {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  --cine-edge-h: clamp(2rem, 1rem + 3vw, 4rem);
}
.footer--cine .hazard-bar,
.footer--cine .wrap {
  position: relative;
  z-index: 2;
}
.footer--cine::before {
  inset: -4%;
  background-image: url("../img/bg/bg-garage-bay.jpg");
  background-position: center;
  filter: saturate(0.75) contrast(1.05);
}
.footer--cine::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(0deg, rgba(11, 10, 9, 0.9) 0%, rgba(11, 10, 9, 0.78) 100%),
    linear-gradient(180deg, var(--ink) 0%, transparent var(--cine-edge-h));
}

/* Marquee → первая cinematic: мягкий спуск в тёмный фон */
.marquee {
  position: relative;
  z-index: 1;
}
.marquee::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: clamp(2rem, 1rem + 4vw, 4.5rem);
  background: linear-gradient(0deg, var(--ink) 0%, transparent 100%);
  pointer-events: none;
}

@media (max-width: 860px) {
  .hero__bg {
    background-image: url("../img/bg/sm/hero-tire-smoke.jpg");
  }
  .section--cine::before {
    inset: -4%;
    background-image: var(--cine-bg-sm, var(--cine-bg));
  }
  .section--cine.is-bg-in::before {
    transform: scale(1.08);
  }
  .final-cta--cine::before {
    background-image: url("../img/bg/sm/bg-wheel-red.jpg");
  }
  .footer--cine::before {
    background-image: url("../img/bg/sm/bg-garage-bay.jpg");
  }
  .hero__photo-frame {
    max-height: 320px;
    aspect-ratio: 16 / 10;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero__bg-image { animation: none; }
  .section--cine::before,
  .final-cta--cine::before,
  .footer--cine::before {
    opacity: 1;
    transform: scale(1.04);
    transition: none;
  }
}
