.ride-hero {
  position: relative;
  isolation: isolate;
  container-type: inline-size;
  overflow: hidden;
  background: #fffaf4;
  color: #68371f;
}

.ride-heading {
  position: absolute;
  inset: 0 auto auto 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.ride-scene { position: relative; transform-origin: 60% 69%; }
.ride-art { display: block; width: 100%; height: auto; }
.ride-effects { display: none; }

.ride-occasion, .ride-date, .ride-scroll {
  position: absolute;
  z-index: 1;
  left: 50%;
  margin: 0;
  transform: translateX(-50%);
  white-space: nowrap;
}

.ride-occasion {
  top: 4.8%;
  font-size: 34px;
  font-size: clamp(25px, 8.6cqw, 38px);
  line-height: 1;
}

.ride-date {
  top: 31.4%;
  display: flex;
  align-items: center;
  gap: .7em;
  font: 16px/1.15 Ovo, Georgia, serif;
  font-size: clamp(12px, 3.6cqw, 16px);
  letter-spacing: .035em;
}

.ride-date::before, .ride-date::after {
  content: "";
  width: 1.4em;
  height: 1px;
  background: #b28149;
}

.ride-scroll {
  top: 34%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55em;
  min-height: 44px;
  padding: 0 12px;
  color: #684a36;
  font: 13px/1 Ovo, Georgia, serif;
  text-decoration: none;
}

.ride-scroll i {
  width: 6px;
  height: 6px;
  border-bottom: 1px solid;
  border-right: 1px solid;
  transform: rotate(45deg);
}

.ride-scroll:focus-visible { outline-offset: -4px; }
.ride-scroll:hover span { text-decoration: underline; text-underline-offset: 3px; }

@media (prefers-reduced-motion: no-preference) {
  @supports (width: 1cqw) {
    .ride-effects, .ride-petals { display: block; position: absolute; inset: 0; pointer-events: none; }

    /* Each moving piece samples the matching area of the same watercolor.
       The paper at its edges blends back into the complete print underneath. */
    .ride-strand, .ride-hearts {
      position: absolute;
      left: var(--x);
      top: var(--y);
      width: var(--w);
      height: var(--h);
      background: url("wedding-ride.webp") no-repeat;
      background-size: 100cqw auto;
      background-position: calc(0px - var(--x)) calc(0px - var(--y));
      -webkit-mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
      mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
    }

    .ride-strand {
      --y: 0cqw;
      --w: 8.3cqw;
      --h: 39cqw;
      --swing: 1.4deg;
      transform-origin: 50% 0;
    }
    .short-left  { --x: 1.8cqw; --period: 4.9s; --delay: -1.2s; }
    .short-right { --x: 89.9cqw; --period: 5.4s; --delay: -3.2s; }
    .long-left, .long-right { --w: 8.4cqw; --h: 57cqw; --swing: 1deg; }
    .long-left  { --x: 8.55cqw; --period: 6.3s; --delay: -3.8s; }
    .long-right { --x: 83.25cqw; --period: 5.9s; --delay: -.6s; }

    .ride-hearts {
      --y: 26.9cqw;
      --w: 11cqw;
      --h: 13.4cqw;
      transform-origin: 50% 70%;
    }
    .hearts-left  { --x: 18.3cqw; --tilt: -4deg; --delay: .7s; }
    .hearts-right { --x: 70.7cqw; --tilt:  4deg; --delay: 1.05s; }

    .ride-petals i {
      --drift: 8cqw;
      --fall: 35cqw;
      --delay: .85s;
      --period: 7.1s;
      position: absolute;
      left: 6.1%;
      top: 15.5%;
      width: 1.15cqw;
      height: 2.05cqw;
      border-radius: 70% 25% 64% 30%;
      background: linear-gradient(125deg, #ffd67a 5%, #ffa318 40%, #dc6226 100%);
      opacity: 0;
    }
    .ride-petals i:nth-child(2) {
      --drift: -10cqw; --fall: 31cqw; --delay: 2.2s; --period: 8.3s;
      left: 87.6%; top: 25.1%; width: 1cqw;
    }
    .ride-petals i:nth-child(3) {
      --drift: 6cqw; --fall: 27cqw; --delay: 4.4s; --period: 8.9s;
      left: 12.3%; top: 25.3%; width: .8cqw; height: 1.6cqw;
    }

    .ride-headlamp {
      position: absolute;
      left: 64.1%;
      top: 69.95%;
      width: 11.2%;
      aspect-ratio: 1;
      translate: -50% -50%;
      border-radius: 50%;
      background: radial-gradient(ellipse, #fff9db 4%, #fff0bdb3 28%, #ffd47663 49%, transparent 72%);
      mix-blend-mode: screen;
      opacity: 0;
    }

    body:not(.sealed) .ride-scene { animation: ride-arrive 2s cubic-bezier(.18,.7,.25,1) both; }
    body:not(.sealed) .ride-strand { animation: ride-sway var(--period) ease-in-out var(--delay) infinite alternate; }
    body:not(.sealed) .ride-hearts { animation: ride-heartbeat 5.4s ease-in-out var(--delay) infinite; }
    body:not(.sealed) .ride-petals i { animation: ride-petal-fall var(--period) linear var(--delay) infinite; }
    body:not(.sealed) .ride-headlamp { animation: ride-light 6.6s ease-in-out .9s infinite; }
    .ride-hero.out-of-view .ride-scene, .ride-hero.out-of-view .ride-effects * { animation-play-state: paused; }
  }
}

@keyframes ride-arrive {
  from { transform: scale(1.045); }
  to { transform: scale(1); }
}
@keyframes ride-sway {
  from { transform: rotate(calc(0deg - var(--swing))); }
  to { transform: rotate(var(--swing)); }
}
@keyframes ride-heartbeat {
  0%, 38%, 100% { transform: none; }
  14% { transform: translateY(-.7cqw) rotate(var(--tilt)) scale(1.055); }
  24% { transform: translateY(-.15cqw) scale(1.015); }
}
@keyframes ride-petal-fall {
  0% { transform: translate(0, 0) rotate(-25deg); opacity: 0; }
  9% { opacity: .86; }
  30% { transform: translate(var(--drift), 9cqw) rotate(75deg) scaleX(.55); }
  55% { transform: translate(0, 20cqw) rotate(165deg) scaleX(.95); opacity: .8; }
  78%, 100% { transform: translate(var(--drift), var(--fall)) rotate(248deg) scaleX(.35); opacity: 0; }
}
@keyframes ride-light {
  0%, 62%, 100% { transform: scale(.78); opacity: 0; }
  22% { transform: scale(1.13); opacity: .93; }
  36% { transform: scale(1); opacity: .5; }
}
