:root {
  --sage: #b8bea4;
  --sage-dark: #7f876e;
  --sage-deep: #5f674f;
  --sage-soft: #d8ddd0;
  --ivory: #f8f4ec;
  --cream: #fffaf1;
  --stone: #e5e1d8;
  --gold: #b89f78;
  --gold-soft: #decda8;
  --charcoal: #2e2e2a;
  --muted-text: #6f6b62;
  --white: #ffffff;

  --font-serif: "Cormorant Garamond", serif;
  --font-script: "Great Vibes", cursive;
  --font-sans: "Inter", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  font-family: var(--font-sans);
  color: var(--charcoal);
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(circle at 12% 8%, rgba(184, 190, 164, 0.18), transparent 30%),
    radial-gradient(circle at 88% 12%, rgba(216, 199, 174, 0.22), transparent 28%),
    radial-gradient(circle at 50% 100%, rgba(184, 190, 164, 0.08), transparent 34%),
    linear-gradient(180deg, #fcf9f4 0%, #f8f4ec 50%, #f3ece2 100%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.20;
  background-image:
    radial-gradient(circle, rgba(184, 159, 120, 0.14) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(127, 135, 110, 0.07) 0 1px, transparent 1.7px),
    linear-gradient(rgba(46, 46, 42, 0.01) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46, 46, 42, 0.008) 1px, transparent 1px);
  background-size:
    260px 260px,
    390px 390px,
    42px 42px,
    42px 42px;
  mix-blend-mode: multiply;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("./bilder/dekopflanze.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: min(1150px, 92vw);
  opacity: 0.085;
  mix-blend-mode: multiply;
  filter: saturate(0.92);
}

.envelope-page {
  position: relative;
  min-height: 100svh;
  padding: clamp(42px, 5vw, 80px) 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.envelope-page::before,
.envelope-page::after {
  content: "";
  position: fixed;
  width: 430px;
  height: 320px;
  background-image: url("./bilder/dekopflanze.png");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  opacity: 0.05;
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: multiply;
}

.envelope-page::before {
  right: -130px;
  top: -20px;
  transform: rotate(-12deg);
}

.envelope-page::after {
  left: -160px;
  bottom: -70px;
  transform: rotate(170deg) scaleX(-1);
}

.fade-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.22), transparent 42%),
    linear-gradient(180deg, rgba(252, 249, 244, 0.18), rgba(248, 244, 236, 0.92));
  transition: opacity 0.75s ease;
}

.cosmic-screen {
  position: fixed;
  inset: 0;
  z-index: 29;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 243, 212, 0.15), transparent 18%),
    radial-gradient(circle at 30% 30%, rgba(255, 248, 225, 0.10), transparent 12%),
    radial-gradient(circle at 70% 24%, rgba(255, 248, 225, 0.10), transparent 10%),
    radial-gradient(circle at 46% 72%, rgba(255, 248, 225, 0.07), transparent 12%),
    radial-gradient(circle at 80% 68%, rgba(255, 248, 225, 0.08), transparent 10%),
    linear-gradient(180deg, rgba(30, 33, 42, 0.82), rgba(49, 45, 54, 0.66), rgba(248, 244, 236, 0.12));
  transition: opacity 0.85s ease;
}

.intro-card {
  position: relative;
  z-index: 2;
  width: min(100%, 980px);
  text-align: center;
  display: grid;
  justify-items: center;
  animation: fadeIn 0.95s ease both;
  transition:
    opacity 0.7s ease,
    transform 0.7s ease,
    filter 0.7s ease;
}

.intro-symbol {
  margin-bottom: 4px;
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1;
  color: rgba(184, 159, 120, 0.82);
  text-shadow:
    0 0 18px rgba(222, 205, 168, 0.22),
    0 4px 10px rgba(46, 46, 42, 0.04);
}

.intro-title {
  font-family: var(--font-script);
  font-weight: 400;
  color: #4a4942;
  font-size: clamp(3.3rem, 8vw, 6.8rem);
  line-height: 0.98;
  text-shadow: 0 10px 28px rgba(46, 46, 42, 0.05);
}

.intro-title span {
  display: block;
  margin-top: 6px;
  color: var(--sage-deep);
  font-size: 1.05em;
}

.intro-title::after {
  content: "";
  display: block;
  width: 150px;
  height: 1px;
  margin: 20px auto 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(184, 159, 120, 0.45),
    rgba(127, 135, 110, 0.35),
    rgba(184, 159, 120, 0.45),
    transparent
  );
}

.intro-subtitle {
  margin-top: 16px;
  color: rgba(46, 46, 42, 0.68);
  font-size: clamp(0.95rem, 2.1vw, 1.16rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.envelope-button {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  width: min(90vw, 700px);
  margin-top: clamp(34px, 5vw, 52px);
  padding: 0;
  display: block;
  transition: transform 0.32s ease;
}

.envelope-button:hover {
  transform: translateY(-5px);
}

.envelope-scene {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1.56 / 1;
}

.envelope-shadow {
  position: absolute;
  left: 50%;
  bottom: -3.5%;
  width: 74%;
  height: 42px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(46, 46, 42, 0.16), transparent 70%);
  filter: blur(12px);
  z-index: 0;
}

.envelope {
  position: absolute;
  inset: 0;
  filter: drop-shadow(0 36px 72px rgba(46, 46, 42, 0.14));
  animation: floatEnvelope 5.5s ease-in-out infinite;
}

.envelope-letter {
  position: absolute;
  left: 50%;
  bottom: 17%;
  width: 68%;
  height: 56%;
  transform: translateX(-50%) translateY(22%);
  z-index: 1;
  border-radius: clamp(16px, 2.5vw, 24px);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.99), transparent 26%),
    linear-gradient(180deg, #fffefb 0%, #f8f2e9 100%);
  border: 1px solid rgba(184, 159, 120, 0.22);
  box-shadow:
    0 14px 30px rgba(46, 46, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  overflow: hidden;
  transition: transform 1.1s cubic-bezier(0.2, 0.82, 0.2, 1);
}

.envelope-letter::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: clamp(12px, 2vw, 18px);
  border: 1px solid rgba(184, 159, 120, 0.14);
  pointer-events: none;
}

.envelope-letter::after {
  content: "";
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(184, 159, 120, 0.35),
    transparent
  );
  pointer-events: none;
}

.letter-kicker {
  color: var(--gold);
  font-size: clamp(0.55rem, 1.7vw, 0.76rem);
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.letter-names {
  margin-top: 6px;
  font-family: var(--font-script);
  color: var(--sage-deep);
  font-size: clamp(1.95rem, 5.7vw, 3.5rem);
  line-height: 1;
}

.letter-date {
  margin-top: 8px;
  font-family: var(--font-serif);
  color: rgba(46, 46, 42, 0.62);
  font-size: clamp(0.8rem, 2.1vw, 1.08rem);
  letter-spacing: 0.06em;
}

.envelope-back {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: clamp(18px, 3vw, 30px);
  overflow: hidden;
  background:
    linear-gradient(145deg, #939b7a 0%, #788160 50%, #616950 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -18px 34px rgba(46, 46, 42, 0.08);
}

.envelope-back::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.08;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.22) 0 1px, transparent 1.8px),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 34px 34px, 24px 24px;
}

.envelope-back::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.08), transparent 24%),
    linear-gradient(180deg, transparent, rgba(46, 46, 42, 0.05));
  pointer-events: none;
}

.envelope-flap {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 62%;
  z-index: 3;
  transform-origin: top center;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-radius: clamp(18px, 3vw, 30px) clamp(18px, 3vw, 30px) 0 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 22%),
    linear-gradient(145deg, #a0a989 0%, #808966 52%, #687054 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 1px 0 rgba(46, 46, 42, 0.03);
  transition: transform 1.1s cubic-bezier(0.2, 0.82, 0.2, 1);
  backface-visibility: hidden;
  pointer-events: none;
}

.envelope-left,
.envelope-right {
  position: absolute;
  bottom: 0;
  width: 50%;
  height: 72%;
  z-index: 4;
  pointer-events: none;
}

.envelope-left {
  left: 0;
  clip-path: polygon(0 0, 100% 58%, 100% 100%, 0 100%);
  background: linear-gradient(145deg, #8d9674 0%, #757d5e 100%);
}

.envelope-right {
  right: 0;
  clip-path: polygon(0 58%, 100% 0, 100% 100%, 0 100%);
  background: linear-gradient(215deg, #8a9371 0%, #727a5b 100%);
}

.envelope-front {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 68%;
  z-index: 5;
  border-radius: 0 0 clamp(18px, 3vw, 30px) clamp(18px, 3vw, 30px);
  clip-path: polygon(0 0, 50% 58%, 100% 0, 100% 100%, 0 100%);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), transparent 18%),
    linear-gradient(145deg, #889170 0%, #727b5c 56%, #5c634d 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 -1px 0 rgba(46, 46, 42, 0.03);
  pointer-events: none;
}

.envelope-lace {
  position: absolute;
  left: -3%;
  top: 41%;
  width: 106%;
  height: clamp(42px, 8vw, 72px);
  z-index: 6;
  opacity: 0.9;
  pointer-events: none;
  background:
    radial-gradient(circle at 22px 58px, transparent 0 20px, rgba(255, 250, 241, 0.76) 21px 23px, transparent 24px),
    radial-gradient(circle at 58px 58px, transparent 0 20px, rgba(255, 250, 241, 0.76) 21px 23px, transparent 24px),
    linear-gradient(180deg, rgba(255, 250, 241, 0.86), rgba(255, 250, 241, 0.6));
  background-size: 72px 74px, 72px 74px, 100% 10px;
  background-position: 0 0, 36px 0, 0 0;
  border-top: 1px solid rgba(255, 250, 241, 0.72);
  border-bottom: 1px solid rgba(46, 46, 42, 0.08);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}

.wax-seal {
  position: absolute;
  left: 50%;
  top: 54%;
  width: clamp(96px, 17vw, 138px);
  height: clamp(96px, 17vw, 138px);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  z-index: 7;
  background:
    linear-gradient(
      120deg,
      rgba(255, 255, 255, 0) 24%,
      rgba(255, 238, 205, 0) 34%,
      rgba(255, 236, 196, 0.65) 45%,
      rgba(255, 255, 255, 0.20) 50%,
      rgba(255, 236, 196, 0) 58%,
      rgba(255, 255, 255, 0) 70%
    ) 0 0 / 240% 240% no-repeat,
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.92), transparent 22%),
    radial-gradient(circle at 50% 50%, #fffaf3 0%, #eee2d6 56%, #d3c1af 100%);
  box-shadow:
    0 16px 34px rgba(46, 46, 42, 0.16),
    0 0 0 1px rgba(184, 159, 120, 0.10),
    inset 0 0 0 8px rgba(255, 255, 255, 0.42),
    inset 0 0 0 10px rgba(184, 159, 120, 0.12),
    inset 0 -10px 18px rgba(46, 46, 42, 0.06);
  transition:
    transform 0.7s ease,
    opacity 0.5s ease,
    box-shadow 0.35s ease;
  pointer-events: none;
  animation: sealShimmer 5.8s ease-in-out infinite;
}

.envelope-button:hover .wax-seal {
  box-shadow:
    0 20px 40px rgba(46, 46, 42, 0.18),
    0 0 22px rgba(222, 205, 168, 0.18),
    0 0 0 1px rgba(184, 159, 120, 0.10),
    inset 0 0 0 8px rgba(255, 255, 255, 0.42),
    inset 0 0 0 10px rgba(184, 159, 120, 0.12),
    inset 0 -10px 18px rgba(46, 46, 42, 0.06);
}

.wax-seal::before {
  content: "∞";
  position: absolute;
  top: 19%;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4.8vw, 2.7rem);
  color: rgba(95, 103, 79, 0.44);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.wax-seal::after {
  content: "J & J";
  position: absolute;
  bottom: 21%;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-serif);
  font-size: clamp(1rem, 2.6vw, 1.42rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(95, 103, 79, 0.54);
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}

.tap-hint {
  margin-top: 22px;
  color: rgba(46, 46, 42, 0.6);
  font-size: 0.92rem;
  letter-spacing: 0.03em;
}

.loading-note {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(14px);
  opacity: 0;
  z-index: 40;
  color: rgba(255, 250, 241, 0.92);
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

/* Partikel */
.opening-particles {
  position: fixed;
  inset: 0;
  z-index: 35;
  pointer-events: none;
  overflow: hidden;
}

.opening-particles.is-active .particle {
  opacity: 1;
}

.particle {
  position: absolute;
  opacity: 0;
  transform: translate3d(0, 0, 0) rotate(0deg);
  animation-name: particleBurst;
  animation-timing-function: cubic-bezier(0.2, 0.72, 0.2, 1);
  animation-fill-mode: forwards;
}

.star {
  background:
    radial-gradient(circle, rgba(255, 248, 225, 1) 0%, rgba(255, 248, 225, 0.92) 42%, rgba(184, 159, 120, 0.74) 72%, rgba(184, 159, 120, 0) 90%);
  clip-path: polygon(
    50% 0%,
    61% 34%,
    98% 35%,
    68% 57%,
    79% 91%,
    50% 70%,
    21% 91%,
    32% 57%,
    2% 35%,
    39% 34%
  );
  filter: drop-shadow(0 0 8px rgba(255, 248, 225, 0.34));
}

.sparkle {
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 248, 225, 1) 0%, rgba(184, 159, 120, 0.78) 52%, rgba(184, 159, 120, 0) 78%);
  filter: blur(0.2px);
  box-shadow:
    0 0 10px rgba(184, 159, 120, 0.32),
    0 0 18px rgba(255, 248, 225, 0.28);
}

/* Einladung */
.invitation-frame-wrap {
  position: fixed;
  inset: 0;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: #f8f4ec;
  transition:
    opacity 0.8s ease,
    visibility 0.8s ease;
}

.invitation-frame-wrap.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.invitation-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #f8f4ec;
}

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

body.invitation-open {
  overflow: hidden;
}

/* Musik */
.music-control {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 220;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid rgba(184, 159, 120, 0.28);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.97), rgba(248, 244, 236, 0.94));
  color: var(--sage-deep);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 700;
  box-shadow:
    0 18px 38px rgba(46, 46, 42, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  cursor: pointer;
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    opacity 0.25s ease;
}

.music-control:hover {
  transform: translateY(-2px);
  box-shadow:
    0 24px 46px rgba(46, 46, 42, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.music-control[hidden] {
  display: none;
}

.music-control-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background:
    linear-gradient(145deg, rgba(184, 159, 120, 0.18), rgba(127, 135, 110, 0.14));
  font-size: 0.88rem;
  line-height: 1;
}

.music-control.is-playing .music-control-icon {
  background:
    linear-gradient(145deg, rgba(184, 159, 120, 0.26), rgba(127, 135, 110, 0.18));
}

.envelope-page.is-opening .envelope {
  animation: none;
}

.envelope-page.is-opening .envelope-flap {
  transform: rotateX(-179deg) translateY(-2px);
}

.envelope-page.is-opening .envelope-letter {
  transform: translateX(-50%) translateY(-34%) scale(1.015);
}

.envelope-page.is-opening .wax-seal {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.68) rotate(-10deg);
}

.envelope-page.is-opening .intro-card {
  opacity: 0.98;
  transform: translateY(-6px);
  filter: blur(0.4px);
}

.envelope-page.is-opening .fade-screen {
  opacity: 1;
}

.envelope-page.is-opening .cosmic-screen {
  opacity: 1;
}

.envelope-page.is-opening .loading-note {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

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

@keyframes floatEnvelope {
  0%, 100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

@keyframes sealShimmer {
  0%, 100% {
    background-position:
      120% 0,
      0 0,
      0 0;
  }

  50% {
    background-position:
      -40% 0,
      0 0,
      0 0;
  }
}

@keyframes particleBurst {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(0deg) scale(0.8);
  }

  12% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform:
      translate3d(var(--drift-x), var(--drift-y), 0)
      rotate(var(--rotate-end))
      scale(1.08);
  }
}

@media (max-width: 720px) {
  body::after {
    background-size: 130vw;
    background-position: center 52%;
    opacity: 0.075;
  }

  .envelope-page {
    align-items: flex-start;
    padding: 34px 14px 42px;
  }

  .intro-symbol {
    font-size: clamp(1.8rem, 8vw, 2.6rem);
  }

  .intro-title {
    font-size: clamp(2.8rem, 13vw, 4.6rem);
  }

  .intro-title::after {
    width: 110px;
    margin-top: 16px;
  }

  .intro-subtitle {
    margin-top: 14px;
    font-size: 0.82rem;
    letter-spacing: 0.14em;
  }

  .envelope-button {
    width: min(94vw, 430px);
    margin-top: 30px;
  }

  .envelope-scene {
    aspect-ratio: 1.48 / 1;
  }

  .envelope-lace {
    background-size: 52px 54px, 52px 54px, 100% 8px;
    background-position: 0 0, 26px 0, 0 0;
  }

  .tap-hint {
    margin-top: 18px;
    font-size: 0.82rem;
  }

  .music-control {
    right: 12px;
    bottom: 12px;
    min-height: 44px;
    padding: 0 14px;
    font-size: 0.8rem;
    gap: 8px;
  }
}

@media (max-width: 390px) {
  .envelope-button {
    width: min(92vw, 360px);
  }

  .loading-note {
    font-size: 0.74rem;
    letter-spacing: 0.08em;
  }

  .music-control-text {
    display: none;
  }

  .music-control {
    min-width: 44px;
    justify-content: center;
    padding: 0 12px;
  }
}

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