/* ============================================================
   animations.css — Keyframes, transitions, GSAP-ready classes
   ============================================================ */

/* ─── Keyframes ─────────────────────────────────────────────── */
@keyframes scrollLine {
  0%   { transform: scaleY(0); transform-origin: top; }
  50%  { transform: scaleY(1); transform-origin: top; }
  51%  { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

@keyframes morphRing {
  0%   { border-radius: 40% 60% 55% 45% / 45% 55% 45% 55%; transform: rotate(0deg); }
  50%  { border-radius: 55% 45% 40% 60% / 60% 40% 60% 40%; transform: rotate(180deg); }
  100% { border-radius: 40% 60% 55% 45% / 45% 55% 45% 55%; transform: rotate(360deg); }
}

@keyframes pulseBg {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50%       { opacity: 0.6; transform: scale(1.1); }
}

@keyframes streakMove {
  0%   { opacity: 0; top: 10%; }
  20%  { opacity: 0.4; }
  80%  { opacity: 0.4; }
  100% { opacity: 0; top: 90%; }
}

@keyframes trackScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes bookFloat {
  0%, 100% { transform: rotateY(-20deg) rotateX(5deg) translateY(0px); }
  50%       { transform: rotateY(-20deg) rotateX(5deg) translateY(-12px); }
}

@keyframes filmstripMove {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-200px); }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(201,168,76,0.2); }
  50%       { box-shadow: 0 0 40px rgba(201,168,76,0.5), 0 0 60px rgba(201,168,76,0.2); }
}

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

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

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

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

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

@keyframes revealWidth {
  from { width: 0; }
  to   { width: 60px; }
}

@keyframes particleFloat {
  0%   { transform: translateY(0px) translateX(0px); opacity: 0.3; }
  33%  { transform: translateY(-30px) translateX(15px); opacity: 0.6; }
  66%  { transform: translateY(-10px) translateX(-10px); opacity: 0.2; }
  100% { transform: translateY(0px) translateX(0px); opacity: 0.3; }
}

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

@keyframes borderDraw {
  to { stroke-dashoffset: 0; }
}

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

@keyframes textReveal {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0% 0 0); }
}

/* ─── GSAP Animation Targets ────────────────────────────────── */
/* Elements start invisible, GSAP reveals them */
.anim-fade-up {
  opacity: 0;
  transform: translateY(40px);
}

.anim-fade-left {
  opacity: 0;
  transform: translateX(-40px);
}

.anim-fade-right {
  opacity: 0;
  transform: translateX(40px);
}

.anim-scale {
  opacity: 0;
  transform: scale(0.95);
}

.anim-clip-reveal {
  clip-path: inset(0 100% 0 0);
}

body.lang-ar .anim-clip-reveal {
  clip-path: inset(0 0 0 100%);
}

/* Stagger children */
.stagger-parent > * {
  opacity: 0;
  transform: translateY(20px);
}

/* ─── Hero animations ───────────────────────────────────────── */
.hero-name-inner {
  will-change: transform;
}

/* ─── Particles canvas ──────────────────────────────────────── */
#particles-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.4;
}

/* ─── Preloader animations ──────────────────────────────────── */
.preloader-filmstrip {
  animation: filmstripMove 1s linear infinite;
}

/* ─── Shimmer loading effect ────────────────────────────────── */
.shimmer {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.05) 50%,
    rgba(255,255,255,0) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ─── Magnetic button effect ────────────────────────────────── */
.magnetic-wrap {
  display: inline-block;
  transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

/* ─── Split text animation ──────────────────────────────────── */
.split-word {
  display: inline-block;
  overflow: hidden;
}

.split-word-inner {
  display: inline-block;
  transform: translateY(100%);
  transition: transform 0.6s var(--ease-out);
}

.split-word.revealed .split-word-inner {
  transform: translateY(0);
}

/* ─── Gold glow button state ────────────────────────────────── */
.btn-glow {
  animation: glowPulse 2.5s ease-in-out infinite;
}

/* ─── Section reveal overlay ─────────────────────────────────── */
.section-reveal-overlay {
  position: absolute;
  inset: 0;
  background: var(--gold);
  transform-origin: left;
  z-index: 10;
}

/* ─── Number counter animate ────────────────────────────────── */
.counter-value {
  display: inline-block;
  will-change: transform, opacity;
}

/* ─── Scroll indicator ──────────────────────────────────────── */
.scroll-indicator {
  opacity: 0;
  animation: fadeInUp 1s var(--ease-out) 2s forwards;
}

/* ─── Film card hover animation ─────────────────────────────── */
.film-card .film-overlay {
  will-change: opacity;
}

/* ─── Blog card hover ───────────────────────────────────────── */
.blog-card {
  will-change: transform;
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s;
}

.blog-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

/* ─── Nav link active line animation ────────────────────────── */
.nav-link.active-enter::after {
  animation: revealWidth 0.4s var(--ease-out) forwards;
}

/* ─── Stars / Particles ─────────────────────────────────────── */
.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--gold);
  border-radius: 50%;
  animation: particleFloat var(--duration, 6s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

/* ─── Page transition overlay ───────────────────────────────── */
#page-transition {
  position: fixed;
  inset: 0;
  background: var(--black);
  z-index: 99990;
  pointer-events: none;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 0.5s var(--ease-in-out);
}

#page-transition.entering {
  clip-path: inset(0 0 0% 0);
  pointer-events: all;
}

#page-transition.leaving {
  clip-path: inset(100% 0 0% 0);
}

/* ─── Scroll snap ────────────────────────────────────────────── */
/* Optional smooth snapping — disabled by default, enable with JS */
.snap-container {
  scroll-snap-type: y mandatory;
  overflow-y: scroll;
  height: 100vh;
}

.snap-section {
  scroll-snap-align: start;
}
