/* Surat "Happy Boyfriend Day": kertas, frame foto, lavender, dan animasi idle amplop.
   Hanya style yang tidak bisa dibuat dengan class Tailwind (gradien berlapis,
   tekstur, bayangan berlapis, keyframe). Tata letak grid ada di index.html. */

/* ------------------------------------------------------------ amplop */

/* Gerakan diam setelah amplop mendarat: terayun pelan seperti tertiup angin. */
@keyframes env-bob {
  0%,
  100% {
    transform: translateY(0) rotate(-1.5deg);
  }
  50% {
    transform: translateY(-7px) rotate(1.5deg);
  }
}

.env-bob {
  animation: env-bob 4.6s ease-in-out infinite;
}

#envelope img {
  filter: drop-shadow(0 8px 10px rgba(80, 55, 20, 0.3));
}

@media (prefers-reduced-motion: reduce) {
  .env-bob {
    animation: none;
  }
}

/* ------------------------------------------------------------ kertas */

.paper {
  background-color: #f8efdb;
  background-image:
    /* dua lipatan surat, di sepertiga dan dua pertiga tinggi */
    linear-gradient(
      to bottom,
      transparent calc(33.33% - 1px),
      rgba(110, 80, 40, 0.08) calc(33.33% - 1px),
      rgba(255, 255, 255, 0.5) 33.33%,
      transparent calc(33.33% + 2px)
    ),
    linear-gradient(
      to bottom,
      transparent calc(66.66% - 1px),
      rgba(110, 80, 40, 0.08) calc(66.66% - 1px),
      rgba(255, 255, 255, 0.5) 66.66%,
      transparent calc(66.66% + 2px)
    ),
    radial-gradient(120% 70% at 15% 0%, rgba(255, 255, 255, 0.6), transparent 60%),
    radial-gradient(100% 60% at 100% 100%, rgba(214, 165, 100, 0.2), transparent 65%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .3 0 0 0 0 .2 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  border-radius: 6px 12px 8px 14px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 25px 50px -15px rgba(70, 50, 20, 0.45),
    0 4px 10px rgba(70, 50, 20, 0.15);
  transition: transform 0.65s cubic-bezier(0.25, 1, 0.35, 1), opacity 0.65s cubic-bezier(0.25, 1, 0.35, 1);
}

/* Transisi tumpukan kertas (Stacking) */
.paper-active {
  z-index: 20;
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
}

.paper-behind {
  z-index: 10;
  opacity: 0.88;
  pointer-events: none;
  transform: translate3d(-6px, -14px, 0) scale(0.96) rotate(-2.5deg);
  filter: brightness(0.95);
}

.paper-deep-behind {
  z-index: 5;
  opacity: 0.75;
  pointer-events: none;
  transform: translate3d(-12px, -26px, 0) scale(0.92) rotate(-4.5deg);
  filter: brightness(0.9);
}

.paper-waiting {
  z-index: 15;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(8px, 35px, 0) scale(0.94) rotate(3.5deg);
}

/* Garis-garis surat halus (Ruled lines) */
.paper-ruled {
  background-image:
    repeating-linear-gradient(
      transparent,
      transparent 29px,
      rgba(90, 59, 42, 0.12) 30px
    ),
    radial-gradient(120% 70% at 15% 0%, rgba(255, 255, 255, 0.6), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .3 0 0 0 0 .2 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --------------------------------------------------- Blanko & Perangko Pos */

.vintage-stamp {
  position: relative;
  width: 48px;
  height: 58px;
  background: #fbf5e8;
  padding: 4px;
  border-radius: 1px;
  box-shadow: 0 2px 6px rgba(80, 55, 20, 0.25);
  border: 2px dashed #b99370;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.vintage-stamp::after {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1px solid rgba(185, 147, 112, 0.5);
  pointer-events: none;
}

/* Cap pos (Postmark) */
.vintage-postmark {
  position: absolute;
  top: -12px;
  right: -14px;
  width: 62px;
  height: 62px;
  border: 1.5px solid rgba(180, 80, 70, 0.65);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: rotate(-16deg);
  pointer-events: none;
}

.vintage-postmark::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px dashed rgba(180, 80, 70, 0.5);
  border-radius: 50%;
}

/* ------------------------------------------------------------- foto */

/* Slot foto: polaroid style dengan rasio proporsional */
.ph {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 2px;
  background:
    radial-gradient(70% 60% at 28% 22%, rgba(255, 255, 255, 0.65), transparent 65%),
    linear-gradient(140deg, var(--a, #c9d59a), var(--b, #a9bd78));
}
.ph::after {
  content: "♡";
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  color: rgba(255, 255, 255, 0.75);
}
.ph img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.5s ease;
}
.ph[data-tone="sage"] {
  --a: #c9d59a;
  --b: #a9bd78;
}
.ph[data-tone="amber"] {
  --a: #f0cf93;
  --b: #e0a95a;
}
.ph[data-tone="rose"] {
  --a: #f2c4bb;
  --b: #d98f86;
}

/* Bingkai polaroid lembut & clean */
.f-print {
  display: flex;
  flex-direction: column;
  padding: 6px 6px 12px;
  background: #fffdf8;
  border-radius: 3px;
  border: 1px solid rgba(180, 150, 110, 0.15);
  box-shadow:
    0 8px 16px -6px rgba(80, 55, 20, 0.28),
    0 1px 3px rgba(80, 55, 20, 0.1);
  transition: transform 0.3s ease;
}
.f-print:hover {
  transform: translateY(-2px) scale(1.02);
}

/* Dekorasi lavender */
.lavender-deco {
  filter: drop-shadow(0 4px 8px rgba(70, 50, 20, 0.2));
  pointer-events: none;
  user-select: none;
}

/* ------------------------------------------------------------- Flip Card 3D */

.flip-card-container {
  perspective: 900px;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s cubic-bezier(0.34, 1.25, 0.64, 1);
  transform-style: preserve-3d;
  cursor: pointer;
}

.flip-card-inner.flipped {
  transform: rotateY(180deg);
}

.flip-card-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 4px;
}

.flip-card-front {
  background: #fffdf8;
  border: 1px solid rgba(180, 150, 110, 0.25);
  box-shadow: 0 4px 10px -2px rgba(80, 55, 20, 0.15);
}

.flip-card-back {
  background: #faf4e6;
  border: 1px dashed rgba(180, 150, 110, 0.5);
  box-shadow: 0 4px 12px -2px rgba(80, 55, 20, 0.2);
  transform: rotateY(180deg);
}

/* ------------------------------------------------------------- Vinyl & Music Player */

@keyframes spin-slow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.vinyl-spin {
  animation: spin-slow 7s linear infinite;
}

.vinyl-paused {
  animation-play-state: paused;
}

.song-card {
  background: #fffdf8;
  border: 1px solid rgba(180, 150, 110, 0.25);
  box-shadow: 0 4px 10px -2px rgba(80, 55, 20, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.song-card.is-playing {
  border-color: #d77a72;
  box-shadow: 0 6px 14px -2px rgba(215, 122, 114, 0.3);
  background: #fffbf5;
}

/* Equalizer mini wave bars */
.eq-bar {
  display: inline-block;
  width: 2.5px;
  background-color: #d77a72;
  border-radius: 2px;
  animation: eq-bounce 1s ease-in-out infinite alternate;
}

.eq-bar:nth-child(1) { height: 10px; animation-delay: 0.1s; }
.eq-bar:nth-child(2) { height: 16px; animation-delay: 0.35s; }
.eq-bar:nth-child(3) { height: 8px; animation-delay: 0.2s; }
.eq-bar:nth-child(4) { height: 13px; animation-delay: 0.45s; }

@keyframes eq-bounce {

/* ------------------------------------------------------------- Closing Section & Wax Seal */

.wax-seal {
  width: 44px;
  height: 44px;
  background: radial-gradient(circle at 35% 35%, #e2857e, #a8473e);
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(168, 71, 62, 0.4), inset 0 2px 3px rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(168, 71, 62, 0.6);
  position: relative;
}

.wax-seal::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px dashed rgba(255, 255, 255, 0.4);
  border-radius: 50%;
}

/* Floating Heart Animation */
@keyframes float-heart-up {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(0.6) rotate(0deg);
  }
  50% {
    opacity: 0.9;
    transform: translate3d(var(--tx, 15px), -60px, 0) scale(1.15) rotate(var(--rot, 15deg));
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--tx-end, 30px), -130px, 0) scale(1.4) rotate(var(--rot-end, -20deg));
  }
}

.floating-heart {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  user-select: none;
  animation: float-heart-up 1.8s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
  0% { transform: scaleY(0.3); }
  100% { transform: scaleY(1); }
}
