/* ============================================
   STACKD — Visual Enhancements
   Premium fintech aesthetic upgrades
   ============================================ */

/* ============================================
   1. HERO SECTION — Animated Gradient + Grid
   ============================================ */

.hero {
  background: 
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(191, 255, 0, 0.06) 0%, transparent 60%),
    linear-gradient(180deg, var(--color-bg) 0%, var(--color-surface-offset) 100%);
  position: relative;
}

.hero__bg-grid {
  background-image:
    linear-gradient(var(--color-border-subtle) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-border-subtle) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 70% 70% at 60% 30%, black 10%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 60% 30%, black 10%, transparent 70%);
  opacity: 0.4;
  animation: gridPulse 8s ease-in-out infinite alternate;
}

@keyframes gridPulse {
  0% { opacity: 0.3; }
  100% { opacity: 0.55; }
}

/* Animated gradient orb behind hero */
.hero::after {
  content: '';
  position: absolute;
  top: -20%;
  right: -10%;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(191, 255, 0, 0.07) 0%, rgba(191, 255, 0, 0.02) 40%, transparent 70%);
  animation: orbFloat 12s ease-in-out infinite alternate;
  z-index: 0;
  pointer-events: none;
}

@keyframes orbFloat {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-40px, 30px) scale(1.1); }
  100% { transform: translate(20px, -20px) scale(0.95); }
}

/* Particle canvas behind hero */
.hero__particles {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* ============================================
   2. HERO TITLE — Text Gradient
   ============================================ */

.hero__title span {
  background: linear-gradient(135deg, #BFFF00 0%, #80FF72 50%, #BFFF00 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 6s ease-in-out infinite;
}

[data-theme='light'] .hero__title span {
  background: linear-gradient(135deg, #6B8F00 0%, #4A7A20 50%, #6B8F00 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradientShift 6s ease-in-out infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ============================================
   3. CARD HOVER EFFECTS — Glow + Scale + Border
   ============================================ */

.card {
  transition:
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
  contain: layout style;
  background-clip: padding-box;
}

/* Gradient border on hover via pseudo-element */
.card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, transparent, transparent);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  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, background 0.4s ease;
  pointer-events: none;
  z-index: 1;
}

.card:hover::before {
  background: linear-gradient(135deg, var(--color-primary), rgba(191, 255, 0, 0.3), var(--color-primary));
  opacity: 1;
}

.card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow:
    0 8px 32px rgba(191, 255, 0, 0.08),
    0 4px 16px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(191, 255, 0, 0.15);
  border-color: transparent;
}

[data-theme='light'] .card:hover {
  box-shadow:
    0 8px 32px rgba(107, 143, 0, 0.1),
    0 4px 16px rgba(26, 26, 46, 0.08),
    0 0 0 1px rgba(107, 143, 0, 0.2);
}

.card:active {
  transform: translateY(-2px) scale(1);
}

/* Card tag shimmer on hover */
.card:hover .card__tag {
  background: var(--color-primary);
  color: var(--color-bg);
  transition: background 0.3s ease, color 0.3s ease;
}

/* ============================================
   4. SCROLL REVEAL ANIMATIONS
   ============================================ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

/* Applied by IntersectionObserver in animations.js */
.js-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.js-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children within grid */
.articles-grid .card.js-reveal:nth-child(1) { transition-delay: 0ms; }
.articles-grid .card.js-reveal:nth-child(2) { transition-delay: 80ms; }
.articles-grid .card.js-reveal:nth-child(3) { transition-delay: 160ms; }
.articles-grid .card.js-reveal:nth-child(4) { transition-delay: 240ms; }
.articles-grid .card.js-reveal:nth-child(5) { transition-delay: 320ms; }
.articles-grid .card.js-reveal:nth-child(6) { transition-delay: 400ms; }
.articles-grid .card.js-reveal:nth-child(7) { transition-delay: 480ms; }
.articles-grid .card.js-reveal:nth-child(8) { transition-delay: 560ms; }

/* Section headers reveal */
.section-header {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.section-header.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   5. ARTICLE PAGE — Reading Progress Bar
   ============================================ */

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), rgba(191, 255, 0, 0.6));
  z-index: 200;
  transition: width 50ms linear;
  will-change: width;
  box-shadow: 0 0 8px rgba(191, 255, 0, 0.3);
}

[data-theme='light'] .reading-progress {
  background: linear-gradient(90deg, var(--color-primary), rgba(107, 143, 0, 0.6));
  box-shadow: 0 0 8px rgba(107, 143, 0, 0.2);
}

/* ============================================
   6. ARTICLE PAGE — Enhanced Blockquotes
   ============================================ */

.article-body blockquote {
  border-left: 3px solid var(--color-primary);
  padding: var(--space-5) var(--space-6);
  margin-block: var(--space-6);
  font-style: italic;
  color: var(--color-text-muted);
  background: var(--color-primary-highlight);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  position: relative;
}

.article-body blockquote::before {
  content: '\201C';
  position: absolute;
  top: -8px;
  left: 12px;
  font-size: 3rem;
  font-family: var(--font-display);
  color: var(--color-primary);
  opacity: 0.3;
  line-height: 1;
}

/* ============================================
   7. ARTICLE CTA — Pulsing Glow
   ============================================ */

.article-cta {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-surface-2) 100%);
  border: 1px solid var(--color-primary);
  box-shadow: 0 0 20px rgba(191, 255, 0, 0.06);
  animation: ctaPulse 3s ease-in-out infinite;
}

@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(191, 255, 0, 0.06); }
  50% { box-shadow: 0 0 40px rgba(191, 255, 0, 0.12), 0 0 80px rgba(191, 255, 0, 0.04); }
}

[data-theme='light'] .article-cta {
  animation: ctaPulseLight 3s ease-in-out infinite;
}

@keyframes ctaPulseLight {
  0%, 100% { box-shadow: 0 0 20px rgba(107, 143, 0, 0.06); }
  50% { box-shadow: 0 0 40px rgba(107, 143, 0, 0.1), 0 0 80px rgba(107, 143, 0, 0.04); }
}

.article-cta::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(191, 255, 0, 0.03) 0%, transparent 50%);
  animation: ctaShimmer 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes ctaShimmer {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(10%, 10%); }
}

/* ============================================
   8. IMAGE BLUR-UP LOADING EFFECT
   ============================================ */

.article-body img {
  opacity: 0;
  filter: blur(10px);
  transition: opacity 0.6s ease, filter 0.6s ease;
}

.article-body img.is-loaded {
  opacity: 1;
  filter: blur(0);
}

/* ============================================
   9. TYPOGRAPHY POLISH
   ============================================ */

/* Better heading spacing hierarchy */
.article-body h2 {
  margin-top: var(--space-12);
  margin-bottom: var(--space-5);
  padding-top: var(--space-4);
  position: relative;
}

.article-body h2::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 40px;
  height: 2px;
  background: var(--color-primary);
  opacity: 0.5;
}

.article-body h3 {
  margin-top: var(--space-10);
  margin-bottom: var(--space-4);
  letter-spacing: -0.01em;
}

/* Hero badge micro-animation */
.hero__badge {
  animation: badgeFadeIn 0.8s 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero__title {
  animation: heroTitleIn 0.9s 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero__subtitle {
  animation: heroTitleIn 0.9s 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero__cta-group {
  animation: heroTitleIn 0.9s 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes badgeFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heroTitleIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   10. NEWSLETTER SECTION — Enhanced
   ============================================ */

.newsletter {
  background: 
    radial-gradient(ellipse 50% 60% at 50% 50%, rgba(191, 255, 0, 0.04) 0%, transparent 60%),
    var(--color-bg);
  border-top: 1px solid var(--color-border-subtle);
}

.newsletter__form {
  position: relative;
}

.newsletter__input:focus {
  box-shadow: 0 0 0 3px var(--color-primary-highlight), 0 0 20px rgba(191, 255, 0, 0.08);
}

[data-theme='light'] .newsletter__input:focus {
  box-shadow: 0 0 0 3px var(--color-primary-highlight), 0 0 20px rgba(107, 143, 0, 0.06);
}

/* ============================================
   11. FOOTER — Enhanced Styling
   ============================================ */

.footer {
  position: relative;
}

.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(200px, 30%);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
}

.footer__social a {
  position: relative;
  overflow: hidden;
}

.footer__social a::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, var(--color-primary-highlight) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.footer__social a:hover::before {
  opacity: 1;
}

.footer__bottom {
  position: relative;
}

/* ============================================
   12. PERFORMANCE — Containment + Reduced Motion
   ============================================ */

.articles-grid {
  contain: layout style;
}

.card {
  contain: layout style;
}

.ticker {
  contain: layout style;
}

.hero__bg-grid {
  contain: strict;
}

/* Reduced motion — kill all animations */
@media (prefers-reduced-motion: reduce) {
  .hero__bg-grid,
  .hero::after {
    animation: none !important;
  }
  
  .hero__title span {
    animation: none !important;
    -webkit-text-fill-color: var(--color-primary);
    background: none !important;
  }
  
  .hero__badge,
  .hero__title,
  .hero__subtitle,
  .hero__cta-group {
    animation: none !important;
    opacity: 1 !important;
  }
  
  .card:hover {
    transform: none !important;
  }
  
  .card::before {
    display: none !important;
  }
  
  .article-cta {
    animation: none !important;
  }
  
  .article-cta::after {
    animation: none !important;
  }
  
  .js-reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  
  .section-header {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  
  .reading-progress {
    transition: none !important;
  }
  
  .ctaPulse,
  .ctaShimmer {
    animation: none !important;
  }
  
  .hero__particles canvas {
    display: none !important;
  }
}

/* ============================================
   13. FEATURED CARD — Enhanced
   ============================================ */

.hero__featured {
  transition: border-color 0.4s ease, box-shadow 0.4s ease, transform 0.4s ease;
}

.hero__featured:hover {
  border-color: var(--color-primary);
  box-shadow: 0 8px 32px rgba(191, 255, 0, 0.06), var(--shadow-md);
  transform: translateY(-2px);
}

[data-theme='light'] .hero__featured:hover {
  box-shadow: 0 8px 32px rgba(107, 143, 0, 0.06), var(--shadow-md);
}

/* ============================================
   14. START HERE — Step hover enhancement
   ============================================ */

.step {
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.step:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 16px rgba(191, 255, 0, 0.06);
  transform: translateX(4px);
}

[data-theme='light'] .step:hover {
  box-shadow: 0 4px 16px rgba(107, 143, 0, 0.06);
}

/* ============================================
   15. BUTTON GLOW ON HOVER
   ============================================ */

.btn--primary:hover {
  box-shadow: 0 4px 20px rgba(191, 255, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme='light'] .btn--primary:hover {
  box-shadow: 0 4px 20px rgba(107, 143, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ============================================
   16. SIDEBAR CARD ENHANCEMENTS
   ============================================ */

.sidebar-card {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.sidebar-card:hover {
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

/* ============================================
   17. TICKER ENHANCEMENT
   ============================================ */

.ticker {
  background: linear-gradient(90deg, var(--color-surface-offset) 0%, var(--color-bg) 50%, var(--color-surface-offset) 100%);
}

.ticker__item span.dot {
  box-shadow: 0 0 6px rgba(191, 255, 0, 0.4);
}

[data-theme='light'] .ticker__item span.dot {
  box-shadow: 0 0 6px rgba(107, 143, 0, 0.3);
}
