/* Invitation openings A/B/C. Only transform and opacity animate; the timeline
   totals ~1s and matches DURATION in invitation-animation.js. */
.io {
  --io-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --io-paper: #f6eee1;
  --io-card: #fffaf2;
  width: min(100%, 22rem);
  margin: 1rem auto 0;
  text-align: center;
}
.io-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.io-stage {
  position: relative;
  overflow: hidden;
  padding: 2.25rem 0.75rem 0.75rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.io[data-state="opening"] .io-stage {
  cursor: default;
  animation: io-stage-out 0.22s ease-in 0.83s both;
}
.io-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.io-controls button + button {
  margin: 0;
}
.io [hidden] {
  display: none !important;
}
.io-controls .io-skip {
  border-color: transparent;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.io-sprig {
  display: block;
  width: 6.5rem;
  height: auto;
  margin: 0.25rem auto;
}
.io-ridge {
  display: block;
  width: 62%;
  height: auto;
  margin: 0 auto 0.35rem;
}
/* Shared card face */
.io-card {
  background: var(--io-card);
  border: 1px solid #d9c7ad;
  box-shadow:
    0 1px 0 #fff inset,
    0 10px 24px -14px rgba(48, 32, 24, 0.45);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.7rem 0.6rem;
}
.io-card::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(169, 90, 45, 0.35);
  pointer-events: none;
}
.io-card p {
  margin: 0;
  line-height: 1.25;
}
.io-kicker {
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.6rem;
  color: var(--rust);
}
.io-names {
  font-size: clamp(1.15rem, 5vw, 1.45rem);
  margin: 0.2rem 0 0 !important;
  color: var(--ink);
}
.io-names span,
.io-monogram span {
  color: var(--copper);
  font-style: italic;
}
.io-greet {
  font-style: italic;
  font-size: 0.88rem;
  color: #5b4536;
  overflow-wrap: anywhere;
}
.io-sprig--card {
  width: 5rem;
}

/* A – botanical envelope */
.io-env {
  position: relative;
  aspect-ratio: 3/2;
  perspective: 900px;
  margin-top: 3.5rem;
}
.io-env-back {
  position: absolute;
  inset: 0;
  background: #e9dcc6;
  border: 1px solid #cbb69d;
}
.io-env-card {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 5%;
  height: 90%;
  z-index: 1;
  transition: none;
}
.io-env-card .io-ridge {
  width: 48%;
}
.io-env-pocket {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  filter: drop-shadow(0 8px 12px rgba(48, 32, 24, 0.18));
}
.io-env-address {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 9%;
  z-index: 3;
  margin: 0;
  font-style: italic;
  font-size: clamp(0.95rem, 4vw, 1.1rem);
  color: #5b4536;
  overflow-wrap: anywhere;
}
.io-env-flap {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 60%;
  z-index: 4;
  transform-origin: 50% 0;
  backface-visibility: visible;
}
.io-env-flap svg {
  display: block;
  width: 100%;
  height: 100%;
}
.io-seal {
  position: absolute;
  left: 50%;
  bottom: -1.3rem;
  width: 3.1rem;
  height: 3.1rem;
  margin-left: -1.55rem;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #c98a55, #a95a2d 55%, #7d3f1f);
  box-shadow:
    0 0 0 3px rgba(169, 90, 45, 0.25),
    0 4px 8px -2px rgba(48, 32, 24, 0.5);
  display: grid;
  place-items: center;
}
.io-sprig--seal {
  width: 2.2rem;
  margin: 0;
  filter: sepia(1) saturate(0.4) brightness(1.6);
}
.io--A[data-state="opening"] .io-seal {
  animation: io-fade-scale 0.22s ease-in both;
}
.io--A[data-state="opening"] .io-env-address {
  animation: io-fade 0.2s ease-in both;
}
.io--A[data-state="opening"] .io-env-flap {
  animation: io-flap 0.42s var(--io-ease) 0.12s both;
}
.io--A[data-state="opening"] .io-env-card {
  animation: io-card-rise 0.46s var(--io-ease) 0.43s both;
}
.io--A[data-state="opening"] .io-env-back,
.io--A[data-state="opening"] .io-env-pocket {
  animation: io-env-drop 0.46s var(--io-ease) 0.43s both;
}
@keyframes io-flap {
  0% {
    transform: rotateX(0);
    z-index: 4;
  }
  49% {
    z-index: 4;
  }
  50% {
    z-index: 0;
  }
  100% {
    transform: rotateX(180deg);
    z-index: 0;
  }
}
@keyframes io-card-rise {
  to {
    transform: translateY(-58%) scale(1.04);
  }
}
@keyframes io-env-drop {
  to {
    transform: translateY(6%);
    opacity: 0.85;
  }
}

/* B – folded card with botanical band */
.io-fold {
  position: relative;
  width: min(100%, 15rem);
  aspect-ratio: 5/7;
  margin: 0 auto;
  perspective: 1100px;
}
.io-fold-inside {
  position: absolute;
  inset: 0;
}
.io-fold-cover {
  position: absolute;
  inset: 0;
  z-index: 2;
  transform-origin: 0 50%;
  transform-style: preserve-3d;
}
.io-cover-frame {
  position: absolute;
  inset: 0;
  background: var(--io-paper);
  border: 1px solid #d1bea3;
  box-shadow: 0 12px 26px -16px rgba(48, 32, 24, 0.55);
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.io-fold-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #ece0cc;
  border: 1px solid #d1bea3;
  transform: rotateY(180deg);
  backface-visibility: hidden;
}
.io-cover-garland {
  position: absolute;
  top: 2%;
  height: 96%;
  width: auto;
  opacity: 0.85;
  pointer-events: none;
}
.io-cover-garland--l {
  left: -30%;
}
.io-cover-garland--r {
  right: -30%;
  transform: scaleX(-1);
}
.io-monogram {
  position: relative;
  font-size: 2rem;
  margin: 0 0 0.2rem;
  letter-spacing: 0.08em;
}
.io-cover-line {
  position: relative;
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  color: var(--rust);
}
.io-band {
  position: absolute;
  left: -3%;
  right: -3%;
  top: 76%;
  height: 13%;
  z-index: 3;
  background: #6d6a48;
  border-block: 2px solid #a95a2d;
  box-shadow: 0 6px 12px -8px rgba(48, 32, 24, 0.6);
  display: grid;
  place-items: center;
}
.io-sprig--band {
  width: 5.5rem;
  margin: 0;
  filter: sepia(0.6) brightness(1.9) saturate(0.5);
}
.io-band-knot {
  position: absolute;
  right: 16%;
  top: 50%;
  width: 0.8rem;
  height: 0.8rem;
  margin-top: -0.4rem;
  background: #a95a2d;
  transform: rotate(45deg);
  box-shadow: 0 0 0 2px #f6eee1;
}
.io--B[data-state="opening"] .io-band {
  animation: io-band-loosen 0.42s cubic-bezier(0.4, 0, 0.6, 1) both;
}
.io--B[data-state="opening"] .io-fold-cover {
  animation: io-cover-open 0.55s var(--io-ease) 0.32s both;
}
.io--B[data-state="opening"] .io-fold-cover::after {
  animation: io-fade 0.25s ease-in 0.62s both;
}
.io--B[data-state="opening"] .io-fold-inside {
  animation: io-settle 0.5s var(--io-ease) 0.38s both;
}
@keyframes io-band-loosen {
  35% {
    transform: translateY(4px) rotate(-2.5deg);
  }
  100% {
    transform: translate(55%, 14px) rotate(-7deg);
    opacity: 0;
  }
}
@keyframes io-cover-open {
  to {
    transform: rotateY(-165deg);
  }
}
@keyframes io-settle {
  from {
    transform: scale(0.96);
  }
  to {
    transform: scale(1.03);
  }
}

/* C – autumn botanical portal */
.io-portal {
  position: relative;
  width: min(100%, 17rem);
  aspect-ratio: 4/5;
  margin: 0 auto;
}
.io-arch {
  position: absolute;
  inset: 0 6%;
  border: 1px solid #a95a2d;
  border-radius: 50% 50% 0 0/34% 34% 0 0;
  background: var(--io-card);
  overflow: hidden;
}
.io-arch::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(169, 90, 45, 0.4);
  border-radius: inherit;
}
.io-arch-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at 50% 30%,
    rgba(199, 137, 72, 0.28),
    transparent 65%
  );
  opacity: 0;
}
.io-arch-card {
  position: absolute;
  inset: 14% 6% 6%;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.io-arch-card::before {
  display: none;
}
.io-leaves {
  position: absolute;
  top: -4%;
  bottom: -4%;
  width: 58%;
  z-index: 2;
  background: var(--io-paper);
  display: flex;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 0 18px -6px rgba(48, 32, 24, 0.4);
}
.io-leaves img {
  height: 108%;
  width: auto;
  margin-top: -4%;
  flex: none;
}
.io-leaves--l {
  left: -6%;
  border-radius: 0 46% 0 0/0 22% 0 0;
}
.io-leaves--l img + img {
  margin-left: -38%;
  transform: scaleY(-1);
}
.io-leaves--r {
  right: -6%;
  border-radius: 46% 0 0 0/22% 0 0 0;
}
.io-leaves--r img {
  transform: scaleX(-1);
}
.io-leaves--r img + img {
  margin-left: -38%;
  transform: scale(-1, -1);
}
.io-portal::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 44%;
  width: 2.6rem;
  height: 2.6rem;
  margin: -1.3rem 0 0 -1.3rem;
  z-index: 3;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #c98a55, #a95a2d 55%, #7d3f1f);
  box-shadow:
    0 0 0 3px rgba(169, 90, 45, 0.25),
    0 4px 8px -2px rgba(48, 32, 24, 0.5);
}
.io--C[data-state="opening"] .io-portal::after {
  animation: io-fade-scale 0.2s ease-in both;
}
.io--C[data-state="opening"] .io-leaves--l {
  animation: io-part-l 0.62s var(--io-ease) 0.12s both;
}
.io--C[data-state="opening"] .io-leaves--r {
  animation: io-part-r 0.62s var(--io-ease) 0.12s both;
}
.io--C[data-state="opening"] .io-arch {
  animation: io-settle 0.6s var(--io-ease) 0.2s both;
}
.io--C[data-state="opening"] .io-arch-glow {
  animation: io-fade-in 0.5s ease-out 0.35s both;
}
@keyframes io-part-l {
  to {
    transform: translateX(-78%) rotate(-4deg);
    opacity: 0.15;
  }
}
@keyframes io-part-r {
  to {
    transform: translateX(78%) rotate(4deg);
    opacity: 0.15;
  }
}

@keyframes io-fade {
  to {
    opacity: 0;
  }
}
@keyframes io-fade-in {
  to {
    opacity: 1;
  }
}
@keyframes io-fade-scale {
  to {
    opacity: 0;
    transform: scale(0.8);
  }
}
@keyframes io-stage-out {
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .io *,
  .io *::before,
  .io *::after,
  .io .io-stage {
    animation: none !important;
    transition: none !important;
  }
}
@media (max-width: 600px) {
  .io-stage {
    padding-inline: 0.25rem;
  }
}
.io-cover-greet {
  position: relative;
  margin: 0.9rem 1.2rem 0;
  font-style: italic;
  font-size: 0.9rem;
  color: #5b4536;
  overflow-wrap: anywhere;
  background: rgba(246, 238, 225, 0.85);
}
.io-portal-label {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 9%;
  z-index: 3;
  margin: 0;
  padding: 0.3rem 0.5rem;
  font-style: italic;
  font-size: 0.95rem;
  color: #5b4536;
  background: rgba(246, 238, 225, 0.92);
  overflow-wrap: anywhere;
}
.io--C[data-state="opening"] .io-portal-label {
  animation: io-fade 0.2s ease-in both;
}
