/* The Golden Gathering: the look. The set is a 3D scene of flat pictures (#world inside #view) filmed by a camera; everything over it (the words, the veils, the frame
   round the title, the invitation card) is ordinary page text on top. Speed first: only transform and opacity are ever animated, nothing carries a filter, no clip-path,
   no blend mode. Lettering: Prata (titles), Fanwood Text (the film's lines and the host's words), Aboreto (small capitals), Instrument Sans (buttons and forms). */
:root {
  --pearl: #FAF9F6; --white: #FFFFFF; --champ: #D6B56E; --gold: #B58A35; --plat: #C5C9CF; --pol: #E1E5EA; --dgold: #866424; --bgold: #F3DA9B; --sshad: #858D98; --ivory: #F0EDE6;
  --ink: #3E4148; --ink2: #5F646D; --line: #D9D6CF;
  --display: 'Prata', 'Didot', 'Bodoni 72', Georgia, serif;
  --script: 'Fanwood Text', 'Iowan Old Style', Georgia, serif;
  --caps: 'Aboreto', 'Optima', 'Trebuchet MS', sans-serif;
  --ui: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* the food board (packs.js) reads these */
  --accent: #B58A35; --accent-d: #866424; --cream: #3E4148; --muted: #6E737C; --row-bg: rgba(181,138,53,.08); --chip-bg: #FFFFFF; --f-bg: #FFFFFF; --f-ink: #3E4148; --f-shadow: inset 0 1px 3px rgba(133,141,152,.25); --ok: #866424; --bad: #8A5A1C;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--pearl); color: var(--ink); font-family: var(--ui); overflow: hidden; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------- the set and the camera ---------------- */
#view { position: fixed; inset: 0; overflow: hidden; background: var(--pearl); perspective-origin: 50% 50%; }
#world { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; transform-origin: 0 0; will-change: transform; }
.pl, .fl, .grp { position: absolute; left: 0; top: 0; display: block; transform-origin: 0 0; pointer-events: none; user-select: none; -webkit-user-select: none; max-width: none; }
.fl { transform-origin: 50% 50%; }
.grp { transform-style: preserve-3d; }
.hdl { transform-origin: 9px 9px; }
.bar { background: linear-gradient(90deg, #866424, #F3DA9B 45%, #D6B56E 70%, #B58A35); }
.bar.v { background: linear-gradient(0deg, #866424, #F3DA9B 45%, #D6B56E 70%, #B58A35); }
body.lite .glow, body.lite .lf2 { display: none; }
#clock { position: fixed; width: 1px; height: 1px; left: -9px; top: -9px; }

/* the light of the film: a warm dimness on entering, the pearl veil behind the title and the card, a fade from pearl at the start, and a sweep of reflected light */
.veil { position: fixed; inset: 0; pointer-events: none; opacity: 0; }
#veil { background: #CFC6B4; }
#pveil { background: radial-gradient(ellipse at 50% 46%, rgba(255,255,255,.96), rgba(250,249,246,.9) 55%, rgba(240,237,230,.86)); }
#fade { background: var(--pearl); opacity: 1; }
#sweep { position: fixed; top: -20vh; left: 0; width: 34vw; min-width: 220px; height: 140vh; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,248,234,.55) 45%, rgba(255,255,255,.7) 50%, rgba(255,248,234,.55) 55%, rgba(255,255,255,0)); }
body.lite #sweep { display: none; }

/* ---------------- the film's words: one line at a time, low on the screen, on a soft pearl band so they read over the set ---------------- */
#scrim { position: fixed; left: 0; right: 0; bottom: 0; height: 40vh; pointer-events: none; opacity: 0;
  background: linear-gradient(180deg, rgba(250,249,246,0), rgba(250,249,246,.82) 48%, rgba(250,249,246,.92)); }
.line { position: fixed; left: 16px; right: 16px; bottom: calc(13vh + env(safe-area-inset-bottom, 0px)); margin: 0; text-align: center; pointer-events: none; }
.line > span { display: inline-block; opacity: 0; font-family: var(--script); font-style: italic; font-size: clamp(25px, 5.2vw, 46px); line-height: 1.18; color: var(--dgold); max-width: 20ch; text-wrap: balance; }
body.editing .line > span { pointer-events: auto; }

/* ---------------- the frame round the title: gold ribbons, silver ones woven round them, metallic leaves, and the words in gold foil ---------------- */
#crest { position: fixed; left: 50%; top: 47%; width: min(94vw, 900px, 150vh); aspect-ratio: 1000 / 600; translate: -50% -50%; pointer-events: none; }
#crest .rb { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
#crest .tt { position: absolute; inset: 22% 12% 20%; display: grid; place-content: center; text-align: center; gap: 4%; }
#t-head { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(30px, min(7.4vw, 11vh), 86px); line-height: 1.02; letter-spacing: .01em; color: var(--dgold); }
#t-head .w { display: block; opacity: 0;
  background: linear-gradient(176deg, #F3DA9B 0%, #D6B56E 28%, #B58A35 52%, #866424 74%, #B58A35 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
#t-tag { margin: 0; opacity: 0; font-family: var(--script); font-style: italic; font-size: clamp(18px, min(3.4vw, 5vh), 32px); color: var(--ink2); }
#glint { position: absolute; top: 16%; bottom: 16%; left: 0; width: 26%; opacity: 0; pointer-events: none;
  background: linear-gradient(100deg, rgba(255,255,255,0), rgba(255,251,240,.85) 50%, rgba(255,255,255,0)); }
body.editing #t-head, body.editing #t-tag { pointer-events: auto; }

/* ---------------- the controls during the film: the speaker (speaker.js, top right) and one way to the reply ---------------- */
#b-skip { position: fixed; z-index: 40; top: calc(14px + env(safe-area-inset-top, 0px)); left: 14px; min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid rgba(181,138,53,.55); background: rgba(250,249,246,.82); color: var(--dgold); font: 600 14px/1 var(--ui); letter-spacing: .06em; cursor: pointer; }
#b-skip:hover { background: #FFFFFF; }
#b-skip:focus-visible, .cd button:focus-visible, .sheet button:focus-visible, .sheet input:focus-visible, .sheet textarea:focus-visible { outline: 2px solid var(--dgold); outline-offset: 2px; }
body[data-s="INTERACTIVE"] #b-skip, body.editing #b-skip, body.static #b-skip { display: none; }
#snd-hint { position: fixed; z-index: 39; top: calc(26px + env(safe-area-inset-top, 0px)); right: 70px; margin: 0; font: 500 12.5px/1 var(--ui); color: var(--ink2); pointer-events: none; transition: opacity .4s; }
#snd-hint.gone { opacity: 0; }

/* ---------------- the invitation card: it rises from the plate, then it is simply a card on the screen ---------------- */
#cardwrap { position: fixed; inset: 0; display: grid; place-items: center; padding: max(12px, env(safe-area-inset-top, 0px)) 12px max(12px, env(safe-area-inset-bottom, 0px)); pointer-events: none; z-index: 20; }
#card { position: relative; width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); opacity: 0; transform-origin: 50% 50%; will-change: transform, opacity;
  background: linear-gradient(180deg, #FFFFFF, #FAF9F6 40%, #F0EDE6); border-radius: 6px;
  box-shadow: 0 1px 0 #FFFFFF inset, 0 0 0 1px rgba(181,138,53,.55), 0 0 0 6px #FAF9F6, 0 0 0 7px rgba(197,201,207,.9), 0 24px 50px rgba(133,141,152,.28), 0 4px 12px rgba(133,141,152,.2); }
body.cardon #card { pointer-events: auto; }
.cd { max-height: inherit; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 34px 30px 26px; text-align: center; scrollbar-width: thin; }
.fil { position: absolute; width: 58px; height: 58px; pointer-events: none; background-size: 100% 100%; }
.fil.tl { top: 8px; left: 8px; } .fil.tr { top: 8px; right: 8px; transform: scaleX(-1); } .fil.bl { bottom: 8px; left: 8px; transform: scaleY(-1); } .fil.br { bottom: 8px; right: 8px; transform: scale(-1); }
.cd-final { margin: 0 0 6px; font: 400 13px/1.3 var(--caps); letter-spacing: .22em; color: var(--gold); }
.cd-for { margin: 0 0 4px; font-family: var(--script); font-style: italic; font-size: 19px; color: var(--ink2); }
.cd-for:empty { display: none; }
#t-event { margin: 4px 0 0; font-family: var(--display); font-weight: 400; font-size: clamp(30px, 8vw, 40px); line-height: 1.08; color: var(--dgold); text-wrap: balance; }
.cd-rule { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 16px auto 14px; color: var(--champ); }
.cd-rule::before, .cd-rule::after { content: ''; width: 70px; height: 1px; background: linear-gradient(90deg, rgba(197,201,207,0), #C5C9CF, rgba(197,201,207,0)); }
.cd-rule i { width: 7px; height: 7px; rotate: 45deg; background: var(--champ); }
.cd-when { margin: 0; font: 600 17px/1.35 var(--ui); color: var(--ink); }
.cd-time { margin: 3px 0 0; font: 500 15px/1.35 var(--ui); color: var(--ink2); }
.cd-where { margin: 12px 0 0; font: 600 16px/1.35 var(--ui); color: var(--ink); }
.cd-addr { margin: 2px 0 0; font: 400 15px/1.4 var(--ui); color: var(--ink2); }
.cd-acts { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 18px; margin: 10px 0 0; }
.linkish { min-height: 40px; padding: 0 4px; border: 0; background: none; color: var(--dgold); font: 600 14px/1 var(--ui); text-decoration: underline; text-decoration-color: rgba(181,138,53,.45); text-underline-offset: 4px; cursor: pointer; }
.linkish:hover { color: #6E511A; }
.cd-rsvp { margin: 22px 0 0; padding: 20px 0 0; border-top: 1px solid var(--line); }
.cd h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 24px; color: var(--dgold); }
.cd-by { margin: 4px 0 0; font-size: 14px; color: var(--ink2); }
.ans { display: grid; gap: 10px; margin: 14px 0 0; }
.ans button, .btn { min-height: 50px; padding: 0 18px; border-radius: 999px; cursor: pointer; font: 600 16px/1 var(--ui); }
.ans button { border: 1px solid rgba(181,138,53,.6); background: #FFFFFF; color: var(--ink); }
.ans button:hover { background: #FFFBF1; }
.ans button.yes, .btn { border: 1px solid #866424; background: linear-gradient(180deg, #E2C47F, #C49A47 60%, #B58A35); color: #2E2A22; box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 3px 10px rgba(134,100,36,.22); }
.ans button.yes:hover, .btn:hover { background: linear-gradient(180deg, #E8CC8A, #CBA352 60%, #BC9140); }
.btn.ghost { border: 1px solid rgba(133,141,152,.6); background: #FFFFFF; color: var(--ink); box-shadow: none; }
.btn.ghost:hover { background: #F6F6F4; }
.btn[disabled] { opacity: .6; cursor: default; }
#done { margin: 14px 0 0; }
#done-t { margin: 0; font-family: var(--display); font-weight: 400; font-size: 22px; color: var(--dgold); }
#done-p { margin: 6px 0 0; font-size: 15px; line-height: 1.45; color: var(--ink2); }
#r-closed { margin: 12px 0 0; color: var(--ink2); font-size: 15px; }
.cd-msg { margin: 20px 0 0; font-family: var(--script); font-style: italic; font-size: 19px; line-height: 1.45; color: var(--ink); white-space: pre-line; }
.cd-msg:empty { display: none; }
.cd-host { margin: 12px 0 0; font-size: 14px; color: var(--ink2); }
.cd-more { margin: 14px 0 0; display: grid; gap: 8px; }
.cd-more div { display: grid; gap: 1px; }
.cd-more dt { font: 400 11px/1.2 var(--caps); letter-spacing: .2em; color: var(--gold); }
.cd-more dd { margin: 0; font-size: 15px; color: var(--ink); }
.cd-dish { margin: 22px 0 0; padding: 20px 0 0; border-top: 1px solid var(--line); }
#dish-sum { margin: 6px 0 12px; font-size: 15px; line-height: 1.4; color: var(--ink2); }
.cd-foot { margin: 20px 0 0; }

/* ---------------- the two sheets: the reply and the food. They come up from the bottom over the card. ---------------- */
.sheet { position: fixed; inset: 0; z-index: 60; display: grid; align-items: end; justify-items: center; background: rgba(62,65,72,.32); }
.sheet[hidden] { display: none; }
.sh-in { width: min(560px, 100vw); max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; padding: 22px 22px calc(22px + env(safe-area-inset-bottom, 0px)); border-radius: 18px 18px 0 0;
  background: linear-gradient(180deg, #FFFFFF, #FAF9F6); box-shadow: 0 -10px 40px rgba(62,65,72,.22); border-top: 3px solid var(--champ); }
@media (min-width: 700px) and (min-height: 620px) { .sheet { align-items: center; } .sh-in { border-radius: 14px; border-top: 0; box-shadow: 0 0 0 1px rgba(181,138,53,.5), 0 24px 60px rgba(62,65,72,.3); } }
@media (prefers-reduced-motion: no-preference) { .sheet:not([hidden]) .sh-in { animation: shUp .32s cubic-bezier(.2,.8,.2,1); } }
@keyframes shUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sh-in h3 { margin: 0 0 12px; font-family: var(--display); font-weight: 400; font-size: 26px; color: var(--dgold); text-align: center; }
.choice { display: grid; gap: 8px; margin: 0 0 14px; padding: 0; border: 0; }
.choice label { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line); background: #FFFFFF; font-weight: 600; cursor: pointer; }
.choice input { width: 20px; height: 20px; accent-color: #B58A35; }
.choice label:has(input:checked) { border-color: #B58A35; background: #FFFBF1; }
.f { display: grid; gap: 6px; margin: 0 0 14px; font-size: 14px; font-weight: 600; color: var(--ink2); }
.f input, .f textarea { width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 12px; border: 1px solid #CFCBC2; background: #FFFFFF; color: var(--ink); font: 400 16px/1.35 var(--ui); }
.f textarea { min-height: 76px; resize: vertical; }
.step { display: flex; align-items: center; gap: 14px; }
.step button { width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(181,138,53,.6); background: #FFFFFF; font-size: 22px; cursor: pointer; }
.step output { min-width: 2ch; font: 600 20px/1 var(--ui); color: var(--ink); text-align: center; }
#err { min-height: 20px; margin: 0 0 10px; font-size: 14px; color: var(--ink2); }
#err.err { color: #8A5A1C; font-weight: 600; }
.sh-acts { display: grid; gap: 8px; }
.sh-acts .btn { width: 100%; }

/* ---------------- the guide (the host editing): the card stays put and the film can be shown at any moment ---------------- */
body.editing #cardwrap { z-index: 20; }

/* ---------------- no animation at all (an old browser or a test): the finished invitation, still ---------------- */
body.static #fade, body.static .line, body.static #crest, body.static #scrim, body.static #sweep, body.static #veil { display: none; }
body.static #pveil { opacity: .55; }
body.static #card { opacity: 1; transform: none; }
body.static #cardwrap { pointer-events: none; }
/* the safety net (goldgather.js, SAFE): a device whose browser stopped the film gets the invitation over a still picture of the room, and no film to play again */
body.safe #view { background: #FAF9F6 url("/assets/shots/the-golden-gathering.svg") 50% 0 / cover no-repeat; }
body.safe #b-replay { display: none; }
body.static #card { pointer-events: auto; }

@media (max-width: 420px) {
  .cd { padding: 30px 20px 22px; }
  .fil { width: 44px; height: 44px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .line { bottom: 8vh; }
  .line > span { font-size: clamp(20px, 3.6vw, 30px); }
  #card { width: min(520px, calc(100vw - 24px)); }
}
