/* Cinematic micro-animations of the car pages. One shared set of rules, switched on per car by the .car-fx class on
   the car dialog (public/app.js, CINEMATIC_CARS). Only opacity, transform and colour: nothing changes the layout,
   no script runs, nothing keeps moving after the entrance. Hover effects exist only for a real mouse; phones get the
   entrance alone, and reduced motion turns everything off. */

/* Entrance of the name: a soft fade and 4 px rise, once. */
@keyframes fx-rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.car-fx .detail-hero-brand, .car-fx .detail-hero-title h2 { animation: fx-rise .5s cubic-bezier(.2, .7, .2, 1) both; }
.car-fx .detail-hero-title h2 { animation-delay: .08s; }
/* The name beside the specifications rises as it scrolls into view (CSS only; browsers without it show it as is). */
@supports (animation-timeline: view()) {
  .car-fx .detail-overview-title { animation: fx-rise linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; }
}

@media (hover: hover) and (pointer: fine) {
  /* Name: a touch more light on hover. */
  .car-fx .detail-overview-title, .car-fx .detail-hero-title h2 { transition: color .3s ease, text-shadow .3s ease; }
  .car-fx .detail-overview-title:hover, .car-fx .detail-hero-title h2:hover { color: #fff; text-shadow: 0 0 22px rgb(255 255 255 / 16%); }

  /* PREMIUM / FOR COLLECTORS: brighter text, the red line stretches. */
  .car-fx .detail-category { transition: color .25s ease; }
  /* The line grows outwards, away from the word, so it never runs under the text. */
  .car-fx .detail-category::before, .car-fx .detail-category.is-collectors::after { transition: transform .25s ease, background-color .25s ease; transform-origin: right center; }
  .car-fx .detail-category.is-collectors::after { transform-origin: left center; }
  .car-fx .detail-category:hover { color: #fff; }
  .car-fx .detail-category:hover::before, .car-fx .detail-category.is-collectors:hover::after { transform: scaleX(1.6); background-color: #ff3b45; }

  /* Specifications: one rule for every field. */
  .car-fx .detail-specs .spec { transition: border-color .25s ease; }
  .car-fx .detail-specs .spec dt, .car-fx .detail-specs .spec dd { transition: color .25s ease, transform .25s ease; }
  .car-fx .detail-specs .spec:hover { border-bottom-color: rgb(227 38 48 / 55%); }
  .car-fx .detail-specs .spec:hover dt { color: #d8d8d5; }
  .car-fx .detail-specs .spec:hover dd { color: #fff; transform: translateY(-2px); }

  /* Buttons: border, a red accent line and a slightly lighter ground, instead of turning white. */
  .car-fx .detail-actions .button, .car-fx .detail-request .button { position: relative; overflow: hidden; transition: border-color .25s ease, background-color .25s ease, color .25s ease; }
  .car-fx .detail-actions .button::after, .car-fx .detail-request .button::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: #e32630; transform: scaleX(0); transition: transform .3s cubic-bezier(.2, .7, .2, 1); }
  .car-fx .detail-actions .button:hover, .car-fx .detail-request .button:hover { color: #fff; border-color: rgb(227 38 48 / 65%); background: rgb(255 255 255 / 7%); transform: none; }
  .car-fx .detail-actions .button:hover::after, .car-fx .detail-request .button:hover::after { transform: scaleX(1); }
  .car-fx .detail-share a, .car-fx .detail-share button { transition: color .25s ease, transform .25s ease; }
  .car-fx .detail-share a:hover, .car-fx .detail-share button:hover { color: #ff5a62; transform: translateY(-2px); }

  /* Gallery: thumbnails only, a very light zoom. The large photos never move. */
  .car-fx .mosaic-grid img { transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
  .car-fx .mosaic-grid button:hover img { opacity: 1; transform: scale(1.03); }
}

@media (prefers-reduced-motion: reduce) {
  .car-fx .detail-hero-brand, .car-fx .detail-hero-title h2, .car-fx .detail-overview-title { animation: none; }
  .car-fx * { transition-duration: 0s !important; }
}
