/* Hero car motion (both homepages): drive in/out between slides with speed
   streaks, a gentle idle float and a mouse parallax. Off for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  /* idle float: the stage (English) / wrapper (Arabic) bobs, its ground shadow breathes */
  .hero .vehicle-stage, .hero .hero-car-wrap { animation: car-arrive 1.3s cubic-bezier(.16,1,.3,1) both, car-float 5.5s ease-in-out 1.3s infinite; transition: translate .5s ease-out; }
  .hero .hero-car-wrap { animation-name: car-arrive, car-float; }
  .hero .vehicle-stage::after, .hero .hero-car-wrap::after {
    content: ""; position: absolute; left: 18%; right: 18%; bottom: 6%; height: 7%; z-index: -1; border-radius: 50%;
    background: radial-gradient(closest-side, #000a, transparent); animation: shadow-breathe 5.5s ease-in-out 1.3s infinite;
  }

  /* slide change: the old car drives off, the new one drives in and settles */
  .hero .vehicle-stage.changing img { opacity: 0; transform: translateX(-110px) scale(.97); transition: transform .3s ease-in, opacity .3s ease-in; }
  .hero .vehicle-stage.changing.to-prev img { transform: translateX(110px) scale(.97); }
  .hero .vehicle-stage.arriving img { transition: none; animation: drive-in-next .95s cubic-bezier(.16,1,.3,1) both; }
  .hero .vehicle-stage.arriving.to-prev img { animation-name: drive-in-prev; }

  /* speed streaks behind the car while it arrives */
  .hero .vehicle-stage::before {
    content: ""; position: absolute; inset: 30% -10% 30% 10%; z-index: -1; opacity: 0; pointer-events: none;
    background: repeating-linear-gradient(180deg, transparent 0 14px, #ffffff1c 14px 15px, transparent 15px 38px);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 40%, transparent); mask-image: linear-gradient(90deg, transparent, #000 40%, transparent);
  }
  .hero .vehicle-stage.arriving::before { animation: streaks .8s ease-out both; }
  .hero .vehicle-stage.arriving.to-prev::before { animation-name: streaks-prev; }

}

/* autoplay progress line along the top of the slider controls */
.showcase-bottom { position: relative; }
.hero-progress { position: absolute; top: -1px; left: 0; height: 2px; width: 100%; background: #ff751f; transform: scaleX(0); transform-origin: left; pointer-events: none; }
.hero-progress.run { transition: transform linear; transform: scaleX(1); }

@keyframes car-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes shadow-breathe { 0%, 100% { transform: scaleX(1); opacity: 1; } 50% { transform: scaleX(.92); opacity: .75; } }
@keyframes drive-in-next {
  0% { opacity: 0; transform: translateX(160px) scale(.97); }
  45% { opacity: 1; }
  72% { transform: translateX(-8px) rotate(-.6deg); }
  86% { transform: translateX(2px) rotate(.25deg); }
  100% { opacity: 1; transform: none; }
}
@keyframes drive-in-prev {
  0% { opacity: 0; transform: translateX(-160px) scale(.97); }
  45% { opacity: 1; }
  72% { transform: translateX(8px) rotate(.6deg); }
  86% { transform: translateX(-2px) rotate(-.25deg); }
  100% { opacity: 1; transform: none; }
}
@keyframes streaks { 0% { opacity: 0; transform: translateX(120px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateX(-60px); } }
@keyframes streaks-prev { 0% { opacity: 0; transform: translateX(-120px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateX(60px); } }
@keyframes car-arrive { from { opacity: 0; transform: translateX(80px); } to { opacity: 1; transform: none; } }
.hero .hero-car-wrap { position: relative; }

/* Hero background: Oman's coastal mountain road behind the car, faded to the dark hero
   colour on the text side so the headline stays readable, plus an orange floor glow
   under the car. English: text left, car right. Arabic (RTL): mirrored. */
.hero.showroom, html[dir=rtl] .hero {
  background:
    linear-gradient(0deg, #101216 0%, rgba(16,18,22,0) 32%),
    linear-gradient(90deg, #101216 0%, #101216 34%, rgba(16,18,22,.8) 56%, rgba(16,18,22,.42) 100%),
    url(/assets/oman-road-1600.webp) 65% 55% / cover no-repeat #101216;
}
html[dir=rtl] .hero {
  background:
    linear-gradient(0deg, #101216 0%, rgba(16,18,22,0) 32%),
    linear-gradient(270deg, #101216 0%, #101216 34%, rgba(16,18,22,.8) 56%, rgba(16,18,22,.42) 100%),
    url(/assets/oman-road-1600-rtl.webp) 35% 55% / cover no-repeat #101216;   /* mirrored photo: sunset behind the car */
}
.hero .showcase, .hero .hero-car-wrap { position: relative; }
.hero .showcase::before, .hero .hero-car-wrap::before {
  content: ""; position: absolute; left: 8%; right: 8%; height: 110px; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, rgba(255,117,31,.34), rgba(255,117,31,.08) 45%, transparent 70%);
}
.hero .showcase::before { bottom: 95px; }
.hero .hero-car-wrap::before { bottom: -18px; }
.hero .showcase .vehicle-stage, .hero .showcase-bottom { position: relative; z-index: 1; }
@media (max-width: 900px) {
  /* Phones/tablets: text on top, car below - fade from the top instead of the side. */
  .hero.showroom {
    background:
      linear-gradient(180deg, #101216 0%, #101216 42%, rgba(16,18,22,.62) 70%, #101216 100%),
      url(/assets/oman-road-900.webp) 70% 100% / cover no-repeat #101216;
  }
  html[dir=rtl] .hero {
    background:
      linear-gradient(180deg, #101216 0%, #101216 42%, rgba(16,18,22,.62) 70%, #101216 100%),
      url(/assets/oman-road-900-rtl.webp) 30% 100% / cover no-repeat #101216;
  }
}

/* Right-to-left (Arabic): the next car drives in from the left instead of the right. */
@media (prefers-reduced-motion: no-preference) {
  [dir=rtl] .hero .vehicle-stage.changing img { transform: translateX(110px) scale(.97); }
  [dir=rtl] .hero .vehicle-stage.changing.to-prev img { transform: translateX(-110px) scale(.97); }
  [dir=rtl] .hero .vehicle-stage.arriving img { animation-name: drive-in-prev; }
  [dir=rtl] .hero .vehicle-stage.arriving.to-prev img { animation-name: drive-in-next; }
  [dir=rtl] .hero .vehicle-stage.arriving::before { animation-name: streaks-prev; }
  [dir=rtl] .hero .vehicle-stage.arriving.to-prev::before { animation-name: streaks; }
}

/* Phones and tablets: no idle float. iPhone Safari draws a constantly moving image from a
   lower-quality cached copy, so the car looked soft; the drive-in between cars stays. */
@media (max-width: 900px), (hover: none) {
  .hero .vehicle-stage, .hero .hero-car-wrap { animation: car-arrive 1.3s cubic-bezier(.16,1,.3,1) both; }
  .hero .vehicle-stage::after, .hero .hero-car-wrap::after { animation: none; }
}
