/* === Enhanced Animations & 3D Effects === */

/* Gothic decorative borders */
.gothic-border {
  position: relative;
}
.gothic-border::before, .gothic-border::after {
  content: '⚜';
  position: absolute;
  font-size: 1.5rem;
  color: var(--accent-gold);
  opacity: 0.3;
}
.gothic-border::before { top: -10px; left: 50%; transform: translateX(-50%); }
.gothic-border::after { bottom: -10px; left: 50%; transform: translateX(-50%) rotate(180deg); }

/* Glitch text effect for hero */
.glitch {
  position: relative;
  animation: glitch-skew 4s infinite linear alternate-reverse;
}
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: var(--bg-primary);
}
.glitch::before {
  left: 2px; text-shadow: -2px 0 var(--accent-red);
  clip-path: inset(0 0 0 0);
  animation: glitch-clip 3s infinite linear alternate-reverse;
}
.glitch::after {
  left: -2px; text-shadow: 2px 0 var(--accent-purple);
  clip-path: inset(0 0 0 0);
  animation: glitch-clip 3s infinite linear alternate-reverse reverse;
}

@keyframes glitch-clip {
  0% { clip-path: inset(40% 0 61% 0); }
  20% { clip-path: inset(92% 0 1% 0); }
  40% { clip-path: inset(43% 0 1% 0); }
  60% { clip-path: inset(25% 0 58% 0); }
  80% { clip-path: inset(54% 0 7% 0); }
  100% { clip-path: inset(58% 0 43% 0); }
}
@keyframes glitch-skew {
  0% { transform: skew(0deg); }
  20% { transform: skew(-0.5deg); }
  40% { transform: skew(0.5deg); }
  60% { transform: skew(0deg); }
  80% { transform: skew(-0.3deg); }
  100% { transform: skew(0deg); }
}

/* Blood drip effect */
.blood-drip {
  position: relative;
  overflow: visible;
}
.blood-drip::after {
  content: '';
  position: absolute;
  bottom: -15px; left: 20%;
  width: 4px; height: 15px;
  background: var(--accent-red);
  border-radius: 0 0 50% 50%;
  animation: drip 3s ease-in infinite;
  opacity: 0.6;
}
@keyframes drip {
  0% { height: 0; opacity: 0; }
  30% { height: 15px; opacity: 0.6; }
  60% { height: 25px; opacity: 0.3; }
  100% { height: 30px; opacity: 0; }
}

/* Fog/mist overlay */
.fog-overlay {
  position: absolute; top: 0; left: 0; width: 200%; height: 100%;
  background: repeating-linear-gradient(
    90deg,
    transparent 0%,
    rgba(196,30,58,0.02) 10%,
    transparent 20%,
    rgba(106,13,173,0.02) 30%,
    transparent 40%
  );
  animation: fog-drift 20s linear infinite;
  pointer-events: none; z-index: 1;
}
@keyframes fog-drift {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Card flip 3D */
.flip-card {
  perspective: 1000px;
  cursor: pointer;
}
.flip-card-inner {
  position: relative;
  width: 100%; height: 100%;
  transition: transform 0.8s cubic-bezier(.25,.8,.25,1);
  transform-style: preserve-3d;
}
.flip-card.flipped .flip-card-inner {
  transform: rotateY(180deg);
}
.flip-card-front, .flip-card-back {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
}
.flip-card-back {
  transform: rotateY(180deg);
  background: var(--bg-card);
  border: 1px solid var(--accent-gold);
  padding: 1.5rem;
  overflow-y: auto;
}

/* Typewriter effect */
.typewriter {
  overflow: hidden;
  border-right: 2px solid var(--accent-gold);
  white-space: nowrap;
  animation: typing 3s steps(30) 1s forwards, blink-caret .75s step-end infinite;
  width: 0;
  display: inline-block;
}
@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}
@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--accent-gold); }
}

/* Floating gothic symbols */
.gothic-symbols {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; overflow: hidden; z-index: 0;
}
.gothic-symbol {
  position: absolute;
  font-size: 2rem;
  opacity: 0.04;
  animation: symbol-float 15s ease-in-out infinite;
  color: var(--accent-gold);
}
@keyframes symbol-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-30px) rotate(5deg); }
  50% { transform: translateY(-10px) rotate(-3deg); }
  75% { transform: translateY(-25px) rotate(2deg); }
}

/* Pulsing glow for tier badges */
.tier-badge.tier-SS {
  animation: pulse-ss 2s ease-in-out infinite;
}
@keyframes pulse-ss {
  0%, 100% { box-shadow: 0 0 5px rgba(255,68,68,0.3); }
  50% { box-shadow: 0 0 20px rgba(255,68,68,0.6), 0 0 40px rgba(255,68,68,0.2); }
}

/* Scan line effect */
.scanlines {
  position: relative;
}
.scanlines::before {
  content: '';
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
  pointer-events: none; z-index: 10;
}

/* Parallax sections */
.parallax-bg {
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
}

/* Enhanced card hover with 3D rotation */
.card-3d {
  transition: all 0.5s cubic-bezier(.25,.8,.25,1);
  transform-style: preserve-3d;
}
.card-3d:hover {
  transform: perspective(800px) rotateX(2deg) rotateY(-3deg) translateZ(20px);
  box-shadow: 
    10px 10px 30px rgba(0,0,0,0.4),
    -5px -5px 20px rgba(196,30,58,0.1),
    0 0 60px rgba(212,168,67,0.05);
}

/* Neon text glow */
.neon-text {
  text-shadow:
    0 0 7px rgba(196,30,58,0.5),
    0 0 10px rgba(196,30,58,0.3),
    0 0 21px rgba(196,30,58,0.2),
    0 0 42px rgba(196,30,58,0.1);
}

/* Chain decoration */
.chain-divider {
  display: flex; align-items: center; justify-content: center;
  gap: 0.5rem; margin: 2rem 0; opacity: 0.3;
}
.chain-link {
  width: 20px; height: 10px;
  border: 2px solid var(--accent-gold);
  border-radius: 50%;
}

/* Stagger animation for grid items */
.cards-grid > *:nth-child(1) { animation-delay: 0s; }
.cards-grid > *:nth-child(2) { animation-delay: 0.1s; }
.cards-grid > *:nth-child(3) { animation-delay: 0.2s; }
.cards-grid > *:nth-child(4) { animation-delay: 0.3s; }
.cards-grid > *:nth-child(5) { animation-delay: 0.4s; }
.cards-grid > *:nth-child(6) { animation-delay: 0.5s; }
.cards-grid > *:nth-child(7) { animation-delay: 0.6s; }

/* Smoke/particle trail on hover */
.smoke-trail {
  position: relative;
}
.smoke-trail::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%;
  width: 0; height: 0;
  background: radial-gradient(circle, rgba(196,30,58,0.2) 0%, transparent 70%);
  border-radius: 50%;
  transition: all 0.5s;
  transform: translateX(-50%);
}
.smoke-trail:hover::after {
  width: 150%; height: 50px;
  bottom: -25px;
}

/* Rotating border animation */
@keyframes border-rotate {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.animated-border {
  position: relative;
  z-index: 1;
}
.animated-border::before {
  content: '';
  position: absolute;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  background: linear-gradient(45deg, var(--accent-red), var(--accent-gold), var(--accent-purple), var(--accent-red));
  background-size: 300% 300%;
  animation: border-rotate 4s ease infinite;
  border-radius: 14px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s;
}
.animated-border:hover::before {
  opacity: 1;
}

/* Vignette effect */
.vignette::after {
  content: '';
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.5) 100%);
  pointer-events: none;
}

/* Text reveal on scroll */
.text-reveal {
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.8s cubic-bezier(.25,.8,.25,1);
}
.text-reveal.visible {
  clip-path: inset(0 0 0 0);
}

/* Heartbeat animation for important elements */
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.05); }
  28% { transform: scale(1); }
  42% { transform: scale(1.03); }
  56% { transform: scale(1); }
}
.heartbeat { animation: heartbeat 2s ease-in-out infinite; }

/* Gothic corner ornaments */
.gothic-corners {
  position: relative;
}
.gothic-corners::before {
  content: '╔';
  position: absolute; top: -5px; left: -5px;
  font-size: 1.5rem; color: var(--accent-gold); opacity: 0.2;
  line-height: 1;
}
.gothic-corners::after {
  content: '╗';
  position: absolute; top: -5px; right: -5px;
  font-size: 1.5rem; color: var(--accent-gold); opacity: 0.2;
  line-height: 1;
}
