@import url("/invitation-palette.css");

/* Layout: a paper invitation on a confetti-sky table; one column, envelope scene on first view. */
/* Cormorant defaults to old-style figures, where 1 and 0 read as I and O. */
h1, h2, h3, .stepper output, .env-seal, .total b { font-variant-numeric: lining-nums; font-feature-settings: "lnum" 1; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
html, body { margin: 0; }
body {
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--sky);
  min-height: 100vh;
}
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.05; text-wrap: balance; margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--berry-ink); outline-offset: 3px; border-radius: 6px; }

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding-block: 32px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid;
  gap: 28px;
}

/* ---------- ZaritskiyZoo wordmark ---------- */
.brand {
  justify-self: center; margin: 0;
  font-family: var(--display); font-weight: 700; font-size: clamp(26px, 7vw, 34px); line-height: 1;
  color: var(--ink); text-decoration: none; letter-spacing: .02em;
}
.brand span { color: var(--tangerine); }
.brand small { font-family: var(--body); font-weight: 800; font-size: .5em; color: var(--berry-ink); margin-left: 1px; }
.brand-stage { font-size: clamp(30px, 9vw, 44px); }
.foot-domain { color: var(--ink); font-size: 16px; }

/* ---------- Envelope scene ---------- */
.stage {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: var(--sky);
  transition: opacity .6s ease;
  padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(16px, env(safe-area-inset-left, 0px));
}
.stage.gone { opacity: 0; pointer-events: none; }
.stage-inner { display: grid; justify-items: center; gap: 22px; }
.env-to, .greeting { margin: 0; font-family: var(--display); font-style: italic; font-weight: 600; text-align: center; color: var(--ink); text-wrap: balance; }
.env-to { font-size: clamp(26px, 7.5vw, 38px); }
.greeting { font-size: clamp(24px, 6.5vw, 32px); }
.stage.revealing .env-to { opacity: 0; transition: opacity .3s; }
.day-notes { white-space: pre-line; }
.booth-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; align-items: start; }
.booth-grid a { display: block; border-radius: 12px; overflow: hidden; background: var(--line); }
.booth-grid img { width: 100%; height: auto; display: block; }
.share-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 12px; }
.share-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; background: var(--line); }
.share-grid .pending { opacity: .45; }
#shareBtn { cursor: pointer; }
.stage-hint { font-weight: 700; color: var(--ink-soft); letter-spacing: .04em; text-transform: uppercase; font-size: 13px; }
.stage-hint button { background: none; border: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }

.env {
  position: relative;
  width: min(86vw, 420px);
  aspect-ratio: 10 / 7;
  perspective: 1200px;
  cursor: pointer;
  border: 0; padding: 0; background: none;
  margin-top: 30%;
  animation: env-arrive .8s cubic-bezier(.2, 1.4, .4, 1) both;
}
.env-back, .env-pocket, .env-flap { position: absolute; left: 0; right: 0; }
.env-back { inset: 0; background: var(--kraft-dark); border-radius: 10px; }
.env-card {
  position: absolute; left: 6%; right: 6%; top: 6%; height: 88%;
  background: var(--card); border-radius: 8px;
  box-shadow: 0 2px 0 var(--line);
  overflow: hidden; padding: 0;
  z-index: 2;
  transition: transform .9s cubic-bezier(.3, 1.5, .5, 1);
}
.env-card img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.env-card small { font-weight: 800; text-transform: uppercase; letter-spacing: .12em; font-size: 11px; color: var(--berry-ink); }
.env-card strong { font-family: var(--script); font-weight: 400; font-size: clamp(22px, 6vw, 32px); line-height: 1; }
.env-pocket {
  inset: 0; z-index: 3;
  clip-path: polygon(0 0, 50% 56%, 100% 0, 100% 100%, 0 100%);
  border-radius: 10px;
  overflow: hidden;
}
.env-pocket::before, .env-pocket::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 50%;
}
/* Side folds, a shade darker than the bottom fold, so the V reads as paper. */
.env-pocket::before { left: 0; background: var(--kraft-mid); clip-path: polygon(0 0, 100% 56%, 100% 100%, 0 100%); }
.env-pocket::after { right: 0; background: var(--kraft-mid); clip-path: polygon(100% 0, 0 56%, 0 100%, 100% 100%); }
.env-bottom { position: absolute; inset: 0; z-index: 1; background: var(--kraft); clip-path: polygon(0 100%, 50% 50%, 100% 100%); }
.env-flap {
  top: 0; height: 62%; z-index: 4;
  background: var(--kraft-light);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transition: transform .6s ease-in;
}
.env-seal {
  position: absolute; left: 50%; top: 62%; z-index: 5;
  width: 58px; height: 58px; margin: -29px 0 0 -29px;
  border-radius: 50%;
  background: var(--berry); color: var(--accent-ink);
  display: grid; place-items: center;
  font-family: var(--display); font-weight: 700; font-size: 24px;
  box-shadow: 0 0 0 5px rgba(239, 170, 163, .3);
  transition: transform .35s ease, opacity .35s ease;
}
.env.opening .env-seal { transform: scale(0); opacity: 0; }
.env.opening .env-flap { transform: rotateX(180deg); }
.env.flap-behind .env-flap { z-index: 1; }
.env.out .env-card { transform: translateY(-82%) scale(1.04) rotate(-1.5deg); z-index: 2; }
.env { transition: transform .7s ease-in, opacity .6s ease; }
.reveal-art {
  position: fixed; left: 50%; top: 50%; z-index: 55;
  height: min(86vh, 150vw); width: auto; max-width: 92vw; border-radius: 6px;
  box-shadow: 0 24px 60px -20px rgba(76, 102, 118, .55);
  transform: translate(-50%, -38%) scale(.55) rotate(-1.5deg); opacity: 0; pointer-events: none;
  transition: transform .9s cubic-bezier(.2, 1.1, .3, 1), opacity .5s ease;
}
.stage.revealing .reveal-art { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-.6deg); }
.stage.revealing .env { transform: translateY(45vh); opacity: 0; animation: none; }
.stage.revealing .brand-stage, .stage.revealing .stage-hint { opacity: 0; transition: opacity .3s; }
.env:not(.opening) { animation: env-arrive .8s cubic-bezier(.2, 1.4, .4, 1) both, env-wiggle 2.6s ease-in-out 1.2s infinite; }

@keyframes env-arrive { from { transform: translateY(40px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes env-wiggle { 0%, 88%, 100% { rotate: 0deg; } 92% { rotate: -2.5deg; } 96% { rotate: 2.5deg; } }

/* Prints that pop out of the envelope and land along the bottom. */
.photo-burst { position: fixed; inset: 0; z-index: 65; pointer-events: none; overflow: hidden; transition: opacity .9s ease; }
.photo-burst.fade { opacity: 0; }
.photo-burst .print {
  position: absolute; left: 0; top: 0; height: auto; aspect-ratio: 4 / 5; object-fit: cover;
  background: var(--card); padding: 5px 5px 14px; border-radius: 3px;
  box-shadow: 0 6px 16px -6px rgba(76, 102, 118, .5);
  will-change: transform;
}

/* ---------- Page ---------- */
.page { transition: opacity .5s ease; }
.page.hidden-until-open { opacity: 0; }

.invite {
  position: relative;
  background: var(--card);
  border-radius: 18px;
  padding: 36px 28px 28px;
  box-shadow: 0 18px 0 -8px var(--sky-deep), 0 2px 0 var(--line);
  text-align: center;
  display: grid; gap: 18px;
  overflow: hidden;
}
.invite { background: transparent; box-shadow: none; padding: 0; overflow: visible; gap: 16px; }
.invite::before { content: none; }
.invite-for { margin: 0; }
.art { position: relative; margin: 0; justify-self: center; width: min(100%, 560px); transform: rotate(-.6deg); }
.art img {
  display: block; width: 100%; height: auto; border-radius: 6px;
  box-shadow: 0 1px 0 rgba(125, 106, 93, .12), 0 18px 40px -18px rgba(76, 102, 118, .45);
}
/* The link tracks the painted RSVP label as the invitation scales. */
.art-rsvp {
  position: absolute; left: 35%; top: 88%; width: 33%; height: 8.5%;
  min-height: 44px; transform: translateY(-50%); border-radius: 8px;
  cursor: pointer;
}
.art-rsvp:hover { box-shadow: 0 0 0 2px var(--berry); }
#rsvp { scroll-margin-top: 20px; }
.chip.chip-primary { background: var(--berry); border-color: var(--berry-ink); color: var(--accent-ink); }
.chip.chip-primary:hover { background: var(--berry-hover); }
.address-note { margin: 0; color: var(--ink-soft); font-size: 15px; }
.invite-for { font-weight: 800; text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: var(--ink-soft); }
.invite-turning { font-size: 18px; font-weight: 700; color: var(--ink-soft); }
.age-badge {
  justify-self: center;
  width: 132px; height: 132px; border-radius: 50%;
  background: var(--tangerine); color: var(--card);
  display: grid; place-items: center;
  font-family: var(--display); font-size: 84px; line-height: 1;
  box-shadow: inset 0 -8px 0 rgba(0,0,0,.12), 0 0 0 8px var(--lemon);
  rotate: -6deg;
}
.facts { display: grid; gap: 0; text-align: left; border-top: 2px dashed var(--line); margin-top: 6px; }
.fact { display: grid; grid-template-columns: 88px 1fr; gap: 12px; padding: 12px 2px; border-bottom: 2px dashed var(--line); }
.fact dt { font-weight: 800; text-transform: uppercase; font-size: 12px; letter-spacing: .1em; color: var(--berry-ink); padding-top: 3px; }
.fact dd { margin: 0; min-width: 0; }
.fact a { color: var(--ink); font-weight: 700; }
.invite-details { margin: 0; color: var(--ink-soft); }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 999px;
  border: 1.5px solid var(--ink); background: var(--card);
  font-weight: 700; font-size: 15px; text-decoration: none; color: var(--ink);
  cursor: pointer;
}
.chip:hover { background: var(--kraft-light); }

.panel {
  background: var(--card);
  border-radius: 18px;
  padding: 26px 22px;
  box-shadow: 0 2px 0 var(--line);
  display: grid; gap: 18px;
}
.panel h2 { font-size: clamp(28px, 7vw, 36px); }
.panel-sub { margin: -10px 0 0; color: var(--ink-soft); }

/* RSVP */
.choice { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; border: 0; padding: 0; margin: 0; }
.choice legend { font-weight: 800; margin-bottom: 8px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label {
  display: grid; place-items: center; text-align: center;
  padding: 14px 6px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--card);
  font-weight: 800; cursor: pointer; line-height: 1.2;
}
.choice label span { display: block; font-weight: 500; font-size: 13px; color: var(--ink-soft); }
.choice input:focus-visible + label { outline: 3px solid var(--berry-ink); outline-offset: 2px; }
.choice input[value="yes"]:checked + label { background: var(--mint); border-color: var(--mint); color: var(--accent-ink); }
.choice input[value="maybe"]:checked + label { background: var(--lemon); border-color: var(--lemon); }
.choice input[value="no"]:checked + label { background: var(--ink); border-color: var(--ink); color: var(--card); }
.choice input:checked + label span { color: inherit; }

.counts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stepper { border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; display: grid; gap: 6px; }
.stepper-label { font-weight: 800; font-size: 14px; }
.stepper-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stepper button {
  width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid var(--ink); background: var(--card);
  font-size: 22px; font-weight: 800; line-height: 1; cursor: pointer;
}
.stepper button:disabled { opacity: .3; cursor: default; }
.stepper output { font-family: var(--display); font-weight: 700; font-size: 32px; min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }

.field { display: grid; gap: 6px; }
.field label { font-weight: 800; font-size: 14px; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--card);
}
.field textarea { min-height: 84px; resize: vertical; }
.on-file { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-variant-numeric: tabular-nums; }
.on-file li { padding: 10px 12px; border-radius: 10px; border: 2px dashed var(--line); color: var(--ink-soft); }
.contacts { display: grid; gap: 8px; }
.add-contact { justify-self: start; font-size: 14px; }

.btn {
  justify-self: start;
  padding: 14px 26px; border-radius: 999px; border: 0;
  background: var(--berry); color: var(--accent-ink);
  font-weight: 800; font-size: 17px; cursor: pointer;
  box-shadow: 0 4px 0 var(--berry-ink);
}
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--berry-ink); }
.btn[disabled] { opacity: .6; cursor: progress; }
.msg { margin: 0; font-weight: 700; }
.msg.err { color: #b3261e; }
.saved {
  display: grid; gap: 8px; padding: 18px; border-radius: 14px;
  background: color-mix(in srgb, var(--mint) 18%, var(--card));
  border: 2px solid var(--mint);
}
.saved strong { font-family: var(--display); font-weight: 700; font-size: 26px; }
.saved .link-btn { justify-self: start; }
.link-btn { background: none; border: 0; padding: 0; color: var(--ink); font-weight: 800; text-decoration: underline; cursor: pointer; }

/* Slideshow */
.show { position: relative; border-radius: 14px; overflow: hidden; background: var(--ink); aspect-ratio: 4 / 3; max-width: 100%; }
.slide { position: absolute; inset: 0; margin: 0; opacity: 0; transition: opacity .9s ease; }
.slide.on { opacity: 1; }
.slide img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.slide img.slide-bg { object-fit: cover; filter: blur(18px) brightness(.85); transform: scale(1.1); }
.slide figcaption {
  position: absolute; left: 12px; bottom: 12px;
  background: var(--card); color: var(--ink);
  padding: 6px 12px; border-radius: 999px; font-weight: 800; font-size: 14px;
}
.show-nav {
  position: absolute; top: 50%; translate: 0 -50%;
  width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(255, 253, 248, .9); color: var(--ink);
  font-size: 22px; font-weight: 800; cursor: pointer;
}
.show-nav.prev { left: 10px; }
.show-nav.next { right: 10px; }
.show-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dots { display: flex; gap: 8px; flex-wrap: wrap; }
.dots button { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); background: transparent; padding: 0; cursor: pointer; }
.dots button[aria-current="true"] { background: var(--ink); }

.foot { text-align: center; color: var(--ink-soft); font-size: 14px; display: grid; gap: 6px; }

.error-card { background: var(--card); border-radius: 18px; padding: 28px; text-align: center; display: grid; gap: 10px; }

@media (max-width: 420px) {
  .fact { grid-template-columns: 1fr; gap: 2px; }
  .invite { padding: 32px 18px 22px; }
  .counts { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Bella's first birthday video, in place of the photo slideshows */
.video-panel { text-align: center; }
.video-slot { width: min(100%, 420px, calc(75vh * 512 / 910)); aspect-ratio: 512 / 910; margin: 0 auto; }
.video-frame { width: 100%; height: 100%; overflow: hidden; background: #272522; border: 6px solid #fff; border-bottom-width: 22px; border-radius: 3px; box-shadow: 0 10px 25px #72573d24; }
.video-frame video { width: 100%; height: 100%; display: block; object-fit: contain; }
#playSound { justify-self: center; }
.video-status { margin: 0; font-size: 13px; color: var(--ink-soft); }
