@font-face {
  font-family: Pinyon;
  src: url("assets/pinyon-script.woff2") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: light;
  --ivory: #f8efe2;
  --olive: #343c28;
  --gold: #76531c;
  --line: #95713662;
  --paper: url("assets/paper.webp");
  --ease: cubic-bezier(.19,.74,.25,1);
  font-family: Georgia, "Times New Roman", serif;
  color: var(--olive);
  background: var(--ivory) var(--paper) repeat 0 0 / 560px auto;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
button { font: inherit; }
[hidden] { display: none !important; }
.symbols, .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:focus-visible { outline: 2px solid #5c612b; outline-offset: 5px; }

.stationery { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; }
.foliage { position: absolute; display: block; background-repeat: no-repeat; background-size: contain; }
.top-left, .top-right {
  top: 0;
  width: clamp(140px, 26vw, 430px);
  aspect-ratio: 620 / 690;
  background-image: url("assets/botanical-top.webp");
}
.top-left { left: 0; }
.top-right { right: 0; transform: scaleX(-1); opacity: .88; }
.bottom-left, .bottom-right {
  bottom: 0;
  width: clamp(154px, 29vw, 490px);
  aspect-ratio: 708 / 680;
  background-image: url("assets/botanical-bottom.webp");
}
.bottom-right { right: 0; }
.bottom-left { left: 0; transform: scaleX(-1); opacity: .72; }

.invitation { min-height: 100svh; padding: clamp(32px, 6vh, 72px) 20px 28px; position: relative; overflow: clip; }
.masthead { text-align: center; position: relative; margin: 0 auto clamp(25px, 4.3vh, 48px); }
.masthead__ornament { display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--gold); margin: 0 auto 16px; }
.masthead__ornament span { display: block; width: clamp(22px, 4vw, 62px); height: 1px; background: var(--line); }
.masthead__ornament svg { width: 34px; height: 29px; }
.eyebrow { margin: 0 auto; max-width: 530px; font: 600 .68rem/1.6 system-ui, sans-serif; letter-spacing: .19em; text-transform: uppercase; }
h1 { font: 400 clamp(3.5rem, 9.4vw, 8.3rem)/1.04 Pinyon, "Snell Roundhand", cursive; margin: .08em 0 .005em; }
h1 span { color: var(--gold); font: italic .65em/0 Georgia, serif; }
.masthead__date { margin: 0; color: var(--gold); font-size: clamp(.9rem, 1.9vw, 1.08rem); letter-spacing: .04em; }
.masthead__date span { padding: 0 .35em; }

.experience {
  --card-w: min(23vw, 32svh, 282px);
  width: min(100%, 980px);
  margin: 0 auto;
  position: relative;
}
.stage { position: relative; isolation: isolate; }
.cards {
  display: grid;
  position: relative;
  z-index: 2;
  grid-template-columns: repeat(3, minmax(0, var(--card-w)));
  justify-content: center;
  align-items: start;
  gap: clamp(15px, 2.8vw, 36px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.card { min-width: 0; }
.card__action { display: block; position: relative; color: var(--olive); text-decoration: none; cursor: zoom-in; }
.card__action img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--ivory);
  border: 1px solid #90734950;
  border-radius: 2px;
  box-shadow: 0 12px 24px -13px #4e381e79, 0 3px 8px #4e381e22;
  transition: box-shadow .25s ease;
}
.card__action:hover img { box-shadow: 0 14px 28px -12px #4e381ea0, 0 3px 9px #4e381e26; }
.card__caption {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  width: fit-content; margin: 7px auto 0; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--ivory);
  font-size: clamp(.79rem, 1.4vw, .98rem); text-align: center;
}
.card__caption span { color: var(--gold); font: 600 .64rem/1 system-ui, sans-serif; letter-spacing: .06em; }
.card[inert] { visibility: hidden; }

.mail {
  display: none;
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 73%;
  translate: -50% -50%;
  width: min(32vw, calc(var(--card-w) * 1.5), 430px);
  aspect-ratio: 1.61;
  perspective: 850px;
  pointer-events: none;
}
[data-phase] .mail { display: block; }
[data-phase="ready"] .mail__flap { transition: none; }
.mail__back, .mail__front, .mail__flap, .mail__flights { position: absolute; inset: 0; }
.mail__back {
  z-index: 0;
  background: linear-gradient(140deg, #939775, #69704d 73%);
  border-radius: 4px;
  border: 1px solid #545a3a;
  box-shadow: 0 24px 42px -20px #3e342b94, 0 4px 11px #352c2333;
}
.mail__front {
  z-index: 3;
  border-radius: 0 0 4px 4px;
  clip-path: polygon(0 0, 50% 61%, 100% 0, 100% 100%, 0 100%);
  background:
    linear-gradient(31deg, transparent 49.65%, #51563f91 50%, transparent 50.35%) left bottom / 50% 100% no-repeat,
    linear-gradient(-31deg, transparent 49.65%, #51563f91 50%, transparent 50.35%) right bottom / 50% 100% no-repeat,
    linear-gradient(155deg, #909575, #777d5b 67%, #828765);
  border: 1px solid #61674a;
}
.mail__flap {
  z-index: 4;
  height: 67%;
  transform-origin: top center;
  background: linear-gradient(154deg, #a8ac8b, #898f69 80%);
  clip-path: polygon(0 0, 100% 0, 100% 1.5%, 53% 97%, 51.5% 99.5%, 48.5% 99.5%, 47% 97%, 0 1.5%);
  border-top: 1px solid #b2b593;
  transition: transform .85s var(--ease);
}
.mail.is-open .mail__flap { transform: rotateX(178deg); }
.mail.is-open .mail__flap.behind { z-index: 1; background: linear-gradient(0deg, #666e49, #929873); }
.mail__seal {
  z-index: 5;
  position: absolute;
  left: 50%;
  top: 60%;
  translate: -50% -50%;
  display: grid;
  place-items: center;
  width: 15%;
  aspect-ratio: 1;
  border-radius: 48% 51% 43% 49%;
  color: #6b4a21;
  background: radial-gradient(ellipse at 43% 34%, #e5c58b 30%, #c59957 72%, #a57136);
  border: 1px solid #b88c50;
  box-shadow: 0 3px 7px #43362355, inset 0 0 0 3px #f4d79a70, inset 0 0 0 5px #91632f40;
  transition: opacity .22s, transform .22s;
}
.mail__back::after, .mail__front::after, .mail__flap::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: var(--paper) repeat 0 0 / 410px auto; opacity: .37; mix-blend-mode: multiply;
}
.mail__seal svg { width: 57%; height: 57%; }
.mail.is-open .mail__seal { opacity: 0; transform: scale(.72); }
.mail__flights { z-index: 2; }
.stage__flights { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.flight {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  border: 1px solid #90734950;
  border-radius: 2px;
  box-shadow: 0 12px 24px -13px #4e381e79, 0 3px 8px #4e381e22;
  max-width: none;
}

.experience__controls { display: flex; justify-content: center; min-height: 42px; margin-top: 27px; }
.text-button {
  cursor: pointer;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--gold);
  padding: 9px 4px;
  font-size: .9rem;
}
.text-button span { margin: 0 .15em; }
.text-button:hover { border-color: currentColor; }
.lightbox { padding: 0; border: 0; overflow: visible; background: var(--ivory); }
.lightbox::backdrop { background: #252719d9; }
.lightbox__card { position: relative; width: min(90vw, calc(88dvh * 5 / 7), 600px); margin: 0; }
.lightbox img { display: block; width: 100%; height: auto; }
.lightbox__rsvp {
  position: absolute; left: 49.3%; top: 71.5%; translate: -50% -50%;
  width: 55%; height: 8%; min-height: 44px; border-radius: 4px;
}
.lightbox__rsvp::after {
  content: ""; position: absolute; left: 9%; right: 9%; top: calc(50% + clamp(7px, 1.08vw, 12px));
  border-bottom: 1px solid #886021a6;
}
.lightbox__rsvp:hover { background: #ad86331a; }
.lightbox__rsvp:focus-visible { outline-offset: 0; }
.lightbox__close {
  position: absolute; z-index: 1; top: 8px; right: 8px; border: 1px solid var(--line);
  border-radius: 50%; width: 42px; height: 42px; background: var(--ivory); color: var(--olive);
  font: 1.65rem/1 system-ui, sans-serif; cursor: pointer;
}

@media (max-width: 700px) {
  .invitation { padding: 32px 14px 22px; }
  .masthead { margin-bottom: 25px; }
  .masthead__ornament { margin-bottom: 12px; }
  .eyebrow { max-width: 245px; letter-spacing: .14em; font-size: .61rem; }
  h1 { font-size: clamp(2rem, 12.5vw, 5.4rem); margin: .14em 0 .13em; white-space: nowrap; }
  .top-left, .top-right { width: clamp(98px, 25vw, 175px); }
  .bottom-left, .bottom-right { width: clamp(103px, 30vw, 210px); }
  .experience { --card-w: min(36vw, 150px); }
  .cards { grid-template-columns: repeat(2, minmax(0, var(--card-w))); gap: 14px; }
  #rsvp { grid-column: 1 / -1; width: var(--card-w); justify-self: center; }
  .mail { top: calc(var(--card-w) * 1.4 + 22px); width: min(76vw, 320px); }
  .card__caption { font-size: .76rem; gap: .33rem; }
  .experience__controls { margin-top: 12px; }
}

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

@media (prefers-reduced-motion: no-preference) {
  .lightbox[open] { animation: lightbox-enter 360ms cubic-bezier(.2,.72,.25,1) both; }
  .lightbox[open]::backdrop { animation: lightbox-dim 320ms ease-out both; }
}

@keyframes lightbox-enter {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes lightbox-dim {
  from { opacity: 0; }
  to { opacity: 1; }
}

.experience__controls { gap: 16px; flex-wrap: wrap; }

.mail-trigger {
  position: absolute; z-index: 4; left: 50%; top: 73%; translate: -50% -50%;
  padding: 11px 18px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--ivory); box-shadow: 0 3px 9px #33230b40;
  color: var(--olive); cursor: pointer; white-space: nowrap;
}
.mail-trigger span { padding-left: .35em; color: var(--gold); }
@media (max-width: 700px) {
  .mail-trigger { top: calc(var(--card-w) * 1.4 + 22px); }
}
[data-phase="playing"]:has(.mail-trigger:not([hidden])) #music-toggle { display: none; }
