/*
 * Homepage hero (partials/hero-film.blade.php): the film plays once, then settles on
 * the turntable with the wrap colour picker. Scoped to .dlv (and the header only on a
 * page with .dlv).
 */

.wrapper:has(.dlv) > .header {
  position: absolute; left: 0; right: 0; top: 0; z-index: 30;
}

.dlv {
  --dlv-gold: var(--color-gradient, linear-gradient(98.74deg, #7d6b3a, #c9b476 30%, #d4c48a 50%, #b09660 75%, #8a7540));
  --dlv-accent: #e4ac69;
  --dlv-muted: rgba(255, 255, 255, .74);
  --dlv-ease: cubic-bezier(.22, .61, .36, 1);
  --dlv-pad: max(20px, calc((100vw - 1290px) / 2 + 15px));
  --band-top: 0px;
  --band-h: 100%;
  position: relative;
  height: 100vh; height: 100svh;
  min-height: 560px;
  margin: 0;                 /* the site gives every section a vertical margin */
  overflow: hidden;
  background: #000;
  isolation: isolate;
}

/* ---------- picture box: poster, film, colour stills ---------- */
.dlv__band, .dlv__fx {
  position: absolute; left: 0; right: 0;
  top: var(--band-top); height: var(--band-h);
}
.dlv__band > * { position: absolute; inset: 0; width: 100%; height: 100%; }
.dlv__poster img, .dlv__video, .dlv__still {
  display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%;
}
.dlv__video { opacity: 0; transition: opacity .5s var(--dlv-ease); background: transparent; }
.dlv.is-playing .dlv__video, .dlv.is-ended .dlv__video { opacity: 1; }

.dlv__stills { opacity: 0; transition: opacity .9s var(--dlv-ease); }
.dlv.is-picker .dlv__stills { opacity: 1; }
.dlv__still { position: absolute; inset: 0; }
.dlv__still--top { clip-path: inset(0 100% 0 0); }
.dlv__still--top.is-wiping { clip-path: inset(0 0 0 0); transition: clip-path .95s cubic-bezier(.65, 0, .35, 1); }
/* gold edge that travels with the wipe */
.dlv__edge {
  position: absolute; top: 0; bottom: 0; left: 0; width: 100%;
  pointer-events: none; transform: translateX(-2px); opacity: 0;
}
.dlv__edge::before {
  content: ""; position: absolute; top: 0; bottom: 0; right: 100%; width: 70px;
  background: linear-gradient(90deg, rgba(228,172,105,0), rgba(228,172,105,.35));
}
.dlv__edge::after {
  content: ""; position: absolute; top: 0; bottom: 0; right: 100%; width: 2px; margin-right: -1px;
  background: linear-gradient(180deg, #7d6b3a, #d4c48a 50%, #8a7540);
}
.dlv__edge.is-wiping { opacity: 1; transform: translateX(100%); transition: transform .95s cubic-bezier(.65, 0, .35, 1); }

.dlv__fx {
  z-index: 2; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0,0,0,.65) 0%, rgba(0,0,0,0) 22%),
    linear-gradient(90deg, rgba(0,0,0,.74) 0%, rgba(0,0,0,.3) 38%, rgba(0,0,0,0) 60%),
    linear-gradient(0deg, rgba(0,0,0,.72) 0%, rgba(0,0,0,0) 34%);
}

/* ---------- first screen text ---------- */
.dlv__intro {
  position: absolute; z-index: 4;
  left: var(--dlv-pad); top: 50%; transform: translateY(-42%);
  max-width: min(600px, 46vw);
  transition: opacity .6s var(--dlv-ease);
}
.dlv__title { margin: 0 0 20px; font-size: clamp(36px, 4vw, 60px); line-height: 1.12; font-weight: 700; }
.dlv__subtitle { margin: 0 0 40px; max-width: 440px; font-size: clamp(16px, 1.3vw, 20px); line-height: 1.45; color: #fff; }
.dlv__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; }

/* Secondary action: straight to the colour picker */
.dlv-ghost {
  display: inline-flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 0 22px;
  border: 1px solid rgba(201,180,118,.6); border-radius: 0;
  background: rgba(10,10,10,.35); color: #fff;
  font: 600 15px/1 var(--font-main, Montserrat, sans-serif); letter-spacing: .01em;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: border-color .3s var(--dlv-ease), background-color .3s var(--dlv-ease);
}
.dlv-ghost:hover { border-color: #d4c48a; background: rgba(30,26,18,.55); }
.dlv-ghost:focus-visible { outline: 2px solid var(--dlv-accent); outline-offset: 3px; }
.dlv-ghost__dots { display: inline-flex; }
.dlv-ghost__dots i {
  width: 12px; height: 12px; border-radius: 50%; margin-left: -4px;
  box-shadow: 0 0 0 1.5px #111;
}
.dlv-ghost__dots i:first-child { margin-left: 0; }

/* ---------- stage label + progress (during the film) ---------- */
.dlv__stage {
  position: absolute; z-index: 4; left: var(--dlv-pad); bottom: 34px;
  display: flex; align-items: center; gap: 14px;
  font-size: 14px; font-weight: 600; letter-spacing: .06em;
  opacity: 0; transition: opacity .35s var(--dlv-ease);
}
.dlv__stage.is-on { opacity: 1; }
.dlv__stage-num { color: var(--dlv-accent); letter-spacing: .3em; }
.dlv__stage-num::after {
  content: ""; display: inline-block; vertical-align: middle;
  width: 36px; height: 1px; margin-left: 14px; background: var(--dlv-gold);
}
.dlv__stage-title { color: #fff; text-transform: uppercase; }

.dlv__line { position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; height: 2px; pointer-events: none; }
.dlv__line::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(201,180,118,0), rgba(212,196,138,.35) 50%, rgba(201,180,118,0));
}
.dlv__line i {
  position: absolute; inset: 0; display: block;
  background: var(--dlv-gold); box-shadow: 0 0 10px rgba(228,172,105,.6);
  transform-origin: left; transform: scaleX(var(--p, 0));
}
.dlv.is-picker .dlv__line { opacity: 0; transition: opacity .6s; }

/* ---------- play button (autoplay blocked, reduced motion, data saver) ---------- */
.dlv__play {
  position: absolute; z-index: 6; left: 50%; top: calc(var(--band-top) + var(--band-h) / 2);
  width: 84px; height: 84px; margin: -42px 0 0 -42px; padding: 0;
  border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(10,10,10,.45);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: inset 0 0 0 1.5px rgba(212,196,138,.85), 0 0 30px rgba(228,172,105,.25);
  opacity: 0; visibility: hidden; transform: scale(.9);
  transition: opacity .4s var(--dlv-ease), transform .4s var(--dlv-ease), visibility 0s .4s;
}
.dlv__play::after {
  content: ""; position: absolute; left: 50%; top: 50%; margin: -12px 0 0 -7px;
  border-style: solid; border-width: 12px 0 12px 20px;
  border-color: transparent transparent transparent #d4c48a;
}
.dlv.is-blocked:not(.is-picker) .dlv__play { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.dlv__play:focus-visible { outline: 2px solid var(--dlv-accent); outline-offset: 4px; }

/* ---------- colour picker ---------- */
/* Desktop: one glass bar under the car; the first-screen text steps aside. */
.dlv-wrap {
  position: absolute; z-index: 6;
  left: 50%; bottom: clamp(28px, 5vh, 56px);
  display: flex; align-items: center; gap: 22px 30px;
  width: max-content; max-width: calc(100vw - 40px);
  padding: 16px 18px 16px 26px;
  background: rgba(10,10,10,.58);
  border: 1px solid rgba(201,180,118,.28);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  opacity: 0; visibility: hidden; transform: translate(-50%, 16px);
  transition: opacity .7s var(--dlv-ease) .25s, transform .7s var(--dlv-ease) .25s, visibility 0s 1s;
}
.dlv.is-picker .dlv-wrap { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition-delay: .35s, .35s, 0s; }
.dlv-wrap__head { min-width: 0; }
.dlv-wrap__title { margin: 0 0 4px; font-size: clamp(22px, 1.9vw, 30px); line-height: 1.1; font-weight: 700; white-space: nowrap; }
.dlv-wrap__text { margin: 0; font-size: 14px; line-height: 1.45; color: var(--dlv-muted); max-width: 300px; }
.dlv-wrap__name { color: #fff; font-weight: 600; }
.dlv.is-picker .dlv__intro { opacity: 0; visibility: hidden; transition: opacity .4s, visibility 0s .4s; }
.dlv.is-picker .dlv__fx { opacity: .55; }
.dlv__fx { transition: opacity .9s var(--dlv-ease); }
.dlv-wrap__swatches { display: flex; gap: 14px; padding: 6px 4px; }
.dlv-swatch {
  position: relative; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 50%; cursor: pointer;
  background: var(--sw);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2), inset 0 -8px 14px rgba(0,0,0,.35);
  transition: transform .25s var(--dlv-ease);
}
.dlv-swatch::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  padding: 1.5px; background: var(--dlv-gold);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transform: scale(.85);
  transition: opacity .25s var(--dlv-ease), transform .25s var(--dlv-ease);
}
.dlv-swatch:hover { transform: scale(1.08); }
.dlv-swatch[aria-pressed="true"]::after { opacity: 1; transform: none; }
.dlv-swatch:focus-visible { outline: 2px solid var(--dlv-accent); outline-offset: 6px; }
.dlv-wrap__actions { display: flex; align-items: center; gap: 22px; }
.dlv-replay {
  display: inline-flex; align-items: center; gap: 9px; padding: 8px 0;
  border: 0; background: none; color: #fff; cursor: pointer;
  font: 600 15px/1 var(--font-main, Montserrat, sans-serif);
  border-bottom: 1px solid rgba(201,180,118,.5);
}
.dlv-replay:hover { color: #d4c48a; }
.dlv-replay svg { width: 16px; height: 16px; }
.dlv-replay:focus-visible { outline: 2px solid var(--dlv-accent); outline-offset: 4px; }


/* ---------- phones and upright tablets: the film as a band ---------- */
@property --band-h { syntax: '<length-percentage>'; inherits: true; initial-value: 0px; }

@media (max-width: 767px), (max-width: 1100px) and (orientation: portrait) {
  .dlv {
    --dlv-pad: 15px;
    /* never taller than what leaves room for the text under it */
    --band-h: min(calc(100vw / .58 * .5625), calc(100svh - 72px - 330px));
    --band-top: max(72px, calc((100svh - var(--band-h) - 320px) / 2));
    --below: calc(var(--band-top) + var(--band-h) + 22px);
    transition: --band-h .8s var(--dlv-ease);
  }
  .dlv.is-picker { --band-h: calc(100vw / .94 * .5625); }
  .dlv__fx {
    background:
      linear-gradient(180deg, #000 0%, rgba(0,0,0,0) 18%),
      linear-gradient(0deg, #000 0%, rgba(0,0,0,0) 24%);
  }
  .dlv__intro { top: var(--below); bottom: auto; right: 15px; transform: none; max-width: none; }
  .dlv__title { font-size: clamp(31px, 5.4vw, 48px); margin-bottom: 14px; }
  .dlv__subtitle { font-size: 16px; margin-bottom: 22px; }
  .dlv__actions { flex-direction: column; align-items: stretch; gap: 12px; max-width: 440px; }
  .dlv__actions .button, .dlv-ghost { width: 100%; justify-content: center; }
  /* the picker takes the place of the first-screen text */
  .dlv__stage { top: calc(var(--band-top) + var(--band-h) - 40px); bottom: auto; }
  .dlv-wrap {
    top: var(--below); bottom: auto; left: 15px; right: 15px; max-width: 520px; width: auto;
    flex-direction: column; align-items: stretch; gap: 16px;
    padding: 0; background: none; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none;
    transform: translateY(16px);
  }
  .dlv.is-picker .dlv-wrap { transform: none; }
  .dlv.is-picker .dlv__fx { opacity: 1; }
  .dlv-wrap__title { white-space: normal; margin-bottom: 8px; }
  .dlv-wrap__text { max-width: none; }
  .dlv-wrap__swatches {
    padding: 11px 14px; border-radius: 999px;
    background: rgba(16,16,16,.62); border: 1px solid rgba(201,180,118,.28);
  }
  .dlv-wrap__title { font-size: clamp(28px, 5vw, 40px); }
  .dlv-wrap__swatches { justify-content: space-between; }
  .dlv-swatch { width: 38px; height: 38px; }
  .dlv-wrap__actions { flex-direction: column; align-items: stretch; gap: 10px; }
  .dlv-wrap__actions .button { width: 100%; }
  .dlv-replay { align-self: center; }
}
/* upright tablets: the two first-screen buttons side by side */
@media (min-width: 600px) and (max-width: 1100px) and (orientation: portrait) {
  .dlv__actions { flex-direction: row; max-width: none; }
  .dlv__actions .button, .dlv-ghost { width: auto; }
}
@media (max-width: 767px) and (max-height: 700px) {
  .dlv__subtitle, .dlv-wrap__text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .dlv, .dlv__video, .dlv__stills, .dlv__intro, .dlv-wrap, .dlv__stage, .dlv-swatch, .dlv-swatch::after,
  .dlv__still--top.is-wiping, .dlv__edge.is-wiping { transition: none !important; }
}
