:root {
  --print-ink:#472433;
  --print-copy:#594642;
  --print-secondary:#67534b;
  --print-brass:#795630;
  --print-line:#b9986476;
}

/* Keep the sheet still while its text moves. The edge and collapse control
   consequently always occupy the same place, including at the end of a form. */
#contentPanel:not(:has(.gallery-access)) {
  display:flex;
  flex-direction:column;
  max-height:clamp(146px,32dvh,292px);
  padding:21px 25px 20px 24px;
  overflow:hidden;
  color:var(--print-ink);
  background:linear-gradient(118deg,#fcf6ea 0%,#f8efdf 66%,#f2e7d5 100%);
  border:1px solid #b59a70;
  border-radius:2px;
  box-shadow:0 5px 18px #23121b29,0 1px 1px #fff8ea inset;
}
#contentPanel:not(:has(.gallery-access))::before {
  inset:5px;
  border:1px solid #c7aa7b54;
}
#contentPanel:not(:has(.gallery-access)) #contentBody {
  flex:0 1 auto;
  min-height:0;
  min-width:0;
  overflow-y:auto;
  overscroll-behavior:contain;
  overflow-wrap:break-word;
}
#collapseContent,#closeDialog { width:43px; height:43px; color:#76563f; }
#contentPanel #collapseContent { top:2px; right:3px; }

#contentBody #contentTitle {
  font:500 clamp(31px,7.8vw,38px)/1.035 var(--serif);
  letter-spacing:-.025em;
  text-wrap:balance;
  margin:0 24px 10px 0;
}
#contentBody p,#dialogBody p,#contentBody address {
  color:var(--print-copy);
  font:400 13px/1.58 var(--sans);
}
#contentBody address { font-style:normal; }
#contentBody .eyebrow,#dialogEyebrow {
  font:600 10px/1.45 var(--sans);
  letter-spacing:.105em;
  color:var(--print-brass);
}
#dialogEyebrow:empty { display:none; }

/* Names have room to breathe across two lines, including titles and degrees.
   Parentage remains one paragraph per family irrespective of the guest link. */
#contentPanel:has(.couple-names) #contentTitle { margin-bottom:8px; }
#contentPanel:has(.couple-names) #contentBody>p { font:400 13px/1.55 var(--sans); }
#contentBody .couple-names { display:flex; flex-direction:column; margin:12px 0 0; }
#contentPanel:has(.couple-names) #contentBody>.family-invitation {
  margin:16px 0 0;
  padding-top:12px;
  border-top:1px solid var(--print-line);
}
#contentBody .couple-names small {
  font:600 10px/1.4 var(--sans);
  letter-spacing:.10em;
  text-transform:uppercase;
  color:var(--print-brass);
}
#contentBody .couple-names h3 {
  font:500 clamp(25px,6.35vw,30px)/1.08 var(--serif);
  text-wrap:balance;
  letter-spacing:-.022em;
  color:var(--print-ink);
  margin:3px 0 6px;
}
#contentBody .couple-names article+article { margin-top:14px; padding-top:13px; border-top:1px solid var(--print-line); }
#contentBody .couple-names p { font:400 12.5px/1.56 var(--sans); color:var(--print-copy); }

#contentBody .date-summary #contentTitle { margin-bottom:4px; }
#contentBody .date-summary>p,#contentBody .ceremony-date { font:500 13px/1.5 var(--sans); }
#contentBody .countdown { margin:13px 0 0; padding-top:10px; border-top:1px solid var(--print-line); }
#contentBody .countdown b { font:500 clamp(29px,7vw,35px)/1.05 var(--serif); font-variant-numeric:lining-nums tabular-nums; }
#contentBody .countdown span { font:600 9px/1.5 var(--sans); letter-spacing:.07em; color:var(--print-brass); }
#contentBody .ceremony-summary #contentTitle { margin-bottom:5px; }
#contentBody .ceremony-time { display:block; margin:11px 0 0; padding:9px 0 0; border-top:1px solid var(--print-line); }
#contentBody .ceremony-time .schedule-clock {
  font:500 clamp(25px,6.2vw,29px)/1.12 var(--serif);
  font-variant-numeric:lining-nums tabular-nums;
  color:var(--print-ink);
}
#contentBody .schedule-clock small {
  font:500 11px/1 var(--sans);
  letter-spacing:.025em;
  color:var(--print-secondary);
}
#contentBody .ceremony-time .event-note { font:400 12px/1.55 var(--sans); color:var(--print-secondary); margin:7px 0 0; }
#contentBody .ceremony-time .event-note:first-child { margin:0; }

#contentBody .venue-summary #contentTitle { font-size:clamp(34px,9vw,43px); margin-bottom:8px; }
.map-action {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  min-height:44px;
  margin-top:12px;
  padding-top:6px;
  text-decoration:none;
  border-top:1px solid var(--print-line);
  font:600 13px/1.45 var(--sans);
  color:#61213b;
}
.map-action span { flex:none; font:500 19px/1 var(--serif); }
.map-action:hover { text-decoration:underline; text-underline-offset:4px; }
#contentBody .pass-summary { text-align:center; }
#contentBody #showPass { margin:0 auto 9px; }
#contentBody #showPass img { width:clamp(104px,min(44vw,19dvh),168px); padding:0; }
#contentBody .pass-summary p { font:400 12.5px/1.5 var(--sans); margin:0 auto; max-width:30ch; text-wrap:balance; }
@media(max-width:759px) and (max-height:650px) and (orientation:portrait) {
  #bookHint { top:calc(53px + env(safe-area-inset-top)); }
  #bookHint .text-button { margin-top:0; }
  #contentPanel.content-panel:has(.pass-summary) { padding-block:12px; }
  #contentBody #showPass { margin-bottom:5px; }
}
#dialogBody .qr-large { width:min(100%,48dvh,370px); margin:2px auto; padding:0; }

#contentBody .gift-row { padding:0; border:0; }
#contentBody .gift-accounts { margin-top:17px; }
#contentBody .account { display:grid; gap:2px; margin:0; }
#contentBody .account+.account { margin-top:12px; border-top:1px solid var(--print-line); padding-top:12px; }
#contentBody .account strong { font:600 13px/1.4 var(--sans); color:var(--print-copy); letter-spacing:0; }
#contentBody .account span { font:500 19px/1.22 var(--sans); font-variant-numeric:tabular-nums; color:var(--print-ink); }
#contentBody .account small { font:500 11.5px/1.45 var(--sans); letter-spacing:.035em; color:var(--print-secondary); }
#contentBody .gift-post { margin-top:20px; padding-top:14px; border-top:1px solid var(--print-line); }
#contentBody .gift-post h3 { font:500 25px/1.1 var(--serif); margin:0 0 5px; }

#contentBody form label,#dialogBody form label,#dialogBody .rsvp-recipient>span {
  display:block;
  font:600 12px/1.45 var(--sans);
  color:#654944;
  margin-bottom:4px;
}
#contentBody form input,#contentBody form textarea,#dialogBody form select {
  font:400 16px/1.45 var(--sans);
  border-color:#a88e698f;
  background:#fffcf6;
}
#contentBody #wishForm>label:not(:first-child) { margin-top:12px; }
#contentBody #wishText { min-height:76px; }
#contentBody .solid-button,#dialogBody .solid-button,.garden-action {
  font:600 13px/1.45 var(--sans);
  letter-spacing:0;
}
#contentBody [data-result]:empty,#dialogBody [data-result]:empty { display:none; }
#contentBody [data-result],#dialogBody [data-result] { font:500 12px/1.5 var(--sans); }
#detailDialog[open] {
  display:flex;
  flex-direction:column;
  overflow:hidden;
  background:linear-gradient(128deg,#fcf6ea,#f5ead8);
  max-height:calc(100dvh - 42px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  padding:26px 25px 24px;
}
#dialogBody { min-height:0; overflow:auto; overscroll-behavior:contain; }
#dialogTitle { flex:none; font:500 clamp(29px,7.5vw,39px)/1.06 var(--serif); text-wrap:balance; margin:2px 22px 15px 0; }
#dialogBody>p:first-child { margin-top:0; }
#dialogBody>h3 { font:500 24px/1.18 var(--serif); color:var(--print-ink); }
#dialogBody .rsvp-recipient { padding-bottom:13px; margin-bottom:14px; border-bottom:1px solid var(--print-line); }
#dialogBody .rsvp-recipient p { font:500 23px/1.2 var(--serif); margin:0; color:var(--print-ink); overflow-wrap:anywhere; }
#dialogBody .form-row { display:grid; grid-template-columns:minmax(0,1fr) minmax(68px,.36fr); gap:10px; margin-top:0; }
#dialogBody .form-row select { width:100%; min-width:0; padding-inline:7px; }
#dialogBody .dialog-gallery-nav span { font:500 12px var(--sans); color:var(--print-secondary); }
#dialogBody .dialog-gallery-nav button { font:500 17px var(--sans); min-height:44px; }
#dialogBody .saved-note p { margin-top:6px; }
#dialogBody .saved-note .quiet-button { min-height:44px; font-weight:600; text-decoration:underline; text-underline-offset:3px; }
#dialogBody .gallery-grid { margin:3px 0; }

#chapterList:not([hidden]) { display:flex; flex-direction:column; overflow:hidden; }
#chapterLinks { min-height:0; overflow:auto; overscroll-behavior:contain; }
#chapterLinks button { flex:none; min-height:44px; font-size:12px; }
#chapterList #calendarAction { flex:none; color:#f4e4cb; min-height:44px; }
#chapterList .editorial-scrollbar { --rail-color:#dbc896; --track-color:#d4bc8d55; right:1px; }
#tiltPanel:not([hidden]) { display:flex; flex-direction:column; max-height:calc(100dvh - 100px - env(safe-area-inset-top)); overflow:hidden; }
#tiltBody { min-height:0; overflow:auto; overscroll-behavior:contain; }
#tiltBody .eyebrow { color:var(--print-brass); font-size:10px; }
#tiltBody h2 { margin:6px 17px 10px 0; font:500 31px/1.08 var(--serif); }
#tiltBody #tiltStatus { color:var(--print-copy); font:400 13px/1.52 var(--sans); }
#tiltBody .fine { font:400 12px/1.5 var(--sans)!important; color:var(--print-secondary); margin:12px 0 0; }
#tiltBody button { min-height:44px; font:600 13px/1.45 var(--sans); }

.editorial-scroll-area { scrollbar-width:none; -webkit-overflow-scrolling:touch; }
.editorial-scroll-area::-webkit-scrollbar { display:none; width:0; height:0; }
.editorial-scroll-area:focus-visible { outline:1px solid #93724d; outline-offset:2px; }
.editorial-scrollbar {
  --rail-color:#8b6b44;
  --track-color:#c3ad8b66;
  position:absolute;
  right:2px;
  width:15px;
  z-index:2;
  cursor:pointer;
  pointer-events:auto;
  touch-action:none;
  user-select:none;
}
.editorial-scrollbar::before,.editorial-scroll-thumb {
  content:"";
  display:block;
  position:absolute;
  top:0;
  right:5px;
  width:3px;
  border-radius:3px;
}
.editorial-scrollbar::before { bottom:0; background:var(--track-color); }
.editorial-scroll-thumb { background:var(--rail-color); }
#guestbookPage:not(.flat-page) .editorial-scrollbar { right:calc(10% - 5px); }

/* The reader has already seen the renderer notice on the cover. Do not layer
   the cover art or its status behind the schedules, forms and final pages. */
body.fallback:not([data-step="0"]) #fallback>p,
body.fallback:not([data-step="0"]) #fallback>small,
body.fallback:not([data-step="0"],[data-step="1"],[data-step="2"]) #fallback .fallback-book { display:none; }

@media(max-width:759px) {
  #contentPanel:not(:has(.gallery-access)) {
    left:max(14px,calc((100vw - 500px)/2));
    right:max(14px,calc((100vw - 500px)/2));
  }
}
@media(max-width:359px) {
  #contentPanel:not(:has(.gallery-access)) { padding:17px 21px 17px 19px; left:11px; right:11px; }
  #dialogBody .form-row { grid-template-columns:minmax(0,1fr); }
  #detailDialog[open] { padding:23px 21px 20px; }
}
@media(min-width:760px) {
  #contentPanel:not(:has(.gallery-access)) {
    width:350px;
    max-height:min(62dvh,530px);
    padding:24px 28px 25px;
  }
  #contentPanel:has(.ceremony-summary) { width:325px; }
  #detailDialog[open] { padding:31px 34px 29px; }
}

/* On a phone held sideways, give the scene and its caption separate columns.
   The lower row keeps both travel controls and the chapter position in reach. */
@media(max-width:759px) and (max-height:480px) and (min-aspect-ratio:6/5) {
  :root { --nav-height:64px; }
  .topbar { padding:calc(4px + env(safe-area-inset-top)) max(13px,env(safe-area-inset-right)) 3px max(13px,env(safe-area-inset-left)); }
  #bookHint { top:calc(48px + env(safe-area-inset-top)); }
  #contentPanel:not(:has(.gallery-access)) {
    left:auto;
    right:max(14px,env(safe-area-inset-right));
    top:calc(48.5% + (env(safe-area-inset-top) - env(safe-area-inset-bottom))/2);
    bottom:auto;
    transform:translateY(-50%);
    width:min(310px,43vw);
    max-height:calc(100dvh - 119px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding:14px 20px 14px 17px;
  }
  #contentPanel:not(:has(.gallery-access)).transit { transform:translateY(calc(-50% + 6px)); }
  #contentPanel #contentTitle { font-size:29px; }
  #contentPanel .venue-summary #contentTitle { font-size:32px; }
  #contentPanel .couple-names h3 { font-size:24px; }
  #contentPanel .pass-summary img { width:min(27vw,35dvh); }
  #journeyNav {
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    align-items:center;
    column-gap:14px;
    bottom:max(7px,env(safe-area-inset-bottom));
    width:min(615px,calc(100% - max(30px,env(safe-area-inset-left) + env(safe-area-inset-right) + 18px)));
    max-width:none;
  }
  #journeyNav .chapter-position { margin:0; justify-content:start; }
  #journeyNav .chapter-position>span:nth-child(2) { font-size:10px; }
  #journeyNav .nav-buttons { gap:7px; }
  #journeyNav .nav-buttons button { min-width:101px; min-height:44px; padding:8px 12px; gap:8px; }
  #journeyNav .progress-track { grid-column:1/-1; width:100%; margin:3px 0 0; }
  #journeyNav #interactionHint { display:none; }
  #restoreContent { left:auto; right:max(14px,env(safe-area-inset-right)); transform:none; bottom:calc(var(--nav-height) + env(safe-area-inset-bottom)); }
  #chapterList,#tiltPanel {
    top:calc(51px + env(safe-area-inset-top));
    max-height:calc(100dvh - 64px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding-top:16px;
    padding-bottom:16px;
  }
  #detailDialog[open] { max-height:calc(100dvh - 22px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); padding-block:18px; }
}
/* Single-line masthead and two independent sound and motion controls. */
.topbar { grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); }
.topbar .brand { font:500 clamp(13px,2.8vw,17px)/1.2 var(--serif); letter-spacing:.065em; text-transform:none; color:#fff2dd; }
.topbar #chapterMenu { justify-self:start; }
.header-tools { justify-self:end; display:flex; align-items:center; gap:1px; }
.music-button { display:grid; place-items:center; width:44px; height:44px; padding:0; background:transparent; border:0; color:inherit; }
.music-button svg,.pass-download svg,.copy-account svg { width:19px; height:19px; fill:none; stroke:currentColor; stroke-width:1.65; stroke-linecap:round; stroke-linejoin:round; }
.music-button[aria-pressed=true] .music-off { display:none; }
body[data-step="0"]:not(.music-opened) .music-button { visibility:hidden; }
.pass-download { display:inline-flex; justify-content:center; align-items:center; gap:7px; min-height:44px; margin-top:5px; padding:4px 16px; background:transparent; color:#60243d; border:0; font:600 13px/1.2 var(--sans); text-decoration:underline; text-underline-offset:4px; }
#contentBody .account { grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:8px; }
.account-details { min-width:0; display:grid; gap:2px; }
#contentBody .account-number { user-select:text; }
.copy-account { min-height:44px; min-width:56px; padding:3px 4px; border:0; background:transparent; color:#65283f; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; }
#contentBody .account .copy-label { font:600 10px/1.25 var(--sans); color:inherit; }
.copy-account .copy-check,.copy-account.is-copied .copy-icon { display:none; }
.copy-account.is-copied .copy-check { display:block; }
.card-export>img { display:block; width:100%; height:auto; margin:0 auto 16px; }
.export-actions { display:flex; justify-content:center; flex-wrap:wrap; gap:8px; }
#dialogBody .export-actions>* { display:inline-flex; align-items:center; justify-content:center; width:auto; flex:1; min-width:105px; min-height:44px; margin:0; text-decoration:none; }
#dialogBody .export-actions [hidden] { display:none; }
.card-export [role=status]:empty { display:none; }
@media(max-width:420px) {
  .topbar .gyro-button { min-width:44px; padding:0; }
  .topbar .gyro-button span { position:absolute; width:1px; height:1px; clip-path:inset(50%); overflow:hidden; }
}
