/* ============================================
   DEGEN DECODED — Visual Enhancements
   Cyberpunk / Neon Crypto Aesthetic
   ============================================ */

/* --- Neon Color Tokens --- */
:root,
[data-theme='dark'] {
  --neon-cyan: #00FFFF;
  --neon-purple: #BF40FF;
  --neon-green: #39FF14;
  --neon-pink: #FF2D95;
  --neon-cyan-dim: rgba(0, 255, 255, 0.15);
  --neon-purple-dim: rgba(191, 64, 255, 0.15);
  --glow-cyan: 0 0 20px rgba(0, 255, 255, 0.3), 0 0 40px rgba(0, 255, 255, 0.1);
  --glow-purple: 0 0 20px rgba(191, 64, 255, 0.3), 0 0 40px rgba(191, 64, 255, 0.1);
  --glow-neon-border: 0 0 8px rgba(0, 255, 255, 0.4), 0 0 16px rgba(191, 64, 255, 0.2);
}

[data-theme='light'] {
  --neon-cyan: #0891B2;
  --neon-purple: #9333EA;
  --neon-green: #16A34A;
  --neon-pink: #DB2777;
  --neon-cyan-dim: rgba(8, 145, 178, 0.1);
  --neon-purple-dim: rgba(147, 51, 234, 0.1);
  --glow-cyan: 0 0 12px rgba(8, 145, 178, 0.2);
  --glow-purple: 0 0 12px rgba(147, 51, 234, 0.2);
  --glow-neon-border: 0 0 6px rgba(8, 145, 178, 0.2);
}

/* ============================================
   GLOBAL GRID BACKGROUND
   ============================================ */
#global-grid-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  contain: strict;
}

/* ============================================
   HERO ENHANCEMENTS
   ============================================ */
.hero {
  position: relative;
}

#hero-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  contain: strict;
}

/* Glitch text animation on the accent word */
.hero__title .accent {
  position: relative;
  display: inline-block;
}

.hero__title .accent.glitch-active {
  animation: glitch-text 0.2s steps(2) forwards;
}

.hero__title .accent.glitch-active::before,
.hero__title .accent.glitch-active::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.hero__title .accent.glitch-active::before {
  color: var(--neon-cyan);
  animation: glitch-clip-1 0.2s steps(2) forwards;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
  transform: translateX(-3px);
}

.hero__title .accent.glitch-active::after {
  color: var(--neon-pink);
  animation: glitch-clip-2 0.2s steps(2) forwards;
  clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
  transform: translateX(3px);
}

@keyframes glitch-text {
  0% { transform: translate(0); }
  25% { transform: translate(-2px, 1px); }
  50% { transform: translate(2px, -1px); }
  75% { transform: translate(-1px, -1px); }
  100% { transform: translate(0); }
}

@keyframes glitch-clip-1 {
  0% { transform: translateX(-3px) skewX(-2deg); }
  50% { transform: translateX(3px) skewX(2deg); }
  100% { transform: translateX(-3px) skewX(0deg); }
}

@keyframes glitch-clip-2 {
  0% { transform: translateX(3px) skewX(2deg); }
  50% { transform: translateX(-3px) skewX(-2deg); }
  100% { transform: translateX(3px) skewX(0deg); }
}

/* Scanlines overlay on hero */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
}

/* Neon underline for hero badge */
.hero__badge {
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.2);
}

/* ============================================
   CARD NEON BORDER GLOW & ANIMATED BORDERS
   ============================================ */

/* Animated gradient border wrapper */
.article-card,
.featured-card,
.hot-take {
  position: relative;
  contain: layout style;
}

/* Neon glow on hover for article cards */
.article-card:hover {
  border-color: var(--neon-cyan);
  box-shadow:
    0 0 12px rgba(0, 255, 255, 0.2),
    0 0 24px rgba(191, 64, 255, 0.1),
    0 8px 32px rgba(0, 0, 0, 0.4);
}

.featured-card:hover {
  border-color: var(--neon-purple);
  box-shadow:
    0 0 16px rgba(191, 64, 255, 0.25),
    0 0 32px rgba(0, 255, 255, 0.1),
    0 12px 40px rgba(0, 0, 0, 0.4);
}

.hot-take:hover {
  border-color: var(--neon-cyan);
  box-shadow:
    0 0 10px rgba(0, 255, 255, 0.15),
    0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Animated gradient top bar on hot takes - enhance existing */
.hot-take::before {
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple), var(--neon-pink), var(--neon-cyan));
  background-size: 300% 100%;
  animation: gradient-shift 4s linear infinite;
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

/* Animated gradient border on cards using pseudo element */
.article-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple), transparent, 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.4s ease;
  pointer-events: none;
  z-index: 1;
}

.article-card:hover::before {
  opacity: 1;
  animation: gradient-border-rotate 3s linear infinite;
}

@keyframes gradient-border-rotate {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ============================================
   READING PROGRESS BAR
   ============================================ */
.reading-progress {
  position: fixed;
  top: 64px; /* Below the header */
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 101;
  pointer-events: none;
  overflow: hidden;
  contain: layout style;
}

.reading-progress__bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple), var(--neon-pink));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.1s linear;
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
  opacity: 0;
  transition: transform 0.1s linear, opacity 0.3s ease;
}

/* ============================================
   ARTICLE BODY ENHANCEMENTS
   ============================================ */

/* Terminal-style code blocks / callouts */
.article-body__inner .callout {
  background: #0A0A0F;
  border: 1px solid #2A2A4A;
  border-left: 3px solid var(--color-warning);
  border-radius: var(--radius-md);
  position: relative;
  padding: var(--space-5) var(--space-5) var(--space-5) var(--space-6);
  font-family: 'Source Sans 3', monospace;
}

[data-theme='light'] .article-body__inner .callout {
  background: #F8F7FF;
  border-color: var(--color-border);
}

/* Terminal dot decoration */
.article-body__inner .callout::before {
  content: '● ● ●';
  position: absolute;
  top: var(--space-2);
  left: var(--space-5);
  font-size: 8px;
  letter-spacing: 4px;
  color: var(--color-text-faint);
  opacity: 0.5;
}

.article-body__inner .callout {
  padding-top: calc(var(--space-5) + 16px);
}

/* Terminal-style callout--tip */
.article-body__inner .callout--tip {
  border-left-color: var(--neon-cyan);
  box-shadow: inset 0 0 30px rgba(0, 255, 255, 0.03);
}

.article-body__inner .callout--tip strong {
  color: var(--neon-cyan);
}

/* Glowing Traderise CTA boxes */
.article-cta {
  background: linear-gradient(135deg, #1A0030, #0A001A, #001A1A);
  border: 1px solid rgba(191, 64, 255, 0.3);
  box-shadow:
    0 0 30px rgba(191, 64, 255, 0.1),
    0 0 60px rgba(0, 255, 255, 0.05),
    inset 0 0 60px rgba(191, 64, 255, 0.05);
  animation: cta-glow-pulse 3s ease-in-out infinite;
}

[data-theme='light'] .article-cta {
  background: linear-gradient(135deg, var(--color-primary), #4A0E8F);
  border: none;
  box-shadow: var(--shadow-lg);
  animation: none;
}

@keyframes cta-glow-pulse {
  0%, 100% {
    box-shadow:
      0 0 30px rgba(191, 64, 255, 0.1),
      0 0 60px rgba(0, 255, 255, 0.05),
      inset 0 0 60px rgba(191, 64, 255, 0.05);
  }
  50% {
    box-shadow:
      0 0 40px rgba(191, 64, 255, 0.2),
      0 0 80px rgba(0, 255, 255, 0.1),
      inset 0 0 80px rgba(191, 64, 255, 0.08);
  }
}

/* Grid overlay on CTA */
.article-cta::before {
  background-image:
    linear-gradient(rgba(0, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 25px 25px;
}

/* Animated gradient separators between sections */
.article-body__inner h2::after {
  content: '';
  display: block;
  width: 60px;
  height: 2px;
  margin-top: var(--space-2);
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple), transparent);
  background-size: 200% 100%;
  animation: gradient-shift 3s linear infinite;
  border-radius: 1px;
}

/* Blockquote enhancement */
.article-body__inner blockquote {
  border-left: 3px solid var(--neon-cyan);
  background: rgba(0, 255, 255, 0.03);
  box-shadow: inset 0 0 30px rgba(0, 255, 255, 0.02);
}

[data-theme='light'] .article-body__inner blockquote {
  background: var(--color-surface);
  border-left-color: var(--color-accent);
  box-shadow: none;
}

/* ============================================
   CTA BANNER ENHANCEMENTS
   ============================================ */
.cta-banner {
  background: linear-gradient(135deg, #1A0030 0%, #0D0D2D 40%, #001A2E 100%);
  border-top: 1px solid rgba(191, 64, 255, 0.2);
  border-bottom: 1px solid rgba(0, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

[data-theme='light'] .cta-banner {
  background: linear-gradient(135deg, var(--color-primary), #4A0E8F);
  border-top: none;
  border-bottom: none;
}

.cta-banner::before {
  background-image:
    linear-gradient(rgba(0, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
}

.cta-banner::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(191, 64, 255, 0.1), transparent 70%);
  pointer-events: none;
}

/* ============================================
   COMMUNITY SECTION — "Join the Degens"
   ============================================ */
.community {
  background: var(--color-bg);
  position: relative;
  overflow: hidden;
}

.community::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
}

.community__inner {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 700px;
  margin-inline: auto;
}

.community__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: var(--neon-cyan-dim);
  border: 1px solid var(--neon-cyan);
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--neon-cyan);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-4);
}

.community__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--color-text);
  margin-bottom: var(--space-3);
}

.community__desc {
  font-size: var(--text-base);
  color: var(--color-text-muted);
  margin-bottom: var(--space-8);
  max-width: 520px;
  margin-inline: auto;
}

.community__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-4);
}

.community__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--color-text);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.3s ease,
    background 0.3s ease;
  min-width: 180px;
  justify-content: center;
}

.community__link:hover {
  transform: translateY(-3px);
}

.community__link--discord:hover {
  border-color: #5865F2;
  box-shadow: 0 0 20px rgba(88, 101, 242, 0.3);
  background: rgba(88, 101, 242, 0.08);
}

.community__link--twitter:hover {
  border-color: var(--color-text);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.community__link--telegram:hover {
  border-color: #26A5E4;
  box-shadow: 0 0 20px rgba(38, 165, 228, 0.3);
  background: rgba(38, 165, 228, 0.08);
}

.community__link svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.community__member-count {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-weight: 400;
  margin-top: var(--space-1);
}

/* ============================================
   FOOTER ENHANCEMENTS
   ============================================ */

/* Animated gradient accent line */
.footer {
  position: relative;
}

.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent,
    var(--neon-cyan),
    var(--neon-purple),
    var(--neon-pink),
    var(--neon-cyan),
    transparent
  );
  background-size: 200% 100%;
  animation: gradient-shift 5s linear infinite;
}

.footer__bottom::before {
  content: '';
  display: none; /* replaced by parent pseudo */
}

/* Footer crypto branding */
.footer__brand-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: var(--neon-purple-dim);
  border: 1px solid rgba(191, 64, 255, 0.3);
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--neon-purple);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: var(--space-3);
}

[data-theme='light'] .footer__brand-badge {
  color: var(--neon-purple);
  background: rgba(147, 51, 234, 0.08);
  border-color: rgba(147, 51, 234, 0.2);
}

.footer__brand-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neon-purple);
  animation: pulse-dot 2s ease-in-out infinite;
}

/* Neon accents on footer social hover */
.footer__socials a:hover {
  color: var(--neon-cyan);
  filter: drop-shadow(0 0 6px rgba(0, 255, 255, 0.4));
}

/* Footer bottom accent line */
.footer__bottom {
  border-top: 1px solid var(--color-divider);
  position: relative;
}

.footer__bottom::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 255, 0.2), rgba(191, 64, 255, 0.2), transparent);
}

/* ============================================
   NEWSLETTER GLOW ENHANCEMENT
   ============================================ */
.newsletter__glow {
  background: radial-gradient(circle,
    rgba(0, 255, 255, 0.08),
    rgba(191, 64, 255, 0.06) 40%,
    transparent 70%
  );
  animation: newsletter-glow-pulse 4s ease-in-out infinite;
}

[data-theme='light'] .newsletter__glow {
  background: radial-gradient(circle, rgba(123, 47, 190, 0.1), transparent 70%);
  animation: none;
}

@keyframes newsletter-glow-pulse {
  0%, 100% { opacity: 0.7; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
}

/* Newsletter input neon focus */
.newsletter__input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 3px rgba(0, 255, 255, 0.15), 0 0 20px rgba(0, 255, 255, 0.08);
}

[data-theme='light'] .newsletter__input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(123, 47, 190, 0.2);
}

/* ============================================
   TICKER BAR NEON ENHANCEMENT
   ============================================ */
.ticker {
  border-top-color: rgba(0, 255, 255, 0.1);
  border-bottom-color: rgba(191, 64, 255, 0.1);
}

[data-theme='light'] .ticker {
  border-top-color: var(--color-divider);
  border-bottom-color: var(--color-divider);
}

.ticker__symbol {
  color: var(--neon-cyan);
}

[data-theme='light'] .ticker__symbol {
  color: var(--color-text-muted);
}

/* ============================================
   ANIMATED GRADIENT SEPARATORS
   ============================================ */
.gradient-separator {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--neon-cyan), var(--neon-purple), transparent);
  background-size: 200% 100%;
  animation: gradient-shift 4s linear infinite;
  border: none;
  margin: 0;
  opacity: 0.4;
}

/* ============================================
   NEON PULSE ACCENT DOTS
   ============================================ */
@keyframes neon-pulse {
  0%, 100% { box-shadow: 0 0 4px var(--neon-cyan), 0 0 8px var(--neon-cyan); }
  50% { box-shadow: 0 0 8px var(--neon-cyan), 0 0 16px var(--neon-cyan), 0 0 24px rgba(0, 255, 255, 0.3); }
}

/* ============================================
   SCROLL REVEAL ANIMATION CLASSES
   ============================================ */
.scroll-revealed {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* Override the CSS scroll animation for JS control */
@supports (animation-timeline: scroll()) {
  .fade-in {
    opacity: 0;
    animation: none;
    animation-timeline: unset;
  }
}

/* ============================================
   PERFORMANCE: CSS CONTAINMENT
   ============================================ */
.articles-grid,
.hot-takes-grid,
.community__links {
  contain: layout style;
}

.article-card,
.featured-card,
.hot-take {
  contain: layout style;
}

.ticker {
  contain: layout style paint;
}

.hero {
  contain: layout style;
}

/* ============================================
   PREFERS-REDUCED-MOTION OVERRIDES
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .hero::after,
  #hero-canvas,
  #global-grid-bg,
  .gradient-separator {
    display: none !important;
  }

  .hot-take::before {
    animation: none !important;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent)) !important;
  }

  .article-cta {
    animation: none !important;
  }

  .footer::before {
    animation: none !important;
  }

  .newsletter__glow {
    animation: none !important;
  }

  .hero__title .accent.glitch-active,
  .hero__title .accent.glitch-active::before,
  .hero__title .accent.glitch-active::after {
    animation: none !important;
    transform: none !important;
  }

  .article-card::before {
    display: none !important;
  }

  .article-body__inner h2::after {
    animation: none !important;
  }

  .reading-progress__bar {
    transition: none !important;
  }
}

/* ============================================
   STAT CARD NEON ENHANCEMENT
   ============================================ */
.stat-card {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.15);
}

/* Pros/cons neon enhancement */
.pros-cons__col--pros {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.pros-cons__col--pros:hover {
  border-color: var(--neon-green);
  box-shadow: 0 0 12px rgba(57, 255, 20, 0.1);
}

.pros-cons__col--cons:hover {
  border-color: var(--neon-pink);
  box-shadow: 0 0 12px rgba(255, 45, 149, 0.1);
}
