@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600&family=Great+Vibes&family=Special+Elite&display=swap');

:root { --olive: #87993E; --olive-dark: #6F7E2D; }
* { box-sizing: border-box; }
html, body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background: #fff;
}
body {
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background: #fff;
}
.cover {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background: #fff;
  isolation: isolate;
}

/* Header diposisikan rapat ke bagian atas amplop. */
.top-copy {
  position: absolute;
  z-index: 5;
  top: 11.2%;
  left: 2%;
  width: 96%;
  text-align: center;
}
.names {
  margin: 0;
  color: var(--olive);
  font-family: "Great Vibes", "Brush Script MT", cursive;
  font-size: clamp(44px, 8vw, 68px);
  font-weight: 400;
  line-height: .98;
  white-space: nowrap;
  opacity: 0;
  animation: nameDrop 1.5s cubic-bezier(.16,.78,.2,1) .15s both;
}
.married {
  margin: 0;
  color: var(--olive);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(15px, 2.4vw, 21px);
  font-weight: 500;
  line-height: 1;
  opacity: 0;
  animation: subtitleDrop 1.25s cubic-bezier(.16,.78,.2,1) .65s both;
}

/* Amplop diperbesar dan dinaikkan agar dekat dengan teks atas dan bawah. */
.envelope-wrap {
  position: absolute;
  z-index: 2;
  width: min(94vw, 700px);
  left: 50%;
  top: 20.5%;
  transform: translateX(-50%);
  opacity: 0;
  animation: envelopeAppear .9s ease-out .2s forwards;
}
.envelope {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
}

/*
  PNG flower memiliki transparansi besar di sisi kiri dan atas.
  Ukuran visual dihitung dari area gambar yang benar-benar terlihat:
  - tinggi bunga terlihat mendekati tinggi amplop;
  - bunga menempel tepat di batas kiri amplop;
  - animasi menggeser seluruh gambar dari luar kiri ke posisi akhir.
*/
.flower {
  position: absolute;
  z-index: 4;
  display: block;
  width: 90%;
  height: auto;
  left: -43.5%;
  top: -18%;
  opacity: 0;
  transform: translateX(-260%);
  animation: flowerSweep 2.7s cubic-bezier(.22,.65,.3,1) .35s both;
  pointer-events: none;
  user-select: none;
}

.envelope-trigger {
  position: absolute;
  z-index: 6;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.recipient {
  position: absolute;
  z-index: 7;
  top: 57.5%;
  left: 50%;
  width: min(64%, 390px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #766B58;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 1px 0 rgba(255,255,255,.45);
}
.recipient-label {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(11px, 1.6vw, 13px);
  font-weight: 500;
  letter-spacing: .19em;
  line-height: 1;
}
.recipient-value {
  max-width: 100%;
  font-family: "Special Elite", "Courier New", monospace;
  font-size: clamp(13px, 2vw, 17px);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: .015em;
  overflow-wrap: anywhere;
}

.seal {
  position: absolute;
  display: block;
  width: 20%;
  height: auto;
  left: 50%;
  top: 43%;
  transform: translate(-50%, -50%);
  transform-origin: center;
  animation: sealPulse 2.8s ease-in-out 2s infinite;
  transition: transform .28s cubic-bezier(.2,.8,.2,1), filter .28s ease;
  filter: drop-shadow(0 3px 4px rgba(71,54,26,.25));
  pointer-events: none;
  user-select: none;
}
.envelope-trigger:hover .seal,
.envelope-trigger:focus-visible .seal {
  animation-play-state: paused;
  transform: translate(-50%, -50%) scale(1.22);
  filter: drop-shadow(0 7px 11px rgba(71,54,26,.42));
}
.envelope-trigger:active .seal {
  animation-play-state: paused;
  transform: translate(-50%, -50%) scale(1.30);
}
.envelope-trigger::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 43%;
  width: 23%;
  aspect-ratio: 1;
  border: 1.5px solid rgba(197,166,106,.85);
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.78);
  pointer-events: none;
}
.envelope-trigger:hover::after,
.envelope-trigger:focus-visible::after {
  opacity: 1;
  animation: sealCue .9s ease-out infinite;
}
.envelope-trigger:focus-visible {
  outline: 2px dashed var(--olive-dark);
  outline-offset: 4px;
}

/* Petunjuk tepat di bawah tepi amplop. */
.open-hint {
  position: absolute;
  z-index: 7;
  top: calc(20.5% + min(94vw, 700px) * .706 + .3%);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 96%;
  padding: 1px 6px;
  border: 0;
  background: transparent;
  color: var(--olive);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(18px, 2.7vw, 23px);
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  cursor: pointer;
  animation: hintRise 1.35s cubic-bezier(.16,.78,.2,1) 1.05s both;
}
.open-hint:hover { color: var(--olive-dark); }

/* Transisi keluar ketika amplop atau segel diklik. */
.cover.opening { animation: pageBlur 1.25s ease-in forwards; pointer-events: none; }
.cover.opening .seal { animation: sealClick .55s ease-in forwards; }
.cover.opening .envelope { animation: envelopeRelease 1.05s ease-in forwards; }
.cover.opening .flower { animation: flowerRelease .8s ease-in forwards; }
.cover.opening .top-copy,
.cover.opening .open-hint { animation: fadeOut .55s ease-in forwards; }

@keyframes nameDrop {
  0% { opacity: 0; transform: translateY(-85px); }
  70% { opacity: 1; transform: translateY(7px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes subtitleDrop {
  0% { opacity: 0; transform: translateY(-48px); }
  70% { opacity: 1; transform: translateY(4px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes flowerSweep {
  0% { opacity: 0; transform: translateX(-260%); }
  8% { opacity: 1; }
  100% { opacity: 1; transform: translateX(0); }
}
@keyframes envelopeAppear {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes hintRise {
  0% { opacity: 0; transform: translate(-50%, 65px); }
  70% { opacity: 1; transform: translate(-50%, -4px); }
  100% { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes sealPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.07); }
}
@keyframes sealCue {
  0% { transform: translate(-50%, -50%) scale(.82); opacity: .8; }
  100% { transform: translate(-50%, -50%) scale(1.35); opacity: 0; }
}
@keyframes sealClick {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  45% { transform: translate(-50%, -50%) scale(1.16) rotate(-7deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(.1) rotate(25deg); opacity: 0; }
}
@keyframes envelopeRelease {
  0% { opacity: 1; transform: scale(1); }
  45% { transform: scale(1.035) translateY(-8px); }
  100% { opacity: .06; transform: scale(1.09) translateY(-20px); }
}
@keyframes flowerRelease {
  to { opacity: 0; transform: translateX(-18%); }
}
@keyframes fadeOut { to { opacity: 0; transform: translateY(-15px); } }
@keyframes pageBlur {
  0% { filter: blur(0); opacity: 1; }
  70% { filter: blur(5px); opacity: .7; }
  100% { filter: blur(10px); opacity: 0; }
}

@media (max-width: 600px) {
  .top-copy { top: 11.2%; }
  .names { font-size: clamp(44px, 9.5vw, 62px); }
  .married { margin-top: 0; font-size: clamp(15px, 3.6vw, 19px); }
  .envelope-wrap { width: 94vw; top: 23%; }
  .flower { width: 90%; left: -43.5%; top: -18%; }
  .seal { width: 21%; }
  .recipient { top: 57.5%; width: 68%; gap: 2px; }
  .recipient-label { font-size: 11px; }
  .recipient-value { font-size: clamp(12px, 3.4vw, 15px); }
  .open-hint {
    top: calc(23% + 94vw * .706 + .3%);
    font-size: clamp(18px, 4.5vw, 22px);
  }
}
@media (max-height: 620px) and (min-width: 601px) {
  .top-copy { top: .5%; }
  .envelope-wrap { top: 14%; width: min(76vw, 500px); }
  .open-hint { top: 78%; }
}
@media (prefers-reduced-motion: reduce) {
  /* Preserve the seal's gentle invitation animation. */
  .seal { animation-duration: 3.4s; }
}
