/* ============================================
   BLACK INK STUDIO — ANIMATIONS
   ============================================ */

/* ─── HERO TEXT ENTRANCE ────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0);    }
}

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

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

@keyframes slideInLine {
  from { width: 0; }
  to   { width: 40px; }
}

.hero-eyebrow { animation: fadeIn 0.8s ease 0.4s both; }
.hero-title { animation: fadeInUp 1s cubic-bezier(0.4,0,0.2,1) 0.6s both; }
.hero-subtitle { animation: fadeInUp 0.8s ease 0.9s both; }
.hero-actions { animation: fadeInUp 0.8s ease 1.1s both; }
.hero-scroll { animation: fadeIn 0.8s ease 1.5s both; }
.hero-counter { animation: fadeIn 0.8s ease 1.3s both; }

/* ─── GLITCH EFFECT ─────────────────────────── */
.glitch {
  position: relative;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  letter-spacing: inherit;
}

.glitch::before {
  color: var(--red-accent);
  clip-path: polygon(0 30%, 100% 30%, 100% 50%, 0 50%);
  transform: translate(-2px, 0);
  animation: glitch-1 3s infinite linear;
}

.glitch::after {
  color: rgba(255,255,255,0.6);
  clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%);
  transform: translate(2px, 0);
  animation: glitch-2 3s infinite linear;
}

@keyframes glitch-1 {
  0%, 90%, 100% { transform: translate(-2px, 0); clip-path: polygon(0 30%, 100% 30%, 100% 50%, 0 50%); }
  92%           { transform: translate(2px, 2px); clip-path: polygon(0 10%, 100% 10%, 100% 30%, 0 30%); }
  95%           { transform: translate(-2px, -1px); }
}

@keyframes glitch-2 {
  0%, 85%, 100% { transform: translate(2px, 0); clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%); }
  88%           { transform: translate(-3px, 1px); clip-path: polygon(0 70%, 100% 70%, 100% 90%, 0 90%); }
  91%           { transform: translate(1px, -1px); }
}

/* ─── SPLIT TEXT REVEAL ─────────────────────── */
.split-text {
  overflow: hidden;
  display: block;
}

.split-text .word {
  display: inline-block;
  overflow: hidden;
}

.split-text .char {
  display: inline-block;
  transform: translateY(100%);
  animation: charReveal 0.6s cubic-bezier(0.4,0,0.2,1) forwards;
}

@keyframes charReveal {
  to { transform: translateY(0); }
}

/* ─── PARALLAX ──────────────────────────────── */
[data-parallax] {
  will-change: transform;
}

/* ─── COUNT UP ──────────────────────────────── */
.count-up {
  display: inline-block;
  transition: none;
}

/* ─── IMAGE REVEAL CLIP ──────────────────────── */
.clip-reveal {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 1s cubic-bezier(0.77, 0, 0.175, 1);
}

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

/* ─── LINE DRAW ─────────────────────────────── */
.line-draw {
  width: 0;
  height: 1px;
  background: var(--red-accent);
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

.line-draw.visible { width: 100%; }

/* ─── STAGGER CHILDREN ───────────────────────── */
.stagger > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.stagger.visible > *:nth-child(1) { opacity: 1; transform: none; transition-delay: 0s; }
.stagger.visible > *:nth-child(2) { opacity: 1; transform: none; transition-delay: 0.1s; }
.stagger.visible > *:nth-child(3) { opacity: 1; transform: none; transition-delay: 0.2s; }
.stagger.visible > *:nth-child(4) { opacity: 1; transform: none; transition-delay: 0.3s; }
.stagger.visible > *:nth-child(5) { opacity: 1; transform: none; transition-delay: 0.4s; }
.stagger.visible > *:nth-child(6) { opacity: 1; transform: none; transition-delay: 0.5s; }

/* ─── HOVER MAGNETIC BUTTON ─────────────────── */
.btn-magnetic {
  display: inline-flex;
  transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

/* ─── PAGE TRANSITION ───────────────────────── */
.page-transition {
  position: fixed;
  inset: 0;
  background: var(--black);
  z-index: 99996;
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.5s cubic-bezier(0.77, 0, 0.175, 1);
}

.page-transition.enter {
  transform: scaleY(1);
  transform-origin: top;
}

/* ─── SPOTLIGHT HOVER ───────────────────────── */
.spotlight {
  position: relative;
  overflow: hidden;
}

.spotlight::after {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(220,38,38,0.15) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.spotlight:hover::after {
  opacity: 1;
}

/* ─── GRADIENT BORDER ANIMATION ─────────────── */
@keyframes gradientBorder {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.animated-border {
  background: linear-gradient(270deg, var(--red-accent), var(--white), var(--red-accent));
  background-size: 400% 400%;
  animation: gradientBorder 4s ease infinite;
}

/* ─── FLOAT UP LOOP ─────────────────────────── */
@keyframes floatUp {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-12px); }
}

.float-element {
  animation: floatUp 4s ease-in-out infinite;
}

/* ─── SMOKE / PARTICLE ───────────────────────── */
@keyframes particleRise {
  0% { transform: translateY(0) scale(1); opacity: 0.6; }
  100% { transform: translateY(-100px) scale(0); opacity: 0; }
}

/* ─── TYPEWRITER ────────────────────────────── */
.typewriter {
  overflow: hidden;
  border-right: 2px solid var(--red-accent);
  white-space: nowrap;
  animation: typing 3s steps(30, end), blink 0.75s step-end infinite;
}

@keyframes typing {
  from { width: 0; }
  to   { width: 100%; }
}

@keyframes blink {
  from, to { border-color: transparent; }
  50% { border-color: var(--red-accent); }
}

/* ─── REDUCE MOTION ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
