body {
  background: var(--ivory);
}

.site-back {
  position: fixed;
  z-index: 20;
  inset-block-start: max(1rem, env(safe-area-inset-top));
  inset-inline-start: 1rem;
  gap: .5rem;
  padding: .55rem 1rem;
  border: 1px solid rgb(157 63 105 / 24%);
  border-radius: 999px;
  background: rgb(255 250 240 / 94%);
  box-shadow: 0 .45rem 1.5rem rgb(86 43 69 / 13%);
  color: var(--berry);
  font-size: .85rem;
  font-weight: 700;
  text-decoration: none;
  backdrop-filter: blur(.7rem);
}

.progress-rail {
  --story-progress: 0;
  position: fixed;
  z-index: 20;
  inset-block: 50% auto;
  inset-inline-end: .9rem;
  display: grid;
  gap: .1rem;
  padding: .45rem .25rem;
  border-radius: 999px;
  background: rgb(255 250 240 / 90%);
  box-shadow: 0 .45rem 1.5rem rgb(86 43 69 / 12%);
  transform: translateY(-50%);
  backdrop-filter: blur(.7rem);
}

.progress-rail::before,
.progress-rail::after {
  position: absolute;
  z-index: 0;
  inset-block: 1.55rem;
  inset-inline-start: 50%;
  width: 2px;
  border-radius: 999px;
  content: "";
  pointer-events: none;
  transform: translateX(-50%);
}

.progress-rail::before {
  background: rgb(157 63 105 / 20%);
}

.progress-rail::after {
  background: var(--coral-text);
  transform: translateX(-50%) scaleY(var(--story-progress));
  transform-origin: center top;
}

.progress-rail a {
  position: relative;
  z-index: 1;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
}

.progress-rail a::before {
  position: absolute;
  inset: 50% auto auto 50%;
  width: .7rem;
  height: .7rem;
  border: 2px solid var(--berry);
  border-radius: 50%;
  background: var(--ivory);
  content: "";
  transform: translate(-50%, -50%);
}

.progress-rail a:hover::before,
.progress-rail a:focus-visible::before,
.progress-rail a[aria-current="step"]::before {
  background: var(--coral);
  box-shadow: 0 0 0 .22rem rgb(184 75 82 / 18%);
}

.progress-rail span {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-end: calc(100% + .9rem);
  width: max-content;
  padding: .25rem .55rem;
  border-radius: .45rem;
  background: #562b45;
  color: white;
  font-size: .72rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-.25rem);
  transition: opacity .2s ease, transform .2s ease;
}

.progress-rail a:hover span,
.progress-rail a:focus-visible span {
  opacity: 1;
  transform: translateY(-50%);
}

.story-scene {
  --scene-progress: .5;
  --scene-background: var(--blush);
  --scene-image: none;
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  align-items: center;
  overflow: hidden;
  padding: clamp(4.75rem, 8vw, 7rem) clamp(2rem, 7vw, 7rem);
  background:
    radial-gradient(circle at 12% 18%, rgb(255 250 240 / 72%) 0 4.5rem, transparent 4.65rem),
    radial-gradient(circle at 88% 82%, rgb(255 255 255 / 36%) 0 7rem, transparent 7.15rem),
    var(--scene-background);
}

.scene-photo {
  grid-area: 1 / 1;
  justify-self: start;
  width: min(67%, 58rem);
  height: min(76vh, 47rem);
  height: min(76svh, 47rem);
  border: clamp(.35rem, .7vw, .65rem) solid rgb(255 255 255 / 76%);
  border-radius: clamp(1.5rem, 4vw, 3.5rem) clamp(1.5rem, 4vw, 3.5rem) clamp(4.5rem, 10vw, 9rem) clamp(1.5rem, 4vw, 3.5rem);
  background: var(--scene-image) center / cover no-repeat;
  box-shadow: 0 1.6rem 4rem rgb(86 43 69 / 19%);
  transform: translateY(calc((var(--scene-progress) - .5) * -3rem));
  will-change: transform;
}

.scene-panel {
  position: relative;
  z-index: 2;
  grid-area: 1 / 1;
  justify-self: end;
  width: min(47%, 35rem);
  padding: clamp(2rem, 5vw, 4.75rem);
  border: 1px solid rgb(157 63 105 / 17%);
  border-radius: clamp(1.25rem, 3vw, 2.5rem);
  background: rgb(255 250 240 / 97%);
  box-shadow: 0 1.6rem 4rem rgb(86 43 69 / 18%);
  text-align: center;
}

.story-scene:nth-child(even) .scene-photo {
  justify-self: end;
  border-radius: clamp(1.5rem, 4vw, 3.5rem) clamp(4.5rem, 10vw, 9rem) clamp(1.5rem, 4vw, 3.5rem) clamp(1.5rem, 4vw, 3.5rem);
}

.story-scene:nth-child(even) .scene-panel {
  justify-self: start;
}

.scene-kicker,
.blessing,
.scene-lead,
.ornament,
.signature,
.scene-panel h1,
.scene-panel h2,
.scene-panel address {
  margin: 0;
}

.scene-kicker,
.blessing {
  margin-top: 1.35rem;
  color: var(--berry);
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  font-weight: 700;
}

.ornament {
  margin-top: 1rem;
  color: var(--coral);
  font-size: 1.25rem;
}

.scene-panel h1,
.scene-panel h2 {
  margin-top: .55rem;
  color: #562b45;
  font-size: clamp(2.5rem, 5.2vw, 5.5rem);
  font-weight: 700;
  line-height: 1.08;
  text-wrap: balance;
}

.scene-names h2 {
  display: grid;
  gap: .15rem;
}

.scene-names h2 b {
  color: var(--coral);
  font-family: Georgia, serif;
  font-size: .52em;
  font-weight: 400;
}

.scene-date h2 {
  color: var(--berry);
  line-height: .98;
}

.scene-lead,
.scene-panel address {
  max-width: 28rem;
  margin: 1.25rem auto 0;
  color: #6c3b53;
  font-size: clamp(1.05rem, 1.65vw, 1.3rem);
  font-style: normal;
  line-height: 1.9;
}

.signature {
  margin-top: 1.35rem;
  color: var(--berry);
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  font-weight: 700;
}

.scene-next,
.gallery-button,
.scene-panel .map-button {
  min-height: 2.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin-top: 1.6rem;
  padding: .65rem 1.2rem;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
}

.scene-next,
.gallery-button {
  border: 1px solid rgb(157 63 105 / 28%);
  color: var(--berry);
}

.scene-panel .map-button {
  border: 1px solid var(--berry);
  background: var(--berry);
  color: white;
}

.closing-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .65rem;
}

.petals {
  --petal-speed-factor: 1;
  --petal-duration-scale: 1;
  position: absolute;
  z-index: 3;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.petals i {
  --petal-base-duration: 11s;
  position: absolute;
  inset-block-start: -4rem;
  width: .85rem;
  height: 1.5rem;
  border-radius: 80% 15% 75% 20%;
  background: var(--coral);
  box-shadow: inset -.2rem -.2rem .35rem rgb(157 63 105 / 20%);
  opacity: .55;
  animation: petal-fall calc(var(--petal-base-duration) * var(--petal-duration-scale)) linear infinite;
}

.petals i:nth-child(1) { inset-inline-start: 12%; animation-delay: -3s; }
.petals i:nth-child(2) { --petal-base-duration: 14s; inset-inline-start: 37%; animation-delay: -8s; background: var(--blush); }
.petals i:nth-child(3) { --petal-base-duration: 12s; inset-inline-start: 71%; animation-delay: -5s; }
.petals i:nth-child(4) { --petal-base-duration: 16s; inset-inline-start: 91%; animation-delay: -10s; background: var(--peach); }

@keyframes petal-fall {
  0% { transform: translate3d(0, -3rem, 0) rotate(0deg); }
  45% { transform: translate3d(2.25rem, 48vh, 0) rotate(160deg); }
  100% { transform: translate3d(-1.75rem, 108vh, 0) rotate(340deg); }
}

.scene-opening { --scene-background: var(--blush); --scene-image: url('../assets/media/floral-opening.jpg'); }
.scene-names { --scene-background: #ffd8bf; --scene-image: url('../assets/media/couple-card.jpg'); }
.scene-invitation { --scene-background: #cfe8d6; --scene-image: url('../assets/media/garden-arch.jpg'); }
.scene-date { --scene-background: #d7ebf7; --scene-image: url('../assets/media/date-flatlay.jpg'); }
.scene-venue { --scene-background: #ffc8c4; --scene-image: url('../assets/media/venue-garden.jpg'); }
.scene-closing { --scene-background: #f6d3e2; --scene-image: url('../assets/media/floral-closing.jpg'); }

@media (max-width: 48rem) {
  .story-scene {
    align-content: center;
    padding: 5.5rem 1.25rem 4rem;
  }

  .scene-photo,
  .story-scene:nth-child(even) .scene-photo {
    grid-area: 1 / 1;
    align-self: start;
    justify-self: stretch;
    width: 100%;
    height: 56vh;
    height: 56svh;
    border-radius: 1.75rem 1.75rem 5rem 1.75rem;
    transform: translateY(calc((var(--scene-progress) - .5) * -1.5rem));
  }

  .scene-panel,
  .story-scene:nth-child(even) .scene-panel {
    grid-area: 1 / 1;
    align-self: end;
    justify-self: center;
    width: calc(100% - 1.5rem);
    margin-top: 39vh;
    margin-top: 39svh;
    padding: 1.8rem 1.35rem;
  }

  .scene-panel h1,
  .scene-panel h2 {
    font-size: clamp(2.35rem, 12vw, 4rem);
  }

  .progress-rail {
    inset-inline-end: .45rem;
    gap: 0;
    padding: .4rem .2rem;
  }

  .progress-rail span {
    display: none;
  }
}

@media (max-width: 25rem) {
  .site-back {
    inset-inline-start: .65rem;
    font-size: .77rem;
  }

  .story-scene {
    padding-inline: .75rem 1.35rem;
  }

  .scene-panel,
  .story-scene:nth-child(even) .scene-panel {
    width: calc(100% - .85rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .scene-photo,
  .story-scene:nth-child(even) .scene-photo {
    transform: none;
    will-change: auto;
  }

  .petals {
    display: none;
  }

  .progress-rail span {
    transition: none;
  }
}
