/* ==============================================
   Terror Publications — Premium Animations v2
   ============================================== */

/* ---- CSS Custom Properties ---- */
:root {
  --scroll-progress: 0%;
  --primary: #9e0027;
  --primary-glow: rgba(158, 0, 39, 0.35);
  --glass-bg: rgba(255, 248, 247, 0.72);
  --glass-border: rgba(227, 190, 189, 0.5);
}
.dark {
  --glass-bg: rgba(30, 16, 16, 0.72);
  --glass-border: rgba(143, 111, 111, 0.4);
}

/* ---- Scroll Progress Bar ---- */
.scroll-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--scroll-progress);
  height: 3px;
  background: linear-gradient(90deg, #9e0027, #ff4d6d, #9e0027);
  background-size: 200% 100%;
  animation: gradientSlide 2s linear infinite;
  z-index: 9999;
  transition: width 0.05s linear;
}
@keyframes gradientSlide {
  0%   { background-position: 0% 0%; }
  100% { background-position: 200% 0%; }
}

/* ---- Smooth page load ---- */
body {
  animation: bodyFadeIn 0.5s ease both;
}
@keyframes bodyFadeIn {
  from { opacity: 0; filter: blur(4px); }
  to   { opacity: 1; filter: blur(0); }
}

/* ---- Page Transition Out ---- */
body.page-exit {
  animation: pageExit 0.35s ease forwards;
}
@keyframes pageExit {
  to { opacity: 0; transform: translateY(-8px); filter: blur(4px); }
}

/* ---- Glassmorphism Nav ---- */
nav.nav-scrolled,
header.nav-scrolled {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom-color: var(--glass-border) !important;
  box-shadow: 0 4px 30px rgba(0,0,0,0.08);
  transition: background 0.35s ease, box-shadow 0.35s ease, backdrop-filter 0.35s ease;
}

/* ---- Gradient Shimmer Text ---- */
.gradient-text {
  background: linear-gradient(135deg, #9e0027 0%, #ff4d6d 40%, #c41e3a 60%, #9e0027 100%);
  background-size: 300% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: textShimmer 4s ease infinite;
}
@keyframes textShimmer {
  0%   { background-position: 0% center; }
  50%  { background-position: 150% center; }
  100% { background-position: 0% center; }
}

/* ---- Hero entrance (staggered) ---- */
@keyframes heroFadeUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero-line {
  opacity: 0;
  animation: heroFadeUp 0.85s cubic-bezier(.22,.68,0,1.2) forwards;
}
.hero-line-1 { animation-delay: 0.15s; }
.hero-line-2 { animation-delay: 0.35s; }
.hero-line-3 { animation-delay: 0.55s; }
.hero-line-4 { animation-delay: 0.75s; }

/* ---- Typewriter Cursor ---- */
.typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: #9e0027;
  margin-left: 2px;
  vertical-align: middle;
  animation: cursorBlink 1s step-end infinite;
}
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ---- Scroll Reveal — Multi-direction variants ---- */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.7s cubic-bezier(0.16,1,0.3,1), transform 0.7s cubic-bezier(0.16,1,0.3,1);
}
.reveal.reveal-from-left  { transform: translateX(-48px); }
.reveal.reveal-from-right { transform: translateX(48px); }
.reveal.reveal-scale      { transform: scale(0.88); }
.reveal.visible {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1);
}
.reveal-delay-1  { transition-delay: 0.08s; }
.reveal-delay-2  { transition-delay: 0.16s; }
.reveal-delay-3  { transition-delay: 0.24s; }
.reveal-delay-4  { transition-delay: 0.32s; }
.reveal-delay-5  { transition-delay: 0.40s; }
.reveal-delay-6  { transition-delay: 0.48s; }

/* ---- Stagger Children ---- */
.stagger-children > * {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.6s cubic-bezier(0.16,1,0.3,1), transform 0.6s cubic-bezier(0.16,1,0.3,1);
}
.stagger-children.visible > * { opacity: 1; transform: translateY(0); }
.stagger-children.visible > *:nth-child(1)  { transition-delay: 0.04s; }
.stagger-children.visible > *:nth-child(2)  { transition-delay: 0.10s; }
.stagger-children.visible > *:nth-child(3)  { transition-delay: 0.16s; }
.stagger-children.visible > *:nth-child(4)  { transition-delay: 0.22s; }
.stagger-children.visible > *:nth-child(5)  { transition-delay: 0.28s; }
.stagger-children.visible > *:nth-child(6)  { transition-delay: 0.34s; }
.stagger-children.visible > *:nth-child(7)  { transition-delay: 0.40s; }
.stagger-children.visible > *:nth-child(8)  { transition-delay: 0.46s; }

/* ---- Animated Gradient Section Divider ---- */
.section-divider {
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, #9e0027 30%, #ff4d6d 50%, #9e0027 70%, transparent);
  background-size: 200% 100%;
  animation: dividerFlow 3s ease-in-out infinite;
  margin: 0;
  border: none;
  display: block;
}
@keyframes dividerFlow {
  0%, 100% { background-position: 0% 0%; }
  50%       { background-position: 100% 0%; }
}

/* ---- Hero Floating Particles ---- */
.hero-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}
.particle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  animation: floatParticle linear infinite;
}
@keyframes floatParticle {
  0%   { transform: translateY(110%) rotate(0deg); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 0.4; }
  100% { transform: translateY(-110vh) rotate(720deg); opacity: 0; }
}

/* ---- Hero parallax bg ---- */
.hero-bg-img {
  will-change: transform;
  transition: transform 0.05s linear;
}

/* ---- 3D Tilt Card ---- */
.tilt-card {
  transform-style: preserve-3d;
  transition: transform 0.12s ease, box-shadow 0.3s ease;
  will-change: transform;
}
.tilt-card:hover {
  box-shadow: 0 28px 64px rgba(158,0,39,0.14), 0 8px 20px rgba(0,0,0,0.1);
}
.tilt-card .tilt-layer {
  transform: translateZ(20px);
}

/* ---- Glow Button ---- */
.glow-btn {
  position: relative;
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}
.glow-btn:hover {
  box-shadow: 0 0 0 3px rgba(158,0,39,0.2), 0 8px 28px rgba(158,0,39,0.35);
  transform: translateY(-2px);
}
.glow-btn:active { transform: translateY(0); }

/* ---- Button ripple ---- */
.btn-ripple { position: relative; overflow: hidden; }
.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  transform: scale(0);
  animation: rippleAnim 0.6s linear;
  pointer-events: none;
}
@keyframes rippleAnim { to { transform: scale(4); opacity: 0; } }

/* ---- Stat counter ---- */
.count-num { font-variant-numeric: tabular-nums; display: inline-block; }

/* ---- Animated nav links ---- */
nav a, header a {
  transition: color 0.2s ease, background-color 0.2s ease;
}

/* ---- Hero gradient overlay ---- */
.hero-gradient-overlay {
  background: linear-gradient(to right,rgba(15,10,10,.85) 0%,rgba(15,10,10,.6) 55%,rgba(15,10,10,.15) 100%);
}
.hero-body-text { color: rgba(255,255,255,.85); }

/* ---- Pulse badge ---- */
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(158,0,39,.5); }
  70%  { box-shadow: 0 0 0 12px rgba(158,0,39,0); }
  100% { box-shadow: 0 0 0 0 rgba(158,0,39,0); }
}
.pulse-badge { animation: pulse-ring 2s infinite; }

/* ---- Featured Article Glow ---- */
.featured-glow-wrap {
  position: relative;
  border-radius: 0.5rem;
  overflow: visible;
}
.featured-glow-wrap::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 0.6rem;
  background: linear-gradient(135deg, #9e0027, #ff4d6d, #9e0027);
  background-size: 300% 300%;
  animation: borderGlow 4s ease infinite;
  z-index: -1;
  opacity: 0.6;
}
@keyframes borderGlow {
  0%, 100% { background-position: 0% 50%; }
  50%       { background-position: 100% 50%; }
}

/* ---- Image zoom on hover ---- */
.img-zoom { overflow: hidden; }
.img-zoom img { transition: transform 0.6s cubic-bezier(0.16,1,0.3,1); }
.img-zoom:hover img { transform: scale(1.08); }

/* ---- Gradient border on hover ---- */
.gradient-border {
  position: relative;
  z-index: 0;
}
.gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(135deg, transparent, rgba(158,0,39,0.7), transparent);
  background-size: 300% 300%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.35s ease;
  animation: borderGlow 3s ease infinite;
  pointer-events: none;
}
.gradient-border:hover::before { opacity: 1; }

/* ---- Mobile Menu Slide ---- */
#mobile-menu {
  transform: translateX(100%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16,1,0.3,1), opacity 0.35s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
#mobile-menu.menu-open {
  transform: translateX(0);
  opacity: 1;
}

/* ---- Priority Card Animated Gradient ---- */
.animated-gradient-card {
  background: linear-gradient(135deg, #7a001e 0%, #9e0027 40%, #c41e3a 70%, #750019 100%);
  background-size: 300% 300%;
  animation: cardGradientShift 6s ease infinite;
}
@keyframes cardGradientShift {
  0%, 100% { background-position: 0% 50%; }
  50%       { background-position: 100% 50%; }
}

/* ---- Map Pin Pulse ---- */
@keyframes mapPinPulse {
  0%, 100% { transform: scale(1) translateY(0); }
  50%       { transform: scale(1.2) translateY(-4px); }
}
.map-pin-pulse {
  animation: mapPinPulse 2s ease-in-out infinite;
  display: inline-block;
}

/* ---- Submit Button Glow Pulse ---- */
@keyframes submitGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(158,0,39,0.5); }
  50%       { box-shadow: 0 0 0 12px rgba(158,0,39,0); }
}
.submit-glow {
  animation: submitGlow 2.5s ease-in-out infinite;
}

/* ---- Toast Notification ---- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
  width: calc(100% - 48px);
}
.toast {
  background: #271718;
  color: #ffffff;
  padding: 14px 18px;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  transform: translateX(120%) scale(0.9);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.175,0.885,0.32,1.275), opacity 0.4s ease;
}
.dark .toast { background: #ffe9e8; color: #271718; }
.toast.show  { transform: translateX(0) scale(1); opacity: 1; }
.toast-success { border-left: 4px solid #4caf50; }
.toast-error   { border-left: 4px solid #f44336; }
.toast-info    { border-left: 4px solid #ba1434; }

/* ---- Modal Styles ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,10,10,0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-container {
  background: #fff8f7;
  border: 1px solid #e3bebd;
  border-radius: 12px;
  max-width: 600px;
  width: calc(100% - 32px);
  max-height: 80vh;
  overflow-y: auto;
  padding: 28px;
  transform: scale(0.88) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.175,0.885,0.32,1.275);
}
.modal-overlay.open .modal-container { transform: scale(1) translateY(0); }
.dark .modal-container {
  background: #271718;
  color: #fff8f7;
  border-color: #8f6f6f;
}

/* ---- Filter Animation ---- */
.filter-item {
  transition: opacity 0.35s ease, transform 0.35s ease;
  will-change: opacity, transform;
}
.filter-hidden {
  opacity: 0;
  transform: scale(0.88) translateY(12px);
  position: absolute !important;
  pointer-events: none;
  width: 0 !important; height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important; padding: 0 !important; border: 0 !important;
}

/* ---- Theme Switcher Toggle ---- */
.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transition: background-color 0.25s ease, transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
  color: #5b4040;
}
.theme-toggle-btn:hover {
  background-color: rgba(158,0,39,0.08);
  transform: rotate(20deg) scale(1.1);
}
.dark .theme-toggle-btn { color: #ffb3b4; }
.dark .theme-toggle-btn:hover { background-color: rgba(255,179,180,0.15); }

/* ---- Card lift on hover (legacy) ---- */
.card-lift {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card-lift:hover {
  transform: translateY(-6px);
  box-shadow: 0 24px 56px rgba(0,0,0,0.14);
}

/* ---- Smooth scrollbar ---- */
html { scroll-behavior: smooth; }

/* ---- Focus visible polish ---- */
*:focus-visible {
  outline: 2px solid #9e0027;
  outline-offset: 2px;
  border-radius: 2px;
}

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