:root {
  --maroon: #5a1420;
  --maroon-deep: #3d0c15;
  --wine: #7a1f2b;
  --gold: #c9a45c;
  --gold-light: #e3c98f;
  --ivory: #f6ecd9;
  --ivory-dim: #e6d6bb;
  --teal: #1f6f6b;
  --display: "Poiret One", "Didot", Georgia, serif;
  --sans: "Josefin Sans", "Futura", "Century Gothic", Arial, sans-serif;
  /* Faint Art Deco fan-scale pattern */
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='24'%3E%3Cg fill='none' stroke='%23c9a45c' stroke-opacity='.09'%3E%3Cpath d='M0 24a24 24 0 0 1 48 0M8 24a16 16 0 0 1 32 0M16 24a8 8 0 0 1 16 0M-24 12a24 24 0 0 1 48 0M24 12a24 24 0 0 1 48 0'/%3E%3C/g%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--pattern), radial-gradient(ellipse at 50% 0%, var(--wine) 0%, var(--maroon) 600px, var(--maroon-deep) 100%);
  background-color: var(--maroon);
  color: var(--ivory);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.6;
  text-align: center;
}

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }

main {
  max-width: 660px;
  margin: 0 auto;
  padding: 24px 16px 32px;
}

/* ===== Shared motifs ===== */
.toran svg { display: block; transform-origin: 50% 0; animation: sway 5s ease-in-out infinite alternate; }
.page-toran { position: relative; z-index: 1; }
@keyframes sway {
  from { transform: skewX(-1.6deg); }
  to   { transform: skewX(1.6deg); }
}

.divider { width: 220px; max-width: 70%; margin: 22px auto; }
.divider svg { display: block; width: 100%; height: auto; }
.divider.small { width: 150px; margin: 14px auto; }

.diyas { display: flex; justify-content: center; align-items: flex-end; gap: 14px; }
.diya { width: 54px; height: auto; overflow: visible; }
.diyas.small .diya { width: 38px; }
.diya .flame {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: flicker var(--s, 1.5s) ease-in-out var(--d, 0s) infinite alternate;
}
.diya .diya-glow {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: glow var(--s, 1.5s) ease-in-out var(--d, 0s) infinite alternate;
  transition: scale 0.8s ease;
}
@keyframes flicker {
  0%   { transform: scale(1, 1) skewX(0deg); }
  30%  { transform: scale(.94, 1.08) skewX(-4deg); }
  60%  { transform: scale(1.04, .95) skewX(3deg); }
  100% { transform: scale(.97, 1.12) skewX(-2deg); }
}
@keyframes glow {
  from { opacity: .75; }
  to   { opacity: 1; }
}

.elephant svg { display: block; width: 100%; height: auto; overflow: visible; }

/* ===== Gift reveal ===== */
.gift { display: none; }
.js .gift {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--pattern), radial-gradient(ellipse at 50% 45%, var(--wine) 0%, var(--maroon) 50%, var(--maroon-deep) 100%);
  background-color: var(--maroon);
}
.gift[hidden] { display: none !important; }
body.gift-open { overflow: hidden; }
body.gift-open .fade-in { animation-play-state: paused; }
.gift .toran { flex: none; }

.gift-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 16px 16px;
  perspective: 1400px;
}

.card-wrap { position: relative; }

.fan {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 205%;
  translate: -50% -97%;
  z-index: 0;
  pointer-events: none;
  opacity: .95;
}
.fan svg { display: block; width: 100%; height: auto; overflow: visible; }
.fan-inner { transform-box: view-box; transform-origin: 50% 100%; }

.card {
  --band: 30px;
  --band-top: 38%;
  position: relative;
  z-index: 1;
  width: min(74vw, 320px, 44vh);
  aspect-ratio: 3 / 4;
  transform-style: preserve-3d;
  filter: drop-shadow(0 20px 34px rgba(20, 0, 5, 0.55));
}

.card-inside {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--pattern), var(--maroon);
  border: 1px solid var(--gold);
  box-shadow: inset 0 0 0 6px var(--maroon), inset 0 0 0 7px var(--gold);
}
.inside-names {
  margin: 10px 0 0;
  font-family: var(--display);
  font-size: clamp(1.7rem, 7vw, 2.3rem);
  line-height: 1.15;
  color: var(--ivory);
}
.inside-date {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-light);
}

.door {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255,255,255,.35), rgba(255,255,255,0) 45%),
    var(--ivory);
  backface-visibility: hidden;
}
.door-left  { left: 0;  transform-origin: left center; }
.door-right { right: 0; transform-origin: right center; }
/* Gold Deco double frame, split across the two doors */
.door::before,
.door::after {
  content: "";
  position: absolute;
  border: 1px solid var(--gold);
  pointer-events: none;
}
.door-left::before  { inset: 8px 0 8px 8px;  border-right: 0; }
.door-left::after   { inset: 13px 0 13px 13px; border-right: 0; }
.door-right::before { inset: 8px 8px 8px 0;  border-left: 0; }
.door-right::after  { inset: 13px 13px 13px 0; border-left: 0; }

.band {
  position: absolute;
  z-index: 1;
  box-shadow: 0 1px 4px rgba(30, 0, 8, 0.45);
}
.band-h {
  top: var(--band-top);
  height: var(--band);
  left: 0;
  right: 0;
  background: linear-gradient(180deg, #3d0c15, #8c2535 25%, #5a1420 50%, #a63e50 72%, #3d0c15);
  border-top: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
}
.band-v { top: 0; bottom: 0; width: calc(var(--band) / 2); }
.band-v-left  { right: 0; background: linear-gradient(90deg, #3d0c15, #8c2535 55%, #6b1826); border-left: 1px solid var(--gold); }
.band-v-right { left: 0;  background: linear-gradient(90deg, #6b1826, #a63e50 45%, #3d0c15); border-right: 1px solid var(--gold); }

.bow {
  position: absolute;
  left: 50%;
  top: calc(var(--band-top) + var(--band) / 2);
  translate: -50% -50%;
  width: 146px;
  height: 116px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  z-index: 3;
  animation: bow-breathe 2.6s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
}
.bow svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 4px 6px rgba(30, 0, 8, 0.45)); }
.bow:focus-visible { outline: 2px solid var(--gold); outline-offset: 6px; border-radius: 12px; }
.bow.untying { animation: none; }
@keyframes bow-breathe {
  0%, 100% { scale: 1; }
  50% { scale: 1.05; }
}

.for-label {
  position: absolute;
  left: 50%;
  top: 64%;
  translate: -50% 0;
  z-index: 2;
  min-width: 140px;
  margin: 0;
  padding: 10px 22px 8px;
  background: var(--ivory);
  border: 1px solid var(--gold);
  box-shadow: inset 0 0 0 3px var(--ivory), inset 0 0 0 4px var(--gold), 0 4px 12px rgba(30, 0, 8, 0.3);
  font-family: var(--display);
  color: var(--maroon);
  pointer-events: none;
}
.for-label span {
  display: block;
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--wine);
}
.for-label em { font-style: normal; font-size: 2rem; line-height: 1.2; }

.elephant-left,
.elephant-right {
  position: absolute;
  bottom: -14px;
  width: 170px;
  z-index: 2;
  pointer-events: none;
}
.elephant-left  { right: calc(100% - 6px); }
.elephant-right { left: calc(100% - 6px); }

.gift .diyas { margin-top: 22px; position: relative; z-index: 2; }
.gift.lit .diya-glow { scale: 1.6; }

.hint {
  margin: 16px 0 0;
  font-family: var(--display);
  font-size: 1.2rem;
  color: var(--gold-light);
  animation: hint-fade 2.6s ease-in-out infinite;
}
@keyframes hint-fade { 50% { opacity: 0.5; } }
.skip {
  margin-top: 4px;
  padding: 8px 16px;
  border: 0;
  background: none;
  font: 400 0.75rem var(--sans);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ivory-dim);
  cursor: pointer;
}
.skip:hover { color: var(--gold); }

@media (max-width: 760px) {
  /* On phones the elephants stand beside the row of diyas, below the card */
  .elephant-left,
  .elephant-right { width: 76px; bottom: -78px; }
  .elephant-left  { right: auto; left: calc(50% - 50vw + 6px); }
  .elephant-right { left: auto; right: calc(50% - 50vw + 6px); }
  .gift .diyas { margin-top: 30px; gap: 8px; }
  .gift .diya { width: 36px; }
}

/* ===== Hero ===== */
.photo-frame {
  position: relative;
  width: 230px;
  height: 300px;
  margin: 28px auto 34px;
}
.arch-clip {
  position: absolute;
  inset: 0;
  clip-path: url(#arch);
}
.arch-clip img,
.monogram {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.monogram {
  display: none;
  align-items: center;
  justify-content: center;
  padding-top: 30px;
  background: var(--pattern), linear-gradient(170deg, var(--wine), var(--maroon-deep));
  font-family: var(--display);
  font-size: 4.2rem;
  color: var(--gold);
}
.photo-frame.no-photo img { display: none; }
.photo-frame.no-photo .monogram { display: flex; }
.arch-line {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.arch-line path { fill: none; stroke: var(--gold); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.arch-line.outer { inset: -10px; width: calc(100% + 20px); height: calc(100% + 20px); }
.arch-line.outer path { stroke-width: 1; }

.eyebrow {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--gold);
}
h1 {
  margin: 12px 0 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.5rem, 9vw, 4rem);
  line-height: 1.1;
  color: var(--ivory);
}
.date {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ivory);
}
.place {
  margin: 6px 0 0;
  color: var(--gold-light);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.82rem;
}

/* ===== Countdown ===== */
.countdown-section { margin: 52px 0 40px; }
.countdown {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}
.unit {
  min-width: 82px;
  padding: 16px 8px 12px;
  border: 1px solid var(--gold);
  box-shadow: inset 0 0 0 3px var(--maroon), inset 0 0 0 4px rgba(201, 164, 92, 0.55);
  background: rgba(61, 12, 21, 0.55);
}
.unit span {
  display: block;
  font-family: var(--display);
  font-size: 2.4rem;
  line-height: 1;
  color: var(--ivory);
  font-variant-numeric: lining-nums tabular-nums;
}
.unit small {
  display: block;
  margin-top: 8px;
  font-size: 0.66rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold-light);
}
.countdown-done {
  width: 100%;
  margin: 0;
  font-family: var(--display);
  font-size: 2.2rem;
  color: var(--gold);
}

/* ===== Buttons & links ===== */
.btn {
  display: inline-block;
  padding: 14px 34px;
  border: 1px solid var(--gold);
  outline: 1px solid rgba(201, 164, 92, 0.5);
  outline-offset: 3px;
  background: transparent;
  color: var(--gold-light);
  font: 600 0.78rem var(--sans);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.25s, color 0.25s;
}
.btn:hover,
.btn:focus-visible {
  background: var(--gold);
  color: var(--maroon-deep);
}
.btn:disabled { opacity: 0.6; cursor: wait; }
.link {
  display: block;
  margin-top: 16px;
  color: var(--ivory-dim);
  font-size: 0.9rem;
  text-decoration: underline;
  text-decoration-color: rgba(201, 164, 92, 0.6);
  text-underline-offset: 4px;
}
.link:hover { color: var(--gold-light); }

/* ===== RSVP ===== */
.signup {
  margin-top: 72px;
  padding: 48px 24px;
  background: rgba(61, 12, 21, 0.7);
  border: 1px solid var(--gold);
  box-shadow: inset 0 0 0 6px var(--maroon-deep), inset 0 0 0 7px rgba(201, 164, 92, 0.6);
}
h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: 2.3rem;
  color: var(--gold-light);
}
.lede { margin: 8px 0 32px; color: var(--ivory-dim); }

form {
  max-width: 400px;
  margin: 0 auto;
  text-align: left;
}
form label:not(.choice),
fieldset {
  display: block;
  margin-bottom: 22px;
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-light);
}
input[type="text"],
input[type="email"],
textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 2px;
  border: 0;
  border-bottom: 1px solid rgba(201, 164, 92, 0.6);
  background: transparent;
  font: 400 1rem var(--sans);
  color: var(--ivory);
  letter-spacing: normal;
  text-transform: none;
  border-radius: 0;
}
input:focus,
textarea:focus {
  outline: none;
  border-bottom-color: var(--gold-light);
  background: rgba(201, 164, 92, 0.06);
}
textarea { resize: vertical; }
fieldset { border: 0; padding: 0; }
legend { padding: 0; margin-bottom: 8px; }
.choice {
  display: block;
  margin: 8px 0;
  font-size: 1rem;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ivory);
  cursor: pointer;
}
.choice input { accent-color: var(--gold); margin-right: 10px; }
.optional { text-transform: none; letter-spacing: normal; color: var(--ivory-dim); }
form .btn { display: block; margin: 30px auto 0; }
.form-status {
  min-height: 1.5em;
  margin: 16px 0 0;
  text-align: center;
  font-size: 1rem;
  color: var(--ivory);
}
.form-status.error { color: #ffb4a8; }
.hidden-field { display: none; }
.thanks {
  margin: 0 0 24px;
  text-align: center;
  font-family: var(--display);
  font-size: 1.7rem;
  color: var(--gold-light);
}

/* ===== Footer ===== */
footer { padding: 32px 16px 56px; }
.footer-elephants {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
}
.footer-elephants .elephant { width: 110px; flex: none; }
.footer-elephants p {
  margin: 0 0 18px;
  font-family: var(--display);
  font-size: 1.25rem;
  color: var(--gold-light);
}
@media (max-width: 480px) {
  .footer-elephants .elephant { width: 74px; }
  .footer-elephants p { font-size: 1.05rem; }
}

/* ===== Page fade-in ===== */
.fade-in {
  opacity: 0;
  transform: translateY(12px);
  animation: fade 0.9s ease forwards;
}
.fade-in:nth-child(2) { animation-delay: 0.15s; }
.fade-in:nth-child(3) { animation-delay: 0.3s; }
.fade-in:nth-child(4) { animation-delay: 0.45s; }
@keyframes fade {
  to { opacity: 1; transform: none; }
}

@media (max-width: 480px) {
  .photo-frame { width: 200px; height: 262px; }
  .unit { min-width: 66px; }
  .unit span { font-size: 1.9rem; }
  .signup { padding: 40px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .fade-in { animation: none; opacity: 1; transform: none; }
  .bow, .hint, .toran svg, .diya .flame, .diya .diya-glow { animation: none; }
}

#plus-one-group[hidden], [hidden] { display: none !important; }
