/* ================================================
   HuntPhone – animate.css
   Animasi: subtle, purposeful, tidak lebay
   Semua animasi hormat reduced-motion preference
   ================================================ */


/* ── KEYFRAMES ─────────────────────────────────── */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes barGrow {
  from { width: 0%; }
  to   { width: var(--bar-target, 100%); }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}

@keyframes pulse-subtle {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.7; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


/* ── PAGE ENTER ────────────────────────────────── */
/* Header & nav turun dari atas */
.site-header {
  animation: slideDown 0.35s ease both;
}
.main-nav {
  animation: slideDown 0.35s 0.07s ease both;
}
.search-bar {
  animation: slideDown 0.35s 0.12s ease both;
}

/* Hero banner naik lembut */
.hero-banner {
  animation: fadeUp 0.45s 0.15s ease both;
}

/* Section cards muncul satu per satu */
.section-card,
.sidebar-card {
  animation: fadeUp 0.4s ease both;
}
/* Delay bertahap untuk tiap card */
.main-col > .section-card:nth-child(1)  { animation-delay: 0.15s; }
.main-col > .section-card:nth-child(2)  { animation-delay: 0.22s; }
.main-col > .section-card:nth-child(3)  { animation-delay: 0.29s; }
.main-col > .section-card:nth-child(4)  { animation-delay: 0.36s; }
.sidebar > .sidebar-card:nth-child(1)   { animation-delay: 0.20s; }
.sidebar > .sidebar-card:nth-child(2)   { animation-delay: 0.27s; }
.sidebar > .sidebar-card:nth-child(3)   { animation-delay: 0.34s; }
.sidebar > .sidebar-card:nth-child(4)   { animation-delay: 0.41s; }


/* ── SCROLL REVEAL ─────────────────────────────── */
/* Elemen yang belum terlihat */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
/* Versi lebih cepat untuk item dalam list */
.reveal-fast {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.reveal-fast.visible {
  opacity: 1;
  transform: translateY(0);
}


/* ── HOVER EFFECTS ─────────────────────────────── */

/* Card lift: section-card dan sidebar-card */
.section-card,
.sidebar-card {
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.section-card:hover,
.sidebar-card:hover {
  box-shadow: 0 4px 20px rgba(123, 47, 247, 0.12);
  transform: translateY(-2px);
}

/* News item — highlight baris */
.news-item {
  transition: background 0.15s ease, padding-left 0.15s ease;
}
.news-item:hover {
  padding-left: 18px;
}

/* Review item */
.review-item {
  transition: background 0.15s ease;
}

/* Brand logo pop */
.brand-logo-item {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.brand-logo-item:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 12px rgba(123, 47, 247, 0.15);
}

/* Nav link underline slide */
.main-nav a {
  position: relative;
  transition: color 0.15s ease;
}
.main-nav a::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 50%;
  width: 0; height: 2px;
  background: var(--phone-gold);
  border-radius: 2px;
  transition: width 0.2s ease, left 0.2s ease;
}
.main-nav a:hover::after,
.main-nav a.active::after {
  width: 100%;
  left: 0;
}

/* Button bounce-in on press */
.finder-btn,
button[type="submit"],
.share-btn,
.buy-btn {
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.finder-btn:active,
button[type="submit"]:active,
.share-btn:active,
.buy-btn:active {
  transform: scale(0.96);
}

/* Tag pill hover */
.tag-pill,
.hero-badge,
.qbadge {
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.tag-pill:hover,
.hero-badge:hover {
  transform: scale(1.04);
}

/* Review thumbnail zoom */
.review-thumb,
.news-thumb {
  transition: transform 0.3s ease;
  overflow: hidden;
}
.review-item:hover .review-thumb,
.news-item:hover .news-thumb {
  transform: scale(1.05);
}

/* Gallery thumbnails */
.gallery-thumb {
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}
.gallery-thumb:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(123, 47, 247, 0.2);
}
.gallery-thumb.active {
  box-shadow: 0 0 0 2px var(--hunt-purple);
}

/* Color swatch */
.color-swatch-item {
  transition: transform 0.2s ease;
}
.color-swatch-item:hover {
  transform: scale(1.1);
}

/* Verdict box soft pulse saat muncul */
.verdict-box {
  animation: scaleIn 0.4s 0.2s ease both;
}

/* Rating bar — animasi dihandle oleh animate.js (initRatingBars)
   agar width sesuai nilai nyata, bukan var(--bar-target, 100%) */
.rating-bar-fill {
  width: 0%;   /* start dari 0, JS yang set target & animasi */
}

/* Stat numbers fadeUp */
.stat-num,
.score-big,
.stat-val {
  animation: countUp 0.5s ease both;
}
.stats-row .stat-item:nth-child(1) .stat-num { animation-delay: 0.3s; }
.stats-row .stat-item:nth-child(2) .stat-num { animation-delay: 0.4s; }
.stats-row .stat-item:nth-child(3) .stat-num { animation-delay: 0.5s; }


/* ── LOADING SKELETON ──────────────────────────── */
/* Pakai ini sementara konten belum load dari JS */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 25%,
    var(--border) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text {
  height: 12px;
  margin-bottom: 8px;
  border-radius: 4px;
}
.skeleton-thumb {
  width: 50px;
  height: 40px;
  border-radius: 5px;
  flex-shrink: 0;
}
.skeleton-img {
  width: 100%;
  height: 84px;
  border-radius: 7px;
}


/* ── THEME TOGGLE ANIMATION ────────────────────── */
.theme-btn {
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.theme-btn:hover {
  transform: translateY(-1px);
}
.theme-btn:active {
  transform: scale(0.95);
}


/* ── BACK BUTTON ───────────────────────────────── */
.back-btn {
  transition: transform 0.2s ease, color 0.2s ease;
}
.back-btn:hover {
  transform: translateX(-3px);
}


/* ── SPEC TABLE ────────────────────────────────── */
.spec-cat-row {
  transition: background 0.15s ease;
}
.spec-cat-row:hover {
  background: var(--accent-light);
}


/* ── FOCUS STATES (aksesibilitas) ──────────────── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--hunt-purple);
  outline-offset: 2px;
  border-radius: 4px;
}


/* ── REDUCED MOTION ────────────────────────────── */
/* Hormati preferensi pengguna — wajib ada */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal,
  .reveal-fast {
    opacity: 1;
    transform: none;
  }
}