/*
  ALAI /ucenje — Animation Vocabulary
  Bismillahir-Rahmanir-Rahim

  Design principle: contemplative pacing, slow transitions.
  Animations reinforce meaning — not distraction.
  All animations respect prefers-reduced-motion.
*/

/* ===== FADE-IN ON SCROLL ===== */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in-delay-1 { transition-delay: 0.1s; }
.fade-in-delay-2 { transition-delay: 0.2s; }
.fade-in-delay-3 { transition-delay: 0.3s; }
.fade-in-delay-4 { transition-delay: 0.4s; }

/* ===== 19-POINTED STAR ROTATION ===== */
/* The star geometry: 19-pointed star formed from 2 overlapping rings of lines */
.star-19 {
  animation: starRotate 120s linear infinite;
  transform-origin: center;
}

.star-19-inner {
  animation: starRotate 80s linear infinite reverse;
  transform-origin: center;
}

@keyframes starRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ===== CONCENTRIC RINGS PULSE ===== */
/* Represents 19-fold structure radiating outward */
.ring-pulse {
  animation: ringPulse 4s ease-in-out infinite;
  transform-origin: center;
}

.ring-pulse:nth-child(2) { animation-delay: 0.5s; }
.ring-pulse:nth-child(3) { animation-delay: 1s; }
.ring-pulse:nth-child(4) { animation-delay: 1.5s; }
.ring-pulse:nth-child(5) { animation-delay: 2s; }

@keyframes ringPulse {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 0.45; }
}

/* ===== NUMBER 19 COUNTER ANIMATION ===== */
/* Used on mladi.html — counting up to 19 */
.counter-digit {
  display: inline-block;
  animation: digitReveal 0.4s ease forwards;
  opacity: 0;
}

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

/* ===== GOLD SHIMMER ===== */
/* Subtle text shimmer for the Bismillah/ayah display */
.gold-shimmer {
  background: linear-gradient(
    120deg,
    var(--gold-dark) 0%,
    var(--gold) 30%,
    var(--gold-light) 50%,
    var(--gold) 70%,
    var(--gold-dark) 100%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 5s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ===== BREATHING DOT ===== */
/* Gentle pulse for "live" indicator */
.breathing-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  animation: breathe 2.5s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* ===== WAVEFORM BARS ===== */
/* Decorative static waveform bars — not a real player */
.wave-bar {
  display: inline-block;
  width: 3px;
  background: var(--gold);
  border-radius: 2px;
  animation: waveBar 1.8s ease-in-out infinite;
  margin: 0 1px;
  opacity: 0.7;
}

.wave-bar:nth-child(odd) { animation-duration: 1.6s; }
.wave-bar:nth-child(3n) { animation-duration: 2.1s; animation-delay: 0.3s; }
.wave-bar:nth-child(4n) { animation-duration: 1.4s; animation-delay: 0.6s; }

@keyframes waveBar {
  0%, 100% { transform: scaleY(0.3); opacity: 0.4; }
  50% { transform: scaleY(1); opacity: 0.9; }
}

/* ===== GEOMETRIC GRID ENTRANCE ===== */
/* 114-cell (6x19) grid cells animating in one by one */
.grid-cell {
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.grid-cell.visible {
  opacity: 1;
  transform: scale(1);
}

/* ===== SURAH TIMELINE REVEAL ===== */
/* Used on audio page — revealing Meccan/Medinan surahs */
.timeline-bar {
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.8s ease;
}

.timeline-bar.visible {
  transform: scaleX(1);
}

/* ===== PERSPECTIVE TILE HOVER ===== */
/* Cards on hub index */
.perspective-tile {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  position: relative;
  overflow: hidden;
}

.perspective-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(201, 169, 97, 0.08) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.perspective-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(26, 23, 20, 0.15);
}

.perspective-tile:hover::before {
  opacity: 1;
}

/* ===== SVG DRAW-ON ===== */
/* For geometric SVGs — paths draw themselves in on scroll */
.svg-draw {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  transition: stroke-dashoffset 2s ease;
}

.svg-draw.visible {
  stroke-dashoffset: 0;
}

/* ===== HERO ENTRANCE ===== */
.hero-entrance {
  animation: heroIn 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

.hero-entrance-delay-1 { animation-delay: 0.2s; }
.hero-entrance-delay-2 { animation-delay: 0.5s; }
.hero-entrance-delay-3 { animation-delay: 0.8s; }
.hero-entrance-delay-4 { animation-delay: 1.1s; }

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

/* ===== ACOUSTIC RING ===== */
/* Concentric circle animation on audio cards */
.acoustic-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid var(--gold);
  opacity: 0;
  animation: acousticExpand 3s ease-out infinite;
}

.acoustic-ring:nth-child(2) { animation-delay: 1s; }
.acoustic-ring:nth-child(3) { animation-delay: 2s; }

@keyframes acousticExpand {
  0% { transform: scale(0.5); opacity: 0.6; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* ===== NUMBER ORBIT ===== */
/* Small "19" numerals slowly orbiting around the hero star */
.orbit-container {
  position: relative;
}

.orbit-num {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--gold);
  opacity: 0.5;
  animation: orbit 40s linear infinite;
  transform-origin: 0 0;
}

@keyframes orbit {
  from { transform: rotate(0deg) translateX(120px) rotate(0deg); }
  to { transform: rotate(360deg) translateX(120px) rotate(-360deg); }
}

/* ===== SEPARATOR ORNAMENT ===== */
.sep-ornament {
  text-align: center;
  margin: var(--space-16) auto;
  position: relative;
}

.sep-ornament::before,
.sep-ornament::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 32px);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-gold));
}

.sep-ornament::before { left: 0; }
.sep-ornament::after { right: 0; background: linear-gradient(-90deg, transparent, var(--border-gold)); }

.sep-ornament-icon {
  font-size: var(--text-base);
  color: var(--gold);
  opacity: 0.7;
  display: inline-block;
  position: relative;
  z-index: 1;
  padding: 0 var(--space-4);
  background: var(--cream);
}

/* ===== REDUCED MOTION OVERRIDES ===== */
@media (prefers-reduced-motion: reduce) {
  .star-19,
  .star-19-inner,
  .ring-pulse,
  .breathing-dot,
  .wave-bar,
  .acoustic-ring,
  .orbit-num,
  .gold-shimmer {
    animation: none;
  }

  .fade-in,
  .grid-cell,
  .timeline-bar,
  .svg-draw {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .perspective-tile:hover {
    transform: none;
  }

  .hero-entrance {
    animation: none;
    opacity: 1;
  }
}
