/* A fixed piece of stationery around one native document scroll.
   No nested scroll container: Safari, anchors and scroll-linked motion keep
   their existing window coordinate system. The envelope is left untouched. */
:root {
  --couple-heading-font: Moul, serif;
  --folio-vv-width: 100%;
  --folio-vv-height: 100vh;
  --folio-vv-top: 0px;
  --folio-vv-left: 0px;
  --folio-width: min(960px, calc(var(--folio-vv-width) - 28px));
  --folio-top: max(14px, env(safe-area-inset-top));
  --folio-bottom: max(14px, env(safe-area-inset-bottom));
  --folio-art-width: 80px;
  --folio-rail-width: 12px;
  --ampersand-size: 26px;
}
@supports(height:100dvh) { :root { --folio-vv-height:100dvh; } }
html[lang=en] { --couple-heading-font: Cormorant, Georgia, serif; }
body [data-i18n=groomFull], body [data-i18n=brideFull], body .person-name.couple-heading {
  font-family: var(--couple-heading-font);
  font-weight: 400;
  font-style: normal;
  font-size: inherit;
  line-height: inherit;
  letter-spacing: 0;
  font-synthesis: none;
}
.couple-heading .name-part { font-family: inherit; font-weight: inherit; font-style: normal; }
html[lang=en] .couple-introduction .person-name.couple-heading { font-family: var(--couple-heading-font); }

.stationery-backdrop, .stationery-frame {
  position: fixed;
  top: calc(var(--folio-vv-top) + var(--folio-top));
  left: calc(var(--folio-vv-left) + var(--folio-vv-width) / 2);
  width: var(--folio-width);
  height: max(0px, calc(var(--folio-vv-height) - var(--folio-top) - var(--folio-bottom)));
  transform: translateX(-50%);
  pointer-events: none;
  visibility: hidden;
}
.entered .stationery-backdrop, .entered .stationery-frame { visibility: visible; }
.entered, body.entered { background: var(--mahogany-dark); }
.entered .background-world { visibility: hidden; }
.stationery-backdrop {
  z-index: 0;
  background-color: var(--ivory);
  /* The original cotton grain supplies depth without enlarging or stretching
     the ornament's baked-in paper/guilloche across the reading surface. */
  box-shadow: 0 8px 42px #0002;
}
.stationery-backdrop::after {
  content: '';
  position: absolute;
  inset: 8px;
  background: url('assets/cotton-paper-v1.webp') center / 440px 440px repeat;
  opacity: .32;
  mix-blend-mode: multiply;
  box-shadow: inset 0 0 28px #967c4320, inset 0 0 2px #fff8e9;
}
/* Printed, not animated: upright blossoms and fine lattice under the cotton grain.
   This layer belongs only to the inside paper, never the envelope or photos. */
.stationery-backdrop::before {
  content: '';
  position: absolute;
  inset: 12px;
  background: url('assets/lotus-lattice-pattern-v4.svg') center / 240px 240px repeat;
  opacity: .10;
  pointer-events: none;
}
@media (max-width: 600px) {
  .stationery-backdrop::before { background-size: 200px 200px; }
}
.stationery-frame {
  z-index: 12;
  /* Opaque, unblurred spread masks content outside the paper's viewport.
     The page still uses native scrolling; no nested scroll or wheel capture. */
  box-shadow: 0 0 0 100vmax var(--mahogany-dark);
}
/* Eight ordinary clipped background tiles, not a masked border-image.
   Source canvas: 1024 x 1536, corner slices: 430 x 430. The artwork's paper
   backing is transparent, so no square corner tile paints over the page. */
.stationery-corner, .stationery-rail {
  position: absolute;
  z-index: 2;
  background-image: url('assets/stationery-page-transparent-v3.webp');
  background-repeat: no-repeat;
  pointer-events: none;
}
.stationery-corner {
  width: var(--folio-art-width); height: var(--folio-art-width);
  background-size: calc(var(--folio-art-width) * 2.38139535) calc(var(--folio-art-width) * 3.57209302);
}
.stationery-corner-nw { top: 0; left: 0; background-position: left top; }
.stationery-corner-ne { top: 0; right: 0; background-position: right top; }
.stationery-corner-sw { bottom: 0; left: 0; background-position: left bottom; }
.stationery-corner-se { bottom: 0; right: 0; background-position: right bottom; }
.stationery-rail-top, .stationery-rail-bottom {
  left: var(--folio-art-width); right: var(--folio-art-width); height: var(--folio-rail-width);
  background-size: 624.390244% calc(var(--folio-art-width) * 3.57209302);
}
.stationery-rail-top { top: 0; background-position: center top; }
.stationery-rail-bottom { bottom: 0; background-position: center bottom; }
.stationery-rail-left, .stationery-rail-right {
  top: var(--folio-art-width); bottom: var(--folio-art-width); width: var(--folio-rail-width);
  background-size: calc(var(--folio-art-width) * 2.38139535) 227.218935%;
}
.stationery-rail-left { left: 0; background-position: left center; }
.stationery-rail-right { right: 0; background-position: right center; }
.stationery-edge {
  position: absolute;
  inset-inline: 12px;
  height: 72px;
  /* The blur is clipped to the fixed paper. The opaque exterior shadow above
     is independent, so blurred content never paints outside the inner folio. */
  overflow: hidden;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  background: linear-gradient(var(--ivory) 0 14px, #f8f1dfb8 32px, #f8f1df00 72px);
  -webkit-mask-image: linear-gradient(#000 0 18px, transparent 72px);
  mask-image: linear-gradient(#000 0 18px, transparent 72px);
}
.stationery-edge-top { top: 0; }
.stationery-edge-bottom {
  bottom: 0;
  background: linear-gradient(to top, var(--ivory) 0 14px, #f8f1dfb8 32px, #f8f1df00 72px);
  -webkit-mask-image: linear-gradient(to top, #000 0 18px, transparent 72px);
  mask-image: linear-gradient(to top, #000 0 18px, transparent 72px);
}
.entered #invitation {
  position: relative;
  z-index: 1;
  width: var(--folio-width);
  margin-inline: auto;
  padding-block: calc(var(--folio-top) + 72px) calc(var(--folio-bottom) + 38px);
}
.invitation-paper { width: 100%; background: transparent; }
.invitation-paper::before { content: none; }
.entered .toolbar {
  top: calc(var(--folio-vv-top) + var(--folio-top) + 12px);
  right: calc((var(--folio-vv-width) - var(--folio-width)) / 2 + 20px);
}
.wedding-section { scroll-margin-top: calc(var(--folio-top) + 84px); }
.section-navigation { padding: 16px 24px; gap: 8px 24px; }
.section-navigation a { border-bottom-color: #b2945538; }

/* Generated engraved surround; original photograph remains unfiltered. */
.invitation-cover { min-height: 0; overflow: visible; background: transparent; }
.invitation-cover::before, .invitation-cover::after { content: none; }
.cover-text {
  width: min(100%, 720px);
  min-height: 0;
  margin-inline: auto;
  padding: 32px 40px 26px;
  justify-content: flex-start;
}
.cover-text .wedding-title { margin: 0 0 18px; color: var(--mahogany); }
html[lang=km] .cover-text h2 { font-size: 23px; line-height: 1.95; }
html[lang=en] .cover-text h2 { font-size: 34px; line-height: 1.25; }
.cover-text h2 { margin: 0 0 24px; }
.cover-text .couple-names { align-items: center; gap: 12px; }
.couple-monogram { display: flex; align-items: center; justify-content: center; align-self: center; justify-self: center; width: 44px; height: 56px; }
.couple-monogram img { width: 100%; height: 100%; object-fit: contain; display: block; }
.cover-text .guest-dedication { max-width: 340px; padding-top: 18px; }
.cover-text .cover-date { margin: 16px 0 4px; }

/* Figma 14:1808: compact 11/13 px inline rows; both blocks align left,
   while their common container is centered. Body lettering remains distinct. */
.formal-invitation .family-grid {
  grid-template-columns: max-content max-content;
  justify-content: space-between;
  align-items: start;
  width: min(100%, 430px);
  max-width: 100%;
  column-gap: 20px;
  margin: 26px auto 28px;
}
.formal-invitation .family-grid > div:first-child,
.formal-invitation .family-grid > div:last-child { text-align: left; }
.formal-invitation .family-grid .family-names { margin: 0; gap: 4px; }
.formal-invitation .family-grid .family-names p {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 4px;
  white-space: nowrap;
}
.formal-invitation .family-grid > div:last-child .family-names p { justify-content: flex-start; }
.formal-invitation .family-grid .family-names p > span { font: 400 13px/1.8 var(--body-font); }
.formal-invitation .family-grid .family-names strong {
  display: inline;
  margin: 0;
  font: 600 15px/1.9 var(--body-font);
  color: var(--mahogany);
}
.formal-invitation .couple-introduction { align-items: center; }
.finale-names { align-items: center; }
.payment-recipient { display: grid; grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr); align-items: center; gap: 5px; }
.payment-recipient .person-name.couple-heading { font-size: 14px; line-height: 1.9; }
html[lang=en] .payment-recipient .person-name.couple-heading { font-size: 22px; line-height: 1.3; }
.payment-recipient .couple-heading .name-part { display: block; }

/* One ampersand component across every locale and placement. Grid rows center
   the glyph between full names, not between their individual wrapped lines. */
.entrance-heading .couple-names > .ampersand,
.cover-text .couple-names > .ampersand,
.letter .letter-names > .ampersand,
.formal-invitation .couple-introduction > .ampersand,
.invitation-paper .finale-names > .ampersand,
.gift-payment .payment-recipient > .ampersand,
.payment-dialog .payment-recipient > .ampersand {
  font: italic 400 var(--ampersand-size)/1 Cormorant, serif;
  color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  justify-self: center;
  width: 28px;
  height: 34px;
  margin: 0;
  padding: 0;
}
.entrance-heading .couple-names, .cover-text .couple-names,
.letter .letter-names, .formal-invitation .couple-introduction,
.finale-names, .payment-recipient {
  /* Center the visible names as a group, not two unequal ink lengths inside
     equally wide cells. Their outer margins are now equal. */
  grid-template-columns: max-content 28px max-content;
  justify-content: center;
  align-items: center;
}
.cover-text .couple-names { grid-template-columns: max-content 44px max-content; }
/* Balance the farewell around the page center, not around the two names'
   unequal text widths. The ampersand sits on the same center axis as contacts. */
.invitation-paper .finale-names {
  display: grid;
  grid-template-columns: minmax(0,1fr) 28px minmax(0,1fr);
  width: 100%;
  max-width: 620px;
  margin-inline: auto;
  column-gap: 12px;
  text-align: center;
}
.invitation-paper .finale-names > .person-name { min-width: 0; width: 100%; }
.formal-invitation .couple-introduction { grid-template-rows: auto auto; row-gap: 0; }
.formal-invitation .couple-introduction > div { display: contents; }
.couple-introduction > div:first-child .section-kicker { grid-column: 1; grid-row: 1; }
.couple-introduction > div:last-child .section-kicker { grid-column: 3; grid-row: 1; }
.couple-introduction > div:first-child h3 { grid-column: 1; grid-row: 2; }
.couple-introduction > div:last-child h3 { grid-column: 3; grid-row: 2; }
.formal-invitation .couple-introduction > .ampersand { grid-column: 2; grid-row: 2; }

/* Photo first, exact generated stamp overlay second. Decorations stay out of
   the lightbox, and have no labels, pointer handling or extra keyboard stops. */
.story-gallery { gap: 28px; max-width: 760px; padding: 6px; overflow: visible; }
.story-photo button {
  aspect-ratio: 3 / 4;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  filter: drop-shadow(0 4px 7px #00000012);
}
.story-photo button:hover { border: 0; }
.story-photo button:active { transform: scale(.96); }
.story-photo button .gallery-photograph {
  position: absolute;
  inset: 14.1% 16.1% 14.3%;
  width: 67.8%;
  height: 71.6%;
  aspect-ratio: auto;
  border-radius: 0;
  object-fit: cover;
  outline: 1px solid oklch(0 0 0 / .1);
  outline-offset: -1px;
}
.story-photo button .postcard-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  border-radius: 0;
  pointer-events: none;
}
.story-photo .photo-expand { right: 20%; bottom: 18%; background: #f8f1dfed; color: var(--mahogany); }
.story-photo figcaption { margin-inline: 5%; padding-top: 10px; color: var(--mahogany); }

@media (max-width: 600px) {
  :root { --folio-width: calc(var(--folio-vv-width) - 20px); --folio-top: max(10px, env(safe-area-inset-top)); --folio-bottom: max(10px, env(safe-area-inset-bottom)); --folio-art-width: 58px; }
  .entered .toolbar { right: calc((var(--folio-vv-width) - var(--folio-width)) / 2 + 12px); gap: 4px; }
  .entered #invitation { padding-top: calc(var(--folio-top) + 76px); }
  .cover-text { width: 100%; padding: 16px 26px 24px; }
  .portrait-cameo { width: min(304px, 100%); margin-bottom: 22px; }
  .cover-text .wedding-title { font-size: clamp(15px, 4.2vw, 18px); margin-bottom: 16px; }
  html[lang=en] .cover-text .wedding-title { font-size: 26px; line-height: 1.3; }
  html[lang=km] .cover-text h2 { font-size: clamp(15px, 4.5vw, 20px); line-height: 1.9; }
  html[lang=en] .cover-text h2 { font-size: clamp(23px, 6.3vw, 28px); line-height: 1.25; }
  .cover-text .couple-names { gap: 7px; }
  .cover-text .guest-dedication { padding-top: 16px; }
  .cover-text .guest-dedication > span { font-size: 13px; }
  .cover-text .guest-dedication p { font-size: 18px; }
  .cover-text .cover-date { font-size: 12px; }
  .section-navigation { gap: 4px 18px; padding: 12px 18px; }
  .wedding-section { padding-inline: 28px; }
  .formal-invitation .family-grid { width: min(100%, 288px); margin: 20px auto 24px; column-gap: 12px; }
  .formal-invitation .family-grid .family-names { gap: 0; }
  .formal-invitation .family-grid .family-names p { gap: 3px; }
  .formal-invitation .family-grid .family-names p > span { font-size: 11px; line-height: 1.8; }
  .formal-invitation .family-grid .family-names strong { font-size: 13px; line-height: 1.9; }
  .formal-invitation .couple-introduction { margin-inline: 0; }
  .countdown-section { margin-inline: 0; }
  .gift-payment { padding: 24px 20px; }
  .invitation-finale { padding-bottom: 48px; }
  .story-gallery { grid-template-columns: minmax(0,1fr); gap: 30px; padding: 4px; }
  .story-photo { width: min(300px, 94%); justify-self: start; }
  .story-photo:nth-child(even) { padding-top: 0; justify-self: end; }
  .story-photo figcaption { font-size: 12px; }
}
/* Each person's FULL name stays on one line on phones, including landscape.
   A measured, shared font size fits the longer name; no ellipsis or clipping.
   Whole-name typography stays in the existing heading family. */
@media (max-width: 600px), (pointer: coarse) {
  html[lang] body .person-name.couple-heading { white-space: nowrap; text-wrap: nowrap; }
  html[lang] body .person-name.couple-heading .name-part { display: inline-block; }
  .cover-text .couple-names { width: calc(100% + 32px); margin-inline: -16px; grid-template-columns: max-content 30px max-content; gap: 5px; }
  .cover-text .couple-monogram { width: 30px; height: 39px; }
  .formal-invitation .couple-introduction, .finale-names { width: calc(100% + 24px); max-width: none; margin-inline: -12px; column-gap: 5px; }
  .payment-recipient { gap: 3px; }
}
@media (max-width: 359px) {
  .wedding-section { padding-inline: 18px; }
  .formal-invitation .family-grid .family-names p > span { font-size: 10px; }
  .formal-invitation .family-grid .family-names strong { font-size: 12px; }
  .formal-invitation .family-grid { column-gap: 8px; }
}
/* Client's final Figma 16:2270: two centered name lines in equal columns,
   a 35×39 center slot, the supplied 30×39 logo, and 5px horizontal gaps. */
.cover-text .couple-names[data-name-layout=stacked] {
  width: min(321px, calc(100% + 18px));
  margin-inline: 0;
  align-self: center;
  grid-template-columns: minmax(0,1fr) 35px minmax(0,1fr);
  gap: 5px;
}
html[lang=km] .cover-text h2[data-name-layout=stacked] { font-size: 17.6px; line-height: 33.44px; }
html[lang=en] .cover-text h2[data-name-layout=stacked] { font-size: 26px; line-height: 33.44px; }
html[lang] body .cover-text [data-name-layout=stacked] .person-name.couple-heading .name-part { display: block; }
.cover-text [data-name-layout=stacked] .couple-monogram { width: 35px; height: 39px; }
.cover-text [data-name-layout=stacked] .couple-monogram img { width: 30px; height: 39px; }
@media (min-width: 601px) {
  .cover-text .couple-names[data-name-layout=stacked] { width: min(640px, 100%); gap: 12px; }
  html[lang=km] .cover-text h2[data-name-layout=stacked] { font-size: 23px; line-height: 1.95; }
  html[lang=en] .cover-text h2[data-name-layout=stacked] { font-size: 34px; line-height: 1.25; }
  html[lang] body .cover-text [data-name-layout=stacked] .person-name.couple-heading { white-space: nowrap; }
  html[lang] body .cover-text [data-name-layout=stacked] .person-name.couple-heading .name-part { display: inline-block; }
}
@media (prefers-reduced-motion: reduce) { .stationery-frame, .stationery-backdrop { animation: none; } }
@media print {
  .stationery-frame, .stationery-backdrop, .toolbar { display: none; }
  .entered #invitation { width: 100%; padding: 0; }
  body.entered, .invitation-paper { background: var(--ivory); }
}
