/* ============================================================
   ANIMATIONS — extends styles.css
   Loaded after styles.css for proper cascade
============================================================ */

/* ============================================================
   PAGE LOADER
============================================================ */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1.5rem;
  transition: opacity 0.6s var(--ease-o), visibility 0.6s;
}
.page-loader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.page-loader__logo {
  height: 64px;
  width: auto;
  animation: loader-pulse 1.2s ease-in-out infinite;
}
.page-loader__bar {
  width: 200px;
  height: 2px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.page-loader__bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 100%;
  background: var(--purple);
  border-radius: 999px;
  animation: loader-slide 1.2s ease-in-out infinite;
}
@keyframes loader-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(0.92); opacity: 0.7; }
}
@keyframes loader-slide {
  0%   { left: -40%; }
  100% { left: 100%; }
}

/* ============================================================
   CURSOR FOLLOWER
============================================================ */
.cursor-dot {
  position: fixed;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: width 0.3s var(--ease-o), height 0.3s var(--ease-o), opacity 0.25s;
  mix-blend-mode: difference;
  opacity: 0;
}
.cursor-dot.is-active { opacity: 1; }
.cursor-dot.is-hover {
  width: 48px;
  height: 48px;
}
@media (hover: none), (max-width: 768px) {
  .cursor-dot { display: none !important; }
}

/* ============================================================
   PHOTO 3D SCROLL-LINKED ROTATION — hero / services / about / contact
============================================================ */

/* Hero photo: outer wrap = perspective + entrance scale,
   inner rot = scroll-linked rotateY (rotates BOTH photo and Hi badge together),
   photo = static Z-tilt */
.hero__photo-wrap {
  perspective: 1800px;
  perspective-origin: center center;
}
.hero__photo-rot {
  --rot-y: 0deg;
  position: relative;
  width: 100%;
  height: 100%;
  transform: rotateY(var(--rot-y));
  transform-origin: center center;
  transform-style: preserve-3d;
  transition: transform 0.06s linear;
  will-change: transform;
}
.hero__photo {
  transform: rotate(-4deg);
  transition: transform 0.5s var(--ease-o);
}
.hero__photo-rot:hover .hero__photo {
  transform: rotate(0deg);
}

/* "Hi" badge tilts opposite to photo */
.hero__badge {
  transform: rotate(8deg);
}
@keyframes float-tilt {
  0%, 100% { transform: rotate(8deg) translateY(0); }
  50%       { transform: rotate(8deg) translateY(-8px); }
}
.hero__badge {
  animation: float-tilt 3.5s ease-in-out infinite;
}

/* Services tilted image — scroll-linked rotation + tilt */
.services__right {
  perspective: 1800px;
  perspective-origin: center center;
}
.services__img-wrap {
  --tilt: 3deg;
  --rot-y: 0deg;
  transform: rotate(var(--tilt)) rotateY(var(--rot-y));
  transition: transform 0.08s linear;
  transform-origin: center center;
  will-change: transform;
}

/* About image — strong 3D scroll-linked Y rotation */
.about__img-wrap {
  perspective: 1800px;
  perspective-origin: center center;
}
.about__img {
  --rot-y: 0deg;
  --rot-x: 0deg;
  transform: rotateY(var(--rot-y)) rotateX(var(--rot-x));
  transform-origin: center center;
  transition: transform 0.08s linear;
  will-change: transform;
}

/* Contact photo also rotates */
.contact__photo-wrap {
  perspective: 1800px;
  perspective-origin: center center;
}
.contact__photo {
  --rot-y: 0deg;
  transform: rotateY(var(--rot-y));
  transform-origin: center center;
  transition: transform 0.08s linear;
  will-change: transform;
}

/* ============================================================
   MARQUEE — infinite scrolling strip
============================================================ */
.marquee {
  background: var(--text);
  color: #fff;
  padding-block: 1.4rem;
  overflow: hidden;
  position: relative;
  border-block: 1px solid var(--text);
}
.marquee__track {
  display: flex;
  width: max-content;
  animation: marquee-scroll 28s linear infinite;
}
.marquee__group {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.marquee__item {
  font-family: var(--font-hero);
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  letter-spacing: 0.06em;
  padding-inline: 2rem;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 2rem;
}
.marquee__item::after {
  content: '✦';
  font-size: 0.7em;
  color: var(--purple);
  display: inline-block;
}
.marquee:hover .marquee__track {
  animation-play-state: paused;
}
@keyframes marquee-scroll {
  to { transform: translateX(-50%); }
}

/* ============================================================
   LETTER-BY-LETTER REVEAL
============================================================ */
.split-letter {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.45em);
  transition: opacity 0.5s var(--ease-o), transform 0.5s var(--ease-o);
}
.split-letter--space {
  width: 0.25em;
  display: inline-block;
}
.is-revealed .split-letter {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   PROJECT CARD — 3D tilt on hover
============================================================ */
.proj-stack-card {
  transform-style: preserve-3d;
  perspective: 1200px;
  transition: transform 0.45s var(--ease-o), box-shadow 0.4s;
  will-change: transform;
}
.proj-stack-card__bg {
  transition: transform 0.6s var(--ease-o);
  will-change: transform;
}
.proj-stack-card:hover {
  box-shadow: 0 30px 80px rgba(0,0,0,0.25);
}

/* ============================================================
   MAGNETIC BUTTONS
============================================================ */
.btn, .nav__cta, .btn-pill-outline {
  will-change: transform;
}

/* ============================================================
   ENTRANCE ANIMATIONS — hero
============================================================ */
.hero__word {
  opacity: 0;
  animation: hero-word-in 1.1s var(--ease-o) forwards;
}
.hero__word:first-child {
  animation-delay: 0.6s;
  animation-name: hero-word-left;
}
.hero__word--r {
  animation-delay: 0.65s;
  animation-name: hero-word-right;
}

@keyframes hero-word-left {
  0%   { opacity: 0; transform: translateX(-60px); }
  100% { opacity: 1; transform: translateX(0); }
}
@keyframes hero-word-right {
  0%   { opacity: 0; transform: translateX(60px); }
  100% { opacity: 1; transform: translateX(0); }
}

.hero__photo-wrap {
  opacity: 0;
  animation: hero-photo-in 0.9s 0.85s var(--ease-o) forwards;
}
@keyframes hero-photo-in {
  0%   { opacity: 0; transform: scale(0.4); }
  100% { opacity: 1; transform: scale(1); }
}

.hero__badge {
  opacity: 0;
  animation: badge-drop 0.7s 1.4s var(--ease-o) forwards, float-tilt 3.5s 2.1s ease-in-out infinite;
}
@keyframes badge-drop {
  0%   { opacity: 0; transform: rotate(8deg) translateY(-30px) scale(0.5); }
  60%  { opacity: 1; transform: rotate(8deg) translateY(8px) scale(1.1); }
  100% { opacity: 1; transform: rotate(8deg) translateY(0) scale(1); }
}

/* ============================================================
   STAT COUNTERS — pulse on activation
============================================================ */
.stat__num.is-counted {
  animation: stat-pulse 0.5s var(--ease-o);
}
@keyframes stat-pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* ============================================================
   SOCIAL ICONS — rotate hover
============================================================ */
.social-icon, .footer__social {
  transition: all 0.3s var(--ease-o), transform 0.4s var(--ease-o);
}
.social-icon:hover, .footer__social:hover {
  transform: translateY(-3px) rotate(-8deg);
}

/* ============================================================
   FAQ + SVC accordion icons — bouncier
============================================================ */
.svc-acc__icon, .faq__icon {
  transition: transform 0.45s cubic-bezier(0.68, -0.55, 0.265, 1.55), border-color 0.25s, color 0.25s;
}

/* ============================================================
   BLOG CARDS — image zoom on hover
============================================================ */
.blog-card__img {
  transition: transform 0.6s var(--ease-o);
}
.blog-card:hover .blog-card__img {
  transform: scale(1.05);
}

/* ============================================================
   AVAILABLE BADGE — pulse green dot
============================================================ */
.avail-badge__dot, .abt-story__badge-dot, .abt-label-dot {
  animation: pulse-green 2.4s ease-in-out infinite;
}
@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 6px var(--green); transform: scale(1); }
  50%       { box-shadow: 0 0 14px var(--green); transform: scale(1.18); }
}

/* ============================================================
   NAV — entrance from top + hide-on-scroll
============================================================ */
.nav {
  opacity: 0;
  transform: translateY(-30px);
  animation: nav-drop 0.8s 0.3s var(--ease-o) forwards;
  transition: transform 0.45s var(--ease-o), opacity 0.4s var(--ease-o);
}
@keyframes nav-drop {
  to { opacity: 1; transform: translateY(0); }
}

/* Hidden state — applied when scrolled past the hero */
.nav.nav--hidden {
  transform: translateY(-120px) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ============================================================
   HERO TOPROW + BTMROW fade
============================================================ */
.hero__toprow {
  opacity: 0;
  animation: fade-up 0.7s 0.4s var(--ease-o) forwards;
}
.hero__btmrow {
  opacity: 0;
  animation: fade-up 0.8s 1.2s var(--ease-o) forwards;
}
@keyframes fade-up {
  0%   { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   AI ART — generative-looking placeholders
   Static composition (.ai-art--image) + animated loop (.ai-art--video)
============================================================ */
.ai-art {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1F4423 0%, #2C5530 35%, #346739 70%, #1F4423 100%);
  isolation: isolate;
}

/* Grainy noise overlay for that AI-generated texture */
.ai-art__grain {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0.18;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200' viewBox='0 0 200 200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='matrix' values='0 0 0 0 0.3 0 0 0 0 0.3 0 0 0 0 0.3 0 0 0 0.4 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 220px 220px;
}

/* Layered translucent blobs */
.ai-art__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(38px);
  mix-blend-mode: screen;
  will-change: transform;
}
.ai-art__blob--1 {
  width: 70%;
  height: 70%;
  background: radial-gradient(circle, #C8956D 0%, transparent 70%);
  top: -15%;
  left: -10%;
  opacity: 0.85;
}
.ai-art__blob--2 {
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, #4F8E54 0%, transparent 70%);
  bottom: -15%;
  right: -10%;
  opacity: 0.8;
}
.ai-art__blob--3 {
  width: 45%;
  height: 45%;
  background: radial-gradient(circle, #F5E9DC 0%, transparent 70%);
  top: 25%;
  left: 35%;
  opacity: 0.4;
}
.ai-art__blob--4 {
  width: 35%;
  height: 35%;
  background: radial-gradient(circle, #346739 0%, transparent 70%);
  top: 55%;
  left: 10%;
  opacity: 0.6;
}

/* Static image — sharper composition, subtle micro-shimmer only */
.ai-art--image .ai-art__blob--3 {
  animation: ai-shimmer 8s ease-in-out infinite alternate;
}
@keyframes ai-shimmer {
  from { opacity: 0.35; transform: scale(1); }
  to   { opacity: 0.55; transform: scale(1.08); }
}

/* Video — full morph loop */
.ai-art__blob--anim:nth-of-type(2) { animation: ai-morph-1 9s ease-in-out infinite alternate; }
.ai-art__blob--anim:nth-of-type(3) { animation: ai-morph-2 11s -2s ease-in-out infinite alternate; }
.ai-art__blob--anim:nth-of-type(4) { animation: ai-morph-3 13s -4s ease-in-out infinite alternate; }
.ai-art__blob--anim:nth-of-type(5) { animation: ai-morph-4 15s -6s ease-in-out infinite alternate; }

@keyframes ai-morph-1 {
  0%   { transform: translate(0,0) scale(1) rotate(0deg); }
  100% { transform: translate(18%,-12%) scale(1.25) rotate(40deg); }
}
@keyframes ai-morph-2 {
  0%   { transform: translate(0,0) scale(1) rotate(0deg); }
  100% { transform: translate(-22%,18%) scale(1.35) rotate(-50deg); }
}
@keyframes ai-morph-3 {
  0%   { transform: translate(0,0) scale(1) rotate(0deg); opacity: 0.4; }
  100% { transform: translate(15%,25%) scale(0.9) rotate(60deg); opacity: 0.55; }
}
@keyframes ai-morph-4 {
  0%   { transform: translate(0,0) scale(1) rotate(0deg); }
  100% { transform: translate(-18%,-22%) scale(1.4) rotate(-30deg); }
}

/* "AI Generated" badge */
.ai-art__badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
}
.ai-art__sparkle {
  color: var(--accent-warm);
  display: inline-block;
  animation: ai-sparkle 2.5s ease-in-out infinite;
}
@keyframes ai-sparkle {
  0%, 100% { opacity: 1; transform: rotate(0deg) scale(1); }
  50%       { opacity: 0.6; transform: rotate(180deg) scale(1.3); }
}

/* Video play indicator */
.ai-art__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--purple-darker);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  animation: ai-pulse 2.5s ease-in-out infinite;
}
@keyframes ai-pulse {
  0%, 100% { box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 0 0 0 rgba(255,255,255,0.4); }
  50%       { box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 0 0 14px rgba(255,255,255,0); }
}

/* Video timeline at bottom */
.ai-art__timeline {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,0.18);
  z-index: 5;
}
.ai-art__progress {
  height: 100%;
  background: #fff;
  width: 0;
  animation: ai-progress 12s linear infinite;
}
@keyframes ai-progress {
  to { width: 100%; }
}

.blog-card:hover .ai-art__play { transform: translate(-50%, -50%) scale(1.08); transition: transform 0.3s var(--ease-o); }

/* ============================================================
   REDUCED MOTION
============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .hero__photo, .hero__badge, .marquee__track {
    animation: none !important;
    transform: none !important;
  }
}
