/* The mobile keepsake fills the available scene on every screen. */
:root {
  --woven-surface: #fbf8f1;
  --woven-ink: #46513d;
  --woven-cloth: #53603d;
}
html { overflow-x: clip; }
#invitation {
  width: 100%;
  max-width: none;
  margin-inline: auto;
  container: woven / inline-size;
  box-shadow: none;
}
/* The closed cover occupies the whole opening, including after rotation. */
.opening .keepsake-cover,
.opening .keepsake-page-shadow {
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
}
.opening .keepsake-cover-face {
  background: var(--woven-cloth);
  border-radius: 0;
  box-shadow: inset -2px 0 #d9c798;
  container-type: inline-size;
}
.woven-cover-art,
.woven-cover-art img {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  pointer-events: none;
}
/* Preserve the complete floral frame at every aspect ratio. Corner scale is
   bounded by both dimensions; cloth and continuous rails extend between them. */
.framed-cover .woven-cover-art {
  --cover-art-width: min(100cqw, calc(var(--scene-height, 100svh) * 2 / 3));
  border-image-source: var(--woven-cover-image);
  border-image-slice: 29.9479167% 37.109375% 29.9479167% 37.109375% fill;
  border-image-width: calc(var(--cover-art-width) * .44921875) calc(var(--cover-art-width) * .37109375);
  border-image-repeat: stretch;
}
[data-cover-art-mode="wide"] .woven-cover-art {
  --cover-art-width: min(100cqw, calc(var(--scene-height, 100svh) * 1.5));
  border-image-slice: 40% 40% 40% 40% fill;
  border-image-width: calc(var(--cover-art-width) * .266666667) calc(var(--cover-art-width) * .4);
}
.framed-cover .woven-cover-art img { opacity: 0; }
.opening .book-open { padding: 11% 17%; gap: 0; }
.book-cover-kicker { font-size: clamp(8px, 2.2cqw, 12px); margin-bottom: clamp(7px, 3cqw, 22px); }
.book-cover-initials { font-size: clamp(22px, 7cqw, 46px); margin-bottom: clamp(8px, 3cqw, 22px); }
.book-cover-title { font-size: clamp(31px, 10cqw, 68px); line-height: 1.05; }
.book-cover-rule { margin: clamp(9px, 3cqw, 24px) 0; }
.book-cover-hint { font-size: clamp(10px, 2.7cqw, 14px); white-space: normal; }
.book-cover-tap { font-size: clamp(9px, 2.3cqw, 12px); }
.book-cover-gesture { width: clamp(58px, 18cqw, 90px); height: auto; aspect-ratio: 90 / 38; margin-bottom: 7px; }

/* Live names remain in normal flow. The foliage has a bounded physical scale,
   shared by its static image and enhanced SVG, independent of window width. */
#opening .hero-toran,
#opening .hero-floral-art {
  width: min(110%, 700px);
  left: 50%;
  transform: translateX(-50%);
}
#opening .hero-copy,
#opening.hero-expanded .hero-copy {
  padding: min(45.84cqw, 310px) clamp(24px, 8cqw, 88px) 30px;
}
#opening .hero-copy h1 {
  font-size: clamp(51px, 10cqw, 90px);
  line-height: 1.1;
  letter-spacing: -.025em;
}
.has-long-names #opening .hero-copy h1 {
  font-size: clamp(34px, 7cqw, 68px);
  overflow-wrap: anywhere;
  line-height: 1.16;
}
#opening .hero-copy h1 > span { max-width: 100%; }
#opening .hero-copy h1 i { font-size: .38em; margin: .18em 0; }
#opening .hero-kicker { font-size: clamp(9px, 1.55cqw, 12px); max-width: 30em; }
#opening .hero-invite { font-size: clamp(19px, 3cqw, 26px); max-width: 24em; }
#opening .hero-date { font-size: clamp(18px, 2.8cqw, 25px); }
#opening .hero-place { font-size: clamp(10px, 1.5cqw, 13px); max-width: 100%; overflow-wrap: anywhere; }
#opening .garden-stage { max-width: 700px; margin: 0 auto; }
#opening .hero-scroll { padding-bottom: max(22px, env(safe-area-inset-bottom, 0px)); }
#opening::before,
#opening::after { display: none; }

#invitation > .section[class*="garden-"] {
  padding-block: clamp(52px, 8cqw, 112px);
  padding-inline: max(clamp(22px, 6cqw, 82px), env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
}
#invitation > .section[class*="garden-"] h2 {
  font-size: clamp(36px, 6.5cqw, 66px);
  max-width: 14ch;
}
.garden-reading { max-width: 30rem; }
.garden-story .story-copy,
.garden-story.story-expanded .story-copy { max-width: 32rem; }
.garden-story .story-copy p { font-size: clamp(21px, 3cqw, 28px); }
.garden-welcome .welcome-message { font-size: clamp(21px, 3cqw, 28px); max-width: 26em !important; }
.garden-celebration .garden-events {
  grid-template-columns: minmax(0, 1fr);
  max-width: 960px;
  margin-inline: auto;
  border: 0;
}
.garden-celebration .event,
.garden-celebration .event + .event {
  border: 0;
  padding-inline: clamp(12px, 3cqw, 30px);
  border-top: 1px solid #b8b29355;
}
.garden-celebration .event-name { min-height: 0; font-size: clamp(25px, 3.6cqw, 34px); }
.garden-celebration .venue-details h3 { max-width: 100%; overflow-wrap: anywhere; }
.garden-celebration .address { max-width: 30em; }
.garden-programme .timeline-rows { max-width: 44rem; }
.garden-programme .timeline-row { grid-template-columns: minmax(64px, .22fr) minmax(0, 1fr); gap: clamp(16px, 4cqw, 42px); }
.garden-guests .guest-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(24px, 4cqw, 50px);
  max-width: none;
}
.garden-guests .guest-card {
  background: none;
  border: 0;
  border-radius: 0;
  padding: 8px 0;
}
.garden-guests .guest-card-art { width: clamp(72px, 10cqw, 110px); }
.garden-guests .guest-card h3 { font-size: clamp(24px, 3cqw, 30px); }
.garden-guests .guest-card p { font-size: clamp(19px, 2.6cqw, 23px); }
.garden-closing .garden-reading { max-width: 42rem; }
.garden-closing h2 { font-size: clamp(40px, 7cqw, 76px); }
.garden-closing .small-caps { max-width: 100%; }
.living-desktop-garden { display: none; }

@media (max-height: 430px) {
  .opening .book-open { padding-block: 12px; }
  .book-cover-kicker, .book-cover-initials { margin-bottom: 7px; }
  .book-cover-rule { margin-block: 9px; }
  .book-cover-kicker { font-size: 9px; }
  .book-cover-initials { font-size: 26px; }
  .book-cover-title { font-size: 30px; }
  .book-cover-hint { font-size: 11px; }
  .book-cover-tap { font-size: 10px; }
  .book-cover-gesture { width: 58px; margin-bottom: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  #invitation { scroll-behavior: auto; }
}
@media print {
  #invitation { width: 100%; max-width: 660px; }
  .opening .keepsake-book-stage { display: none !important; }
}

/* Runtime-added RSVP fields share the form's sizing and native label targets. */
#reply-dialog #rsvp-form > label:has(#guest-email) { display: block; width: 100%; min-width: 0; margin-block: 12px 18px; text-align: left; }
#reply-dialog #rsvp-form #guest-email { display: block; width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; margin: 7px 0 0; min-height: 46px; padding: 12px 10px; font: 16px/1.5 Georgia, serif; }
#reply-dialog #rsvp-form .keepsake-rsvp-events { min-width: 0; margin: 16px 0 22px; padding: 0; border: 0; }
#reply-dialog #rsvp-form .keepsake-rsvp-events legend { width: 100%; margin-bottom: 8px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
#reply-dialog #rsvp-form .keepsake-rsvp-event { min-height: 44px; min-width: 0; gap: 10px; padding-block: 6px; margin: 0; align-items: center; font-size: 14px; line-height: 1.5; cursor: pointer; overflow-wrap: anywhere; }
#reply-dialog #rsvp-form .keepsake-rsvp-event input[type=checkbox] { width: 20px !important; height: 20px; min-width: 20px; min-height: 20px; flex: 0 0 20px; margin: 0; padding: 0; accent-color: #6b7c58; }
