/* /correas family-album carousel — intentionally route-scoped. */

/* Mobile browser chrome changes the visible viewport while scrolling.
   Keep both full-screen envelope stages flush with that live height so
   the cream page beneath cannot appear as a strip at the bottom. */
.intro {
  height: 100dvh;
  min-height: 100dvh;
}

.mini-envelope {
  min-height: 100dvh;
}

.intro-arrow {
  bottom: max(clamp(1.25rem, 4vh, 2.25rem), calc(env(safe-area-inset-bottom) + 0.75rem));
}

/* Let the card pick up the envelope's warm shadow at its exposed edge.
   A pure white card against the pocket created a ruler-straight flash
   while the flap was open. */
.mini-env-card {
  background: linear-gradient(180deg, #ead9bd 0%, #f6ebd8 15%, #fffdf8 44%);
}

.gallery-title {
  position: relative;
  z-index: 1;
  margin: 0 auto clamp(1.5rem, 4vw, 2.5rem);
  max-width: 18ch;
}

.details-inner {
  max-width: 74rem;
}

.acts--three {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1fr);
  gap: clamp(1rem, 2vw, 2rem);
}

.acts--three .act {
  min-width: 0;
}

.act-sprig--rings {
  display: block;
  width: clamp(4.5rem, 7vw, 5.75rem);
  height: auto;
  margin-inline: auto;
  margin-bottom: 0.75rem;
  object-fit: contain;
  filter: none;
  mix-blend-mode: normal;
}

.act-after {
  position: relative;
  margin-top: 1.75rem;
  padding-top: 1.6rem;
}

.act-after::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: clamp(4rem, 10vw, 7rem);
  height: 1px;
  translate: -50% 0;
  background: var(--gold);
}

.act-after-label,
.act-after-venue,
.act-after-address {
  margin: 0;
}

.act-after-label {
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.act-after-venue {
  margin-top: 0.45rem;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.6vw, 1.5rem);
  font-weight: 500;
  color: var(--ink);
}

.act-after-address {
  margin-top: 0.25rem;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.act-after .act-map {
  margin-top: 0.85rem;
}

.gallery-viewport {
  position: relative;
  margin-inline: -1.5rem;
  perspective: 1100px;
}

.gallery-frames {
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: clamp(0.9rem, 2vw, 1.5rem);
  max-width: none;
  padding: 1.25rem max(1.5rem, calc((100vw - 15rem) / 2)) 2rem;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-padding-inline: max(1.5rem, calc((100vw - 15rem) / 2));
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.gallery-frames::-webkit-scrollbar {
  display: none;
}

.gallery-frames:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: -6px;
}

.frame {
  flex: 0 0 clamp(12rem, 18vw, 15rem);
  padding: 0.5rem 0.5rem 1.25rem;
  opacity: 0.78;
  scale: 0.965;
  translate: 0 0.3rem;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  transition:
    opacity 350ms cubic-bezier(0.25, 1, 0.5, 1),
    scale 450ms cubic-bezier(0.22, 1, 0.36, 1),
    translate 450ms cubic-bezier(0.22, 1, 0.36, 1),
    rotate 450ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 450ms cubic-bezier(0.22, 1, 0.36, 1);
}

.frame img {
  height: auto;
  aspect-ratio: auto;
  object-fit: contain;
  filter: none;
}

.frame--landscape {
  flex-basis: clamp(18rem, 28vw, 24rem);
}

.frame--small {
  flex-basis: clamp(11.25rem, 16vw, 13.25rem);
}

.frame--large {
  flex-basis: clamp(13rem, 19.5vw, 16rem);
}

.frame--landscape.frame--small {
  flex-basis: clamp(17rem, 25vw, 21.5rem);
}

.frame--landscape.frame--large {
  flex-basis: clamp(19.5rem, 30vw, 25.5rem);
}

.frame:nth-child(4n + 1) {
  rotate: -0.8deg;
}

.frame:nth-child(4n + 2) {
  rotate: 0.6deg;
}

.frame:nth-child(4n + 3) {
  rotate: -0.4deg;
}

.frame:nth-child(4n) {
  rotate: 0.75deg;
}

.frame.is-active {
  z-index: 1;
  opacity: 1;
  scale: 1.025;
  translate: 0 -0.55rem;
  rotate: 0deg;
  box-shadow: 0 10px 8px -6px rgba(42, 20, 32, 0.3);
}

.gallery-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 2rem;
  margin: 0 auto;
}

html:not(.js) .gallery-dots {
  display: none;
}

.gallery-dot {
  display: grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.gallery-dot::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--gold-deep);
  opacity: 0.38;
  scale: 1;
  transition:
    background-color 300ms ease,
    opacity 300ms ease,
    scale 400ms cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-dot:hover::before,
.gallery-dot.is-active::before {
  background: var(--pink-deep);
  opacity: 1;
  scale: 1.55;
}

.gallery-dot:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 1px;
}

.gallery-finale {
  display: grid;
  place-items: center;
  padding: clamp(4rem, 10vw, 8rem) 1rem 1rem;
}

.gallery-finale-photo {
  width: min(42rem, 90vw);
  margin: 0;
  padding: 0.7rem 0.7rem 1.35rem;
  background: #fffdf8;
  border: 1px solid var(--gold);
  border-radius: 4px;
  rotate: -1deg;
  box-shadow: 0 6px 8px -4px rgba(42, 20, 32, 0.25);
}

.gallery-finale-photo img {
  width: 100%;
  height: auto;
  border-radius: 2px;
  filter: none;
}

.gallery-finale-photo figcaption {
  margin-top: 1rem;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.1rem, 3vw, 1.45rem);
  color: var(--ink);
}

@media (pointer: coarse) and (max-width: 900px) {
  /* The mobile choreography crossfades these layers. Large animated
     masks force a full-viewport repaint on every scroll frame. */
  .intro-hero,
  .intro-env-layer,
  .hero-church,
  .mini-envelope {
    -webkit-mask-image: none;
    mask-image: none;
  }

  html.js .intro-hero {
    opacity: 0;
  }

  html:not(.js) .intro-hero {
    opacity: 1;
  }

  .intro-hero,
  .intro-env-layer {
    will-change: opacity;
  }

  /* Keep the artwork itself at a stable size while mobile browser chrome
     expands and contracts. The outer intro can still use dvh to cover the
     live viewport without making the church zoom during a scroll. */
  .hero-church {
    top: 0;
    bottom: auto;
    height: 100vh;
    height: 100lvh;
    will-change: auto;
  }

  .envelope,
  .env-card,
  .env-flap-top,
  .mini-env-body,
  .mini-env-flap {
    will-change: transform;
  }

  .mini-env-seal {
    will-change: transform, opacity;
  }

  /* The desktop mask dissolves this room into the cream page above. On
     phones the mask is intentionally disabled, so bake the same dissolve
     into the background itself to avoid a hard full-width color edge. */
  .mini-envelope {
    background:
      linear-gradient(180deg,
        var(--cream) 0%,
        rgba(250, 243, 232, 0.96) 8%,
        rgba(250, 243, 232, 0) 30%),
      radial-gradient(110% 80% at 50% 30%, rgba(213, 0, 109, 0.05), transparent 55%),
      radial-gradient(140% 110% at 50% 45%, var(--cream) 0%, var(--cream-deep) 58%, #dfc9a8 100%);
  }

  /* Static watercolor files replace the continuously-rendering WebGL
     canvases on phones. */
  .wc {
    display: none;
  }

  .details {
    background:
      linear-gradient(180deg,
        var(--cream) 0%,
        rgba(250, 243, 232, 0.82) 14%,
        rgba(250, 243, 232, 0.82) 86%,
        var(--cream) 100%),
      url("../images/wash-interlude-cream.webp") center / cover no-repeat;
  }

  .interlude--cream::after {
    background: linear-gradient(180deg,
      var(--cream) 0%,
      rgba(250, 243, 232, 0.76) 16%,
      rgba(250, 243, 232, 0.76) 84%,
      var(--cream) 100%);
  }

  .interlude--plum::after,
  .closing-wash::after {
    background: linear-gradient(180deg,
      var(--cream) 0%,
      rgba(243, 231, 238, 0.88) 16%,
      rgba(243, 231, 238, 0.88) 84%,
      var(--cream) 100%);
  }

  .gallery,
  .gallery-viewport,
  .gallery-frames {
    perspective: none;
  }

  .gallery-viewport {
    contain: paint;
  }

  .frame {
    transition:
      opacity 250ms cubic-bezier(0.25, 1, 0.5, 1),
      scale 320ms cubic-bezier(0.22, 1, 0.36, 1),
      translate 320ms cubic-bezier(0.22, 1, 0.36, 1),
      rotate 320ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .frame img,
  .frame.is-active img {
    filter: none;
  }
}

@media (max-width: 900px) {
  .acts--three {
    grid-template-columns: 1fr;
    max-width: 34rem;
    margin-inline: auto;
  }

  .acts--three .acts-divider {
    width: min(14rem, 60%);
    height: 1px;
    min-height: 0;
    margin: 0 auto;
    background: linear-gradient(90deg, transparent, var(--gold) 25%, var(--gold) 75%, transparent);
  }
}

@media (max-width: 640px) {
  .gallery {
    padding-inline: 1rem;
  }

  .gallery-viewport {
    margin-inline: -1rem;
  }

  .gallery-frames {
    gap: 0.75rem;
    padding: 1rem max(1rem, calc((100vw - 12.5rem) / 2)) 1.75rem;
    scroll-padding-inline: max(1rem, calc((100vw - 12.5rem) / 2));
  }

  .frame {
    flex-basis: min(12.5rem, 58vw);
    padding: 0.4rem 0.4rem 1rem;
  }

  .frame--landscape {
    flex-basis: min(18rem, 82vw);
  }

  .frame--small {
    flex-basis: min(10.75rem, 50vw);
  }

  .frame--large {
    flex-basis: min(13.75rem, 64vw);
  }

  .frame--landscape.frame--small {
    flex-basis: min(16.5rem, 75vw);
  }

  .frame--landscape.frame--large {
    flex-basis: min(19rem, 86vw);
  }

  .gallery-finale-photo {
    width: min(22rem, 88vw);
    padding: 0.5rem 0.5rem 1rem;
  }
}
