/* Hallmark · component scope (guest invitation page) · fast · signature: the envelope that takes its colours from the uploaded invitation · built 2026-11-29 */
/* critique: the invitation image is the hero; everything around it borrows its palette so the page feels made for this one family */

:root {
  /* theme, overwritten at load from the invitation's own colours */
  --th-paper: oklch(96% 0.02 85);
  --th-paper-2: oklch(92% 0.025 85);
  --th-accent: oklch(38% 0.06 165);
  --th-accent-2: oklch(66% 0.11 80);
  --th-bg-a: oklch(30% 0.008 60);
  --th-bg-b: oklch(18% 0.008 60);
  --th-ink: oklch(24% 0.03 165);
  --th-on-accent: oklch(98% 0.01 85);

  --font-display: "Frank Ruhl Libre", "David", serif;
  --font-body: "Heebo", system-ui, sans-serif;
  --shadow: oklch(15% 0.02 165 / 0.35);
  --scrim: oklch(15% 0.02 165 / 0.45);
  --line: oklch(50% 0.02 165 / 0.18);
  --line-strong: oklch(35% 0.03 165 / 0.5);
  --error: oklch(52% 0.19 27);
  --focus: var(--th-accent-2);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-rise: cubic-bezier(0.32, 1.2, 0.6, 1);
  --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-slow: cubic-bezier(0.45, 0.05, 0.2, 1);
  /* the open invitation's backdrop: an ornament lattice in the invitation's own ornament colour */
  --lattice: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120' fill='none' stroke='black' stroke-width='1'%3E%3Cpath d='M60 6 C74 26 94 46 114 60 C94 74 74 94 60 114 C46 94 26 74 6 60 C26 46 46 26 60 6Z'/%3E%3Cpath d='M60 30 C66 44 76 54 90 60 C76 66 66 76 60 90 C54 76 44 66 30 60 C44 54 54 44 60 30Z' stroke-width='0.8'/%3E%3Ccircle cx='60' cy='60' r='3.2' fill='black' stroke='none'/%3E%3Cpath d='M0 0 C8 6 14 6 20 0 M100 0 C106 6 112 6 120 0 M0 120 C8 114 14 114 20 120 M100 120 C106 114 112 114 120 120' stroke-width='0.8'/%3E%3Ccircle cx='0' cy='0' r='2.4' fill='black' stroke='none'/%3E%3Ccircle cx='120' cy='0' r='2.4' fill='black' stroke='none'/%3E%3Ccircle cx='0' cy='120' r='2.4' fill='black' stroke='none'/%3E%3Ccircle cx='120' cy='120' r='2.4' fill='black' stroke='none'/%3E%3C/svg%3E");
  --bd-glow: color-mix(in oklch, var(--th-paper) 22%, transparent);
  --bd-edge: oklch(8% 0.01 60 / 0.5);
  /* the setting around the mailbox: a sunlit champagne corner with baby's breath and a satin ribbon */
  --set-1: oklch(95.5% 0.018 82);
  --set-2: oklch(91% 0.026 78);
  --set-3: oklch(85% 0.034 74);
  --set-sun: oklch(100% 0.01 90 / 0.55);
  --set-shade: oklch(55% 0.04 65 / 0.16);
  --set-ink: oklch(36% 0.03 60);
  --hint-bg: oklch(30% 0.03 60 / 0.55);
  --tray-shade: oklch(30% 0.03 60 / 0.3);
  --logo-shade: oklch(40% 0.05 65 / 0.55);
  --gold-2: oklch(68% 0.11 78);
  --gold-hi: oklch(98% 0.03 90 / 0.8);
  --gold-lo: oklch(40% 0.06 70 / 0.45);
  --box-shadow: oklch(40% 0.05 65 / 0.38);
  --st-1: oklch(86% 0.04 78);
  --st-hi: oklch(97% 0.02 88);
  --st-2: oklch(72% 0.055 70);
  /* the envelope and the letter: champagne paper, a satin ribbon, baby's breath */
  --env-paper: oklch(90% 0.03 78);
  --env-paper-2: oklch(86% 0.034 76);
  --env-inside: oklch(81% 0.036 72);
  --env-crease: oklch(66% 0.045 70 / 0.45);
  --card-paper: oklch(96.5% 0.012 85);
  --card-paper-2: oklch(92% 0.016 82);
  --rb-1: oklch(84% 0.045 76);
  --rb-hi: oklch(96% 0.022 85);
  --rb-2: oklch(68% 0.06 68);
  --flower: oklch(98% 0.008 90);
  --flower-heart: oklch(86% 0.06 90);
  --stem: oklch(55% 0.05 120);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' seed='5'/%3E%3CfeColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.34 0 0 0 0 0.24 0 0 0 0.16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  --air-halo: color-mix(in oklch, var(--th-paper) 26%, transparent);
  --air-floor: color-mix(in oklch, var(--th-accent-2) 22%, transparent);
  --air-edge: oklch(8% 0.01 60 / 0.55);
  --air-mote: color-mix(in oklch, var(--th-paper) 55%, transparent);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; background: var(--th-bg-b); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; color: var(--th-ink);
  font-family: var(--font-body); font-size: 1rem; line-height: 1.55;
  background:
    radial-gradient(110% 70% at 50% 0%, var(--th-bg-a), transparent 70%),
    linear-gradient(180deg, var(--th-bg-a), var(--th-bg-b));
  background-attachment: fixed;
}
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

/* ---------- scene 1: envelope ---------- */
.scene {
  position: fixed; inset: 0; display: grid; place-items: center; align-content: center; gap: 28px; overflow-y: auto;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  transition: opacity 420ms var(--ease-out), transform 520ms var(--ease-out);
  z-index: 2;
}
.headline {
  margin: 0; font-family: var(--font-display); font-weight: 500; color: var(--th-paper);
  font-size: clamp(1.75rem, 6vw + 0.5rem, 3rem); line-height: 1.15; text-align: center;
  overflow-wrap: break-word; min-width: 0; text-wrap: balance;
}
.hint { margin: 0; color: var(--th-paper); font-size: 1rem; }

/* the black and gold post box; the guest taps it and the envelope rises out of its slot */
.post { position: relative; width: min(70vw, 340px, 46vh); aspect-ratio: 400 / 540; }
.pillar {
  display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  filter: drop-shadow(0 30px 34px var(--box-shadow)) drop-shadow(0 6px 8px var(--box-shadow)); transition: transform 160ms var(--ease-out), opacity 1400ms var(--ease-out);
}
.pillar svg { width: 100%; height: 100%; display: block; overflow: visible; }
.pillar:active { transform: scale(0.985); }
.pillar:disabled { cursor: default; }
.pillar:focus-visible { outline: 3px solid var(--focus); outline-offset: 8px; border-radius: 8px; transition: none; }
.pillar .glow { opacity: 0; transition: opacity 600ms var(--ease-out); }
.guest.is-rise .pillar .glow { opacity: 1; }
.guest.is-flown .post .pillar { transform: translateY(12vh) scale(0.88); opacity: 0.4; transition: transform 1600ms var(--ease-out), opacity 1600ms var(--ease-out); }

.env {
  position: absolute; left: 50%; top: 28.6%; width: 49%; aspect-ratio: 3 / 2; z-index: 0; pointer-events: none;
  perspective: 1400px; filter: drop-shadow(0 18px 22px var(--shadow));
  transform: translate(-50%, 0); -webkit-clip-path: inset(-300% -40% 100% -40%); clip-path: inset(-300% -40% 100% -40%);
}
.guest.is-rise .env { transform: translate(-50%, -100%); -webkit-clip-path: inset(-300% -40% 0 -40%); clip-path: inset(-300% -40% 0 -40%); transition: transform 1800ms var(--ease-slow), clip-path 1800ms var(--ease-slow), -webkit-clip-path 1800ms var(--ease-slow); }
/* lifted out of the box: placed at the centre and flown there with a transform */
#mail.is-flying { position: fixed; left: var(--fx); top: var(--fy); width: var(--fw); -webkit-clip-path: none; clip-path: none; transform-origin: 0 0; z-index: 4; transition: transform 1600ms var(--ease-slow); }
.env__back { position: absolute; inset: 0; border-radius: 4px; background: var(--grain), linear-gradient(180deg, var(--env-inside), var(--env-paper-2)); }
.env__front { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; }
.env__front .side { fill: var(--th-paper-2); }
.env__front .bottom { fill: var(--th-paper); }
.env__front .line, .env__flap .line { fill: none; stroke: var(--line); stroke-width: 1.2; }
.env__flap {
  position: absolute; inset-inline: 0; top: 0; height: 62%; z-index: 5;
  transform-origin: 50% 0; transition: transform 1000ms var(--ease-slow);
}
.env__flap svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.env__flap .face { fill: var(--env-paper); }
.env__flap .line { stroke: var(--env-crease); }
.seal {
  position: absolute; left: 50%; bottom: -13%; width: 27%; aspect-ratio: 1;
  transform: translateX(-50%); transition: opacity 200ms ease-out, transform 320ms var(--ease-out);
}
.seal svg { width: 100%; height: 100%; display: block; overflow: visible; }
.seal .wax { fill: var(--th-accent-2); }
.seal .rim { fill: none; stroke: var(--th-ink); stroke-width: 2; opacity: 0.25; }
.seal .glint { fill: var(--th-paper); opacity: 0.5; }
.seal .mono { fill: var(--th-ink); opacity: 0.72; font-family: var(--font-display); font-weight: 700; font-size: 24px; }
.seal .mono-rule { stroke: var(--th-ink); stroke-width: 1.2; opacity: 0.4; }

/* opening sequence: the envelope rises, flies to the front, the seal breaks, the letter rises, the scene gives way */
.guest.is-unseal .env__flap { transform: rotateX(180deg); }
.js .guest.is-unseal .seal { opacity: 0; transform: translateX(-50%) scale(1.15); }
.guest.is-lifted .env__flap { z-index: 1; }
.headline, .hint { transition: opacity 240ms ease-out; }
.js .guest[data-state="opening"] .headline, .js .guest[data-state="opening"] .hint { opacity: 0; }
.js .guest[data-state="open"] .scene { opacity: 0; pointer-events: none; visibility: hidden; transition: opacity 420ms var(--ease-out), transform 520ms var(--ease-out), visibility 0s linear 600ms; } /* fully gone once faded: a played animation can leave the faded layer painted */

/* ---------- scene 2: the invitation ---------- */
.view {
  min-height: 100vh; min-height: 100dvh; padding: 28px 16px calc(120px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 28px;
  transform-origin: 50% 30%;
  transition: opacity 520ms var(--ease-out), transform 620ms var(--ease-rise);
}
.js .view { opacity: 0; transform: translateY(24px) scale(0.96); pointer-events: none; }
.js .guest[data-state="open"] .view { opacity: 1; transform: none; pointer-events: auto; }
.view:focus { outline: none; }
.card { margin: 0; width: min(100%, 560px); border-radius: 6px; overflow: hidden; box-shadow: 0 24px 48px var(--shadow), 0 2px 6px var(--shadow); background: var(--th-paper); }
.card img { width: 100%; height: auto; }
.made img { width: 96px; height: auto; opacity: 0.85; }

/* ---------- action bar ---------- */
.bar {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 3;
  display: flex; justify-content: center; gap: 8px;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  transition: opacity 360ms var(--ease-out) 260ms, transform 460ms var(--ease-out) 260ms;
}
.js .bar { opacity: 0; transform: translateY(20px); pointer-events: none; }
.js .guest[data-state="open"] .bar { opacity: 1; transform: none; pointer-events: auto; }
.act {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--th-paper); color: var(--th-ink);
  font-size: 1rem; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap;
  box-shadow: 0 8px 20px var(--shadow);
  transition: transform 140ms var(--ease-out), background-color 160ms ease-out, box-shadow 160ms ease-out;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.act:hover { box-shadow: 0 10px 24px var(--shadow); }
.act:active { transform: scale(0.96); }
.act:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; transition: none; }
.act svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.act--main { background: var(--th-accent); color: var(--th-on-accent); border-color: transparent; }

/* ---------- RSVP sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 10; }
.sheet__scrim { position: absolute; inset: 0; touch-action: none; overscroll-behavior: contain; background: var(--scrim); opacity: 0; transition: opacity 320ms ease-out; }
.sheet.is-in .sheet__scrim { opacity: 1; }
.sheet__panel {
  position: absolute; inset-inline: 0; bottom: 0; margin-inline: auto; width: min(100%, 520px);
  max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  translate: 0 var(--drag, 0px);
  background: var(--th-paper); color: var(--th-ink);
  border-radius: 22px 22px 0 0; padding: 8px 20px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform 420ms var(--ease-sheet);
  box-shadow: 0 -10px 40px var(--shadow);
}
.sheet.is-in .sheet__panel { transform: translateY(0); }
.sheet.is-dragging .sheet__panel { transition: none; }
@media (min-width: 700px) {
  .sheet__panel { bottom: 50%; border-radius: 22px; transform: translateY(60%) scale(0.98); opacity: 0; transition: transform 380ms var(--ease-out), opacity 240ms ease-out; }
  .sheet.is-in .sheet__panel { transform: translateY(50%); opacity: 1; }
}
.sheet__grip { display: grid; place-items: center; height: 24px; cursor: grab; touch-action: none; }
.sheet__grip span { width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.x {
  position: absolute; top: 10px; inset-inline-end: 10px; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; cursor: pointer; display: grid; place-items: center;
}
.x:hover { background: var(--th-paper-2); }
.x:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; transition: none; }
.x svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

.rsvp { display: grid; gap: 20px; }
.rsvp h2:focus { outline: none; }
.rsvp h2, .done h2 { margin: 4px 0 0; font-family: var(--font-display); font-weight: 500; font-size: 1.75rem; line-height: 1.2; text-wrap: balance; }
.field { display: grid; gap: 8px; }
.field input {
  min-height: 52px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line-strong);
  background: var(--th-paper-2); color: var(--th-ink); font: inherit; font-size: 1.0625rem;
}
.field input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; transition: none; }
.field input[aria-invalid="true"] { border-color: var(--error); }
.field__err, .form__err { color: var(--error); font-size: 0.9375rem; margin: 0; }

.seg { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 4px; border-radius: 16px; background: var(--th-paper-2); }
.seg button {
  min-height: 46px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; font-weight: 500;
  transition: background-color 180ms ease-out, box-shadow 180ms ease-out;
}
.seg button[aria-checked="true"] { background: var(--th-paper); box-shadow: 0 2px 8px var(--shadow), inset 0 0 0 1.5px var(--th-accent); color: var(--th-accent); font-weight: 700; }
.seg button:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; transition: none; }

.counts { display: grid; gap: 12px; }
.chips { display: flex; gap: 8px; }
.chip {
  flex: 1; min-height: 44px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; cursor: pointer;
  transition: background-color 160ms ease-out, border-color 160ms ease-out, transform 120ms ease-out;
}
.chip:active { transform: scale(0.96); }
.chip[aria-pressed="true"] { background: var(--th-accent); color: var(--th-on-accent); border-color: transparent; }
.chip:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; transition: none; }
.step { display: grid; grid-template-columns: 1fr 48px 56px 48px; align-items: center; min-height: 60px; padding: 8px; padding-inline-start: 16px; border-radius: 16px; background: var(--th-paper-2); }
.step__label { font-size: 1.0625rem; font-weight: 500; }
.step__val { text-align: center; font-size: 1.375rem; font-variant-numeric: tabular-nums; font-weight: 500; }
.step__btn {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--th-paper);
  display: grid; place-items: center; cursor: pointer; transition: transform 120ms ease-out;
}
.step__btn:active { transform: scale(0.92); }
.step__btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; transition: none; }
.step__btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.send {
  min-height: 54px; border: 0; border-radius: 999px; background: var(--th-accent); color: var(--th-on-accent);
  font-size: 1.0625rem; font-weight: 500; cursor: pointer; transition: transform 140ms ease-out, opacity 160ms ease-out;
}
.send:active { transform: scale(0.98); }
.send:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; transition: none; }
.send[aria-busy="true"] { opacity: 0.7; cursor: progress; }

.done { display: grid; justify-items: center; text-align: center; gap: 12px; padding: 12px 0 4px; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.done__sum { margin: 0; font-size: 1.0625rem; }
.done__acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
.done .act { box-shadow: none; background: var(--th-paper-2); }

@media (max-width: 360px) {
  .bar { gap: 4px; padding-inline: 8px; }
  .act { padding: 0 12px; gap: 4px; font-size: 0.9375rem; }
  .act svg { width: 20px; height: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .scene, .view, .bar, .env, .env__flap, .fold__p, .seal, .sheet__panel, .sheet__scrim, .act, .chip, .step__btn, .send {
    transition: opacity 200ms linear !important;
  }
  .guest[data-state="open"] .scene { transform: none; }
  .view { transform: none; }
  .bar { transform: none; }
  .sheet__panel { transform: none !important; opacity: 0; }
  .sheet.is-in .sheet__panel { opacity: 1; }
  }

/* ---------- atelier: the owner's chosen interface style (square, hairlines, one metallic thread) ---------- */
.retry { min-height: 48px; padding: 0 24px; border: 1px solid var(--th-accent-2); border-radius: 2px; background: transparent; color: var(--th-paper); cursor: pointer; transition: background-color 180ms var(--ease-out); }
.retry:hover { background: var(--th-bg-a); }
.retry:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.act { border-radius: 2px; border-color: var(--th-accent-2); }
.act--main { border-color: var(--th-accent-2); box-shadow: inset 0 0 0 1px var(--th-accent-2); }
.sheet__panel { border-radius: 2px 2px 0 0; border-top: 1px solid var(--th-accent-2); }
@media (min-width: 700px) { .sheet__panel { border-radius: 2px; border: 1px solid var(--th-accent-2); } }
.sheet__grip span { border-radius: 0; height: 2px; width: 48px; background: var(--line-strong); }
@media (min-width: 700px) { .sheet__grip { visibility: hidden; } }
.x { border-radius: 2px; }
.rsvp h2, .done h2 { font-family: var(--display); font-weight: 400; font-size: 2rem; text-align: center; }
.rsvp h2::after { content: ""; display: block; width: 40px; height: 1px; margin: 12px auto 0; background: var(--th-accent-2); }
.field input { border-radius: 2px; background: transparent; border-color: var(--line-strong); }
.seg { padding: 0; border-radius: 2px; background: transparent; border: 1px solid var(--line-strong); gap: 0; }
.seg button { border-radius: 0; }
.seg button[aria-checked="true"] { background: var(--th-accent); color: var(--th-on-accent); box-shadow: none; font-weight: 600; }
.chip { border-radius: 2px; }
.step { border-radius: 0; background: transparent; padding-inline: 0; border-bottom: 1px solid var(--line); }
.step__btn { border-radius: 2px; background: transparent; }
.step__val { font-family: var(--display); font-size: 1.625rem; font-weight: 400; }
.send { border-radius: 2px; letter-spacing: 0; }
.done__sum { font-family: var(--display); font-size: 1.25rem; }
.done .act { border-color: var(--line-strong); }
/* the first scene waits for the invitation's own colours (content stays visible without scripts) */
.js .guest:not(.is-ready) .scene { opacity: 0; }

/* ---------- living invitation: light over the lettering, a glass reflection, glints, a gentle breath ---------- */
:root { --live-light: oklch(100% 0 0 / 0.9); --live-glass: oklch(100% 0 0 / 0.12); --live-glint: oklch(97% 0.06 90); }
.card { position: relative; }
.live { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.live__sheen, .live__glass { position: absolute; inset: 0; overflow: hidden; }
.live__sheen { -webkit-mask-size: 100% 100%; mask-size: 100% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }
.live__band { will-change: transform; position: absolute; top: -20%; bottom: -20%; left: 0; width: 16%; transform: translateX(-120%) skewX(-18deg); }
.live__sheen .live__band { background: linear-gradient(90deg, transparent, var(--live-light) 50%, transparent); animation: live-sweep-narrow 6.5s cubic-bezier(0.45, 0, 0.25, 1) 1.2s infinite; }
.live__glass .live__band { width: 34%; background: linear-gradient(90deg, transparent, var(--live-glass) 50%, transparent); animation: live-sweep 11s cubic-bezier(0.45, 0, 0.25, 1) 4s infinite; }
@keyframes live-sweep-narrow { 0% { transform: translateX(-150%) skewX(-18deg); } 45%, 100% { transform: translateX(760%) skewX(-18deg); } }
@keyframes live-sweep { 0% { transform: translateX(-130%) skewX(-18deg); } 45%, 100% { transform: translateX(330%) skewX(-18deg); } }
.live__glint { position: absolute; width: 4.2%; aspect-ratio: 1; margin: -2.1% 0 0 -2.1%; opacity: 0; animation: live-twinkle 5.2s ease-in-out infinite; }
.live__glint svg { width: 100%; height: 100%; fill: var(--live-glint); filter: drop-shadow(0 0 3px var(--live-glint)); }
@keyframes live-twinkle { 0%, 70%, 100% { opacity: 0; transform: scale(0.3) rotate(0deg); } 80% { opacity: 1; transform: scale(1) rotate(25deg); } 90% { opacity: 0.4; transform: scale(0.6) rotate(45deg); } }
.card.is-living { animation: live-breathe 7s ease-in-out infinite alternate; }
@keyframes live-breathe { from { transform: translateY(0) scale(1); } to { transform: translateY(-3px) scale(1.006); } }
@media (prefers-reduced-motion: reduce) { .live { display: none; } .card.is-living { animation: none; } }

/* ---------- envelope paper: each panel catches the light a little differently ---------- */
.env__front .es-a { stop-color: var(--env-paper); }
.env__front .es-b { stop-color: var(--env-paper-2); }
.env__front .es-c { stop-color: var(--env-inside); }
.env__front .side--l { fill: url(#envL); }
.env__front .side--r { fill: url(#envR); }
.env__front .bottom { fill: url(#envB); }
.env__back { box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- the letter: folded in three, it comes out of the envelope and opens in 3D ---------- */
.fold { position: absolute; z-index: 2; width: var(--lw); height: var(--lh); perspective: 1600px; transform-style: preserve-3d; pointer-events: none; }
.fold.is-free { position: fixed; z-index: 6; transform-origin: 0 0; }
.fold__p { position: absolute; left: 0; width: 100%; height: calc(var(--lh) / 3 + 0.5px); transform-style: preserve-3d; transition: transform 1200ms var(--ease-slow); }
.fold__top { top: 0; transform-origin: 50% 100%; transform: translateZ(0.8px) rotateX(-178deg); }
.fold__mid { top: calc(var(--lh) / 3); }
.fold__bot { top: calc(var(--lh) * 2 / 3); transform-origin: 50% 0; transform: translateZ(0.4px) rotateX(178deg); }
.fold__f, .fold__b { position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.fold__f { background-image: var(--img); background-size: var(--lw) var(--lh); background-repeat: no-repeat; background-color: var(--th-paper); }
.fold__top .fold__f { background-position: 0 0; }
.fold__mid .fold__f { background-position: 0 calc(var(--lh) / -3); }
.fold__bot .fold__f { background-position: 0 calc(var(--lh) * -2 / 3); }
.fold__b { transform: rotateX(180deg); background-color: var(--card-paper); background-image: var(--grain), linear-gradient(180deg, var(--card-paper), var(--card-paper-2)); box-shadow: inset 0 0 0 1px var(--env-crease); }
/* the shade on a panel that is still bent, and the soft creases that stay on the paper */
.fold__f::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, var(--shadow), transparent 60%); opacity: 0.5; transition: opacity 1200ms var(--ease-slow); }
.fold__mid .fold__f::after { opacity: 0.12; background: linear-gradient(180deg, var(--shadow), transparent 12%, transparent 88%, var(--shadow)); }
.fold.open-top .fold__top, .fold.open-bot .fold__bot { transform: none; }
.fold.open-top .fold__top .fold__f::after, .fold.open-bot .fold__bot .fold__f::after { opacity: 0.08; }
.fold.is-free { filter: drop-shadow(0 18px 24px var(--shadow)); }
.guest.is-seamless .view { transition: opacity 500ms var(--ease-out); transform: none; }
.fold.is-out { transform: translateY(var(--rise)); transition: transform 1300ms var(--ease-slow); }
/* the names are engraved on the mailbox plate, so the heading stays for screen readers only */
.scene .headline { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.scene .hint { color: var(--th-paper); font-family: var(--display); font-size: 1.25rem; opacity: 0.9; }

/* ---------- the mailbox floats in the air, in a space with depth ---------- */
@property --sway { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.scene::before {
  content: ""; position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(42% 30% at 50% 44%, var(--air-halo), transparent 72%),
    radial-gradient(130% 70% at 50% 108%, var(--air-floor), transparent 62%),
    radial-gradient(140% 110% at 50% 40%, transparent 55%, var(--air-edge));
}
@keyframes mote { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(var(--dx, 10px), var(--dy, -40px), 0); } }
.post {
  --tilt-x: 0deg; --tilt-y: 0deg;
  transform: perspective(900px) rotateX(var(--tilt-x)) rotateY(calc(var(--tilt-y) + var(--sway)));
  animation: float 5.5s ease-in-out infinite alternate, sway 9s ease-in-out infinite alternate;
  transition: transform 500ms var(--ease-out);
}
@keyframes float { from { translate: 0 0; } to { translate: 0 -14px; } }
@keyframes sway { from { --sway: -7deg; } to { --sway: 7deg; } }
.floor {
  display: block; width: min(46vw, 230px, 30vh); height: 28px; margin-top: -32px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--shadow), transparent); opacity: 0.85;
  animation: floor 5.5s ease-in-out infinite alternate;
}
@keyframes floor { from { transform: scale(1); opacity: 0.85; } to { transform: scale(0.84); opacity: 0.55; } }
.guest.is-flown .floor { opacity: 0; transition: opacity 800ms var(--ease-out); animation: none; }
@media (prefers-reduced-motion: reduce) { .post, .floor { animation: none; } }

/* ---------- champagne envelope closed with a satin ribbon and a sprig of baby's breath ---------- */
.env .seal { display: none; }
.env__front .line { stroke: var(--env-crease); }
.env__grain { position: absolute; inset: 0; z-index: 4; pointer-events: none; background: var(--grain); border-radius: 4px; }
.ribbon { position: absolute; inset: 0; z-index: 6; pointer-events: none; transition: opacity 900ms var(--ease-slow), transform 1100ms var(--ease-slow); }
.ribbon__band { position: absolute; left: -1%; right: -1%; top: 56%; height: 11%; background: linear-gradient(180deg, var(--rb-2), var(--rb-1) 22%, var(--rb-hi) 48%, var(--rb-1) 72%, var(--rb-2)); box-shadow: 0 2px 3px var(--shadow); }
.ribbon__bow { position: absolute; left: 50%; top: 40%; width: 46%; transform: translateX(-50%); overflow: visible; filter: drop-shadow(0 3px 3px var(--shadow)); }
.ribbon__bow .rb-1 { stop-color: var(--rb-1); }
.ribbon__bow .rb-hi { stop-color: var(--rb-hi); }
.ribbon__bow .rb-2 { stop-color: var(--rb-2); }
.ribbon__bow .rb-crease { fill: none; stroke: var(--rb-2); stroke-width: 1.2; opacity: 0.55; }
.ribbon__sprig { position: absolute; left: 50%; top: 27%; width: 44%; transform: translate(-4%, 0) rotate(-14deg); overflow: visible; filter: drop-shadow(0 2px 2px var(--shadow)); }
.ribbon__sprig .sp-stem { fill: none; stroke: var(--stem); stroke-width: 1.4; stroke-linecap: round; }
.ribbon__sprig .sp-flower { fill: var(--flower); }
.ribbon__sprig .sp-heart { fill: var(--flower-heart); }
/* when the envelope opens, the ribbon and the flowers slip off */
.guest.is-unseal .ribbon { opacity: 0; transform: translateY(30%) rotate(4deg); }
.fold__f { background-color: var(--card-paper); }

/* ---------- a sunlit champagne corner: soft window light, baby's breath at the sides, a satin ribbon in front ---------- */
.scene { background: linear-gradient(175deg, var(--set-1), var(--set-2) 62%, var(--set-3)); }
.scene::before { display: none; }
.setting { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; contain: strict; }
.set-light {
  position: absolute; inset: -20%;
  background:
    repeating-linear-gradient(118deg, transparent 0 9%, var(--set-sun) 11%, transparent 15%, transparent 22%),
    radial-gradient(70% 50% at 70% 10%, var(--set-sun), transparent 70%),
    linear-gradient(180deg, transparent 66%, var(--set-shade) 67%, transparent 100%);
  filter: blur(18px); opacity: 0.85; will-change: transform;
}
.flora { position: absolute; bottom: 2%; height: min(66vh, 560px); aspect-ratio: 260 / 520; }
.flora--left { left: -22%; transform: rotate(-8deg); }
.flora--right { right: -24%; transform: scaleX(-1) rotate(-10deg); }
.flora--near { right: -6%; bottom: -14%; height: min(46vh, 400px); transform: scaleX(-1) rotate(-30deg); opacity: 0.9; }
.set-ribbon { position: absolute; left: -8%; right: -8%; bottom: 2%; height: 17vh; filter: drop-shadow(0 6px 8px var(--set-shade)); }
.set-ribbon svg { width: 100%; height: 100%; display: block; }
.set-ribbon .st-1 { stop-color: var(--st-1); }
.set-ribbon .st-hi { stop-color: var(--st-hi); }
.set-ribbon .st-2 { stop-color: var(--st-2); }
.set-ribbon .st-edge { stroke: var(--st-hi); stroke-width: 1.5; opacity: 0.7; }
.scene .hint { color: var(--set-ink); }
.floor { background: radial-gradient(closest-side, var(--set-shade), transparent); opacity: 1; }
@media (min-width: 900px) { .flora--left { left: 6%; } .flora--right { right: 6%; } .flora--near { right: 16%; } }

/* ---------- the opening is a real photograph: a cream mailbox seen from the front. The page places the photo so it
   always fills the screen, and everything on it (names, slot, tap area) is set in the photo's own coordinates ---------- */
.scene { display: block; padding: 0; overflow: hidden; background: var(--set-ink); }
.setting, .floor { display: none; }
.post { position: absolute; left: 0; top: 0; width: 100%; height: 100%; aspect-ratio: auto; transform: none; animation: none; transition: none; }
.photo { position: absolute; inset: 0; width: 100%; height: 100%; }
.plate {
  position: absolute; left: var(--nx); top: var(--ny); transform: translate(-50%, -50%); white-space: nowrap; pointer-events: none;
  font-family: var(--font-display); font-weight: 700; line-height: 1; color: var(--gold-2);
  filter: drop-shadow(0 1px 0 var(--gold-hi)) drop-shadow(0 -1px 0.5px var(--gold-lo));
}
.pillar { position: absolute; left: var(--bx); top: var(--by); width: var(--bw); height: var(--bh); filter: none; border-radius: 12px; }
.pillar:active { transform: none; }
.guest.is-flown .post .pillar { transform: none; opacity: 1; }
/* the envelope comes up out of the real slot in the photograph */
.env { left: var(--sx); top: var(--sy); width: var(--sw); visibility: hidden; }
.guest.is-rise .env { visibility: visible; }
.scene::after { content: ""; position: absolute; inset: 0; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity 1400ms var(--ease-out); z-index: 3; }
.guest.is-flown .scene::after { opacity: 0.75; }
.scene .hint {
  position: absolute; left: var(--hx, 50%); bottom: calc(4% + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 2;
  width: max-content; padding: 8px 24px; border-radius: 2px; background: var(--hint-bg); color: var(--card-paper); font-size: 1.375rem;
}
.retry { position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%); z-index: 2; }
/* a missing invitation or a failed load: the message itself is shown, on the page colours */
.guest.is-msg .scene { display: grid; place-items: center; align-content: center; gap: 24px; background: none; }
.guest.is-msg .scene .headline { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; }
.guest.is-msg .scene .hint, .guest.is-msg .retry { position: static; transform: none; background: none; }
/* the mailbox speaks for itself: no caption on it (the line is kept only for the "could not load" message) */
.guest:not(.is-msg) .scene .hint { display: none; }

/* the invitation comes out as one flat card, with no folds */
.fold__all { top: 0; height: var(--lh); transform: none; }
.fold__all .fold__f { background-position: 0 0; }
.fold__all .fold__f::after { display: none; }

/* ---------- the open invitation sits inside a photographed scene: printed on the card that stands by its envelope,
   with the satin ribbon and the baby's breath around it. The page sizes the photo so the card always fits. ---------- */
.view {
  position: relative; isolation: isolate; height: 100vh; height: 100dvh; min-height: 0; padding: 0; overflow: hidden;
  background: var(--set-2) url("/setting/room-blur.webp") center / cover;
}
.room { position: absolute; }
.room__photo {
  position: absolute; inset: 0; width: 100%; height: 100%;
  -webkit-mask-image: linear-gradient(90deg, transparent, var(--set-ink) 5%, var(--set-ink) 95%, transparent), linear-gradient(180deg, transparent, var(--set-ink) 5%, var(--set-ink) 95%, transparent);
  mask-image: linear-gradient(90deg, transparent, var(--set-ink) 5%, var(--set-ink) 95%, transparent), linear-gradient(180deg, transparent, var(--set-ink) 5%, var(--set-ink) 95%, transparent);
  -webkit-mask-composite: source-in; mask-composite: intersect;
}
/* the card in the photograph: x 300 to 984 and y 190 to 1150 of 1122 by 1402 */
.card {
  position: absolute; left: 26.74%; top: 13.55%; width: 60.96%; height: 68.47%; margin: 0;
  border-radius: 0; box-shadow: none; background: none; outline: none; overflow: hidden;
}
.card.is-living { animation: none; }
/* printed on the paper: the photo's own light and shade show through the invitation */
.card img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.card.is-cover img { object-fit: cover; }
/* the Sogno logo sits at the bottom left */
.made { position: absolute; z-index: 3; left: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); } /* above a scene's front layer */
/* the light version of the logo (white letters, bright teal mark), with a soft shade so it reads on the pale scene */
.made__logo { display: block; width: 92px; height: auto; opacity: 1; filter: drop-shadow(0 1px 2px var(--logo-shade)) drop-shadow(0 0 10px var(--logo-shade)); }

.guest.is-seamless .view { transition: opacity 500ms var(--ease-out); transform: none; }

/* ---------- the Sogno loader (the logo's twelve dots) wherever the page is busy ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; z-index: 1; pointer-events: none; }
.boot .sogno-loader { width: 44px; height: 44px; color: var(--th-paper); }
.send { display: inline-flex; align-items: center; justify-content: center; gap: 12px; }
.send .sogno-loader { display: none; width: 24px; height: 24px; color: currentColor; }
.send[aria-busy="true"] .sogno-loader { display: block; }
.send[aria-busy="true"] { opacity: 1; }

/* ==========================================================================================================
   The system parts of the guest page in the Sogno soft-UI language of the contact form (soft.css):
   the three buttons under the invitation, the RSVP form, and the loading and message screens.
   The mailbox, the envelope and the photographed scene keep their own look.
   ========================================================================================================== */
html { background: var(--surface); }
body { background: var(--surface); color: var(--ink); font-family: var(--body); }

/* the three actions: raised buttons standing on a soft tray */
.bar {
  left: 50%; right: auto; bottom: calc(12px + env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 24px); transform: translateX(-50%); gap: 12px;
  padding: 12px; border-radius: 26px; background: var(--surface); box-shadow: 0 14px 30px var(--tray-shade);
}
.js .bar { transform: translate(-50%, 20px); }
.js .guest[data-state="open"] .bar { transform: translateX(-50%); }
.bar .act { min-height: 54px; padding: 0 20px; border: 0; border-radius: var(--radius-input); background: var(--surface); color: var(--ink); box-shadow: var(--raised-sm); font: 500 1.0625rem/1 var(--body); }
.bar .act:hover { box-shadow: var(--raised-sm); color: var(--teal-ink); }
.bar .act:active { transform: none; box-shadow: var(--pressed); }
.bar .act--main, .bar .sb--main { background: var(--surface); color: var(--teal-ink); box-shadow: var(--raised-sm); }
.bar .act:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
@media (max-width: 360px) { .bar { gap: 8px; padding: 8px; } .bar .act { padding: 0 8px; gap: 4px; font-size: .9375rem; white-space: nowrap; } .bar .act svg { width: 18px; height: 18px; } }

/* the RSVP sheet: a card raised from the same surface */
.sheet__panel { background: var(--surface); color: var(--ink); border: 0; border-radius: var(--radius) var(--radius) 0 0; padding: 12px 24px calc(28px + env(safe-area-inset-bottom)); box-shadow: 0 -12px 30px var(--tray-shade); }
@media (min-width: 700px) { .sheet__panel { border: 0; border-radius: var(--radius); padding: 20px 40px 40px; box-shadow: var(--raised); } }
.sheet__grip span { width: 48px; height: 6px; border-radius: 999px; background: var(--surface); box-shadow: var(--pressed); }
.x { border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: var(--raised-sm); }
.x:hover { color: var(--teal-ink); background: var(--surface); }
.x:active { box-shadow: var(--pressed); }
.rsvp h2, .done h2 { font-family: var(--display); font-weight: 400; font-size: 2rem; letter-spacing: -.01em; text-align: center; color: var(--ink); }
.rsvp h2::after { display: none; }
.rsvp { gap: 20px; }
.field input { border: 2px solid transparent; border-radius: var(--radius-input); background: var(--surface); }
.field input:focus-visible { outline: 2px solid var(--night); outline-offset: -2px; }
.field__err, .form__err { color: var(--error); }

/* coming or not: a pressed track, and the chosen side sinks into it */
.seg { gap: 12px; padding: 0; border: 0; border-radius: 0; background: none; }
.seg button { min-height: 54px; border-radius: var(--radius-input); background: var(--surface); color: var(--ink); font-weight: 500; }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--teal-ink); box-shadow: var(--pressed); font-weight: 500; }
.chips { gap: 12px; }
.chip { flex: 1; border: 0; border-radius: 14px; background: var(--surface); }
.chip[aria-pressed="true"] { background: var(--surface); color: var(--teal-ink); border: 0; box-shadow: var(--pressed); }
.chip:active { transform: none; }
.step { grid-template-columns: 1fr 52px 56px 52px; min-height: 68px; padding: 8px; padding-inline: 16px 8px; border: 0; border-radius: var(--radius-input); background: var(--surface); box-shadow: var(--pressed); }
.step__btn { width: 52px; height: 52px; min-height: 0; padding: 0; border: 0; border-radius: 14px; background: var(--surface); }
.step__btn:active { transform: none; }
.step__val { font-family: var(--display); font-size: 1.625rem; color: var(--ink); }
.step__label { font-weight: 400; }
.send { width: 100%; min-height: 58px; border-radius: var(--radius-input); background: var(--surface); color: var(--teal-ink); letter-spacing: 0; }
.send:active { transform: none; }
.send .sogno-loader { display: block; position: absolute; }
.send[aria-busy="true"] .sogno-loader { display: block; }
.form__err.fail { margin: 0; }

/* thank you: the ring of dots closes and a check is drawn inside it */
.done { gap: 12px; }
.done .done-mark { margin-bottom: 8px; }
.done__sum { font-family: var(--body); font-size: 1.125rem; color: var(--muted); }
.done .act { border: 0; background: var(--surface); box-shadow: var(--raised-sm); color: var(--ink); border-radius: 14px; }
.done .act:active { transform: none; box-shadow: var(--pressed); }
.done__acts { gap: 16px; margin-top: 12px; }

/* loading and messages: the soft surface with the room of spheres behind */
.boot .sogno-loader { width: 52px; height: 52px; color: var(--teal); }
.guest.is-msg .scene { background: none; }
.guest.is-msg .scene .headline { font-family: var(--display); font-weight: 400; color: var(--ink); font-size: clamp(1.75rem, 5vw + .5rem, 2.75rem); position: relative; z-index: 1; padding: 0 24px; }
.guest.is-msg .scene .hint { color: var(--muted); font-family: var(--body); font-size: 1.125rem; position: relative; z-index: 1; }
.retry { border: 0; background: var(--surface); color: var(--teal-ink); }
.retry:hover { background: var(--surface); }
/* behind the photographs the page stays dark, so pulling past the edge on a phone never shows a pale strip */
html:has(.guest:not(.is-msg).is-ready) { background: var(--set-ink); }
.orbs { z-index: 0; }
/* the three actions stand on the photograph by themselves, with no tray behind them */
.bar { padding: 0; border-radius: 0; background: none; box-shadow: none; }
.bar .act, .bar .act:hover, .bar .act--main, .bar .sb--main { box-shadow: 0 10px 22px var(--tray-shade), inset 2px 2px 3px var(--light), inset -3px -3px 6px var(--shade); }
.bar .act:active { box-shadow: var(--pressed); }
/* the RSVP card: no scrollbar is drawn (it still scrolls when the screen is short), and no pale glow around it */
.sheet__panel { scrollbar-width: none; }
.sheet__panel::-webkit-scrollbar { display: none; }
@media (min-width: 700px) { .sheet__panel { box-shadow: 0 30px 70px var(--tray-shade), 0 8px 20px var(--tray-shade); } }
/* the parts of the form rise into place one after another when the card opens, and the thank-you parts do the same */
@keyframes rise-in { from { opacity: 0; transform: translateY(18px); } }
.sheet.is-in .rsvp > *, .sheet.is-in .counts > *, .sheet.is-in .done.is-on > * { animation: rise-in 560ms var(--ease) both; }
.sheet.is-in .rsvp > :nth-child(1) { animation-delay: 120ms; }
.sheet.is-in .rsvp > :nth-child(2) { animation-delay: 180ms; }
.sheet.is-in .rsvp > :nth-child(3) { animation-delay: 240ms; }
.sheet.is-in .rsvp > :nth-child(4) { animation: none; }
.sheet.is-in .counts > :nth-child(1) { animation-delay: 300ms; }
.sheet.is-in .counts > :nth-child(2) { animation-delay: 360ms; }
.sheet.is-in .counts > :nth-child(3) { animation-delay: 420ms; }
.sheet.is-in .rsvp > :nth-child(5) { animation-delay: 480ms; }
.sheet.is-in .done.is-on > :nth-child(2) { animation-delay: 500ms; }
.sheet.is-in .done.is-on > :nth-child(3) { animation-delay: 600ms; }
.sheet.is-in .done.is-on > :nth-child(4) { animation-delay: 700ms; }
.sheet.is-in .done.is-on > :nth-child(1) { animation: none; }
/* a number that changes gives a small bounce, and a chosen option settles in */
@keyframes tick { 0% { transform: scale(1); } 40% { transform: scale(1.28); } 100% { transform: scale(1); } }
.step__val.is-tick { animation: tick 320ms var(--ease); }
.sb { transition: box-shadow .22s var(--ease), color .18s var(--ease), transform .18s var(--ease); }
.sheet .sb:active { transform: scale(.97); }
@media (prefers-reduced-motion: reduce) {
  .sheet.is-in .rsvp > *, .sheet.is-in .counts > *, .sheet.is-in .done.is-on > *, .step__val.is-tick { animation: none; }
  .sheet .sb:active { transform: none; }
}
/* ---------- coming / not coming: the switch is a small show ----------
   coming: the card swings open like a door, the chosen button wobbles like jelly, the logo's dots burst out in teal,
   and the counters jump back in one by one. not coming: the card shakes its head, grey dots drop away, and the
   counters fold back and fall. */
.rsvp { transform-style: preserve-3d; }
@keyframes swing-yes { 0% { transform: perspective(900px) rotateY(0); } 22% { transform: perspective(900px) rotateY(-22deg) scale(1.03); } 46% { transform: perspective(900px) rotateY(14deg); } 68% { transform: perspective(900px) rotateY(-7deg); } 86% { transform: perspective(900px) rotateY(3deg); } 100% { transform: perspective(900px) rotateY(0); } }
@keyframes shake-no { 0%, 100% { transform: translateX(0) rotate(0); } 12% { transform: translateX(-18px) rotate(-2.5deg); } 28% { transform: translateX(16px) rotate(2.2deg); } 44% { transform: translateX(-12px) rotate(-1.6deg); } 60% { transform: translateX(9px) rotate(1.1deg); } 78% { transform: translateX(-4px) rotate(-.5deg); } }
.rsvp.is-yes { animation: swing-yes 900ms var(--ease) both; }
.rsvp.is-no { animation: shake-no 700ms var(--ease) both; }
@keyframes jelly { 0%, 100% { transform: scale(1); } 20% { transform: scale(1.16, .82); } 42% { transform: scale(.9, 1.12); } 62% { transform: scale(1.06, .95); } 82% { transform: scale(.98, 1.02); } }
.seg button.is-jelly { animation: jelly 720ms var(--ease) both; }
.burst { position: absolute; z-index: 5; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; pointer-events: none; background: var(--teal); animation: burst 900ms var(--ease) both; }
.burst:nth-child(even) { background: var(--teal-bright); }
.burst--no { background: var(--shade); animation-name: drop; animation-duration: 1000ms; animation-timing-function: cubic-bezier(.5, 0, .9, .6); }
.burst--no:nth-child(even) { background: var(--muted); }
@keyframes burst { 0% { transform: translate(0, 0) scale(.2); opacity: 1; } 60% { opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(var(--s, 1)); opacity: 0; } }
@keyframes drop { 0% { transform: translate(0, 0) scale(.3); opacity: 1; } 25% { transform: translate(calc(var(--dx) * .5), -26px) scale(1); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(.5); opacity: 0; } }
.counts { transform-origin: 50% 0; }
@keyframes fold-away { 0% { transform: perspective(700px) rotateX(0); opacity: 1; } 40% { transform: perspective(700px) rotateX(-55deg) translateY(6px); opacity: 1; } 100% { transform: perspective(700px) rotateX(-95deg) translateY(60px) scale(.8); opacity: 0; } }
.counts.is-leaving { animation: fold-away 460ms cubic-bezier(.5, 0, .9, .6) both; pointer-events: none; }
@keyframes jump-in { 0% { transform: translateY(40px) scale(.4) rotate(-8deg); opacity: 0; } 55% { transform: translateY(-10px) scale(1.08) rotate(2deg); opacity: 1; } 78% { transform: translateY(3px) scale(.98) rotate(-.6deg); } 100% { transform: none; opacity: 1; } }
.sheet.is-in .counts.is-back > * { animation: jump-in 620ms var(--ease) both; }
.sheet.is-in .counts.is-back > :nth-child(1) { animation-delay: 80ms; }
.sheet.is-in .counts.is-back > :nth-child(2) { animation-delay: 170ms; }
.sheet.is-in .counts.is-back > :nth-child(3) { animation-delay: 260ms; }
@media (prefers-reduced-motion: reduce) {
  .rsvp.is-yes, .rsvp.is-no, .seg button.is-jelly, .counts.is-leaving, .sheet.is-in .counts.is-back > * { animation: none; }
  .burst { display: none; }
}
.done h2 { overflow-wrap: anywhere; text-wrap: balance; }

/* the thank-you summary: a card pressed into the surface with the guest's name and three raised number tiles */
.sum { display: grid; gap: 16px; width: 100%; padding: 20px; border-radius: 24px; background: var(--surface); box-shadow: var(--pressed); }
.sum__name { font-family: var(--display); font-size: 1.5rem; line-height: 1.2; color: var(--ink); overflow-wrap: anywhere; }
.sum__row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sum__tile { display: grid; gap: 4px; padding: 12px 8px; border-radius: 16px; background: var(--surface); box-shadow: var(--raised-sm); }
.sum__n { font-family: var(--display); font-size: 2rem; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.sum__k { color: var(--muted); font-size: .9375rem; }
.sum__tile--all .sum__n { color: var(--teal-ink); }
.sum__note { color: var(--muted); font-size: 1.125rem; }
.sheet.is-in .done.is-on .sum__tile { animation: jump-in 620ms var(--ease) both; }
.sheet.is-in .done.is-on .sum__tile:nth-child(1) { animation-delay: 700ms; }
.sheet.is-in .done.is-on .sum__tile:nth-child(2) { animation-delay: 800ms; }
.sheet.is-in .done.is-on .sum__tile:nth-child(3) { animation-delay: 900ms; }
@media (prefers-reduced-motion: reduce) { .sheet.is-in .done.is-on .sum__tile { animation: none; } }

/* a scene without a blank card in the photo: the invitation lies on it as a card of its own, with its shadow */
.room--loose .card { box-shadow: 0 2px 4px var(--shadow), 0 18px 34px var(--tray-shade); border-radius: 3px; }
.room--loose .card img { mix-blend-mode: normal; }
.sum__row--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sum__row--4 .sum__n { font-size: 1.75rem; }
/* four tiles on a narrow phone: the labels stay on one line */
.sum__row--4 .sum__tile { padding-inline: 4px; }
.sum__row--4 .sum__k { white-space: nowrap; font-size: clamp(.75rem, 3.4vw, .9375rem); }
.sheet.is-in .done.is-on .sum__tile:nth-child(4) { animation-delay: 1000ms; }
.sheet.is-in .counts > :nth-child(4) { animation-delay: 480ms; }
.sheet.is-in .counts.is-back > :nth-child(4) { animation-delay: 350ms; }
/* the three actions are fully rounded */
.bar .act { border-radius: 999px; padding: 0 24px; }
/* on a phone the three buttons share the width between 16px side gutters, and shrink a little on narrow screens */
@media (max-width: 480px) {
  .bar { width: calc(100% - 32px); max-width: none; gap: clamp(6px, 2vw, 10px); justify-content: space-between; }
  .bar .act { flex: 1 1 auto; min-width: 0; justify-content: center; gap: 6px; padding: 0 clamp(8px, 3.2vw, 18px); font-size: clamp(.875rem, 3.9vw, 1.0625rem); white-space: nowrap; }
  .bar .act svg { width: clamp(17px, 5vw, 22px); height: clamp(17px, 5vw, 22px); }
}
/* their lettering takes the deep colour of the invitation itself (always dark enough to read on the light button) */
.bar .act, .bar .act:hover, .bar .act--main, .bar .sb--main { color: var(--th-accent); }
/* the scene's front layer lies over the invitation, so the flowers, ribbon and pen sit on top of it */
.room__fg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.room .card { z-index: 1; }
/* a wide screen: the upright photo runs from top to bottom and its sides fade slowly into the soft background */
.room--tall .room__photo { --m: linear-gradient(to right, rgba(0,0,0,0) calc(var(--fade-l) * 0), rgba(0,0,0,0.02) calc(var(--fade-l) * 0.2), rgba(0,0,0,0.08) calc(var(--fade-l) * 0.38), rgba(0,0,0,0.2) calc(var(--fade-l) * 0.55), rgba(0,0,0,0.4) calc(var(--fade-l) * 0.7), rgba(0,0,0,0.7) calc(var(--fade-l) * 0.85), rgba(0,0,0,1) calc(var(--fade-l) * 1), rgba(0,0,0,1) calc(100% - (100% - var(--fade-r)) * 1), rgba(0,0,0,0.7) calc(100% - (100% - var(--fade-r)) * 0.85), rgba(0,0,0,0.4) calc(100% - (100% - var(--fade-r)) * 0.7), rgba(0,0,0,0.2) calc(100% - (100% - var(--fade-r)) * 0.55), rgba(0,0,0,0.08) calc(100% - (100% - var(--fade-r)) * 0.38), rgba(0,0,0,0.02) calc(100% - (100% - var(--fade-r)) * 0.2), rgba(0,0,0,0) calc(100% - (100% - var(--fade-r)) * 0)); -webkit-mask-image: var(--m); mask-image: var(--m); }
.room--tall .room__fg { --m: linear-gradient(to right, rgba(0,0,0,0) calc(var(--fg-l) * 0), rgba(0,0,0,0.02) calc(var(--fg-l) * 0.2), rgba(0,0,0,0.08) calc(var(--fg-l) * 0.38), rgba(0,0,0,0.2) calc(var(--fg-l) * 0.55), rgba(0,0,0,0.4) calc(var(--fg-l) * 0.7), rgba(0,0,0,0.7) calc(var(--fg-l) * 0.85), rgba(0,0,0,1) calc(var(--fg-l) * 1), rgba(0,0,0,1) calc(100% - (100% - var(--fg-r)) * 1), rgba(0,0,0,0.7) calc(100% - (100% - var(--fg-r)) * 0.85), rgba(0,0,0,0.4) calc(100% - (100% - var(--fg-r)) * 0.7), rgba(0,0,0,0.2) calc(100% - (100% - var(--fg-r)) * 0.55), rgba(0,0,0,0.08) calc(100% - (100% - var(--fg-r)) * 0.38), rgba(0,0,0,0.02) calc(100% - (100% - var(--fg-r)) * 0.2), rgba(0,0,0,0) calc(100% - (100% - var(--fg-r)) * 0)); -webkit-mask-image: var(--m); mask-image: var(--m); }
/* a phone: where the photo stops short of the top or the bottom of the screen, that edge fades slowly into the background */
.room--vfade .room__photo, .room--vfade .room__fg { --m: linear-gradient(to bottom, rgba(0,0,0,0) calc(var(--fade-t) * 0), rgba(0,0,0,0.02) calc(var(--fade-t) * 0.2), rgba(0,0,0,0.08) calc(var(--fade-t) * 0.38), rgba(0,0,0,0.2) calc(var(--fade-t) * 0.55), rgba(0,0,0,0.4) calc(var(--fade-t) * 0.7), rgba(0,0,0,0.7) calc(var(--fade-t) * 0.85), rgba(0,0,0,1) calc(var(--fade-t) * 1), rgba(0,0,0,1) calc(100% - (100% - var(--fade-b)) * 1), rgba(0,0,0,0.7) calc(100% - (100% - var(--fade-b)) * 0.85), rgba(0,0,0,0.4) calc(100% - (100% - var(--fade-b)) * 0.7), rgba(0,0,0,0.2) calc(100% - (100% - var(--fade-b)) * 0.55), rgba(0,0,0,0.08) calc(100% - (100% - var(--fade-b)) * 0.38), rgba(0,0,0,0.02) calc(100% - (100% - var(--fade-b)) * 0.2), rgba(0,0,0,0) calc(100% - (100% - var(--fade-b)) * 0));
  --mx: linear-gradient(to right, rgba(0,0,0,0) 0%, rgba(0,0,0,0.08) calc(var(--side-l, 0%) * 0.38), rgba(0,0,0,0.4) calc(var(--side-l, 0%) * 0.7), rgba(0,0,0,1) var(--side-l, 0%), rgba(0,0,0,1) var(--side-r, 100%), rgba(0,0,0,0.4) calc(100% - (100% - var(--side-r, 100%)) * 0.7), rgba(0,0,0,0.08) calc(100% - (100% - var(--side-r, 100%)) * 0.38), rgba(0,0,0,0) 100%);
  -webkit-mask-image: var(--m), var(--mx); mask-image: var(--m), var(--mx); -webkit-mask-composite: source-in; mask-composite: intersect; } /* and a side the photo does not reach fades the same way */

/* no name yet: the field shakes its head, a bubble pops up under it with a waving hand, and asks for the name */
.field:has(.name-ask) { position: relative; }
.name-ask { display: inline-flex; align-items: center; gap: 8px; justify-self: start; width: max-content; margin-top: 10px; padding: 10px 16px; position: relative;
  border-radius: 18px; background: var(--surface); color: var(--th-accent, var(--teal-ink)); font: 500 1rem/1.2 var(--body); box-shadow: var(--raised-sm); transform-origin: 85% -10px; }
.name-ask::before { content: ""; position: absolute; top: -7px; inset-inline-start: 22px; width: 14px; height: 14px; background: var(--surface); transform: rotate(45deg); border-radius: 3px 0 0 0; box-shadow: -3px -3px 6px var(--light); }
.name-ask svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transform-origin: 70% 90%; }
.field.is-nudge input { animation: nudge-no .55s cubic-bezier(.36, .07, .19, .97); }
.field.is-nudge .name-ask { animation: nudge-pop .6s var(--spring, cubic-bezier(.3, 1.35, .6, 1)) both; }
.field.is-nudge .name-ask svg { animation: nudge-wave 1.1s .35s ease-in-out 2; }
@keyframes nudge-no { 15% { transform: translateX(-9px) rotate(-1deg); } 35% { transform: translateX(8px) rotate(1deg); } 55% { transform: translateX(-6px); } 75% { transform: translateX(4px); } 90% { transform: translateX(-2px); } }
@keyframes nudge-pop { 0% { opacity: 0; transform: scale(.3) translateY(-12px); } 60% { opacity: 1; transform: scale(1.08) rotate(-2deg); } 80% { transform: scale(.97) rotate(1deg); } }
@keyframes nudge-wave { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-18deg); } 40% { transform: rotate(14deg); } 60% { transform: rotate(-12deg); } 80% { transform: rotate(8deg); } }
@media (prefers-reduced-motion: reduce) { .field.is-nudge input, .field.is-nudge .name-ask, .field.is-nudge .name-ask svg { animation: none; } }

/* on an upright phone the small logo sits at the very bottom, centred under the buttons, which rise a little to make room */
@media (max-width: 699.98px) and (orientation: portrait) {
  .made { left: 50%; transform: translateX(-50%); bottom: calc(6px + env(safe-area-inset-bottom)); }
  .made .made__logo { width: 52px; height: auto; }
  .bar { bottom: calc(30px + env(safe-area-inset-bottom)); }
}
@media (min-width: 700px) { .made { left: 24px; bottom: 20px; } .made .made__logo { width: 76px; } }

/* the button icons: one family drawn for Sogno, a fine line with a soft tint of the same colour and one solid accent */
.act .ico { stroke-width: 1.5; overflow: visible; order: 2; } /* the icon stands after the words (on the left in Hebrew) */
.act .ico .ico__tone { fill: currentColor; stroke: none; opacity: .16; }
.act .ico .ico__dot { fill: currentColor; stroke: none; }
.act .ico .ico__seal { fill: currentColor; stroke: none; }
.act .ico .ico__tick { stroke: var(--surface); stroke-width: 1.5; }

/* ---------- the paper envelope (envelope.js): real paper with a grain, a thick flap, a wax seal ---------- */
.pe-stage { position: fixed; inset: 0; z-index: 4; display: grid; place-items: center; pointer-events: none; }
.pe-stage[hidden], .pe-cue[hidden] { display: none; }
.pe-fly { opacity: 0; transition: opacity 500ms var(--ease-out); }
.pe-stage.is-painted .pe-fly { opacity: 1; }
/* once it has arrived it floats a little, as if held in the hand */
.pe-stage.is-settled .pe-float { animation: pe-float 7s ease-in-out infinite; }
@keyframes pe-float { 0%, 100% { transform: translateY(0) rotate(-0.5deg); } 50% { transform: translateY(-7px) rotate(0.5deg); } }
/* (the envelope itself is drawn by envelope.css) */
.pe__pocket .fold { z-index: 1; }
/* a quiet cue that the envelope answers to a tap or a scroll */
.pe-cue { position: fixed; z-index: 5; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom)); width: 46px; height: 46px; margin-left: -23px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(255, 251, 244, .82); box-shadow: 0 6px 18px rgba(30, 20, 10, .3); pointer-events: none; }
.pe-cue svg { width: 22px; height: 22px; fill: none; stroke: #6b5a45; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; animation: pe-nudge 1.8s ease-in-out infinite; }
.pe-cue__far { opacity: .45; }
@keyframes pe-nudge { 0%, 100% { transform: translateY(-2px); } 50% { transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) { .pe-stage.is-settled .pe-float, .pe-cue svg { animation: none; } }
/* the page opens straight on the envelope: it lies on a soft, softly lit picture of the scene it will open into */
.backdrop { position: absolute; inset: 0; background-size: cover; background-position: 50% 50%; display: none; }
.backdrop::after { content: ""; position: absolute; inset: 0;
  background: radial-gradient(80% 60% at 28% 18%, rgba(255, 250, 240, .34), rgba(255, 250, 240, 0) 70%), radial-gradient(120% 90% at 50% 46%, rgba(0, 0, 0, 0) 55%, rgba(20, 14, 8, .26)); }
.guest.is-direct .backdrop { display: block; transition: opacity 800ms var(--ease-out) 100ms; }
.guest.is-direct.is-landing .backdrop { opacity: 0; }
.guest.is-direct .photo, .guest.is-direct .plate { display: none; }
.guest.is-direct .pillar { left: 0; top: 0; width: 100%; height: 100%; border-radius: 0; }
.guest.is-direct.is-msg .pe-stage, .guest.is-direct.is-msg .pe-cue, .guest.is-direct.is-msg .backdrop { display: none; }
/* once the invitation is out, the closed envelope lies behind it in the scene */
.room__env { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.room__env[hidden] { display: none; }
.room__envtilt { position: absolute; transform: rotate(-7deg); }
.room__envtilt .pe { width: 100%; }
/* as the invitation leaves the envelope, the opening fades straight into the scene it lands in (not back to the mailbox) */
.guest.is-landing .scene { background: transparent; }
.guest.is-landing .scene::after { opacity: 0; transition: opacity 500ms var(--ease-out); }
.guest.is-landing .post { opacity: 0; transition: opacity 400ms var(--ease-out); }
.js .guest.is-landing .view { opacity: 1; transform: none; }
.guest.is-landing:not([data-state="open"]) .room .card { opacity: 0; }
/* the opening tune's switch, in the top corner: a round sibling of the buttons at the bottom. While the tune plays its two waves
   breathe one after the other; silenced, the waves fold away and a small cross is drawn in their place */
.tune { position: fixed; z-index: 7; left: 16px; top: calc(16px + env(safe-area-inset-top)); width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; color: var(--th-accent); background: var(--surface); box-shadow: 0 10px 22px var(--tray-shade), inset 2px 2px 3px var(--light), inset -3px -3px 6px var(--shade);
  -webkit-tap-highlight-color: transparent; opacity: 0; transform: scale(.8); transition: opacity .5s var(--ease-out), transform .5s var(--ease-out), box-shadow .2s var(--ease-out); }
.tune.is-on { opacity: 1; transform: none; }
.tune.is-on:active { transform: scale(.93); transition-duration: .12s; box-shadow: var(--pressed); }
.tune:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.tune svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.tune .tune__tone { fill: currentColor; stroke: none; opacity: .16; }
.tune__wave { transform-origin: 13px 12px; transition: opacity .35s var(--ease-out), transform .45s var(--ease-out); animation: tune-breathe 2.4s ease-in-out infinite; }
.tune__wave--far { animation-delay: .3s; }
.tune__off { stroke-dasharray: 7; stroke-dashoffset: 7; transition: stroke-dashoffset .4s var(--ease-out); }
.tune[aria-pressed="true"] .tune__wave { opacity: 0; transform: scale(.55); animation: none; }
.tune[aria-pressed="true"] .tune__off { stroke-dashoffset: 0; transition-delay: .12s; }
@keyframes tune-breathe { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .tune, .tune__wave, .tune__off { transition: none; animation: none; } }
