/* ==========================================================================
   HAMCO Sports News - Reusable Animations
   Fade, slide, pulse, skeleton shimmer, card hover effects
   ========================================================================== */

/* ==========================================================================
   Keyframes
   ========================================================================== */

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

@keyframes hn-fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes hn-slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes hn-slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes hn-slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes hn-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.85);
  }
}

@keyframes hn-shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes hn-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes hn-bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* ==========================================================================
   Animation Utility Classes
   ========================================================================== */

.hn-animate-fadeIn {
  animation: hn-fadeIn var(--hn-transition-base) forwards;
}

.hn-animate-slideUp {
  animation: hn-slideUp var(--hn-transition-slow) forwards;
}

.hn-animate-slideDown {
  animation: hn-slideDown var(--hn-transition-slow) forwards;
}

.hn-animate-slideInLeft {
  animation: hn-slideInLeft var(--hn-transition-slow) forwards;
}

.hn-animate-slideInRight {
  animation: hn-slideInRight var(--hn-transition-slow) forwards;
}

.hn-animate-scaleIn {
  animation: hn-scaleIn var(--hn-transition-base) forwards;
}

/* ---- Staggered Entrance ---- */
.hn-stagger > * {
  opacity: 0;
  animation: hn-slideUp 400ms ease forwards;
}

.hn-stagger > *:nth-child(1) { animation-delay: 0ms; }
.hn-stagger > *:nth-child(2) { animation-delay: 60ms; }
.hn-stagger > *:nth-child(3) { animation-delay: 120ms; }
.hn-stagger > *:nth-child(4) { animation-delay: 180ms; }
.hn-stagger > *:nth-child(5) { animation-delay: 240ms; }
.hn-stagger > *:nth-child(6) { animation-delay: 300ms; }
.hn-stagger > *:nth-child(7) { animation-delay: 360ms; }
.hn-stagger > *:nth-child(8) { animation-delay: 420ms; }
.hn-stagger > *:nth-child(9) { animation-delay: 480ms; }
.hn-stagger > *:nth-child(10) { animation-delay: 540ms; }
.hn-stagger > *:nth-child(n+11) { animation-delay: 600ms; }

/* ==========================================================================
   Scroll-Triggered Animations (JS adds .is-visible)
   ========================================================================== */

.hn-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 600ms ease, transform 600ms ease;
}

.hn-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.hn-reveal--left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 600ms ease, transform 600ms ease;
}

.hn-reveal--left.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.hn-reveal--right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 600ms ease, transform 600ms ease;
}

.hn-reveal--right.is-visible {
  opacity: 1;
  transform: translateX(0);
}

.hn-reveal--scale {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 600ms ease, transform 600ms ease;
}

.hn-reveal--scale.is-visible {
  opacity: 1;
  transform: scale(1);
}

/* Delay modifiers for reveals */
.hn-reveal--delay-1 { transition-delay: 100ms; }
.hn-reveal--delay-2 { transition-delay: 200ms; }
.hn-reveal--delay-3 { transition-delay: 300ms; }
.hn-reveal--delay-4 { transition-delay: 400ms; }

/* ==========================================================================
   Live Indicator Pulse
   ========================================================================== */

.hn-live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--hn-green);
  animation: hn-pulse 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

.hn-live-dot--sm {
  width: 6px;
  height: 6px;
}

.hn-live-dot--lg {
  width: 10px;
  height: 10px;
}

.hn-live-dot--with-ring {
  position: relative;
}

.hn-live-dot--with-ring::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--hn-green);
  opacity: 0;
  animation: hn-pulse-ring 1.5s ease-in-out infinite;
}

@keyframes hn-pulse-ring {
  0% {
    opacity: 0.6;
    transform: scale(0.8);
  }
  100% {
    opacity: 0;
    transform: scale(1.6);
  }
}

/* ==========================================================================
   Skeleton Loading
   ========================================================================== */

.hn-skeleton {
  position: relative;
  overflow: hidden;
  background-color: var(--hn-gray-200);
  border-radius: var(--hn-radius-sm);
}

.hn-skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  animation: hn-shimmer 1.5s ease-in-out infinite;
}

.hn-skeleton--text {
  height: 14px;
  width: 100%;
  margin-bottom: var(--hn-space-2);
}

.hn-skeleton--text:last-child {
  width: 70%;
}

.hn-skeleton--title {
  height: 24px;
  width: 80%;
  margin-bottom: var(--hn-space-3);
}

.hn-skeleton--avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.hn-skeleton--image {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--hn-radius-md);
}

.hn-skeleton--badge {
  width: 60px;
  height: 20px;
  border-radius: var(--hn-radius-sm);
}

.hn-skeleton--card {
  border-radius: var(--hn-radius-md);
  padding: var(--hn-space-4);
}

/* ==========================================================================
   Card Hover Effects
   ========================================================================== */

.hn-hover-lift {
  transition: transform var(--hn-transition-base), box-shadow var(--hn-transition-base);
}

.hn-hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--hn-shadow-card-hover);
}

.hn-hover-scale {
  transition: transform var(--hn-transition-base);
}

.hn-hover-scale:hover {
  transform: scale(1.02);
}

/* Image zoom on card hover */
.hn-hover-zoom {
  overflow: hidden;
}

.hn-hover-zoom img {
  transition: transform 500ms ease;
}

.hn-hover-zoom:hover img {
  transform: scale(1.06);
}

/* Overlay darken on hover */
.hn-hover-overlay {
  position: relative;
}

.hn-hover-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0);
  transition: background-color var(--hn-transition-base);
  pointer-events: none;
  z-index: 1;
}

.hn-hover-overlay:hover::after {
  background-color: rgba(0, 0, 0, 0.15);
}

/* Border accent on hover */
.hn-hover-border {
  border-bottom: 3px solid transparent;
  transition: border-color var(--hn-transition-fast);
}

.hn-hover-border:hover {
  border-bottom-color: var(--hn-red);
}

/* ==========================================================================
   Spinner / Loading
   ========================================================================== */

.hn-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--hn-gray-300);
  border-top-color: var(--hn-red);
  border-radius: 50%;
  animation: hn-spin 0.7s linear infinite;
}

.hn-spinner--sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.hn-spinner--lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .hn-reveal,
  .hn-reveal--left,
  .hn-reveal--right,
  .hn-reveal--scale {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .hn-stagger > * {
    opacity: 1;
    animation: none;
  }

  .hn-hover-lift:hover {
    transform: none;
  }

  .hn-hover-zoom:hover img {
    transform: none;
  }

  .hn-live-dot {
    animation: none;
  }

  .hn-skeleton::after {
    animation: none;
  }
}
