@font-face { font-family: "Pinyon Script"; src: url(/fonts/pinyon-script-latin-400-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Cormorant"; font-weight: 400; src: url(/fonts/cormorant-garamond-latin-400-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Cormorant"; font-weight: 400; font-style: italic; src: url(/fonts/cormorant-garamond-latin-400-italic.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Cormorant"; font-weight: 500; src: url(/fonts/cormorant-garamond-latin-500-normal.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Cormorant"; font-weight: 500; font-style: italic; src: url(/fonts/cormorant-garamond-latin-500-italic.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Cormorant"; font-weight: 600; src: url(/fonts/cormorant-garamond-latin-600-normal.woff2) format("woff2"); font-display: swap; }

:root {
  --forest: #12301f;
  --forest-deep: #0a1f13;
  --pine: #1d4a30;
  --ivory: #fbf7ec;
  --ivory-2: #f4eddb;
  --ink: #1f2a22;
  --muted: #5d665c;
  --gold: #b8913f;
  --gold-lt: #dcc283;
  --gold-dk: #8a6a2a;
  --red: #8f1a22;
  --red-dk: #6d1219;
  --script: "Pinyon Script", "Snell Roundhand", cursive;
  --serif: "Cormorant", "Cormorant Garamond", Garamond, "Times New Roman", serif;
  --ease: cubic-bezier(.22,.8,.24,1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.45;
  color: var(--ink);
  background:
    radial-gradient(120% 70% at 50% -10%, #23503a 0%, transparent 60%),
    radial-gradient(90% 60% at 50% 110%, #0a1c11 0%, transparent 70%),
    var(--forest);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }

/* ================= Envelope stage ================= */
.stage {
  position: fixed; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 28px; padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  transition: opacity .8s ease, transform .9s var(--ease);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.stage.gone { opacity: 0; transform: scale(1.04); pointer-events: none; }
.stage-eyebrow {
  margin: 0; color: var(--gold-lt); text-align: center;
  font-style: italic; font-size: 20px; letter-spacing: .02em;
  opacity: 0; animation: rise 1.2s .2s var(--ease) forwards;
}
.stage-hint { margin: 0; height: 24px; }
.stage-hint span {
  display: inline-block; color: var(--ivory); opacity: 0;
  font-size: 14px; letter-spacing: .32em; text-transform: uppercase;
  animation: rise 1s .9s var(--ease) forwards, breathe 2.6s 2s ease-in-out infinite;
}
.stage.opening .stage-hint, .stage.opening .stage-eyebrow { opacity: 0; transition: opacity .3s; animation: none; }

.env {
  --w: min(84vw, 380px);
  position: relative; width: var(--w); height: calc(var(--w) * .68);
  border: 0; padding: 0; background: none; cursor: pointer;
  perspective: 1400px; -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 22px 30px rgba(0,0,0,.45));
  opacity: 0; animation: drop 1.1s .35s var(--ease) forwards, bob 5s 1.6s ease-in-out infinite;
}
.env:focus-visible { outline: 2px solid var(--gold-lt); outline-offset: 10px; border-radius: 6px; }
.env > span { position: absolute; display: block; }

.env-back {
  inset: 0; border-radius: 6px;
  background:
    repeating-linear-gradient(135deg, rgba(220,194,131,.22) 0 2px, transparent 2px 11px),
    linear-gradient(#c6a258, #9d7a35);
}
.env-card {
  left: 6%; right: 6%; top: 5%; height: 92%;
  background: var(--ivory); border-radius: 3px;
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
  transition: transform 1s var(--ease);
  z-index: 2;
}
.env-card-inner {
  position: absolute; inset: 7px; border: 1px solid var(--gold);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 7%;
}
.env-card-inner::after { content: ""; position: absolute; inset: 3px; border: .5px solid rgba(184,145,63,.6); }
.mini-script { font-family: var(--script); color: var(--pine); font-size: calc(var(--w) * .095); line-height: 1.05; }
.mini-caps { margin-top: 6px; font-size: calc(var(--w) * .03); letter-spacing: .25em; text-transform: uppercase; color: var(--gold-dk); }

.env-pocket {
  inset: 0; z-index: 3; border-radius: 6px;
  background:
    linear-gradient(to top right, transparent 49.6%, rgba(0,0,0,.18) 50%, transparent 51.5%) left/50.2% 100% no-repeat,
    linear-gradient(to top left, transparent 49.6%, rgba(0,0,0,.18) 50%, transparent 51.5%) right/50.2% 100% no-repeat,
    linear-gradient(170deg, #a1222b, var(--red) 55%, var(--red-dk));
  clip-path: polygon(0 0, 50% 52%, 100% 0, 100% 100%, 0 100%);
}
.env-flap {
  left: 0; right: 0; top: 0; height: 60%; z-index: 4;
  transform-origin: 50% 0; transform-style: preserve-3d;
  transition: transform .8s cubic-bezier(.5,.1,.3,1);
}
.flap-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.flap-front {
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: linear-gradient(180deg, #a82530, var(--red) 70%, #7c161d);
}
.flap-front::after { /* soft edge shadow */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.08), transparent 30%);
}
.flap-back {
  transform: rotateX(180deg);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background:
    repeating-linear-gradient(135deg, rgba(255,246,214,.35) 0 2px, transparent 2px 11px),
    linear-gradient(#d8b96c, #b08a3e);
}
.env-seal {
  width: 23%; aspect-ratio: 1; left: 38.5%; top: calc(60% - 15%); z-index: 6;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.35));
  transition: transform .45s var(--ease), opacity .4s;
}
.env-seal svg { width: 100%; height: 100%; display: block; }

.env.open { animation: none; opacity: 1; cursor: default; }
.env.open .env-seal { transform: scale(1.25) rotate(-12deg); opacity: 0; }
.env.open .env-flap { transform: rotateX(180deg); transition-delay: .25s; }
.env.flap-behind .env-flap { z-index: 1; }
.env.card-out .env-card { transform: translateY(-58%); }

@keyframes drop { from { opacity: 0; transform: translateY(-30px) rotate(-3deg); } to { opacity: 1; transform: none; } }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-6px) rotate(.6deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%,100% { opacity: .55; } 50% { opacity: 1; } }

/* ================= Invitation ================= */
.invite {
  position: relative; z-index: 2;
  width: 100%; max-width: 520px; margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 16px calc(40px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 22px;
}
.invite.reveal { animation: reveal 1.1s var(--ease) both; }
@keyframes reveal { from { opacity: 0; transform: translateY(24px) scale(.98); } to { opacity: 1; transform: none; } }

.card {
  position: relative;
  background:
    radial-gradient(120% 90% at 20% 0%, #fffdf6 0%, transparent 60%),
    radial-gradient(100% 80% at 100% 100%, var(--ivory-2) 0%, transparent 70%),
    var(--ivory);
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, 0 18px 40px -12px rgba(0,0,0,.55), 0 2px 6px rgba(0,0,0,.2);
}
.card-hero { padding: 12px; }
.card-border {
  position: relative; text-align: center;
  border: 1.5px solid var(--gold);
  padding: 22px 18px 28px;
}
.card-border::before { content: ""; position: absolute; inset: 5px; border: 1px solid rgba(184,145,63,.55); pointer-events: none; }

.holly { width: 150px; height: auto; display: block; margin: 0 auto 2px; }

.title {
  margin: 4px 0 14px; font-family: var(--script); font-weight: 400; color: var(--pine);
  line-height: .95; font-size: clamp(54px, 15.5vw, 74px);
}
.title span { display: block; }
.title span + span { margin-top: 4px; }

.hosted { margin: 0; color: var(--muted); font-size: 18px; }
.caps { margin: 2px 0 0; text-transform: uppercase; letter-spacing: .28em; font-weight: 600; font-size: 14.5px; }
.hosts { color: var(--red); }

.rule + .label + .detail-link { margin-top: 0; }
.rule { display: flex; align-items: center; gap: 12px; margin: 22px auto; width: 78%; color: var(--gold); font-size: 13px; }
.rule::before, .rule::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--gold) 30%, var(--gold) 70%, transparent); }

.label { margin: 0 0 6px; text-transform: uppercase; letter-spacing: .34em; font-size: 12.5px; font-weight: 600; color: var(--gold-dk); }
.detail { display: block; margin: 0; font-size: 23px; font-weight: 500; line-height: 1.3; }
.detail-sub { margin: 2px 0 0; font-style: italic; font-size: 20px; color: #3f4a41; }
.detail-link { display: inline; text-decoration: none; padding-bottom: 2px; background-image: linear-gradient(var(--gold-lt), var(--gold-lt)); background-size: 100% 1px; background-repeat: no-repeat; background-position: 0 100%; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.message { margin: 0 auto; max-width: 21em; font-style: italic; font-size: 21px; line-height: 1.4; }
.message-sub { margin: 12px auto 0; max-width: 22em; font-style: italic; font-size: 18px; line-height: 1.4; color: var(--muted); }
.reply-by { margin: 18px 0 0; line-height: 1.7; text-transform: uppercase; letter-spacing: .22em; font-size: 13px; font-weight: 600; color: var(--red); }

.actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px;
  padding: 0 18px; border-radius: 999px; border: 1px solid transparent; cursor: pointer;
  font-family: var(--serif); font-weight: 600; font-size: 14px; letter-spacing: .16em; text-transform: uppercase;
  text-decoration: none; transition: transform .15s, box-shadow .2s, background .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.btn-gold { color: #fff; background: linear-gradient(180deg, #c9a24f, #a37f35); box-shadow: 0 6px 16px -6px rgba(138,106,42,.7), inset 0 1px 0 rgba(255,255,255,.3); }
.btn-red { color: #fff; background: linear-gradient(180deg, #a3232c, var(--red-dk)); box-shadow: 0 6px 16px -6px rgba(109,18,25,.7), inset 0 1px 0 rgba(255,255,255,.2); }
.btn-ghost { color: var(--pine); border-color: var(--gold); background: transparent; }
.btn-wide { width: 100%; }
.btn[disabled] { opacity: .6; pointer-events: none; }

.cal { position: relative; }
.cal-menu {
  position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%); z-index: 5;
  min-width: 190px; padding: 6px; background: #fff; border: 1px solid var(--gold-lt); border-radius: 10px;
  box-shadow: 0 12px 30px -8px rgba(0,0,0,.35);
}
.cal-menu a { display: block; padding: 11px 12px; text-decoration: none; font-size: 18px; border-radius: 6px; }
.cal-menu a:active, .cal-menu a:hover { background: var(--ivory-2); }

/* ================= Panels ================= */
.panel { padding: 26px 20px 24px; }
.panel::before { content: ""; position: absolute; inset: 7px; border: 1px solid rgba(184,145,63,.45); border-radius: 2px; pointer-events: none; }
.script-h { margin: 0 0 4px; text-align: center; font-family: var(--script); font-weight: 400; font-size: 44px; line-height: 1.1; color: var(--pine); }
.panel-sub { margin: 0 0 18px; text-align: center; font-style: italic; color: var(--muted); font-size: 18px; }

.form { position: relative; display: grid; gap: 16px; margin-top: 14px; }
.choices { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice span {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 12px 4px 10px; border: 1px solid #d9caa2; border-radius: 10px; background: rgba(255,255,255,.55);
  transition: all .2s;
}
.choice b { font-size: 21px; font-weight: 600; }
.choice small { font-style: italic; font-size: 15px; color: var(--muted); }
.choice input:checked + span { border-color: var(--pine); background: var(--pine); color: var(--ivory); box-shadow: 0 6px 14px -6px rgba(29,74,48,.8); }
.choice input:checked + span small { color: var(--gold-lt); }
.choice input[value="no"]:checked + span { background: #5b625c; border-color: #5b625c; }
.choice input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; letter-spacing: .2em; text-transform: uppercase; font-weight: 600; color: var(--gold-dk); }
.field > span i { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted); font-size: 15px; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 8px; border: 1px solid #d9caa2; background: #fff;
  font: inherit; font-size: 18px; color: var(--ink); /* >=16px avoids iOS zoom */
  transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(220,194,131,.4); }
.field input::placeholder, .field textarea::placeholder { color: #a8a596; font-style: italic; }
.hint { color: var(--muted); font-style: italic; font-size: 15.5px; }

.stepper { display: inline-flex; align-items: center; gap: 4px; justify-self: start; border: 1px solid #d9caa2; border-radius: 999px; background: #fff; padding: 4px; }
.stepper button { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--ivory-2); font-size: 22px; cursor: pointer; color: var(--pine); }
.stepper button:active { background: var(--gold-lt); }
.stepper output { min-width: 44px; text-align: center; font-size: 22px; font-weight: 600; }

.if-coming { display: grid; gap: 16px; }
.form.declined .if-coming { display: none; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-error { margin: 0; color: var(--red); font-size: 17px; text-align: center; }

.rsvp-done { text-align: center; padding: 6px 0 2px; }
.done-msg { margin: 6px 0 18px; font-size: 21px; font-style: italic; }
.done-msg strong { font-style: normal; color: var(--pine); }

/* Guests */
.tally { margin: 0 0 14px; text-align: center; text-transform: uppercase; letter-spacing: .28em; font-size: 13.5px; font-weight: 600; color: var(--red); }
.guests { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; }
.guests li { padding: 7px 0; border-bottom: 1px dotted #d9caa2; font-size: 18px; display: flex; justify-content: space-between; gap: 6px; min-width: 0; }
.guests li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guests li .n { color: var(--gold-dk); font-style: italic; flex: none; }
.guests .empty { grid-column: 1 / -1; justify-content: center; border: 0; font-style: italic; color: var(--muted); }
.maybes { margin: 16px 0 0; text-align: center; font-size: 16.5px; color: var(--muted); font-style: italic; }
@media (max-width: 340px) { .guests { grid-template-columns: 1fr; } }

/* Wall */
.wall-form { margin-bottom: 8px; }
.posts { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 12px; }
.post {
  position: relative; padding: 14px 16px 12px; background: #fff; border-radius: 8px;
  border: 1px solid #ece2c8; box-shadow: 0 4px 10px -8px rgba(0,0,0,.35);
  animation: rise .5s var(--ease) both;
}
.post::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--red); }
.post:nth-child(3n+2)::before { background: var(--pine); }
.post:nth-child(3n+3)::before { background: var(--gold); }
.post p { margin: 0 0 8px; font-size: 19px; white-space: pre-wrap; overflow-wrap: anywhere; }
.post footer { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 15px; color: var(--muted); }
.post footer b { color: var(--ink); font-weight: 600; letter-spacing: .04em; }
.post .del { border: 0; background: none; color: var(--red); font-size: 14px; letter-spacing: .12em; text-transform: uppercase; cursor: pointer; padding: 4px 0 4px 8px; }
.posts .empty { text-align: center; font-style: italic; color: var(--muted); }

.foot { text-align: center; color: var(--gold-lt); padding: 8px 0 12px; }
.script-sm { margin: 0; font-family: var(--script); font-size: 30px; color: var(--ivory); }

.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 20;
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  padding: 12px 20px; border-radius: 999px; background: var(--pine); color: var(--ivory);
  font-size: 17px; box-shadow: 0 10px 24px -8px rgba(0,0,0,.5); border: 1px solid var(--gold);
  transition: all .35s var(--ease); white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
