/* enhancements.css — Mind the Market Visual Revamp */

/* ============================================
   NEURAL NETWORK HERO VISUALIZATION
   ============================================ */
.hero {
  position: relative;
}

.hero-neural-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.hero-neural-canvas svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Neural node pulsing animation */
@keyframes neural-pulse {
  0%, 100% { opacity: 0.15; r: 2; }
  50% { opacity: 0.5; r: 3.5; }
}

@keyframes neural-pulse-accent {
  0%, 100% { opacity: 0.2; r: 3; }
  50% { opacity: 0.7; r: 5; }
}

@keyframes neural-signal {
  0% { stroke-dashoffset: 200; opacity: 0; }
  10% { opacity: 0.4; }
  90% { opacity: 0.4; }
  100% { stroke-dashoffset: 0; opacity: 0; }
}

@keyframes neural-fade-line {
  0%, 100% { opacity: 0.04; }
  50% { opacity: 0.12; }
}

.neural-node {
  fill: var(--color-text-faint);
  animation: neural-pulse 4s ease-in-out infinite;
}

.neural-node--accent {
  fill: var(--color-accent);
  animation: neural-pulse-accent 3s ease-in-out infinite;
}

.neural-line {
  stroke: var(--color-text-faint);
  stroke-width: 0.5;
  opacity: 0.06;
  animation: neural-fade-line 6s ease-in-out infinite;
}

.neural-signal {
  stroke: var(--color-accent);
  stroke-width: 1;
  stroke-dasharray: 8 192;
  stroke-dashoffset: 200;
  fill: none;
  animation: neural-signal 4s linear infinite;
}

/* Stagger the animations for organic feel */
.neural-node:nth-child(3n) { animation-delay: -1s; }
.neural-node:nth-child(5n) { animation-delay: -2s; }
.neural-node:nth-child(7n) { animation-delay: -3s; }
.neural-line:nth-child(4n) { animation-delay: -1.5s; }
.neural-line:nth-child(6n) { animation-delay: -3s; }
.neural-signal:nth-child(2n) { animation-delay: -2s; animation-duration: 5s; }
.neural-signal:nth-child(3n) { animation-delay: -3.5s; animation-duration: 6s; }

/* Hero gradient overlay for readability */
.hero-neural-canvas::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 70% at 20% 50%, var(--color-bg) 30%, transparent 70%);
}

[data-theme='dark'] .hero-neural-canvas::after,
:root:not([data-theme]) .hero-neural-canvas::after {
  background: radial-gradient(ellipse 80% 70% at 20% 50%, oklch(from var(--color-bg) l c h / 0.95) 30%, transparent 70%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .hero-neural-canvas::after {
    background: radial-gradient(ellipse 80% 70% at 20% 50%, oklch(from var(--color-bg) l c h / 0.95) 30%, transparent 70%);
  }
}

/* ============================================
   ENHANCED CARD EFFECTS
   ============================================ */
.card {
  transition:
    transform 0.4s cubic-bezier(0.23, 1, 0.32, 1),
    box-shadow 0.4s cubic-bezier(0.23, 1, 0.32, 1),
    border-color 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  contain: layout style;
}

a.card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.05),
    0 12px 24px -4px rgba(0, 0, 0, 0.08),
    0 24px 48px -8px rgba(0, 0, 0, 0.06);
  border-color: oklch(from var(--color-accent) l c h / 0.3);
}

[data-theme='dark'] a.card:hover {
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.2),
    0 12px 24px -4px rgba(0, 0, 0, 0.3),
    0 24px 48px -8px rgba(0, 0, 0, 0.25),
    0 0 0 1px oklch(from var(--color-accent) l c h / 0.1);
}

a.card:hover .card-image-inner {
  transform: scale(1.03);
}

.card-image-inner {
  transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

/* Subtle accent wash on hover */
a.card:hover .card-image::after {
  opacity: 1;
}

.card-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, oklch(from var(--color-accent) l c h / 0.06) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  pointer-events: none;
}

/* Quick card enhancements */
.quick-card {
  transition:
    transform 0.4s cubic-bezier(0.23, 1, 0.32, 1),
    box-shadow 0.4s cubic-bezier(0.23, 1, 0.32, 1),
    border-color 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  contain: layout style;
}

a.quick-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.08);
  border-color: oklch(from var(--color-accent) l c h / 0.25);
}

a.quick-card:hover .quick-card-number {
  opacity: 0.6;
  color: var(--color-accent);
}

/* Bias card enhancements */
.bias-card {
  transition:
    transform 0.4s cubic-bezier(0.23, 1, 0.32, 1),
    box-shadow 0.4s cubic-bezier(0.23, 1, 0.32, 1),
    border-color 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  contain: layout style;
}

.bias-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.08);
  border-color: oklch(from var(--color-accent) l c h / 0.2);
}

/* ============================================
   SCROLL ANIMATIONS — ENHANCED
   ============================================ */
.fade-in-js {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.7s cubic-bezier(0.23, 1, 0.32, 1),
    transform 0.7s cubic-bezier(0.23, 1, 0.32, 1);
}

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

/* Stagger children for grid reveals */
.fade-in-js:nth-child(2) { transition-delay: 80ms; }
.fade-in-js:nth-child(3) { transition-delay: 160ms; }
.fade-in-js:nth-child(4) { transition-delay: 240ms; }
.fade-in-js:nth-child(5) { transition-delay: 320ms; }
.fade-in-js:nth-child(6) { transition-delay: 400ms; }

/* ============================================
   READING PROGRESS BAR (Article Pages)
   ============================================ */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 200;
  background: transparent;
  pointer-events: none;
}

.reading-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-accent) 0%, oklch(from var(--color-accent) calc(l + 0.1) c h) 50%, var(--color-accent) 100%);
  background-size: 200% 100%;
  border-radius: 0 2px 2px 0;
  transition: width 60ms linear;
  will-change: width;
}

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

/* Enhanced blockquote — research citation style */
.article-content blockquote {
  border-left: 3px solid var(--color-accent);
  padding: var(--space-6) var(--space-8);
  margin: var(--space-10) 0;
  margin-left: var(--space-4);
  background: var(--color-accent-soft);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-base);
  color: var(--color-text);
  line-height: 1.7;
  position: relative;
}

.article-content blockquote::before {
  content: '';
  position: absolute;
  top: var(--space-4);
  left: calc(-1 * var(--space-4) - 3px);
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F5A623' stroke-width='2'%3E%3Cpath d='M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V21zm12 0c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.4;
}

/* Callout boxes */
.article-callout {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-6);
  margin: var(--space-8) 0;
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.article-callout::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--color-accent);
}

.article-callout-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
  opacity: 0.8;
}

.article-callout-content {
  flex: 1;
  min-width: 0;
}

.article-callout-content p {
  margin-bottom: 0;
  font-size: var(--text-sm);
  line-height: 1.65;
}

.article-callout-content strong {
  color: var(--color-text);
  font-weight: 600;
}

/* Statistics highlight */
.stat-highlight {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1em;
  color: var(--color-accent);
  position: relative;
}

.stat-highlight::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: oklch(from var(--color-accent) l c h / 0.3);
  border-radius: 1px;
}

/* ============================================
   NEURAL PATHWAY DECORATIVE LINES
   ============================================ */
.neural-decoration {
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

.section-neural-accent {
  position: relative;
  overflow: hidden;
}

.section-neural-accent::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -60px;
  width: 300px;
  height: 300px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 300' fill='none'%3E%3Ccircle cx='150' cy='150' r='2' fill='%23F5A623' opacity='0.15'/%3E%3Ccircle cx='80' cy='100' r='1.5' fill='%23F5A623' opacity='0.1'/%3E%3Ccircle cx='220' cy='80' r='1.5' fill='%23F5A623' opacity='0.1'/%3E%3Ccircle cx='200' cy='200' r='2' fill='%23F5A623' opacity='0.12'/%3E%3Ccircle cx='100' cy='220' r='1.5' fill='%23F5A623' opacity='0.08'/%3E%3Cpath d='M150 150 L80 100' stroke='%23F5A623' stroke-width='0.5' opacity='0.06'/%3E%3Cpath d='M150 150 L220 80' stroke='%23F5A623' stroke-width='0.5' opacity='0.06'/%3E%3Cpath d='M150 150 L200 200' stroke='%23F5A623' stroke-width='0.5' opacity='0.06'/%3E%3Cpath d='M150 150 L100 220' stroke='%23F5A623' stroke-width='0.5' opacity='0.06'/%3E%3Cpath d='M80 100 L220 80' stroke='%23F5A623' stroke-width='0.3' opacity='0.04'/%3E%3Cpath d='M200 200 L100 220' stroke='%23F5A623' stroke-width='0.3' opacity='0.04'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.5;
}

/* ============================================
   FEATURED RESEARCH SECTION
   ============================================ */
.featured-research {
  padding-block: clamp(var(--space-12), 6vw, var(--space-24));
  position: relative;
  overflow: hidden;
}

.research-grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .research-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.research-card {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
  contain: layout style;
  transition:
    transform 0.4s cubic-bezier(0.23, 1, 0.32, 1),
    box-shadow 0.4s cubic-bezier(0.23, 1, 0.32, 1),
    border-color 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.research-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.08);
  border-color: oklch(from var(--color-accent) l c h / 0.25);
}

.research-card-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  color: var(--color-accent);
  opacity: 0.7;
}

.research-card-stat {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-accent);
  line-height: 1.1;
  margin-bottom: var(--space-2);
}

.research-card-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-2);
  line-height: 1.3;
}

.research-card-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: var(--space-3);
}

.research-card-source {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-style: italic;
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.research-card-source svg {
  flex-shrink: 0;
  opacity: 0.5;
}

/* Decorative corner accent on research cards */
.research-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, transparent 50%, oklch(from var(--color-accent) l c h / 0.04) 50%);
  pointer-events: none;
}

/* ============================================
   ENHANCED FOOTER
   ============================================ */
.site-footer {
  border-top: 1px solid var(--color-divider);
  padding-block: var(--space-16);
  position: relative;
}

.footer-about {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.footer-about-author {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  margin-top: var(--space-4);
}

.footer-about-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
  flex-shrink: 0;
}

.footer-about-info {
  font-size: var(--text-xs);
  line-height: 1.5;
}

.footer-about-info strong {
  display: block;
  color: var(--color-text);
  font-weight: 600;
  font-size: var(--text-sm);
}

.footer-about-info span {
  color: var(--color-text-muted);
}

.footer-credibility {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.footer-credibility-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
}

.footer-credibility-badge svg {
  color: var(--color-accent);
  opacity: 0.7;
  flex-shrink: 0;
}

.footer-divider {
  height: 1px;
  background: var(--color-divider);
  border: none;
  margin-block: var(--space-8);
}

/* ============================================
   CSS CONTAINMENT FOR PERFORMANCE
   ============================================ */
.section {
  contain: layout style;
}

.card-image {
  contain: layout style;
}

.hero-neural-canvas {
  contain: strict;
}

/* ============================================
   PREFERS REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .neural-node,
  .neural-node--accent,
  .neural-line,
  .neural-signal {
    animation: none !important;
  }

  .neural-node { opacity: 0.15; }
  .neural-node--accent { opacity: 0.25; }
  .neural-line { opacity: 0.06; }
  .neural-signal { opacity: 0; }

  .fade-in-js {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .card,
  .quick-card,
  .bias-card,
  .research-card {
    transition: none !important;
  }

  a.card:hover,
  a.quick-card:hover,
  .bias-card:hover,
  .research-card:hover {
    transform: none !important;
  }

  .reading-progress-bar {
    transition: none !important;
  }

  .card-image-inner {
    transition: none !important;
  }

  .card-image::after {
    transition: none !important;
  }
}

/* ============================================
   SECTION DIVIDER — Neural line
   ============================================ */
.section-divider-neural {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-block: var(--space-2);
  overflow: hidden;
}

.section-divider-neural svg {
  width: 200px;
  height: 12px;
  opacity: 0.3;
}

/* ============================================
   RESPONSIVE POLISH
   ============================================ */
@media (max-width: 767px) {
  .article-content blockquote {
    margin-left: 0;
    padding: var(--space-4) var(--space-5);
  }

  .article-content blockquote::before {
    display: none;
  }

  .article-callout {
    flex-direction: column;
    gap: var(--space-3);
  }

  .research-card-stat {
    font-size: var(--text-lg);
  }

  .footer-credibility {
    flex-direction: column;
  }
}
