/* ============================================================
   大梅沙垃圾图鉴 · Animations & Transitions
   ============================================================ */

/* ─── Card 3D Tilt (applied by tilt.js) ──────────────────── */
.trash-card {
  transform-style: preserve-3d;
  will-change: transform;
}

/* Gloss overlay for tilt effect */
.trash-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: radial-gradient(
    circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
    rgba(255,255,255,0.18) 0%,
    transparent 65%
  );
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 1;
}
.trash-card:hover::after { opacity: 1; }

/* ─── Hero parallax items ─────────────────────────────────── */
.h-item {
  will-change: transform;
}

/* Float animation on hero items (subtle) */
@keyframes float-a {
  0%, 100% { transform: translateY(0px) rotate(var(--rot, -5deg)); }
  50% { transform: translateY(-8px) rotate(var(--rot, -5deg)); }
}
@keyframes float-b {
  0%, 100% { transform: translateY(0px) rotate(var(--rot, 5deg)); }
  50% { transform: translateY(-12px) rotate(var(--rot, 5deg)); }
}
@keyframes float-c {
  0%, 100% { transform: translateY(0px) rotate(var(--rot, 0deg)); }
  50% { transform: translateY(-6px) rotate(var(--rot, 0deg)); }
}

.h-item:nth-child(odd)  { animation: float-a 4s ease-in-out infinite; }
.h-item:nth-child(even) { animation: float-b 5s ease-in-out infinite; }
.h-item:nth-child(3n)   { animation: float-c 3.5s ease-in-out infinite; }

/* ─── Page scroll fade-in ─────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Stats count-up number ──────────────────────────────── */
.count-up {
  display: inline-block;
  transition: transform 0.1s;
}
.count-up.bump { transform: scale(1.15); }

/* ─── Filter button active indicator ─────────────────────── */
.filter-btn {
  position: relative;
  overflow: hidden;
}
.filter-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--brand-blue);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
  z-index: -1;
  border-radius: 100px;
}
.filter-btn.active::before { transform: scaleX(1); }

/* ─── Gallery grid stagger ───────────────────────────────── */
.gallery-grid .trash-card:nth-child(1)  { animation-delay: 0.00s; }
.gallery-grid .trash-card:nth-child(2)  { animation-delay: 0.05s; }
.gallery-grid .trash-card:nth-child(3)  { animation-delay: 0.10s; }
.gallery-grid .trash-card:nth-child(4)  { animation-delay: 0.15s; }
.gallery-grid .trash-card:nth-child(5)  { animation-delay: 0.20s; }
.gallery-grid .trash-card:nth-child(6)  { animation-delay: 0.25s; }
.gallery-grid .trash-card:nth-child(7)  { animation-delay: 0.30s; }
.gallery-grid .trash-card:nth-child(8)  { animation-delay: 0.35s; }
.gallery-grid .trash-card:nth-child(9)  { animation-delay: 0.40s; }
.gallery-grid .trash-card:nth-child(10) { animation-delay: 0.45s; }
.gallery-grid .trash-card:nth-child(11) { animation-delay: 0.50s; }
.gallery-grid .trash-card:nth-child(12) { animation-delay: 0.55s; }

/* ─── Rank list item slide-in ────────────────────────────── */
@keyframes rankIn {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}
.rank-item {
  animation: rankIn 0.35s ease both;
}
.rank-item:nth-child(1)  { animation-delay: 0.00s; }
.rank-item:nth-child(2)  { animation-delay: 0.05s; }
.rank-item:nth-child(3)  { animation-delay: 0.10s; }
.rank-item:nth-child(4)  { animation-delay: 0.15s; }
.rank-item:nth-child(5)  { animation-delay: 0.20s; }
.rank-item:nth-child(6)  { animation-delay: 0.25s; }
.rank-item:nth-child(7)  { animation-delay: 0.30s; }
.rank-item:nth-child(8)  { animation-delay: 0.35s; }
.rank-item:nth-child(9)  { animation-delay: 0.40s; }
.rank-item:nth-child(10) { animation-delay: 0.45s; }

/* ─── Modal open/close ───────────────────────────────────── */
.modal-overlay[hidden] { display: none; }

/* Smooth score bar fill on modal open */
.score-bar-fill {
  transition: width 0.8s cubic-bezier(0.34,1.56,0.64,1) 0.15s;
}

/* ─── Ripple on submit button ────────────────────────────── */
@keyframes ripple {
  from { transform: scale(0); opacity: 0.5; }
  to   { transform: scale(4); opacity: 0; }
}
.btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  width: 80px; height: 80px;
  margin-left: -40px; margin-top: -40px;
  pointer-events: none;
  animation: ripple 0.6s linear;
}

/* ─── Scroll progress bar ────────────────────────────────── */
#scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: var(--brand-blue);
  z-index: 999;
  width: 0%;
  transition: width 0.1s;
}

/* ─── Wave animation ─────────────────────────────────────── */
@keyframes wave-drift {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ─── Logo bounce on load ────────────────────────────────── */
@keyframes logoBounce {
  0%   { transform: translateY(-8px); opacity: 0; }
  60%  { transform: translateY(3px); opacity: 1; }
  100% { transform: translateY(0); }
}
.hero-logo { animation: logoBounce 0.6s ease 0.2s both; }
.hero-title { animation: logoBounce 0.6s ease 0.35s both; }

/* ─── Hover on footer logo ───────────────────────────────── */
.footer-logo:hover { transform: scale(1.05) rotate(-3deg); transition: transform 0.3s; }
