/**
 * Homepage Content Sections - Session 5
 * Three panels, pull quote, principle cards
 */

/* ============================================
   CONTAINER & BASE LAYOUT
   ============================================ */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* ============================================
   SECTION: THREE PANELS (What This Is)
   ============================================ */

.what-section {
  padding: var(--space-20) 0;
  background: var(--bg-primary);
  position: relative;
}

.panels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-8);
  margin: 0 auto;
}

.panel {
  padding: var(--space-8);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  /* No transitions initially - don't interfere with entrance animation */
  /* Start hidden for animation */
  opacity: 0;
  transform: translateY(30px);
  /* Required for energy sweep pseudo-element */
  position: relative;
  overflow: hidden;
}

/* Entrance animation + transitions for hover */
.panel.is-visible {
  /* Entrance animation */
  animation: fadeSlideIn 0.8s var(--ease-out) forwards;
  /* Smooth transitions for hover effects - applied after animation completes */
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              border-color 0.3s ease,
              box-shadow 0.4s ease,
              background 0.3s ease;
}

/* Energy sweep effect - mad scientist laboratory energy */
.panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent,
    rgba(230, 126, 34, 0.15),
    rgba(243, 156, 18, 0.2),
    rgba(230, 126, 34, 0.15),
    transparent
  );
  transition: left 800ms cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  z-index: 1;
}

/* Animate when visible */
.panel.is-visible {
  animation: fadeSlideIn 0.8s var(--ease-out) forwards;
}

/* Staggered animation delays */
.panel:nth-child(1) { animation-delay: 0.1s; }
.panel:nth-child(2) { animation-delay: 0.3s; }
.panel:nth-child(3) { animation-delay: 0.5s; }

.panel:hover {
  /* Lift card with smooth bounce */
  transform: translateY(-12px) scale(1.02);
  border-color: var(--color-orange);
  /* Dramatic multi-layered orange glow - mad scientist energy */
  box-shadow:
    0 0 30px rgba(230, 126, 34, 0.4),
    0 0 60px rgba(230, 126, 34, 0.25),
    0 12px 50px rgba(230, 126, 34, 0.2),
    0 4px 20px rgba(0, 0, 0, 0.15);
  /* Background energy glow */
  background: linear-gradient(135deg,
    var(--bg-secondary) 0%,
    rgba(230, 126, 34, 0.03) 100%
  );
}

/* Fire the energy sweep on hover */
.panel:hover::before {
  left: 100%;
}

/* Panel Icons */
.panel-icon {
  width: 100px;
  height: 100px;
  margin: 0 auto var(--space-6);
  filter: drop-shadow(0 0 8px var(--glow-orange));
  /* Smooth transitions for icon hover effects */
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              filter 0.3s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Keep icon above energy sweep */
  z-index: 2;
}

/* Dark mode contrast background - SOLID bright circle */
.panel-icon.dark-mode-ring::before {
  content: '';
  position: absolute;
  width: 105px;
  height: 105px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.9) 0%,
    rgba(255, 255, 255, 0.75) 100%
  );
  box-shadow: 0 0 20px rgba(230, 126, 34, 0.3);
  z-index: -1;
}

.panel-icon .icon-pixel-art {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.panel:hover .panel-icon {
  /* More dramatic icon transform - scale + slight rotation for energy */
  transform: scale(1.2) rotate(3deg);
  filter:
    drop-shadow(0 0 20px var(--glow-orange))
    drop-shadow(0 0 40px rgba(230, 126, 34, 0.6));
}

/* Panel Typography */
.panel-title {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 2vw, 1.75rem);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  text-align: center;
  position: relative;
  /* Keep text above energy sweep */
  z-index: 2;
}

.panel-description {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  text-align: center;
  position: relative;
  /* Keep text above energy sweep */
  z-index: 2;
}

/* ============================================
   SECTION: PULL QUOTE
   ============================================ */

.quote-section {
  padding: var(--space-20) 0;
  background: var(--bg-secondary);
  position: relative;
  overflow: hidden;
}

/* BOLD living gradient - visible energy */
.quote-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 140% 100% at 50% 50%,
    rgba(230, 126, 34, 0.2) 0%,
    rgba(243, 156, 18, 0.12) 30%,
    rgba(230, 126, 34, 0.06) 60%,
    transparent 100%
  );
  background-size: 200% 200%;
  animation: breathingGradient 6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes breathingGradient {
  0%, 100% {
    background-position: 50% 0%;
    transform: scale(1);
  }
  50% {
    background-position: 50% 100%;
    transform: scale(1.05);
  }
}

/* Rising energy bubbles - organic chemistry spectrum */
.quote-section::after {
  content: '';
  position: absolute;
  inset: 0;
  /* Subtle spectrum: hot reactions (magenta), core (orange), active (yellow-lime), cool (teal) */
  background-image:
    /* Large bubbles: bold chemistry reactions */
    radial-gradient(circle, rgba(230, 126, 34, 0.26) 11px, transparent 11px), /* classic orange */
    radial-gradient(circle, rgba(236, 72, 153, 0.24) 10px, transparent 10px), /* magenta - hot reaction */
    radial-gradient(circle, rgba(20, 184, 166, 0.23) 12px, transparent 12px), /* teal - cool chemistry */
    /* Medium bubbles: active transitional compounds */
    radial-gradient(circle, rgba(251, 191, 36, 0.27) 6px, transparent 6px), /* amber gold */
    radial-gradient(circle, rgba(163, 230, 53, 0.25) 7px, transparent 7px), /* yellow-lime - active */
    radial-gradient(circle, rgba(255, 120, 100, 0.26) 5px, transparent 5px); /* coral - warm transition */
  /* Large tiles reduce repetition visibility, different aspects prevent moiré */
  background-size: 280px 200px, 290px 190px, 320px 180px, 190px 140px, 200px 145px, 170px 135px;
  /* Sparse organic placement - gaps are natural */
  background-position: 40px 60px, 155px 95px, 230px 125px, 25px 45px, 125px 70px, 80px 30px;
  animation: organicRise 20s linear infinite;
  pointer-events: none;
}

@keyframes organicRise {
  0% {
    background-position: 40px 60px, 155px 95px, 230px 125px, 25px 45px, 125px 70px, 80px 30px;
  }
  100% {
    /* CORRECTED: Each layer travels exact multiples of its height
       Layer 1: 60 - (3×200) = -540 ✓
       Layer 2: 95 - (3×190) = -475
       Layer 3: 125 - (3×180) = -415
       Layer 4: 45 - (4×140) = -515
       Layer 5: 70 - (4×145) = -510
       Layer 6: 30 - (5×135) = -645 */
    background-position: 40px -540px, 155px -475px, 230px -415px, 25px -515px, 125px -510px, 80px -645px;
  }
}

.pull-quote {
  margin: 0 auto;
  max-width: 900px;
  text-align: center;
  /* Start hidden for animation */
  opacity: 0;
  transform: translateY(30px);
  position: relative;
  z-index: 1;
}

.pull-quote.is-visible {
  animation: fadeSlideIn 0.8s var(--ease-out) forwards;
}

.quote-text {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-primary);
  margin: 0;
  position: relative;
  display: inline-block;
}

.quote-text br {
  display: block;
  content: "";
  margin-top: var(--space-3);
}

/* Make key words PULSE with VISIBLE energy */
.quote-text .glow-word {
  display: inline-block;
  animation: wordPulse 2.5s ease-in-out infinite;
}

.quote-text .glow-word-emphasis {
  display: inline-block;
  animation: alivenessPulse 2s ease-in-out infinite;
}

@keyframes wordPulse {
  0%, 100% {
    text-shadow:
      0 0 15px var(--glow-orange),
      0 0 30px var(--glow-orange),
      0 0 45px rgba(230, 126, 34, 0.5);
    transform: scale(1);
  }
  50% {
    text-shadow:
      0 0 25px var(--glow-orange),
      0 0 50px var(--glow-orange),
      0 0 75px rgba(230, 126, 34, 0.8);
    transform: scale(1.05);
  }
}

@keyframes alivenessPulse {
  0%, 100% {
    text-shadow:
      0 0 20px var(--glow-orange),
      0 0 40px var(--glow-orange),
      0 0 60px rgba(230, 126, 34, 0.6);
    transform: scale(1);
  }
  50% {
    text-shadow:
      0 0 35px var(--glow-orange),
      0 0 70px var(--glow-orange),
      0 0 100px rgba(230, 126, 34, 1);
    transform: scale(1.08);
  }
}

/* ============================================
   SECTION: PRINCIPLE CARDS
   ============================================ */

.principles-section {
  padding: var(--space-20) 0;
  background: var(--bg-primary);
  position: relative;
}

.section-title {
  font-family: var(--font-heading);
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  font-weight: 800;
  color: var(--color-orange);
  text-align: center;
  margin-bottom: var(--space-16);
  position: relative;
  display: inline-block;
  width: 100%;
  /* Start hidden for animation */
  opacity: 0;
  transform: translateY(30px);
}

.section-title.is-visible {
  animation: fadeSlideIn 0.8s var(--ease-out) forwards;
}

.principles-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-6);
  margin-bottom: var(--space-12);
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.principle-card {
  padding: var(--space-8);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  /* No transitions initially - don't interfere with entrance animation */
  /* Start hidden for animation */
  opacity: 0;
  transform: translateY(30px);
  /* Flexbox sizing: 3 per row on desktop, 2 centered on second row */
  flex: 1 1 calc(33.333% - var(--space-6));
  min-width: 320px;
  max-width: 380px;
  /* Required for energy sweep pseudo-element */
  position: relative;
  overflow: hidden;
}

/* Entrance animation + transitions for hover */
.principle-card.is-visible {
  /* Entrance animation */
  animation: fadeSlideIn 0.8s var(--ease-out) forwards;
  /* Smooth transitions for hover effects - applied after animation completes */
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              border-color 0.3s ease,
              box-shadow 0.4s ease,
              background 0.3s ease;
}

/* Energy sweep effect - principle cards get the same mad scientist treatment */
.principle-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent,
    rgba(230, 126, 34, 0.15),
    rgba(243, 156, 18, 0.2),
    rgba(230, 126, 34, 0.15),
    transparent
  );
  transition: left 800ms cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  z-index: 1;
}

.principle-card.is-visible {
  animation: fadeSlideIn 0.8s var(--ease-out) forwards;
}

/* Staggered animation for 5 cards */
.principle-card:nth-child(1) { animation-delay: 0.1s; }
.principle-card:nth-child(2) { animation-delay: 0.2s; }
.principle-card:nth-child(3) { animation-delay: 0.3s; }
.principle-card:nth-child(4) { animation-delay: 0.4s; }
.principle-card:nth-child(5) { animation-delay: 0.5s; }

.principle-card:hover {
  /* Lift card with smooth bounce */
  transform: translateY(-12px) scale(1.02);
  border-color: var(--color-orange);
  /* Dramatic multi-layered orange glow - mad scientist energy */
  box-shadow:
    0 0 30px rgba(230, 126, 34, 0.4),
    0 0 60px rgba(230, 126, 34, 0.25),
    0 12px 50px rgba(230, 126, 34, 0.2),
    0 4px 20px rgba(0, 0, 0, 0.15);
  /* Background energy glow */
  background: linear-gradient(135deg,
    var(--bg-secondary) 0%,
    rgba(230, 126, 34, 0.03) 100%
  );
}

/* Fire the energy sweep on hover */
.principle-card:hover::before {
  left: 100%;
}

.card-title {
  font-family: var(--font-heading);
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 700;
  color: var(--color-orange);
  margin-bottom: var(--space-4);
  position: relative;
  /* Keep text above energy sweep */
  z-index: 2;
}

.card-description {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  position: relative;
  /* Keep text above energy sweep */
  z-index: 2;
}

/* ============================================
   FRAMEWORK CTA
   ============================================ */

.framework-cta {
  text-align: center;
  margin-top: 64px;
  padding-bottom: 96px;
  /* Start hidden for animation */
  opacity: 0;
  transform: translateY(30px);
}

.framework-cta.is-visible {
  animation: fadeSlideIn 0.8s var(--ease-out) forwards;
  animation-delay: 0.4s;
}

/* Bottom button now uses base .cta-button styles from hero.css (same as top button) */

.cta-subtext {
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text-tertiary);
  margin-top: var(--space-3);
}

/* ============================================
   SCRIBBLE UNDERLINES
   ============================================ */

.scribble-underline {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 1;
}

.scribble-underline path {
  stroke: var(--color-orange);
}

/* ============================================
   RESPONSIVE: MOBILE
   ============================================ */

@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-4);
  }

  .what-section {
    padding: var(--space-12) 0;
  }

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

  .panel-icon {
    width: 60px;
    height: 60px;
  }

  .quote-section {
    padding: var(--space-16) 0;
  }

  .principles-section {
    padding: var(--space-16) 0 var(--space-20) 0;
  }

  .principles-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .section-title {
    margin-bottom: var(--space-8);
  }

  /* Disable icon animations on mobile for performance */
  .icon-flask .bubble,
  .icon-brain,
  .icon-network circle:first-child {
    animation: none;
  }
}

/* ============================================
   ACCESSIBILITY: REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .panel,
  .pull-quote,
  .section-title,
  .principle-card,
  .framework-cta {
    animation: none !important;
    opacity: 1;
    transform: none;
  }

  .icon-flask .bubble,
  .icon-brain,
  .icon-network circle:first-child {
    animation: none;
  }

  .panel:hover,
  .principle-card:hover {
    transform: none;
  }
}

/* ============================================
   SECTION: PROVENANCE
   ============================================ */

.provenance-section {
  padding: var(--space-20) 0 var(--space-16) 0;
  background: var(--bg-primary);
  text-align: center;
}

.provenance-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 2.5rem);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-6);
}

.provenance-description {
  font-size: clamp(1rem, 2.5vw, 1.125rem);
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto var(--space-4);
}

.provenance-ecosystem {
  font-size: 1rem;
  color: var(--text-tertiary);
  margin-top: var(--space-4);
}

.ecosystem-link {
  color: var(--color-teal);
  text-decoration: none;
  font-weight: 600;
  transition: all var(--duration-fast) var(--ease-out);
  border-bottom: 2px solid transparent;
}

.ecosystem-link:hover {
  color: var(--color-teal-bright);
  border-bottom-color: var(--color-teal-bright);
}

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

.site-footer {
  padding: var(--space-10) 0 var(--space-8) 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.site-footer .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.footer-copyright {
  font-size: 0.875rem;
  color: var(--text-tertiary);
  margin: 0;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
  justify-content: center;
}

.footer-link {
  font-size: 0.875rem;
  color: var(--color-teal);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--duration-fast) var(--ease-out);
  border-bottom: 1px solid transparent;
}

.footer-link:hover {
  color: var(--color-teal-bright);
  border-bottom-color: var(--color-teal-bright);
}

.footer-separator {
  color: var(--text-tertiary);
  font-size: 0.875rem;
  user-select: none;
}

/* Desktop: Horizontal layout */
@media (min-width: 768px) {
  .site-footer .container {
    flex-direction: row;
    justify-content: space-between;
  }
}
