:root {
  --paper: #fff9ef;
  --paper-deep: #f7efe2;
  --sage: #8da06e;
  --sage-dark: #536544;
  --sage-soft: #dfe8cf;
  --sage-pale: #eef4e4;
  --pink: #e8a1b2;
  --pink-soft: #f8dce3;
  --ink: #424338;
  --muted: #7d786b;
  --line-green: rgba(141, 160, 110, 0.38);
  --line-pink: rgba(232, 161, 178, 0.36);
  --shadow: 0 22px 68px rgba(66, 67, 56, 0.16);
  --script: "Marck Script", "Segoe Print", "Comic Sans MS", cursive;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  margin: 0;
  min-height: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 2%, rgba(248, 220, 227, 0.72), transparent 320px),
    radial-gradient(circle at 96% 4%, rgba(223, 232, 207, 0.8), transparent 340px),
    linear-gradient(180deg, #fffefd 0%, #fbf5eb 52%, #f1e8d9 100%);
  font-family: var(--serif);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.2;
  background-image: radial-gradient(rgba(83, 101, 68, 0.15) 0.7px, transparent 0.7px);
  background-size: 17px 17px;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    url("./assets/botanical-sprig-soft.png"),
    url("./assets/botanical-sprig-soft-mirror.png");
  background-repeat: no-repeat;
  background-position:
    left -72px top 7vh,
    right -82px bottom 3vh;
  background-size:
    clamp(220px, 28vw, 360px) auto,
    clamp(210px, 26vw, 340px) auto;
}

body.intro-playing {
  overflow: hidden;
}

.intro-envelope {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 0;
  background: transparent;
  transition: opacity 700ms ease, visibility 700ms ease;
}

.intro-envelope::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 255, 255, 0.86), transparent 290px),
    radial-gradient(circle at 80% 86%, rgba(232, 161, 178, 0.12), transparent 300px),
    linear-gradient(180deg, #fbf6ea 0%, #eadbc8 100%);
  opacity: 1;
  pointer-events: none;
}

.intro-envelope.is-opening {
  animation: letterOpenAway 1450ms linear forwards;
}

.intro-envelope.is-opening::before {
  animation: introBackdropFade 1300ms cubic-bezier(0.22, 0.7, 0.22, 1) forwards;
}

.intro-envelope.is-opening .wax-seal {
  animation: clickedSeal 420ms cubic-bezier(0.22, 0.7, 0.22, 1) forwards;
}

.intro-envelope.is-opening .letter-paper {
  animation: paperUnfold 1450ms linear forwards;
}

.intro-envelope.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.letter-screen {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: min(100%, 540px);
  min-height: 100svh;
  padding: 0;
  perspective: 1800px;
  perspective-origin: 50% 44%;
}

.letter-paper {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100svh;
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow:
    0 28px 70px rgba(66, 67, 56, 0.2),
    inset 0 0 0 1px rgba(255, 255, 250, 0.74);
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

.letter-paper::before,
.letter-paper::after {
  content: "";
  position: absolute;
  inset: 0;
  display: block;
  border: 0;
  border-radius: 0;
  pointer-events: none;
}

.letter-paper::before {
  z-index: 3;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.06), rgba(239, 224, 199, 0.08)),
    url("./assets/envelope-embossed.png") center / cover no-repeat;
  opacity: 1;
}

.letter-paper::after {
  z-index: 2;
  background:
    radial-gradient(ellipse at 50% 49%, rgba(255, 253, 248, 0.28), transparent 34%),
    linear-gradient(180deg, rgba(255, 253, 248, 0.08), rgba(232, 161, 178, 0.06));
  opacity: 0;
}

.intro-envelope.is-opening .letter-paper::before {
  animation: closedEnvelopeAway 440ms ease-out forwards;
}

.intro-envelope.is-opening .letter-paper::after {
  animation: invitationWindowGlow 900ms ease 220ms forwards;
}

.intro-kicker {
  position: absolute;
  top: clamp(42px, 8vh, 70px);
  left: 50%;
  z-index: 8;
  margin: 0;
  color: rgba(83, 101, 68, 0.38);
  font-family: var(--serif);
  font-size: clamp(1.18rem, 4.6vw, 1.56rem);
  font-weight: 600;
  text-align: center;
  transform: translateX(-50%);
  opacity: 0;
}

.envelope-flap {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background: url("./assets/envelope-embossed-open.png") center / cover no-repeat;
  transform-style: preserve-3d;
  backface-visibility: visible;
}

.envelope-flap::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background-image:
    radial-gradient(circle, rgba(116, 101, 76, 0.035) 0 0.45px, transparent 0.75px),
    radial-gradient(ellipse at 28% 18%, rgba(255, 255, 255, 0.45), transparent 30%),
    radial-gradient(ellipse at 72% 82%, rgba(141, 160, 110, 0.08), transparent 32%);
  background-size:
    12px 14px,
    auto,
    auto;
}

.envelope-flap-top {
  z-index: 6;
  clip-path: polygon(0 0, 100% 0, 50% 50%);
  transform-origin: 50% 0;
  filter: drop-shadow(0 12px 14px rgba(66, 67, 56, 0.16));
}

.envelope-flap-top::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background:
    linear-gradient(27deg, transparent 0 49.58%, rgba(255, 255, 255, 0.8) 49.74% 49.92%, rgba(132, 115, 86, 0.5) 50.08% 50.2%, transparent 50.42%),
    linear-gradient(153deg, transparent 0 49.58%, rgba(255, 255, 255, 0.8) 49.74% 49.92%, rgba(132, 115, 86, 0.5) 50.08% 50.2%, transparent 50.42%);
  opacity: 0.3;
}

.envelope-flap-left {
  z-index: 4;
  clip-path: polygon(0 0, 50% 50%, 0 100%);
  transform-origin: 0 50%;
  filter: drop-shadow(10px 0 12px rgba(66, 67, 56, 0.12));
}

.envelope-flap-right {
  z-index: 4;
  clip-path: polygon(100% 0, 50% 50%, 100% 100%);
  transform-origin: 100% 50%;
  filter: drop-shadow(-10px 0 12px rgba(66, 67, 56, 0.12));
}

.envelope-flap-bottom {
  z-index: 5;
  clip-path: polygon(0 100%, 50% 50%, 100% 100%);
  transform-origin: 50% 100%;
  filter: drop-shadow(0 -10px 12px rgba(66, 67, 56, 0.14));
}

.intro-envelope.is-opening .envelope-flap-top {
  animation: openTopEnvelopeFlap 960ms cubic-bezier(0.22, 0.7, 0.22, 1) 160ms forwards;
}

.intro-envelope.is-opening .envelope-flap-left {
  animation: openLeftEnvelopeFlap 960ms cubic-bezier(0.22, 0.7, 0.22, 1) 160ms forwards;
}

.intro-envelope.is-opening .envelope-flap-right {
  animation: openRightEnvelopeFlap 960ms cubic-bezier(0.22, 0.7, 0.22, 1) 160ms forwards;
}

.intro-envelope.is-opening .envelope-flap-bottom {
  animation: openBottomEnvelopeFlap 960ms cubic-bezier(0.22, 0.7, 0.22, 1) 160ms forwards;
}

.wax-seal {
  position: absolute;
  left: 50%;
  top: 51%;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 1vw, 6px);
  width: clamp(112px, 29vw, 136px);
  height: clamp(112px, 29vw, 136px);
  min-height: 0;
  margin: 0;
  padding: 0;
  color: #fffdf8;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 238, 244, 0.76), transparent 19px),
    radial-gradient(circle at 74% 28%, rgba(255, 229, 237, 0.24), transparent 13px),
    radial-gradient(circle at 33% 74%, rgba(196, 91, 122, 0.16), transparent 20px),
    radial-gradient(circle at 68% 76%, rgba(127, 45, 71, 0.2), transparent 35px),
    radial-gradient(circle at 50% 50%, transparent 0 45%, rgba(255, 230, 238, 0.28) 46% 47%, transparent 48% 55%, rgba(120, 43, 68, 0.16) 56% 57%, transparent 58%),
    repeating-radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.065) 0 1px, transparent 1.5px 7px),
    linear-gradient(135deg, #f5c8d4 0%, #df8ea7 48%, #c97891 100%);
  border: 8px solid rgba(255, 249, 225, 0.94);
  border-radius: 47% 53% 51% 49% / 52% 46% 54% 48%;
  box-shadow:
    0 18px 34px rgba(151, 67, 92, 0.28),
    0 0 0 9px rgba(255, 249, 225, 0.44),
    inset 0 2px 7px rgba(255, 255, 255, 0.46),
    inset 0 0 0 2px rgba(151, 67, 92, 0.22),
    inset 0 -18px 26px rgba(117, 43, 68, 0.2);
  font-family: var(--script);
  font-size: clamp(2.08rem, 8.6vw, 2.86rem);
  font-style: normal;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  outline: none;
  overflow: visible;
  transform: translate(-50%, -50%);
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.wax-seal::before,
.wax-seal::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.wax-seal::before {
  inset: -9px -7px -8px -10px;
  border: 1px solid rgba(255, 253, 248, 0.58);
  border-radius: 54% 46% 49% 51% / 44% 58% 42% 56%;
  background:
    radial-gradient(circle at 16% 54%, rgba(232, 161, 178, 0.36) 0 9px, transparent 10px),
    radial-gradient(circle at 81% 63%, rgba(205, 119, 144, 0.32) 0 8px, transparent 9px),
    radial-gradient(circle at 56% 96%, rgba(205, 119, 144, 0.28) 0 7px, transparent 8px),
    radial-gradient(circle at 48% 48%, transparent 0 64%, rgba(255, 231, 239, 0.42) 65% 66%, rgba(122, 41, 67, 0.14) 67% 68%, transparent 69%);
  box-shadow:
    inset 0 0 0 1px rgba(151, 67, 92, 0.15),
    0 4px 10px rgba(151, 67, 92, 0.2);
}

.wax-seal::after {
  inset: 15px;
  border: 1px solid rgba(255, 222, 232, 0.34);
  border-radius: 52% 48% 49% 51% / 46% 56% 44% 54%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 238, 244, 0.16), transparent 16px),
    radial-gradient(circle at 68% 76%, rgba(116, 42, 68, 0.12), transparent 18px),
    radial-gradient(circle at 50% 50%, transparent 0 55%, rgba(255, 232, 239, 0.3) 56% 57%, rgba(112, 36, 61, 0.13) 58% 59%, transparent 60%),
    radial-gradient(ellipse at 50% 52%, rgba(117, 43, 68, 0.12), transparent 44%);
  box-shadow:
    inset 0 2px 4px rgba(255, 227, 236, 0.34),
    inset 0 -2px 6px rgba(112, 36, 61, 0.13);
}

.wax-seal span,
.wax-seal small {
  position: relative;
  z-index: 1;
  color: rgba(190, 82, 116, 0.64);
  mix-blend-mode: normal;
  opacity: 1;
  text-shadow:
    0 -1.6px 1.2px rgba(97, 30, 54, 0.42),
    0 1.6px 1.4px rgba(255, 232, 240, 0.72),
    1px 0 1px rgba(255, 240, 246, 0.24),
    -1px 0 1px rgba(105, 35, 60, 0.16);
}

.wax-seal span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.82em;
  height: 0.84em;
  overflow: hidden;
  transform: translateY(-0.02em);
}

.wax-seal:hover,
.wax-seal:focus-visible {
  transform: translate(-50%, -53%) translateZ(24px) scale(1.035);
  box-shadow:
    0 24px 42px rgba(151, 67, 92, 0.34),
    0 0 0 10px rgba(223, 232, 207, 0.54),
    inset 0 0 0 2px rgba(151, 67, 92, 0.22),
    inset 0 -16px 24px rgba(151, 67, 92, 0.18);
}

.wax-seal small {
  width: 0.2em;
  margin-top: -0.04em;
  color: rgba(190, 82, 116, 0.54);
  font-family: var(--serif);
  font-size: 0.22em;
  font-style: normal;
  font-weight: 700;
}

.seal-hint {
  position: absolute;
  top: calc(51% + 104px);
  left: 50%;
  z-index: 8;
  margin: 0;
  color: rgba(83, 101, 68, 0.68);
  font-family: var(--script);
  font-size: clamp(1.35rem, 5vw, 1.9rem);
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity 700ms ease, transform 700ms ease;
}

.intro-envelope.show-seal-hint .seal-hint {
  opacity: 1;
  transform: translate(-50%, 0);
}

.intro-envelope.is-opening .seal-hint {
  opacity: 0;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 430px);
  margin: 0 auto;
  padding: 8px 12px 34px;
  opacity: 0;
  transform: translateY(18px);
}

body.invitation-open .page-shell {
  animation: pageArrive 820ms cubic-bezier(0.22, 0.7, 0.22, 1) 220ms forwards;
}

.hero-card,
.panel {
  position: relative;
  overflow: hidden;
  background-image:
    var(--panel-sprig, linear-gradient(transparent, transparent)),
    radial-gradient(circle at 78% 0%, rgba(223, 232, 207, 0.52), transparent 220px),
    radial-gradient(circle at 14% 14%, rgba(248, 220, 227, 0.36), transparent 230px),
    linear-gradient(180deg, rgba(255, 249, 239, 0.98), rgba(255, 249, 239, 0.95));
  background-repeat: no-repeat;
  background-position:
    var(--panel-sprig-position, right -100px top 34px),
    center,
    center,
    center;
  background-size:
    var(--panel-sprig-size, 220px auto),
    auto,
    auto,
    auto;
  border: 1px solid rgba(207, 198, 177, 0.8);
  box-shadow: var(--shadow);
}

.hero-card {
  --panel-sprig: url("./assets/botanical-sprig-soft-mirror.png");
  --panel-sprig-position: right -116px top 168px;
  --panel-sprig-size: 230px auto;
  min-height: 0;
  border-radius: 16px 16px 8px 8px;
  text-align: center;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 9px;
  pointer-events: none;
  border: 1px solid var(--line-green);
  border-radius: 12px;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: 18px;
  pointer-events: none;
  border: 1px solid rgba(232, 161, 178, 0.22);
  border-radius: 10px;
}

.script-title {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(100%, 320px);
  margin: 40px auto 0;
  font-family: var(--script);
  font-size: clamp(4.1rem, 18vw, 5.25rem);
  line-height: 0.72;
  letter-spacing: 0;
  transform: rotate(-6deg);
  animation: titleFloatIn 900ms ease 2820ms both;
}

body.invitation-open .script-title {
  animation: titleFloatIn 760ms ease 120ms both;
}

.script-title span:first-child {
  justify-self: start;
  color: var(--sage);
}

.script-title span:last-child {
  justify-self: end;
  margin-top: 10px;
  color: var(--pink);
}

.doodle {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  font-family: var(--script);
}

.heart {
  color: var(--pink);
  font-size: 2.2rem;
  line-height: 1;
  animation: heartFloat 3600ms ease-in-out infinite;
}

.heart-one {
  top: 118px;
  left: 28px;
  transform: rotate(-18deg);
}

.heart-two {
  top: 92px;
  right: 34px;
  color: var(--sage);
  transform: rotate(15deg);
  animation-delay: -1300ms;
}

.heart-three {
  top: 238px;
  left: 36px;
  color: var(--sage);
  transform: rotate(18deg);
  animation-delay: -800ms;
}

.heart-four {
  top: 224px;
  right: 30px;
  font-size: 1.8rem;
  transform: rotate(-12deg);
  animation-delay: -1800ms;
}

.heart-five {
  top: 326px;
  right: 60px;
  font-size: 1.5rem;
  color: var(--pink);
  transform: rotate(18deg);
  animation-delay: -500ms;
}

.kids {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0;
  margin-top: 28px;
  animation: softRise 900ms ease 3020ms both;
}

body.invitation-open .kids {
  animation: softRise 720ms ease 260ms both;
}

.kid-card {
  position: relative;
  width: 132px;
}

.kid-card.groom {
  z-index: 2;
  transform: rotate(-1deg) translateX(22px);
}

.kid-card.bride {
  z-index: 1;
  transform: rotate(1deg) translateX(-22px);
}

.kid-label {
  position: absolute;
  top: -27px;
  z-index: 5;
  display: inline-block;
  color: var(--sage-dark);
  font-family: var(--script);
  font-size: 1.38rem;
  line-height: 1;
  white-space: nowrap;
}

.groom .kid-label {
  left: 2px;
  transform: rotate(-13deg);
}

.bride .kid-label {
  right: -6px;
  transform: rotate(9deg);
}

.kid-photo {
  position: relative;
  display: grid;
  place-items: center;
  height: 164px;
  overflow: hidden;
  color: rgba(83, 101, 68, 0.78);
  background:
    linear-gradient(180deg, rgba(248, 220, 227, 0.76), rgba(239, 244, 228, 0.86)),
    radial-gradient(circle at 50% 14%, rgba(255, 255, 255, 0.72), transparent 74px);
  border: 5px solid #fffdf8;
  border-radius: 64px 64px 18px 18px;
  outline: 3px solid var(--pink);
  font-family: var(--script);
  font-size: 1.22rem;
  line-height: 1;
  box-shadow: 0 16px 28px rgba(66, 67, 56, 0.12);
}

.kid-photo::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  height: 28px;
  background: linear-gradient(135deg, rgba(83, 101, 68, 0.05), rgba(255, 255, 255, 0.18));
}

.kid-portrait {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: saturate(0.94) contrast(1.02);
}

.groom-portrait {
  position: absolute;
  left: 50%;
  bottom: -2px;
  width: 166px;
  height: 202px;
  transform: translateX(-50%) scaleX(-1);
  transform-origin: center bottom;
  filter: saturate(0.94) contrast(1.02) drop-shadow(0 8px 10px rgba(66, 67, 56, 0.1));
}

.bride-portrait {
  position: absolute;
  left: 50%;
  bottom: -2px;
  width: 134px;
  height: 168px;
  transform: translateX(-50%) scaleX(-1);
  transform-origin: center bottom;
  filter: saturate(0.98) contrast(1) drop-shadow(0 8px 10px rgba(66, 67, 56, 0.1));
}

.groom .kid-photo {
  height: 174px;
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: 0;
  outline: 0;
  box-shadow: none;
}

.groom .kid-photo::after {
  display: none;
}

.bride .kid-photo {
  height: 174px;
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: 0;
  outline: 0;
  box-shadow: none;
}

.bride .kid-photo::after {
  display: none;
}

.brush-label {
  position: relative;
  z-index: 4;
  width: 208px;
  margin: -18px auto 12px;
  padding: 8px 18px 9px;
  color: #fffdf8;
  background: var(--sage);
  border-radius: 5px 14px 6px 12px;
  font-family: var(--script);
  font-size: 1.44rem;
  line-height: 1;
  box-shadow: 0 10px 18px rgba(83, 101, 68, 0.23);
  transform: rotate(-1deg);
  animation: ribbonPop 760ms cubic-bezier(0.2, 1.4, 0.24, 1) 3320ms both;
}

body.invitation-open .brush-label {
  animation: ribbonPop 640ms cubic-bezier(0.2, 1.4, 0.24, 1) 480ms both;
}

.hero-card h1 {
  position: relative;
  z-index: 2;
  width: min(100% - 30px, 400px);
  margin: 0 auto 16px;
  color: var(--sage-dark);
  font-family: var(--script);
  font-size: clamp(1.55rem, 6vw, 2.25rem);
  font-weight: 400;
  line-height: 1;
  white-space: normal;
  overflow-wrap: break-word;
  text-wrap: balance;
  animation: softRise 820ms ease 3440ms both;
}

.hero-card h1::after {
  content: "";
  display: block;
  width: 142px;
  height: 32px;
  margin: 4px auto 0;
  background:
    url("./assets/floral-divider.png") center / 92px auto no-repeat,
    linear-gradient(90deg, transparent, rgba(141, 160, 110, 0.62)) left center / 38px 1px no-repeat,
    linear-gradient(90deg, rgba(141, 160, 110, 0.62), transparent) right center / 38px 1px no-repeat;
}

body.invitation-open .hero-card h1 {
  animation: softRise 680ms ease 560ms both;
}

.countdown {
  position: relative;
  z-index: 2;
  margin: 24px 16px 16px;
  padding: 22px 4px 25px;
  background: linear-gradient(90deg, transparent, rgba(255, 253, 248, 0.72) 18%, rgba(255, 253, 248, 0.72) 82%, transparent);
  border-top: 1px solid rgba(141, 160, 110, 0.24);
  border-bottom: 1px solid rgba(232, 161, 178, 0.22);
}

.countdown::before,
.countdown::after {
  content: none;
}

.countdown h2 {
  margin: 0 0 10px;
  font-size: clamp(1.75rem, 7.4vw, 2.35rem);
}

.countdown h2::after {
  width: 156px;
  height: 34px;
  margin-top: 3px;
  background-size:
    100px auto,
    40px 1px,
    40px 1px;
}

.timer {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.timer div {
  min-width: 0;
  padding: 12px 4px 9px;
  text-align: center;
  background: rgba(255, 253, 248, 0.78);
  border: 1px solid rgba(141, 160, 110, 0.32);
  border-radius: 10px;
  animation: timerPop 640ms cubic-bezier(0.2, 1.28, 0.26, 1) both;
}

.timer div:nth-child(1) {
  animation-delay: 4100ms;
}

body.invitation-open .timer div:nth-child(1) {
  animation-delay: 1080ms;
}

.timer div:nth-child(2) {
  animation-delay: 4200ms;
}

body.invitation-open .timer div:nth-child(2) {
  animation-delay: 1160ms;
}

.timer div:nth-child(3) {
  animation-delay: 4300ms;
}

body.invitation-open .timer div:nth-child(3) {
  animation-delay: 1240ms;
}

.timer div:nth-child(4) {
  animation-delay: 4400ms;
}

body.invitation-open .timer div:nth-child(4) {
  animation-delay: 1320ms;
}

.timer strong {
  display: block;
  color: var(--pink);
  font-size: clamp(2.15rem, 9.6vw, 2.85rem);
  font-weight: 600;
  line-height: 0.9;
}

.timer span {
  color: var(--ink);
  font-size: 0.9rem;
}

.panel {
  margin-top: 12px;
  padding: 26px 18px;
  border-radius: 8px;
}

.reveal {
  opacity: 0;
  transform: translateY(34px) scale(0.985);
  transition:
    opacity 760ms ease,
    transform 760ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.form-panel {
  --panel-sprig: url("./assets/botanical-sprig-soft-mirror.png");
  --panel-sprig-position: right -122px top 54px;
  --panel-sprig-size: 220px auto;
  overflow: visible;
}

.panel::before,
.panel::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 5px;
}

.panel::before {
  inset: 8px;
  border: 1px solid var(--line-green);
}

.panel::after {
  inset: 14px;
  border: 1px solid var(--line-pink);
}

h2 {
  position: relative;
  z-index: 1;
  margin: 0 0 18px;
  color: var(--sage-dark);
  font-family: var(--serif);
  font-size: clamp(2.25rem, 9vw, 3rem);
  font-weight: 600;
  line-height: 0.95;
  text-align: center;
  letter-spacing: 0;
}

h2::after {
  content: "";
  display: block;
  width: 174px;
  height: 38px;
  margin: 5px auto 0;
  background:
    url("./assets/floral-divider.png") center / 112px auto no-repeat,
    linear-gradient(90deg, transparent, rgba(141, 160, 110, 0.62)) left center / 46px 1px no-repeat,
    linear-gradient(90deg, rgba(141, 160, 110, 0.62), transparent) right center / 46px 1px no-repeat;
}

.invite {
  --panel-sprig: url("./assets/botanical-sprig-soft.png");
  --panel-sprig-position: left -112px bottom -38px;
  --panel-sprig-size: 220px auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 108px;
  gap: 14px;
  align-items: center;
}

.invite-text,
.date-card,
.location > *,
.program > *,
.form-panel > * {
  position: relative;
  z-index: 1;
}

.invite h2 {
  grid-column: 1;
  text-align: center;
}

.invite p {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.48;
  text-align: center;
}

.signature {
  color: var(--sage-dark);
  font-family: var(--script);
  font-size: 1.22rem !important;
}

.date-card {
  display: grid;
  justify-items: center;
  padding-left: 14px;
  border-left: 1px solid rgba(207, 198, 177, 0.9);
  text-align: center;
}

.date-card span {
  color: var(--sage-dark);
  font-size: 1.04rem;
  line-height: 1.05;
}

.date-card strong {
  color: var(--pink);
  font-size: 5rem;
  font-weight: 500;
  line-height: 0.84;
}

.date-card small {
  margin-top: 8px;
  color: var(--pink);
  font-family: var(--script);
  font-size: 1.6rem;
}

.location {
  --panel-sprig: url("./assets/botanical-sprig-soft-mirror.png");
  --panel-sprig-position: right -116px bottom -46px;
  --panel-sprig-size: 225px auto;
  text-align: center;
}

.program {
  --panel-sprig: url("./assets/botanical-sprig-soft.png");
  --panel-sprig-position: left -126px center;
  --panel-sprig-size: 230px auto;
}

.location-photo {
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(141, 160, 110, 0.34);
  border-radius: 14px;
}

.location-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

.venue {
  margin: 16px 0 4px;
  color: var(--sage-dark);
  font-size: 1.12rem;
}

.venue-name {
  color: var(--pink);
  font-weight: 600;
}

.address {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.42;
}

.map-button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 43px;
  border-radius: 7px;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.map-button {
  gap: 12px;
  width: min(100%, 292px);
  min-height: 54px;
  margin-top: 17px;
  padding: 0 24px;
  color: var(--sage-dark);
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(249, 246, 236, 0.92));
  border: 2px solid rgba(141, 160, 110, 0.82);
  border-radius: 9px;
  box-shadow:
    inset 0 0 0 3px rgba(255, 253, 248, 0.86),
    0 3px 0 rgba(83, 101, 68, 0.14),
    0 9px 18px rgba(66, 67, 56, 0.08);
  font-family: var(--serif);
  font-size: 1.22rem;
  font-weight: 600;
  transition:
    color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.map-button:hover {
  color: #48583b;
  border-color: var(--sage-dark);
  box-shadow:
    inset 0 0 0 3px rgba(255, 253, 248, 0.9),
    0 3px 0 rgba(83, 101, 68, 0.18),
    0 12px 22px rgba(66, 67, 56, 0.11);
  transform: translateY(-1px);
}

.map-button:focus-visible {
  outline: 3px solid rgba(232, 161, 178, 0.44);
  outline-offset: 3px;
}

.map-pin {
  position: relative;
  width: 18px;
  height: 22px;
  flex: 0 0 18px;
}

.map-pin::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--sage);
  border-radius: 50% 50% 50% 0;
  box-shadow: 0 2px 4px rgba(83, 101, 68, 0.2);
  transform: rotate(-45deg);
}

.map-pin::after {
  content: "";
  position: absolute;
  top: 5px;
  left: 6px;
  width: 6px;
  height: 6px;
  background: var(--paper);
  border-radius: 50%;
}

.timeline {
  position: relative;
  display: grid;
  width: min(100%, 338px);
  gap: 12px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 8px;
  width: 2px;
  background: linear-gradient(var(--pink), var(--sage));
}

.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 18px 62px minmax(0, 1fr);
  gap: 14px;
  align-items: baseline;
  font-size: clamp(1.08rem, 4.5vw, 1.22rem);
  line-height: 1.05;
  opacity: 0;
  transform: translateX(-14px);
  transition: opacity 520ms ease, transform 520ms ease;
}

.program.is-visible .timeline li {
  opacity: 1;
  transform: translateX(0);
}

.program.is-visible .timeline li:nth-child(1) {
  transition-delay: 120ms;
}

.program.is-visible .timeline li:nth-child(2) {
  transition-delay: 210ms;
}

.program.is-visible .timeline li:nth-child(3) {
  transition-delay: 300ms;
}

.program.is-visible .timeline li:nth-child(4) {
  transition-delay: 390ms;
}

.program.is-visible .timeline li:nth-child(5) {
  transition-delay: 480ms;
}

.program.is-visible .timeline li:nth-child(6) {
  transition-delay: 570ms;
}

.timeline li::before {
  content: "";
  position: absolute;
  top: 0.24em;
  left: 0;
  width: 16px;
  height: 16px;
  background: var(--sage);
  border: 3px solid var(--paper);
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(141, 160, 110, 0.28);
}

.timeline li:nth-child(odd)::before {
  background: var(--pink);
}

.timeline time {
  grid-column: 2;
  color: var(--sage-dark);
  font-variant-numeric: tabular-nums;
}

.timeline span {
  grid-column: 3;
}

form {
  display: grid;
  gap: 10px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

label span,
.field-caption,
legend {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.85rem;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.82);
  border: 1px solid rgba(141, 160, 110, 0.42);
  border-radius: 7px;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 0.92rem;
  font-weight: 500;
  outline: none;
}

textarea {
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: rgba(83, 101, 68, 0.42);
  opacity: 1;
}

input[name="phone"]::placeholder {
  color: rgba(83, 101, 68, 0.32);
  font-weight: 400;
}

input[name="phone"] {
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 0.94rem;
  font-weight: 500;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(232, 161, 178, 0.2);
}

input.is-invalid,
select.is-invalid,
textarea.is-invalid,
.select-trigger.is-invalid {
  border-color: rgba(232, 161, 178, 0.82);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.94), rgba(248, 220, 227, 0.18));
  box-shadow: 0 0 0 3px rgba(232, 161, 178, 0.18);
}

.select-field {
  position: relative;
}

.select-field.is-open {
  z-index: 10;
}

.select-trigger {
  position: relative;
  width: 100%;
  min-height: 38px;
  margin: 0;
  padding: 8px 36px 8px 10px;
  justify-content: flex-start;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.82);
  border: 1px solid rgba(141, 160, 110, 0.42);
  border-radius: 9px;
  box-shadow: none;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.1;
  text-align: left;
}

.select-trigger.has-value {
  color: var(--ink);
}

.select-trigger::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--sage-dark);
  border-bottom: 2px solid var(--sage-dark);
  transform: translateY(-65%) rotate(45deg);
  transition: transform 160ms ease;
}

.select-field.is-open .select-trigger {
  border-color: var(--pink);
  border-radius: 9px 9px 6px 6px;
  box-shadow: 0 0 0 3px rgba(232, 161, 178, 0.16);
}

.select-field.is-open .select-trigger::after {
  transform: translateY(-28%) rotate(225deg);
}

.select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 5px);
  display: none;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(255, 249, 239, 0.98));
  border: 1px solid rgba(141, 160, 110, 0.36);
  border-radius: 10px;
  box-shadow: 0 16px 34px rgba(66, 67, 56, 0.16);
}

.select-field.is-open .select-menu {
  display: grid;
}

.select-menu button {
  width: 100%;
  min-height: 38px;
  margin: 0;
  padding: 9px 12px;
  justify-content: flex-start;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.1;
  text-align: left;
}

.select-menu button:hover,
.select-menu button:focus,
.select-menu button[aria-selected="true"] {
  color: var(--sage-dark);
  background: rgba(248, 220, 227, 0.34);
}

fieldset {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin: 0;
  padding: 0;
  border: 0;
}

fieldset label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 0.92rem;
}

input[type="checkbox"] {
  width: 17px;
  height: 17px;
  min-height: 0;
  accent-color: var(--sage);
}

button {
  width: min(100%, 270px);
  margin: 6px auto 0;
  padding: 0 18px;
  color: #fffdf8;
  background: linear-gradient(135deg, var(--sage), #789164);
  border: 0;
  box-shadow: 0 12px 24px rgba(83, 101, 68, 0.2);
}

.form-note {
  min-height: 20px;
  margin: 0;
  color: var(--sage-dark);
  font-size: 0.9rem;
  text-align: center;
}

.form-note-error,
.form-note-success {
  width: min(100%, 310px);
  margin: 2px auto 0;
  padding: 9px 12px;
  border-radius: 10px;
  line-height: 1.35;
}

.form-note-error {
  color: #8b6270;
  background: rgba(248, 220, 227, 0.46);
  border: 1px solid rgba(232, 161, 178, 0.36);
}

.form-note-success {
  color: var(--sage-dark);
  background: rgba(223, 232, 207, 0.52);
  border: 1px solid rgba(141, 160, 110, 0.32);
}

@media (min-width: 760px) {
  body {
    padding: 24px 0;
  }

  .page-shell {
    width: min(100%, 1040px);
    padding: 0 24px 60px;
  }

  .letter-screen,
  .letter-paper {
    width: 100vw;
  }

  .hero-card {
    width: 100%;
    min-height: 1020px;
    margin: 0 auto;
  }

  .script-title {
    width: min(100%, 440px);
    margin-top: 58px;
    font-size: clamp(4.8rem, 8vw, 6.2rem);
  }

  .kids {
    margin-top: 50px;
    transform: scale(1.55);
    transform-origin: center bottom;
  }

  .brush-label {
    width: 300px;
    margin-top: -22px;
    font-size: 1.9rem;
  }

  .hero-card h1 {
    width: min(100% - 40px, 520px);
    margin-bottom: 20px;
    font-size: clamp(2.2rem, 4vw, 3.2rem);
  }

  .countdown {
    width: min(100% - 54px, 540px);
    margin: 34px auto 24px;
  }

  .invite p {
    font-size: 1.08rem;
    line-height: 1.55;
  }

  .signature {
    font-size: 1.4rem !important;
  }

  .date-card span {
    font-size: 1.16rem;
  }

  .date-card strong {
    font-size: 5.6rem;
  }

  .date-card small {
    font-size: 1.75rem;
  }

  .venue {
    font-size: 1.22rem;
  }

  .address {
    font-size: 1.04rem;
  }

  .timeline {
    width: min(100%, 470px);
  }

  .timeline li {
    grid-template-columns: 18px 74px minmax(0, 1fr);
    font-size: 1.16rem;
  }

  label span,
  .field-caption,
  legend {
    font-size: 0.96rem;
  }

  input,
  select,
  textarea,
  .select-trigger,
  .select-menu button {
    font-size: 1rem;
  }

  fieldset label {
    font-size: 1rem;
  }

  .form-note {
    font-size: 0.98rem;
  }
}

@media (min-width: 920px) {
  .page-shell {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: stretch;
  }

  .page-shell > .hero-card,
  .page-shell > .invite,
  .page-shell > .form-panel {
    grid-column: 1 / -1;
  }

  .page-shell > .panel {
    margin-top: 0;
  }
}

@media (max-width: 380px) {
  body::after {
    background-position:
      left -146px top 10vh,
      right -150px bottom 4vh;
    background-size:
      220px auto,
      220px auto;
  }

  .hero-card,
  .panel {
    --panel-sprig-size: 190px auto;
  }

  .hero-card h1 {
    width: min(100% - 24px, 360px);
    font-size: clamp(1.5rem, 7.2vw, 1.95rem);
  }

  .page-shell {
    padding-inline: 6px;
  }

  .script-title {
    width: 292px;
    font-size: 3.65rem;
  }

  .kid-card {
    width: 120px;
  }

  .kid-photo {
    height: 150px;
  }

  .groom .kid-photo {
    height: 160px;
  }

  .groom-portrait {
    width: 154px;
    height: 190px;
  }

  .bride .kid-photo {
    height: 160px;
  }

  .bride-portrait {
    width: 124px;
    height: 158px;
  }

  .invite {
    grid-template-columns: 1fr;
  }

  .date-card {
    padding: 14px 0 0;
    border-left: 0;
    border-top: 1px solid rgba(207, 198, 177, 0.9);
  }

  .field-grid,
  fieldset {
    grid-template-columns: 1fr;
  }
}

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

  .page-shell,
  .reveal,
  .timeline li {
    transform: none;
  }

  body.invitation-open .page-shell,
  .reveal.is-visible,
  .timeline li {
    opacity: 1;
  }
}

@keyframes letterOpenAway {
  0% {
    opacity: 1;
    visibility: visible;
  }
  90% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    visibility: hidden;
  }
}

@keyframes paperUnfold {
  0% {
    transform: none;
    filter: blur(0);
  }
  100% {
    transform: none;
    filter: blur(0);
  }
}

@keyframes clickedSeal {
  0% {
    transform: translate(-50%, -50%) translateZ(0) scale(1);
    opacity: 1;
  }
  24% {
    transform: translate(-50%, -50%) scale(0.94);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -54%) scale(1.04);
    opacity: 0;
  }
}

@keyframes introBackdropFade {
  0%, 14% {
    opacity: 1;
  }
  55% {
    opacity: 0.28;
  }
  100% {
    opacity: 0;
  }
}

@keyframes closedEnvelopeAway {
  0%, 34% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
    transform: none;
  }
}

@keyframes invitationWindowGlow {
  0% {
    opacity: 0;
  }
  28% {
    opacity: 0.1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes openTopEnvelopeFlap {
  0% {
    transform: rotateX(0deg);
    opacity: 1;
  }
  88% {
    transform: rotateX(-82deg);
    opacity: 1;
  }
  100% {
    transform: rotateX(-89.5deg);
    opacity: 0;
  }
}

@keyframes openLeftEnvelopeFlap {
  0% {
    transform: rotateY(0deg);
    opacity: 1;
  }
  88% {
    transform: rotateY(82deg);
    opacity: 1;
  }
  100% {
    transform: rotateY(89.5deg);
    opacity: 0;
  }
}

@keyframes openRightEnvelopeFlap {
  0% {
    transform: rotateY(0deg);
    opacity: 1;
  }
  88% {
    transform: rotateY(-82deg);
    opacity: 1;
  }
  100% {
    transform: rotateY(-89.5deg);
    opacity: 0;
  }
}

@keyframes openBottomEnvelopeFlap {
  0% {
    transform: rotateX(0deg);
    opacity: 1;
  }
  88% {
    transform: rotateX(82deg);
    opacity: 1;
  }
  100% {
    transform: rotateX(89.5deg);
    opacity: 0;
  }
}

@keyframes introText {
  0%,
  18% {
    opacity: 0;
    transform: translateY(8px);
  }
  34%,
  74% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@keyframes envelopeLift {
  0% {
    transform: translateY(18px) rotateX(10deg) scale(0.96);
  }
  24% {
    transform: translateY(0) rotateX(0) scale(1);
  }
  78% {
    transform: translateY(0) rotateX(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-36px) rotateX(0) scale(1.03);
    opacity: 0;
  }
}

@keyframes flapLeftOpen {
  0%,
  30% {
    transform: rotateY(0);
  }
  72%,
  100% {
    transform: rotateY(-66deg);
  }
}

@keyframes flapRightOpen {
  0%,
  30% {
    transform: rotateY(0);
  }
  72%,
  100% {
    transform: rotateY(66deg);
  }
}

@keyframes flapBottomOpen {
  0%,
  38% {
    transform: rotateX(0);
  }
  78%,
  100% {
    transform: rotateX(-46deg);
  }
}

@keyframes sealOpen {
  0%,
  28% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
  52% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.12) rotate(-8deg);
  }
  76%,
  100% {
    opacity: 0;
    transform: translate(-50%, -86%) scale(0.72) rotate(18deg);
  }
}

@keyframes cardPeek {
  0%,
  34% {
    opacity: 0;
    transform: translate(-50%, 42px) scale(0.96);
  }
  72% {
    opacity: 1;
    transform: translate(-50%, -44px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -96px) scale(1.03);
  }
}

@keyframes pageArrive {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes titleFloatIn {
  from {
    opacity: 0;
    transform: translateY(28px) rotate(-6deg) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(-6deg) scale(1);
  }
}

@keyframes softRise {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ribbonPop {
  from {
    opacity: 0;
    transform: translateY(14px) rotate(-1deg) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(-1deg) scale(1);
  }
}

@keyframes timerPop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes heartFloat {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -8px;
  }
}
