@import url('https://fonts.googleapis.com/css?family=Indie+Flower');
@import url('https://fonts.googleapis.com/css?family=Amatic+SC');

body {
  font-family: 'Indie Flower', cursive !important;
  background: #fde3a7;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

::selection {
  background: transparent;
}

h4 {
  font-size: 26px;
  line-height: 1px;
  font-family: 'Amatic SC', cursive !important;
}

.color1 {
  color: #1bbc9b;
}
.color2 {
  color: #c0392b;
}

/* ================= CARD ================= */
.card {
  cursor: pointer;
  user-select: none;
  color: #013243;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 320px;
  height: 440px;
  background: #e0e1dc;

  transform-style: preserve-3d;
  transform: translate(-50%, -50%) perspective(2000px);

  box-shadow:
    inset 300px 0 50px rgba(0, 0, 0, 0.4),
    20px 0 60px rgba(0, 0, 0, 0.5);

  transition: 0.6s;
  z-index: 10;
}

/* Hover hanya sedikit efek, tidak membuka cover */
.card:hover {
  transform: translate(-50%, -50%) perspective(2000px) rotate(5deg) scale(1.05);
}

.card.active {
  transform: translate(-50%, -50%) perspective(2000px) rotate(3deg) scale(1.05);
}

/* Hover tidak mengubah kartu saat sudah terbuka */
.card.active:hover {
  transform: translate(-50%, -50%) perspective(2000px) rotate(3deg) scale(1.05);
}

/* sisi lipatan */
.card:before {
  content: '';
  position: absolute;
  top: -5px;
  left: 0;
  width: 100%;
  height: 5px;
  background: #bac1ba;
  transform-origin: bottom;
  transform: skewX(-45deg);
}

.card:after {
  content: '';
  position: absolute;
  top: 0;
  right: -5px;
  width: 5px;
  height: 100%;
  background: #92a29c;
  transform-origin: left;
  transform: skewY(-45deg);
}

/* ================= IMG BOX ================= */
.imgBox {
  width: 100%;
  height: 100%;
  position: relative;
  transform-origin: left;
  transition: 0.8s;
  transform-style: preserve-3d;
}

.imgBox img,
.bark {
  backface-visibility: hidden;
}

/* cover hanya terbuka saat aktif */
.card.active .imgBox {
  transform: rotateY(-160deg);
}

.imgBox img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  backface-visibility: hidden;
  position: absolute;
  z-index: 2;
}

/* layer penutup */
.bark {
  position: absolute;
  width: 100%;
  height: 100%;
  background: #e0e1dc;
  transform: rotateY(180deg);
  backface-visibility: hidden;
  z-index: 1;
}

.open-instruction {
  position: absolute;
  bottom: 15px;
  width: 100%;
  text-align: center;
  color: white;
  background: rgba(0, 0, 0, 0.4);
  font-size: 13px;
  padding: 5px 0;
}

/* ================= DETAILS ================= */
.details {
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 15px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.details h4 {
  text-align: center;
}

.message p {
  line-height: 1.5;
  margin: 4px 0;
}

.signature {
  margin-top: 10px;
  text-align: right;
}

/* ================= GALLERY ================= */
.gallery {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.gallery img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: 10px;
  cursor: pointer;

  transition: all 0.35s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.gallery img:hover {
  transform: scale(1.18) rotate(3deg);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  z-index: 3;
}

/* ================= VIDEO GALLERY ================= */
.video-gallery {
  margin-top: 12px;
  width: 100%;
}

.video-gallery video {
  width: 100%;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: 0.3s;
}

.video-gallery video:hover {
  transform: scale(1.02);
}

/* ================= BALLOON EFFECT ================= */
.balloon-container {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.balloon {
  position: absolute;
  bottom: -120px;
  width: 60px;
  animation: floatUp linear forwards;
  will-change: transform;
}

@keyframes floatUp {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(-120vh);
    opacity: 0;
  }
}

/* ================= RESPONSIVE MOBILE ================= */
@media (max-width: 768px) {
  .card {
    width: 92vw;
    height: 85vh;
    max-width: 360px;
    max-height: 600px;

    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) perspective(2000px);
  }

  .card.active {
    transform: translate(-50%, -50%) perspective(2000px) rotate(3deg);
  }

  h4 {
    font-size: 22px;
  }

  .details {
    padding: 12px;
  }
}

@media (max-width: 480px) {
  .card {
    width: 94vw;
    height: 88vh;
  }

  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }

  .video-gallery video {
    max-height: 220px;
  }

  .card:hover {
    transform: translate(-50%, -50%) perspective(2000px);
  }
}
