/* witcher-card.css
   Toggle tema (sun / moon switch) — disesuaikan dari konsep Uiverse (RiccardoRapelli)
   agar cocok dengan markup di index.html:
   label.theme-toggle > span.switch > input#darkModeToggle + span.slider.round > span.sun-moon, span.stars
   Palet warna mengikuti variabel di styles.css (--primary, --border, --text)
*/

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  z-index: 0;
  cursor: pointer;
  overflow: hidden;
  background: linear-gradient(160deg, #6db9f5, #2f8fe0);
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.slider.round {
  border-radius: 34px;
}

.switch input:focus-visible + .slider {
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.35);
}

/* Matahari / Bulan */
.sun-moon {
  position: absolute;
  left: 4px;
  bottom: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6d8, #ffd35a 60%, #f5a623 100%);
  box-shadow:
    0 0 10px rgba(255, 211, 90, 0.9),
    0 0 22px rgba(255, 211, 90, 0.55);
  transition: transform 0.4s ease, background 0.4s ease, box-shadow 0.4s ease;
}

.switch input:checked + .slider {
  background: linear-gradient(160deg, #0c1626, #16243b);
  border-color: var(--border, #3a506d);
}

.switch input:checked + .slider .sun-moon {
  transform: translateX(26px);
  background: radial-gradient(circle at 32% 28%, #ffffff, #d7dee8 55%, #b7c5d8 100%);
  box-shadow:
    inset -3px -2px 0 rgba(0, 0, 0, 0.08),
    inset 4px 6px 0 -3px rgba(150, 160, 175, 0.55),
    inset -6px -4px 0 -4px rgba(150, 160, 175, 0.5),
    0 0 8px rgba(255, 255, 255, 0.35);
}

/* Bintang-bintang, muncul saat mode gelap aktif */
.stars {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.switch input:checked + .slider .stars {
  opacity: 1;
}

.stars::before,
.stars::after {
  content: "✦";
  position: absolute;
  color: #f1f5f9;
  animation: witcher-twinkle 2s ease-in-out infinite;
}

.stars::before {
  left: 8px;
  top: 5px;
  font-size: 9px;
  animation-delay: 0.2s;
}

.stars::after {
  left: 18px;
  bottom: 4px;
  font-size: 7px;
  animation-delay: 0.9s;
}

@keyframes witcher-twinkle {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.25);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .slider,
  .sun-moon,
  .stars,
  .stars::before,
  .stars::after {
    transition: none !important;
    animation: none !important;
  }
}
