/* The invitation's ornamental frame, rebuilt around the whole viewport from pieces of the card
   (see scripts/make-frame.py). Corners and centre ornaments keep their natural proportions;
   the side vines tile at their natural repeat. --s scales the card's pixels to the screen. */
:root {
  --s: 0.28;
  --band-top: calc(176px * var(--s));
  --band-bottom: calc(174px * var(--s));
  --side: calc(205px * var(--s));
}

@media (min-width: 40rem) {
  :root {
    --s: 0.38;
  }
}

@media (min-width: 72rem) {
  :root {
    --s: 0.46;
  }
}

.frame {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.frame-band {
  position: absolute;
  inset-inline: 0;
  background: var(--black) no-repeat center / calc(var(--w) * var(--s)) auto;
}

/* Corner ornaments sit on the band's pseudo-elements; the centre ornament is the band's own background. */
.frame-band::before,
.frame-band::after {
  content: "";
  position: absolute;
  inset-block: 0;
  inline-size: calc(var(--w) * var(--s));
  background: no-repeat var(--pos) / 100% auto;
}

.frame-band::before {
  left: 0;
  --w: var(--left-w);
  background-image: var(--left);
}

.frame-band::after {
  right: 0;
  --w: var(--right-w);
  background-image: var(--right);
}

.frame-top {
  top: 0;
  block-size: var(--band-top);
  --pos: top;
  --w: 288px;
  --left-w: 526px;
  --right-w: 530px;
  --left: url("/art/top-left.webp");
  --right: url("/art/top-right.webp");
  background-image: url("/art/top-center.webp");
  background-position: center top;
}

.frame-bottom {
  bottom: 0;
  block-size: var(--band-bottom);
  --pos: bottom;
  --w: 293px;
  --left-w: 532px;
  --right-w: 530px;
  --left: url("/art/bottom-left.webp");
  --right: url("/art/bottom-right.webp");
  background-image: url("/art/bottom-center.webp");
  background-position: center bottom;
}

.frame-side {
  position: absolute;
  inset-block: var(--band-top) var(--band-bottom);
  inline-size: var(--side);
  background-color: var(--black);
  background-repeat: no-repeat, repeat-y;
  background-size: calc(165px * var(--s)) auto, calc(140px * var(--s)) auto;
}

.frame-left {
  left: 0;
  background-image: url("/art/medallion-left.webp"), url("/art/vine-left.webp");
  background-position: left calc(40px * var(--s)) center, left calc(40px * var(--s)) top;
}

.frame-right {
  right: 0;
  background-image: url("/art/medallion-right.webp"), url("/art/vine-right.webp");
  background-position: right calc(40px * var(--s)) center, right calc(40px * var(--s)) top;
}

/* Content scrolls inside the frame, as if through a window. */
.card {
  max-inline-size: calc(34rem + 2 * var(--side));
  margin-inline: auto;
  padding: calc(var(--band-top) + 2rem) calc(var(--side) + 1rem) calc(var(--band-bottom) + 3rem);
  text-align: center;
}

.invitation h1 {
  margin: 0;
}

.invitation img {
  display: block;
  block-size: auto;
  margin-inline: auto;
}

/* Widths keep the card's own proportions between lettering, bats and details. */
.title-art {
  inline-size: 100%;
}

.bats {
  inline-size: 82%;
  margin-block: clamp(1.25rem, 5vw, 2.5rem);
}

.details-art {
  inline-size: 53%;
}

.map {
  margin: 0.75rem 0 0;
}

.map a {
  color: var(--gold);
}

.note {
  margin-block-start: 3rem;
  color: var(--gold-soft);
}

.panel {
  max-inline-size: 26rem;
  margin: 3rem auto 0;
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: clamp(2.5rem, 10vw, 3rem);
  font-weight: 400;
  line-height: 1.1;
}

form {
  text-align: start;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 0 0 1.75rem;
  padding: 0;
  border: 0;
}

.choices legend {
  inline-size: 100%;
  margin-block-end: 0.75rem;
  padding: 0;
  font-size: 2rem;
  text-align: center;
}

.choice {
  position: relative;
  display: grid;
  place-items: center;
  min-block-size: 4rem;
  padding-block: 0.4rem;
  white-space: nowrap;
  text-align: center;
  font-size: 1.75rem;
  cursor: pointer;
}

.choice input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.choice:hover {
  color: var(--gold-lit);
}

/* Chosen: a small bat from the card appears above the label, which also brightens, so the state
   isn't carried by colour alone. */
.choice:has(input:checked) {
  color: var(--gold-lit);
}

/* The bat's space is reserved on both options, so choosing one doesn't shift the layout. */
.choice span::before {
  content: "";
  display: block;
  inline-size: 2.4em;
  block-size: 1.1em;
  margin: 0 auto 0.15em;
  background: url("/art/bat.webp") no-repeat center / contain;
  opacity: 0;
}

.choice:has(input:checked) span::before {
  opacity: 1;
}

.choice:has(input:focus-visible) {
  outline: 2px solid var(--gold-lit);
  outline-offset: 3px;
}

.field label {
  display: block;
  margin-block-end: 0.35rem;
}

.optional {
  color: var(--gold-soft);
}

textarea {
  resize: vertical;
}

form .button {
  inline-size: 100%;
  margin-block-start: 1.5rem;
}

blockquote {
  margin: 1.25rem 0;
  padding-inline-start: 1rem;
  border-inline-start: 1px solid var(--gold-soft);
  color: var(--gold-soft);
  font-style: italic;
  text-align: start;
  white-space: pre-wrap;
}

@media (prefers-reduced-motion: no-preference) {
  .panel:not([hidden]) {
    animation: rise 0.5s ease-out;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
}
