/* Patjhad body motion. One invitation reveal, then a readable resting state.
   The opening and hero retain their own choreography. */
#invitation-page :is(#invitation,#events,#story,#gallery,#travel,#countdown,#rsvp) { --cinema-ease: cubic-bezier(.18,.68,.2,1); isolation: isolate; }
#invitation-page #family-letter.is-open .invitation-turn { animation: patjhad-letter-turn 3.4s cubic-bezier(.22,.64,.2,1) both; }
@keyframes patjhad-letter-turn {
  0% { transform: translateY(22px) rotateY(-205deg) rotateZ(-4deg); }
  32% { transform: translateY(8px) rotateY(-140deg) rotateZ(-2deg); }
  75% { transform: translateY(0) rotateY(10deg) rotateZ(.6deg); }
  100% { transform: none; }
}
.is-backgrounded #invitation-page #family-letter .invitation-turn,
.menu-open #invitation-page #family-letter .invitation-turn { animation-play-state: paused; }
.card-preview #invitation-page #family-letter.is-open .invitation-turn { animation: none; transform: none; }
@media(prefers-reduced-motion:reduce) { #invitation-page #family-letter.is-open .invitation-turn { animation: none; transform: none; } }

/* The compass lives inside the same scene as the celebration. A stable stage
   keeps its full height when the guest changes a chapter. */
#invitation-page #events { display: grid; grid-template-columns: minmax(0,1fr); }
#invitation-page #events>.section-intro { grid-column: 1; grid-row: 1; position: relative; z-index: 4; padding-bottom: 2rem; }
#invitation-page #events .season-dial { grid-column: 1; grid-row: 2; align-self: start; z-index: 5; margin: .2rem auto 0; }
#invitation-page #events .season-dial::before { opacity: .92; }
#invitation-page #events .season-dial-center::after {
  content: ''; position: absolute; left: 50%; top: -17px; width: 5px; height: 5px; border-radius: 50%;
  background: #dfc081; box-shadow: 0 0 9px rgb(236 199 117/.4); transform-origin: 0 61px;
  animation: patjhad-dial-hour var(--season-duration,11s) linear infinite; animation-play-state: paused;
}
#invitation-page #events .season-dial.is-season-playing .season-dial-center::after { animation-play-state: running; }
#invitation-page #events .season-stop { text-shadow: 0 2px 7px #142219; }
#invitation-page #events .season-stop[aria-selected='true'] .season-stop-name { text-shadow: 0 0 15px rgb(209 171 88/.3),0 2px 7px #142219; }
#invitation-page #events .season-playback {
  grid-column: 1; grid-row: 2; align-self: start; justify-self: center; z-index: 5;
  margin: 327px 0 0; min-height: 44px; padding: .5rem .9rem;
  border: 0; border-bottom: 1px solid rgb(215 186 125/.34); background: rgb(24 42 34/.32);
  color: #ddc69a; font-family: var(--font-body); font-size: .73rem; line-height: 1.5;
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
}
#invitation-page #events .season-playback::before,
#invitation-page #gallery .projection-playback::before {
  content: ''; display: block; flex: 0 0 7px; width: 7px; height: 10px;
  border-left: 2px solid currentColor; border-right: 2px solid currentColor;
}
#invitation-page #events .season-playback[aria-pressed='false']::before,
#invitation-page #gallery .projection-playback[aria-pressed='false']::before { border: 0; background: currentColor; clip-path: polygon(0 0,100% 50%,0 100%); }
#invitation-page #events-list { grid-column: 1; grid-row: 2; width: 100%; min-width: 0; position: relative; z-index: 2; }
#invitation-page #events-list .ceremony,
#invitation-page #events-list .ceremony:nth-child(even) {
  display: flex; flex-direction: column; justify-content: flex-start; align-items: center;
  width: 100%; padding: 0; min-height: max(1030px,calc(610px + var(--season-copy-height,420px)));
}
#invitation-page #events-list.has-season-dial .ceremony { min-height: max(1030px,calc(610px + var(--season-copy-height,420px))); }
#invitation-page #events-list .ceremony-art,
#invitation-page #events-list .ceremony:nth-child(even) .ceremony-art { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; max-height: none; order: 0!important; }
#invitation-page #events-list .ceremony-art>img,
#invitation-page #events-list .ceremony-art>.scene-film { object-position: center 39%; }
#invitation-page #events-list .ceremony-art::after,
#invitation-page #events-list .ceremony:nth-child(even) .ceremony-art::after {
  background: linear-gradient(#182a22 0%,rgb(24 42 34/.74) 13%,rgb(24 42 34/.37) 30%,rgb(18 31 23/.09) 43%,rgb(17 30 23/.68) 59%,rgb(17 30 23/.96) 75%,#182a22 100%);
}
#invitation-page #events-list .ceremony-copy,
#invitation-page #events-list .ceremony:nth-child(even) .ceremony-copy {
  position: relative; z-index: 4; width: 100%; max-width: 640px; min-height: 0;
  margin: 610px auto 0!important; padding: 0 1.8rem 4.6rem; text-align: center;
  text-shadow: 0 2px 15px rgb(4 16 9/.35); transform: none!important;
}
#invitation-page #events-list .ceremony-date { color: #e1c38b; font-size: .79rem; }
#invitation-page #events-list .ceremony h3 { font-size: clamp(3.1rem,11.3vw,5rem); max-width: none; }
#invitation-page #events-list .ceremony-venue { color: #e1cba5; }
#invitation-page #events-list .ceremony-description { color: #e1d5bc; }
#invitation-page #events-list .ceremony-attire { color: #c4b799; }
#invitation-page #events-list .ceremony[data-scene='evening'] .ceremony-art::after { background: linear-gradient(#182a22,rgb(17 29 23/.68) 22%,rgb(17 29 23/.12) 43%,rgb(14 26 19/.73) 62%,#182a22 93%); }
#invitation-page #events .season-dial-many { grid-row: 2; margin-bottom: 0; padding-bottom: 0; background: linear-gradient(#182a22 70%,transparent); }
#invitation-page #events:has(.season-dial-many) .season-playback { grid-row: 3; margin: 0 auto .8rem; }
#invitation-page #events:has(.season-dial-many) #events-list { grid-row: 4; }
#invitation-page #events:has(.season-dial-many) #events-list .ceremony { min-height: max(810px,calc(390px + var(--season-copy-height,420px))); }
#invitation-page #events:has(.season-dial-many) #events-list .ceremony-copy { margin-top: 390px!important; }

/* The photograph remains the focus; its entrance is owned by scene.js. */
#invitation-page #story { padding-top: 6.6rem; padding-bottom: 6.5rem; }
#invitation-page #story .portrait-keepsake,#invitation-page #story .story-copy { z-index: 3; }
#invitation-page #story .story-copy { position: relative; }
#invitation-page #story .story-portrait img { display: block; }
#invitation-page #story .canopy-names { position: relative; z-index: 6; padding-top: 1.8rem; text-shadow: 0 2px 13px #14291b,0 0 24px rgb(221 184 110/.12); }
#invitation-page #story .keepsake-bough { opacity: .45; }
#invitation-page #story:is(.is-in-view,.cinema-ready) .keepsake-bough { animation-play-state: paused; }
#invitation-page #story.cinema-running .keepsake-bough { animation-play-state: running; }

/* A static optical lantern grounds the guest-driven photographic change. */
#invitation-page #gallery { padding-bottom: 5.7rem; }
#invitation-page #gallery>.section-intro { position: relative; z-index: 3; padding-bottom: 2.8rem; }
#invitation-page #gallery .memory-projection { --projector-width: clamp(177px,47vw,265px); --projector-left: -2%; --projector-bottom: 5px; z-index: 3; max-width: 1200px; padding-bottom: 178px; }
#invitation-page #gallery #gallery-list { --memory-inset: 16px; --memory-gap: 32px; }
#invitation-page #gallery .memory img { height: clamp(370px,121vw,600px); max-height: none; }
#invitation-page #gallery .memory-projection .memory::after {
  content: ''; position: absolute; display: block; inset: 0 0 55px; z-index: 1;
  pointer-events: none; opacity: 0; background: linear-gradient(115deg,transparent 24%,rgb(236 217 170/.13) 48%,transparent 70%);
}
#invitation-page #gallery .memory-projection.is-projecting .memory.is-current::after { animation: patjhad-projector-pass .9s ease both; }
#invitation-page #gallery .memory-projection.is-projecting .memory.is-current img { animation: patjhad-projector-image .9s ease both; }
#invitation-page #gallery .projection-lamp { left: var(--projector-left); bottom: var(--projector-bottom); width: var(--projector-width); transform: rotate(-12deg); transform-origin: 50% 100%; }
#invitation-page #gallery .projection-lamp img { position: relative; z-index: 1; }
#invitation-page #gallery .projection-lamp::after {
  content: ''; position: absolute; z-index: 2; left: 72%; top: 38%; width: 17%; height: 27%;
  border-radius: 50%; background: radial-gradient(ellipse,rgb(249 227 169/.72),rgb(229 185 96/.14) 42%,transparent 72%);
  opacity: .4; transform: rotate(9deg); mix-blend-mode: screen;
}
#invitation-page #gallery .projection-beam {
  /* The rotated lantern's illuminated lens sits at .73w from its left and
     .38w above its base. Keep the beam's pivot there at every viewport size. */
  left: calc(var(--projector-left) + var(--projector-width) * .72);
  bottom: calc(var(--projector-bottom) + var(--projector-width) * .38);
  width: calc(100% - var(--projector-left) - var(--projector-width) * .72);
  height: 68%; z-index: 0; opacity: .42;
  background: linear-gradient(27deg,rgb(229 206 144/.27),rgb(235 218 163/.09) 46%,transparent 81%);
  clip-path: polygon(0 100%,2% 100%,100% 0,34% 0); transform-origin: 1% 100%;
}
#invitation-page #gallery .memory-projection.is-projecting .projection-beam { animation: patjhad-projection-shutter .9s ease both; }
#invitation-page #gallery .gallery-controls { flex-wrap: wrap; column-gap: 1.8rem; row-gap: .4rem; margin-top: .55rem; }
#invitation-page #gallery .gallery-controls .projection-playback {
  display: inline-flex; align-items: center; justify-content: center; gap: .65rem; flex: 0 0 auto;
  min-height: 44px; min-width: 145px; padding: .55rem .6rem;
  color: #d8c197; font-family: var(--font-body); font-size: .73rem; line-height: 1.5;
  border: 0; border-bottom: 1px solid rgb(215 186 125/.3); background: none;
}
#invitation-page #gallery .album-help { position: relative; z-index: 3; margin-top: .6rem; color: #c6b694; font-size: .77rem; }

/* Practical chapters remain steady while guests read and act. */
#invitation-page #travel .travel-content { z-index: 3; }
#invitation-page #travel .travel-stilllife img { opacity: .43; }
#invitation-page #travel .guest-note-toggle { transition: color .35s ease; }
#invitation-page #travel .guest-note-toggle:hover { color: #fff0ce; }
#invitation-page #travel .guest-note-toggle[aria-expanded='true']::before { filter: brightness(1.08); }
#invitation-page #countdown { display: grid; grid-template-columns: minmax(0,1fr); justify-items: center; }
#invitation-page #countdown>.gif-canopy { grid-column: 1; grid-row: 1; position: relative; z-index: 2; width: 240px; max-width: 75%; margin-bottom: .8rem; }
#invitation-page #countdown>h2 { grid-column: 1; grid-row: 2; position: relative; z-index: 3; }
#invitation-page #countdown .countdown-values { grid-column: 1; grid-row: 3; position: relative; z-index: 3; width: min(100%,450px); }
#invitation-page #countdown .countdown-values>div:first-child span { text-shadow: 0 0 32px rgb(213 175 96/.11); }
#invitation-page #countdown>p { grid-column: 1; grid-row: 4; position: relative; z-index: 3; }
#invitation-page #countdown .calendar-actions { grid-column: 1; grid-row: 5; position: relative; z-index: 3; }
#invitation-page #rsvp .rsvp-copy { z-index: 4; }
#invitation-page #rsvp .gif-grove-embers {
  position: absolute; left: -8%; bottom: 2%; width: 116%; height: 420px; max-width: none;
  z-index: 0; margin: 0; overflow: hidden; pointer-events: none; opacity: .59;
  -webkit-mask-image: radial-gradient(ellipse at 50% 67%,#000 19%,rgb(0 0 0/.8) 44%,transparent 74%);
  mask-image: radial-gradient(ellipse at 50% 67%,#000 19%,rgb(0 0 0/.8) 44%,transparent 74%);
}
#invitation-page #rsvp .gif-grove-embers img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 68%; }
@keyframes patjhad-dial-hour { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes patjhad-projection-shutter { 0% { opacity: .38; } 22% { opacity: .04; } 49% { opacity: .63; } 100% { opacity: .38; } }
@keyframes patjhad-projector-pass { 0% { opacity: 0; transform: translateX(-55%); } 35% { opacity: .65; } 100% { opacity: 0; transform: translateX(55%); } }
@keyframes patjhad-projector-image { 0% { opacity: .66; } 45% { opacity: .92; } 100% { opacity: 1; } }

@media(min-width:760px) {
  #invitation-page #events .season-dial { margin: .6rem auto 0 max(2vw,calc((100vw - 1230px)/2)); width: 400px; height: 335px; }
  #invitation-page #events .season-playback { justify-self: start; margin: 341px 0 0 max(calc(2vw + 135px),calc((100vw - 960px)/2)); }
  #invitation-page #events-list .ceremony,
  #invitation-page #events-list .ceremony:nth-child(even),
  #invitation-page #events-list.has-season-dial .ceremony { min-height: max(900px,calc(330px + var(--season-copy-height,470px))); align-items: flex-end; }
  #invitation-page #events-list .ceremony-art,
  #invitation-page #events-list .ceremony:nth-child(even) .ceremony-art { position: absolute; inset: 0; width: 100%; height: 100%; }
  #invitation-page #events-list .ceremony-art>img,
  #invitation-page #events-list .ceremony-art>.scene-film { object-position: center 46%; }
  #invitation-page #events-list .ceremony-art::after,
  #invitation-page #events-list .ceremony:nth-child(even) .ceremony-art::after {
    background: linear-gradient(90deg,rgb(21 35 26/.23) 0%,rgb(21 35 26/.11) 34%,rgb(19 33 25/.83) 63%,rgb(18 32 24/.94)),linear-gradient(#182a22,transparent 24%,transparent 67%,#182a22);
  }
  #invitation-page #events-list .ceremony-copy,
  #invitation-page #events-list .ceremony:nth-child(even) .ceremony-copy {
    width: 46%; max-width: 640px; margin: 335px 4% 0 auto!important; padding: 0 1.4rem 5rem 1.9rem; text-align: left;
  }
  #invitation-page #events-list .ceremony h3 { font-size: clamp(3.1rem,5.3vw,5.2rem); }
  #invitation-page #events-list .ceremony-description { margin-inline: 0; }
  #invitation-page #events .season-dial-many { margin-inline: auto; width: min(100%,750px); height: auto; }
  #invitation-page #events:has(.season-dial-many) .season-playback { justify-self: center; }
  #invitation-page #events:has(.season-dial-many) #events-list .ceremony { min-height: max(790px,calc(200px + var(--season-copy-height,470px))); }
  #invitation-page #events:has(.season-dial-many) #events-list .ceremony-copy { margin-top: 220px!important; }
  #invitation-page #story { padding-top: 8rem; padding-bottom: 7rem; }
  #invitation-page #gallery .memory-projection { --projector-width: 290px; --projector-left: 2%; --projector-bottom: 10px; width: min(96%,1200px); padding-bottom: 220px; }
  #invitation-page #gallery #gallery-list { --memory-inset: 62px; --memory-gap: 124px; }
  #invitation-page #gallery .memory img { height: 650px; }
  #invitation-page #gallery .projection-beam { height: 75%; }
  #invitation-page #gallery .gallery-controls { column-gap: 2.2rem; }
  #invitation-page #gallery .gallery-controls .projection-playback { margin-left: 1rem; }
  #invitation-page #rsvp .gif-grove-embers { height: 530px; left: 2%; width: 96%; opacity: .52; }
}
@media(max-width:359px) {
  #invitation-page #events-list .ceremony-copy,
  #invitation-page #events-list .ceremony:nth-child(even) .ceremony-copy { padding-inline: 1.3rem; }
  #invitation-page #events-list .ceremony h3 { font-size: 2.8rem; }
  #invitation-page #events .season-playback { font-size: .76rem; }
  #invitation-page #gallery .memory img { height: 378px; }
  #invitation-page #gallery .gallery-controls { column-gap: 1.1rem; }
  #invitation-page #gallery .gallery-controls .projection-playback { flex-basis: 100%; width: max-content; border-bottom: 0; }
}

/* Keep clocks frozen during overlays or backgrounding. Completion classes
   remain intact, so returning to a section never restarts its entrance. */
.is-backgrounded #invitation-page :is(#invitation,#events,#story,#gallery,#travel,#countdown,#rsvp) *,
.is-backgrounded #invitation-page :is(#invitation,#events,#story,#gallery,#travel,#countdown,#rsvp) *::before,
.is-backgrounded #invitation-page :is(#invitation,#events,#story,#gallery,#travel,#countdown,#rsvp) *::after { animation-play-state: paused!important; }
#invitation-page #gallery:not(.cinema-running) .memory-projection.is-projecting :is(.projection-beam,.memory.is-current img),
#invitation-page #gallery:not(.cinema-running) .memory-projection.is-projecting .memory.is-current::after { animation-play-state: paused; }
@media(prefers-reduced-motion:reduce) {
  #invitation-page :is(#invitation,#events,#story,#gallery,#travel,#countdown,#rsvp) *,
  #invitation-page :is(#invitation,#events,#story,#gallery,#travel,#countdown,#rsvp) *::before,
  #invitation-page :is(#invitation,#events,#story,#gallery,#travel,#countdown,#rsvp) *::after { animation: none!important; transition-duration: 0s!important; }
  #invitation-page #events .season-dial-center::after { display: none; }
  #invitation-page #events-list .ceremony-art { transform: none; opacity: 1; }
  #invitation-page #gallery .projection-beam { opacity: .3; }
}
