/* Eron & Leona — old-money lace envelope → letterpress invitation */
:root {
  --ivory: #f4efe4;
  --ivory-hi: #fbf8f1;
  --ink: #2b2925;
  --ink-2: #4f4a43;
  --ink-3: #6b655c;
  --gold: #a08455;
  --gold-soft: rgba(160, 132, 85, 0.55);
  --meadow: #3d4636;
  --serif: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --sc: "Cormorant SC", "Cormorant Garamond", Garamond, serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.25, 1.25, 0.4, 1);
  --press: 0 1px 0 rgba(255, 255, 255, 0.75), 0 -0.5px 0 rgba(58, 48, 32, 0.14);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; background: var(--meadow); }
body {
  font-family: var(--serif);
  color: var(--ink);
  background: var(--meadow);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.is-closed { overflow: hidden; height: 100svh; }
img { display: block; max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--ivory); color: var(--ink); padding: 0.6rem 1rem; }
.skip:focus { left: 0.5rem; top: 0.5rem; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.lang {
  position: fixed; z-index: 60;
  top: calc(var(--safe-t) + 0.7rem); right: 0.8rem;
  min-width: 44px; min-height: 44px; padding: 0 0.6rem;
  font: 500 0.95rem/1 var(--sc); letter-spacing: 0.14em;
  color: var(--ivory-hi); background: rgba(30, 32, 26, 0.28);
  border: 1px solid rgba(251, 248, 241, 0.35); border-radius: 999px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  cursor: pointer; transition: color .3s, background .3s, border-color .3s;
}
body.is-page .lang { position: absolute; color: var(--ink); background: rgba(244, 239, 228, 0.82); border-color: rgba(43, 41, 37, 0.2); }

/* ───────── 1 · scene ───────── */
.scene { position: fixed; inset: 0; z-index: 20; overflow: hidden; background: var(--meadow); }
.scene-bg, .scene-bg img { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene-bg img { object-fit: cover; object-position: 60% 50%; transform: scale(1.04); transition: transform 2.6s var(--ease-out), filter 1.6s ease; }
.scene-veil {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120% 70% at 50% 55%, rgba(0,0,0,0) 40%, rgba(18, 20, 14, 0.35) 100%),
    linear-gradient(180deg, rgba(20, 22, 16, 0.12), rgba(20, 22, 16, 0) 30%, rgba(20, 22, 16, 0.18));
}
.is-opening .scene-bg img { transform: scale(1.1); filter: blur(2px) brightness(0.92); }

.env-wrap {
  --w: min(86vw, 600px, calc((100svh - 140px) / 1.05));
  position: absolute; left: 50%; top: 60%;
  width: var(--w); aspect-ratio: 984 / 690;
  transform: translate(-50%, -50%);
  transition: transform 1.3s var(--ease-out), opacity .9s ease;
}
.is-rising .env-wrap { transform: translate(-50%, -32%); }
.is-leaving .env-wrap { transform: translate(-50%, -26%) scale(1.06); transition: transform 1.4s var(--ease-out); }
.is-leaving .scene-bg img { filter: blur(8px) brightness(.8); }

.env { position: relative; width: 100%; height: 100%; animation: float 7s ease-in-out infinite; }
.is-opening .env { animation: none; }
@keyframes float { 50% { transform: translateY(-4px) rotate(-0.25deg); } }
.env-cast {
  position: absolute; left: 4%; right: 4%; top: 12%; bottom: -6%;
  background: radial-gradient(60% 55% at 50% 60%, rgba(10, 14, 6, 0.42), rgba(10, 14, 6, 0) 70%);
  filter: blur(14px); transform: translateY(6%);
}
.lyr { position: absolute; left: 0; top: 0; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.closed { z-index: 7; }
.flap {
  z-index: 6; transform-origin: 50% 2.61%;
  transform: perspective(1800px) rotateX(0deg);
  backface-visibility: hidden; will-change: transform;
  transition: transform .62s cubic-bezier(.55, .05, .75, .45);
}
.shadow { z-index: 5; transition: opacity .5s ease; }
.pocket { z-index: 4; filter: drop-shadow(0 -1px 1.5px rgba(40, 34, 22, 0.16)); }
.inside { z-index: 1; }
.flapback {
  z-index: 2; top: -71.45%; height: 74.64%;
  transform-origin: 50% 99.2%;
  transform: perspective(1800px) rotateX(-90deg);
  visibility: hidden; will-change: transform;
  transition: transform .9s var(--ease-spring);
  filter: drop-shadow(0 -2px 3px rgba(0,0,0,.12));
}
.is-opening .closed { opacity: 0; }
.is-flap .flap { transform: perspective(1800px) rotateX(90deg); }
.is-flap .shadow { opacity: 0; }
.is-flapback .flap { visibility: hidden; }
.is-flapback .flapback { visibility: visible; transform: perspective(1800px) rotateX(0deg); }

/* card inside the envelope */
.card {
  position: absolute; z-index: 3; left: 7%; width: 86%; top: 6%; height: 84%;
  container-type: inline-size;
  background: var(--ivory-hi) url(paper.webp) center / 320px;
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 -6px 18px -10px rgba(40, 32, 18, 0.25);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 13cqw; text-align: center;
  transform: translateY(0); will-change: transform;
  transition: transform 1.35s var(--ease-out);
}
.is-rising .card { transform: translateY(-64%); }
.card-lace { position: absolute; left: 0; right: 0; top: 0; height: 9cqw; background: url(lace.webp) repeat-x 0 0 / auto 100%; opacity: .95; }
.card-mono { margin: 0; font: 500 4.2cqw/1 var(--sc); letter-spacing: .3em; color: var(--gold); }
.card-mono i, .card-names i { font-style: italic; font-family: var(--serif); }
.card-names { margin: 3.4cqw 0 0; font: 500 9.4cqw/1 var(--serif); color: var(--ink); text-shadow: var(--press); }
.card-date { margin: 3cqw 0 0; font: 500 3.6cqw/1 var(--sc); letter-spacing: .22em; color: var(--ink-2); }

/* seal */
.seal {
  position: absolute; z-index: 8; left: 50.7%; top: 66%;
  width: 15.5%; aspect-ratio: 327 / 360; transform: translate(-50%, -50%);
  padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
}
.seal::before { /* expanded hit area, min 44px */
  content: ""; position: absolute; inset: -40%; border-radius: 50%;
}
.seal::after {
  content: ""; position: absolute; inset: -14%; border-radius: 50%;
  border: 1px solid rgba(251, 248, 241, 0.7); opacity: 0;
  animation: ping 2.8s ease-out 1.2s infinite;
}
.is-opening .seal::after { animation: none; opacity: 0; }
@keyframes ping { 0% { transform: scale(.9); opacity: .0; } 25% { opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
.seal-half {
  position: absolute; inset: 0; background: url(seal.webp) center / 100% 100% no-repeat;
  filter: drop-shadow(0 2px 2px rgba(40, 30, 16, 0.28)) drop-shadow(0 6px 8px rgba(40, 30, 16, 0.12));
  transition: transform .55s var(--ease-out), opacity .45s ease .25s;
}
.seal-l { clip-path: polygon(0 0, 54% 0, 47% 14%, 56% 27%, 45% 41%, 55% 55%, 46% 70%, 53% 84%, 48% 100%, 0 100%); }
.seal-r { clip-path: polygon(54% 0, 100% 0, 100% 100%, 48% 100%, 53% 84%, 46% 70%, 55% 55%, 45% 41%, 56% 27%, 47% 14%); }
.seal:active .seal-half { transform: scale(.97); }
.is-opening .seal-l { transform: translate(-9%, 7%) rotate(-11deg); opacity: 0; }
.is-opening .seal-r { transform: translate(10%, 9%) rotate(9deg); opacity: 0; }
.is-opening .seal { pointer-events: none; }

.hint {
  position: absolute; left: 0; right: 0; bottom: calc(var(--safe-b) + 7svh); margin: 0;
  text-align: center; font: italic 400 1.35rem/1 var(--serif); letter-spacing: .04em;
  color: var(--ivory-hi); text-shadow: 0 1px 12px rgba(0,0,0,.35);
  transition: opacity .4s ease;
}
.is-opening .hint { opacity: 0; }

/* ───────── 2 · invitation ───────── */
.invite {
  position: relative; z-index: 10; min-height: 100svh;
  opacity: 0; visibility: hidden;
  padding: 0 0 calc(var(--safe-b) + 0px);
}
.invite::before { /* meadow behind the sheet on wide screens */
  content: ""; position: fixed; inset: 0; z-index: -1;
  background: var(--meadow) url(field-480.webp) center / cover;
  filter: blur(18px) brightness(.62) saturate(.8); transform: scale(1.1);
}
.is-leaving .invite { z-index: 30; visibility: visible; opacity: 1; transition: opacity 1.05s cubic-bezier(.4,0,.2,1) .25s; }
.is-leaving .card { transform: translateY(-64%) scale(1.08); transition: transform 1.2s var(--ease-out); }
.is-page .invite { visibility: visible; opacity: 1; }
.is-page .scene { display: none; }

.sheet {
  position: relative; margin: 0 auto; width: 100%; max-width: 620px;
  background: var(--ivory) url(paper.webp) 0 0 / 320px;
  padding: 0 clamp(36px, 10vw, 76px) 0;
  text-align: center; overflow: hidden;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.55), 0 2px 6px rgba(0,0,0,.18);
}
@media (min-width: 700px) { .sheet { margin: 48px auto 64px; } }
@media (min-aspect-ratio: 1/1) { .invite::before { background-image: url(field-wide.webp); } .scene-bg img { object-position: 50% 50%; } }
.lace { height: clamp(34px, 9vw, 52px); margin: 0 calc(-1 * clamp(36px, 10vw, 76px)); background: url(lace.webp) repeat-x 0 0 / auto 100%; }
.lace-bot { transform: scaleY(-1); margin-top: 56px; }

.vine { position: absolute; top: 60px; bottom: 60px; width: clamp(22px, 6vw, 44px); height: calc(100% - 120px); overflow: visible; fill: none; stroke: var(--ink-3); stroke-width: 0.9; stroke-linecap: round; stroke-linejoin: round; opacity: .75; }
.vine-l { left: clamp(6px, 2vw, 18px); }
.vine-r { right: clamp(6px, 2vw, 18px); transform: scaleX(-1); }

.draw path, .draw circle, .vine path, .vine circle { stroke-dasharray: 1 1; stroke-dashoffset: 1; }
.draw { display: block; fill: none; stroke: var(--ink-3); stroke-width: 1.05; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.draw-gold { stroke: var(--gold); stroke-width: 1.15; }

.sec { position: relative; }
.sec-head { padding-top: 34px; }
.mono-wrap { position: relative; width: 128px; height: 128px; margin: 0 auto 26px; }
.wreath { position: absolute; inset: 0; width: 100%; height: 100%; }
.mono { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; font: 500 2.1rem/1 var(--serif); letter-spacing: .04em; color: var(--ink); text-shadow: var(--press); }
.mono span { font-style: italic; color: var(--gold); margin: 0 .12em; font-size: .8em; }
.greet { margin: 0; font: italic 400 1.35rem/1.4 var(--serif); color: var(--ink-2); }
.lead { margin: .6rem auto 0; max-width: 30ch; font: 400 1.15rem/1.6 var(--serif); color: var(--ink-2); text-wrap: balance; }
.names {
  margin: 1.6rem 0 0; font: 500 clamp(3.1rem, 14vw, 4.6rem)/0.95 var(--serif); letter-spacing: -0.005em;
  color: var(--ink); text-shadow: var(--press); display: flex; flex-direction: column; align-items: center;
}
.names .amp { font-style: italic; font-weight: 400; font-size: .55em; color: var(--gold); margin: .12em 0 .08em; }

.filigree { width: min(78%, 300px); height: auto; margin: 40px auto; }
.label { margin: 0; font: 500 .95rem/1 var(--sc); letter-spacing: .26em; color: var(--ink-3); }
.label-gap { margin-top: 34px; }
.day { margin: 14px 0 0; font: italic 400 1.3rem/1 var(--serif); color: var(--ink-2); }
.date { margin: 10px 0 0; display: flex; justify-content: center; align-items: center; gap: .55rem; font: 500 clamp(2.4rem, 10vw, 3.1rem)/1 var(--serif); font-variant-numeric: lining-nums tabular-nums; color: var(--ink); text-shadow: var(--press); }
.date .rule { width: 18px; height: 1px; background: var(--gold); }
.time { margin: 14px 0 0; font: 500 1.05rem/1 var(--sc); letter-spacing: .2em; color: var(--ink-2); }
.venue { margin: 12px 0 0; font: 500 2rem/1.1 var(--serif); color: var(--ink); text-shadow: var(--press); }
.city { margin: 4px 0 0; font: italic 400 1.2rem/1.3 var(--serif); color: var(--ink-2); }
.link {
  display: inline-flex; align-items: center; min-height: 44px; margin-top: 6px; padding: 0 4px;
  font: 500 .98rem/1 var(--sc); letter-spacing: .16em; color: var(--ink);
  text-decoration: underline; text-decoration-color: var(--gold-soft); text-underline-offset: 6px; text-decoration-thickness: 1px;
}
.link:hover { text-decoration-color: var(--gold); }

.photo { position: relative; margin: 52px auto 10px; width: min(100%, 380px); }
.photo-print {
  background: var(--ivory-hi); padding: 10px 10px 12px; transform: rotate(-1.4deg);
  box-shadow: 0 1px 1px rgba(40,30,16,.12), 0 14px 30px -14px rgba(30, 24, 12, 0.45);
}
.photo-print img { width: 100%; height: auto; aspect-ratio: 864 / 1152; object-fit: cover; filter: contrast(.98); }
.photo-lace { position: absolute; width: 96px; height: 30px; background: url(lace.webp) repeat-x 0 0 / auto 100%; filter: drop-shadow(0 1px 1px rgba(40,30,16,.25)); }
.pl-1 { left: -24px; top: 14px; transform: rotate(-44deg); }
.pl-2 { right: -26px; bottom: 32px; transform: rotate(136deg); }
.photo figcaption { margin-top: 18px; font: 500 .9rem/1 var(--sc); letter-spacing: .3em; color: var(--ink-3); }

.sec-prog { padding-top: 46px; }
.lily { width: 64px; height: auto; margin: 0 auto 10px; }
.title { margin: 0; font: 500 1.7rem/1.2 var(--serif); color: var(--ink); text-shadow: var(--press); }
.prog { list-style: none; margin: 22px auto 0; padding: 0; max-width: 360px; text-align: left; }
.prog li { display: flex; align-items: baseline; gap: 10px; padding: 9px 0; font-size: 1.15rem; line-height: 1.35; }
.prog .t { font: 500 1.05rem/1 var(--serif); font-variant-numeric: lining-nums tabular-nums; color: var(--gold); min-width: 3.1em; }
.prog .dots { flex: 1; border-bottom: 1px dotted rgba(43, 41, 37, 0.38); transform: translateY(-4px); min-width: 16px; }
.prog .e { color: var(--ink); text-align: right; }

.sec-count { padding-top: 4px; }
.count { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; max-width: 380px; margin: 22px auto 0; }
.count > div { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 0; border-left: 1px solid rgba(160,132,85,.35); }
.count > div:first-child { border-left: 0; }
.count .n { font: 500 clamp(1.9rem, 8vw, 2.4rem)/1 var(--serif); font-variant-numeric: lining-nums tabular-nums; color: var(--ink); text-shadow: var(--press); }
.count .u { font: 500 .82rem/1 var(--sc); letter-spacing: .16em; color: var(--ink-3); }

.sec-rsvp { padding-top: 52px; display: flex; flex-direction: column; align-items: center; }
.note { margin: 8px 0 0; font: italic 400 1.15rem/1.5 var(--serif); color: var(--ink-2); }
.btn {
  margin-top: 24px; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 30px; border-radius: 2px;
  font: 500 1.05rem/1 var(--sc); letter-spacing: .16em; color: var(--ivory-hi); text-decoration: none;
  background: var(--ink);
  box-shadow: inset 0 0 0 3px var(--ink), inset 0 0 0 4px rgba(160, 132, 85, 0.75), 0 8px 18px -10px rgba(20, 16, 8, .55);
  transition: transform .2s ease, background .2s ease;
}
.btn:hover { background: #3a3732; }
.btn:active { transform: translateY(1px); }
.sec-rsvp .link { margin-top: 12px; }

.sec-close { padding-top: 56px; }
.lily-c { width: 74px; }
.sign { margin: 6px 0 0; font: italic 400 1.3rem/1.3 var(--serif); color: var(--ink-2); }
.sign-names { margin: 6px 0 0; font: 500 2.2rem/1.1 var(--serif); color: var(--ink); text-shadow: var(--press); }
.sign-names i { color: var(--gold); font-weight: 400; }

@media (prefers-reduced-motion: reduce) {
  .env { animation: none; }
  .seal::after { animation: none; }
  .draw path, .draw circle, .vine path, .vine circle { stroke-dashoffset: 0 !important; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
.card > * { transition: opacity .35s ease; }
.is-leaving .card > * { opacity: 0; }
.draw path, .draw circle { transition: stroke-dashoffset .9s cubic-bezier(.3,.6,.3,1); }
.wreath path, .wreath circle { transition: stroke-dashoffset 2.2s cubic-bezier(.4,.1,.3,1) calc(var(--i, 0) * 70ms + .3s); }
.vine { visibility: hidden; }
.vines-ready .vine { visibility: visible; }
@media (prefers-reduced-motion: reduce) { .draw path, .draw circle, .vine path, .vine circle { transition: none !important; } }
#invite:focus { outline: none; }
