:root {
  /* Nuansa Sunda Ceria & Modern untuk Anak SD */
  --bg-dark: #070f1a;
  --bg-blue: #0e2439;
  --sunny: #ffcd3c;      /* Emas/Kuning ceria */
  --sunny-soft: #fff4d1;
  --leaf: #4caf50;       /* Hijau bambu segar */
  --card-white: #ffffff;
  --text-dark: #1a2b3c;
  --text-light: #f1f5f9;
  --radius: 24px;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Fredoka', 'Lexend', sans-serif;
  background: var(--bg-dark);
  color: var(--text-light);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: url('../background/background.jpg') center/cover no-repeat;
  filter: blur(5px) brightness(0.7);
  transform: scale(1.1);
}

body > * {
  position: relative;
  z-index: 1;
}

/* Audio Control */
.audio-control {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--sunny);
  border: 4px solid white;
  color: var(--text-dark);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.audio-control:hover {
  transform: scale(1.1) rotate(5deg);
}

.audio-control svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ===== Landing page ===== */
header {
  text-align: center;
  padding: 40px 16px 20px;
}

.logo-area {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  padding: 40px 20px;
  border-bottom: 5px solid var(--sunny);
  border-radius: 0 0 50px 50px;
  max-width: 900px;
  margin: -40px auto 40px;
  box-shadow: var(--shadow);
}

header h1 {
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(2.5rem, 6vw, 4rem);
  color: var(--sunny);
  margin: 0;
  text-shadow: 4px 4px 0px rgba(0,0,0,0.3);
  letter-spacing: 2px;
}

header p {
  font-size: 1.2rem;
  color: #fff;
  margin-top: 15px;
  font-weight: 400;
  max-width: 600px;
  margin: 15px auto 0;
}

.gallery-container {
  width: min(1200px, 92%);
  margin: 0 auto 60px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  justify-content: center;
  gap: 30px;
}

.product-card {
  background: var(--card-white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  padding: 15px;
  transform: rotate(-1.5deg);
}

.product-card:nth-child(even) {
  transform: rotate(1.5deg);
}

.product-card:hover {
  transform: scale(1.05) rotate(0deg);
  box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}

.product-link {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.product-thumbnail {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 18px;
  background: #f1f5f9;
}

.product-info {
  padding: 20px 10px 10px;
  text-align: center;
  color: var(--text-dark);
}

.product-title {
  margin: 0 0 8px;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-dark);
  font-family: 'Fredoka', sans-serif;
}

.product-short-desc {
  margin: 0 0 20px;
  font-size: 1rem;
  line-height: 1.5;
  color: #4a5568;
}

.view-button {
  display: block;
  background: var(--leaf);
  color: #fff;
  padding: 12px 24px;
  border-radius: 15px;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 5px 0 #2d6a30;
  transition: all 0.2s;
}

.view-button:hover {
  filter: brightness(1.1);
}

.view-button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #2d6a30;
}

footer {
  text-align: center;
  padding: 40px 20px;
  color: #d8e4f5;
  font-weight: 500;
}

/* ===== Viewer page ===== */
.viewer-page {
  width: min(1000px, 94%);
  margin: 10px auto 40px;
}

.viewer-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  background: rgba(255,255,255,0.1);
  padding: 12px 20px;
  border-radius: 20px;
  backdrop-filter: blur(5px);
}

.back-link {
  display: inline-block;
  padding: 10px 20px;
  background: white;
  color: var(--text-dark);
  border-radius: 12px;
  font-weight: 700;
  box-shadow: 0 4px 0 #cbd5e1;
  transition: 0.2s;
}

.back-link:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #cbd5e1;
}

.viewer-title {
  margin: 0;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  color: var(--sunny);
  font-family: 'Fredoka', sans-serif;
  text-shadow: 2px 2px 0px rgba(0,0,0,0.5);
}

.viewer-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 7; /* Lebih lebar ke samping, lebih pendek ke bawah */
  min-height: 300px;
  max-height: 500px;
  border-radius: 30px;
  overflow: hidden;
  border: 6px solid white;
  box-shadow: var(--shadow);
  background: rgba(0, 0, 0, 0.1);
}

.viewer-canvas-wrap iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
}

.viewer-canvas-wrap::after {
  content: "🖱️ Area Gerak: Putar & Zoom di sini";
  position: absolute;
  top: 15px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(5px);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  color: white;
  pointer-events: none;
  border: 1px solid rgba(255,255,255,0.3);
}

#viewer-canvas {
  width: 100%;
  height: 100%;
}

#viewer-canvas canvas {
  display: block;
  touch-action: none;
}

.viewer-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: white;
  font-size: 1.5rem;
  font-weight: 600;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
}

.viewer-status.hidden {
  display: none;
}

.desc-box {
  margin-top: 30px;
  background: white;
  padding: 35px;
  border-radius: 30px;
  color: var(--text-dark);
  box-shadow: var(--shadow);
  border-left: 12px solid var(--leaf);
}

.desc-box h2 {
  margin-top: 0;
  font-family: 'Fredoka', sans-serif;
  font-size: 2rem;
  color: var(--leaf);
  margin-bottom: 20px;
}

/* Play Sound Button */
.play-sound-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--sunny);
  color: var(--text-dark);
  border: none;
  padding: 12px 24px;
  border-radius: 15px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 20px;
  box-shadow: 0 4px 0 #d9a406;
  transition: all 0.2s;
}

.play-sound-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.play-sound-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #d9a406;
}

.play-sound-btn .icon {
  font-size: 1.4rem;
}

.desc-box p {
  margin: 0;
  line-height: 1.8;
  font-size: 1.2rem;
}

@media (max-width: 600px) {
  body {
    padding-bottom: 20px; /* Space for the bottom navigation feel */
  }

  .logo-area {
    margin-top: -20px;
    padding: 25px 15px;
    border-radius: 0 0 30px 30px;
    text-align: center;
  }

  /* Desktop & Mobile: 2-Column Grid Wrap */
  .gallery-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Tetap 2 kolom di mobile */
    gap: 15px;
    padding: 20px 15px 40px;
    width: 100%;
    overflow-x: visible; /* Matikan horizontal swipe */
    scroll-snap-type: none;
  }

  .product-card {
    flex: none;
    width: 100%;
    transform: rotate(0deg) !important;
    padding: 8px;
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  }

  .product-title {
    font-size: 1.1rem; /* Ukuran font disesuaikan agar pas 2 blok */
    margin-bottom: 2px;
  }

  .product-short-desc {
    font-size: 0.85rem;
    line-height: 1.3;
    margin-bottom: 12px;
  }

  .view-button {
    padding: 8px 12px;
    font-size: 0.9rem;
    border-radius: 12px;
  }

  /* Modern Viewer for Mobile */
  .viewer-page {
    width: 100%;
    margin: 0;
    padding: 10px;
  }

  .viewer-topbar {
    padding: 12px;
    border-radius: 15px;
    margin-bottom: 15px;
  }

  .viewer-canvas-wrap {
    min-height: 350px;
    aspect-ratio: 4 / 5; /* Tetap portrait untuk mobile agar objek terlihat besar */
    border-radius: 20px;
    border-width: 4px;
    max-height: none;
  }

  .viewer-canvas-wrap::after {
    top: auto;
    bottom: 15px;
    right: 50%;
    transform: translateX(50%);
    width: max-content;
    font-size: 0.75rem;
  }

  .desc-box {
    padding: 24px;
    border-radius: 25px;
    border-left: none;
    border-bottom: 10px solid var(--leaf);
    margin-top: -30px; /* Overlap with canvas slightly */
    position: relative;
    z-index: 2;
    box-shadow: 0 -10px 25px rgba(0,0,0,0.2);
  }

  .desc-box h2 {
    font-size: 1.6rem;
    text-align: center;
  }

  /* Audio Control repositioning */
  .audio-control {
    bottom: 20px;
    left: 20px; /* Move to left to not obstruct 'Back' or other actions */
    width: 50px;
    height: 50px;
  }
}
