/* ============================================
   MaP Outcomes Visualization — Page Styles
   Scroll-driven data story layout
   ============================================ */

/* ===== Site Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

.site-header__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.site-header__logo {
  height: 36px;
  width: auto;
}

.site-header__title {
  font-family: var(--font-sans);
  font-size: var(--wb-p3);
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
}

.site-header__controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#dark-mode-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--wb-p1);
  padding: 0.25rem;
  color: var(--color-text-secondary);
  transition: color 0.15s ease;
}

#dark-mode-toggle:hover {
  color: var(--color-text);
}

/* ===== Section Layout ===== */
.outcomes-section {
  padding: 12vh 8vw;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

@media (prefers-reduced-motion: reduce) {
  .outcomes-section {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

.outcomes-section__inner {
  max-width: 1400px;
  margin: 0 auto;
}

/* Alternating backgrounds */
.outcomes-section--surface {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

/* ===== Hero Section (Layer 1) ===== */
.hero-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding-top: 6vh;
  padding-bottom: 6vh;
}

.hero-section .outcomes-section__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero__headline {
  font-size: var(--h1);
  max-width: 18em;
  margin-bottom: 0.3em;
}

.hero__subhead {
  font-size: var(--wb-p1);
  color: var(--color-text-secondary);
  max-width: 32em;
  margin-bottom: 3rem;
}

.hero__subhead strong {
  color: var(--color-text);
  font-weight: 700;
}

#hero-viz {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.hero-chart {
  width: 100%;
  height: auto;
}

.hero__scroll-cue {
  margin-top: 3rem;
  font-family: var(--font-sans);
  font-size: var(--badge-size);
  color: var(--color-text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  animation: scroll-cue-bounce 2s ease-in-out infinite;
}

@keyframes scroll-cue-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

.hero__scroll-arrow {
  font-size: 1.5rem;
  line-height: 1;
}

/* ===== Pattern Section (Layer 2) ===== */
.pattern-section__header {
  margin-bottom: 2.5rem;
}

.pattern-section__title {
  font-size: var(--h3);
  margin-bottom: 0.3em;
}

.pattern-section__subtitle {
  font-size: var(--wb-p1);
  color: var(--color-text-secondary);
  max-width: 40em;
}

#pattern-viz {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.pattern-chart {
  width: 100%;
  max-width: 900px;
  height: auto;
}

/* ===== Detail Section (Layer 3) ===== */
.detail-section__header {
  margin-bottom: 2.5rem;
}

.detail-section__title {
  font-size: var(--h3);
  margin-bottom: 0.3em;
}

.detail-section__subtitle {
  font-size: var(--wb-p1);
  color: var(--color-text-secondary);
  max-width: 40em;
}

#detail-viz {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.detail-chart {
  width: 100%;
  min-width: 700px;
  height: auto;
}

/* Scroll hint gradient for horizontal overflow */
.scroll-hint {
  position: relative;
}

.scroll-hint::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 60px;
  height: 100%;
  background: linear-gradient(to right, transparent, var(--color-bg));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.scroll-hint.has-overflow::after {
  opacity: 1;
}

/* ===== Methodology Section ===== */
.methodology-section {
  padding: 8vh 8vw;
}

.methodology__panel {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 2.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.methodology__title {
  font-size: var(--h5);
  margin-bottom: 1rem;
  color: var(--color-text);
}

.methodology__text {
  font-size: var(--wb-p3);
  color: var(--color-text-secondary);
  line-height: 1.7;
}

.methodology__text p:last-child {
  margin-bottom: 0;
}

/* ===== CTA Section ===== */
.cta-section {
  text-align: center;
  padding: 12vh 8vw 6vh;
}

.cta__headline {
  font-size: var(--h3);
  margin-bottom: 0.5em;
}

.cta__description {
  font-size: var(--wb-p1);
  color: var(--color-text-secondary);
  max-width: 30em;
  margin: 0 auto 2rem;
}

/* ===== Footer ===== */
.site-footer {
  padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: var(--wb-p3);
  color: var(--color-text-muted);
}

.site-footer a {
  color: var(--color-text-secondary);
}

/* ===== Error State ===== */
.error-state {
  padding: 3rem 1rem;
  text-align: center;
}

.error-state p:first-child {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--wb-p1);
}

.error-detail {
  color: var(--color-text-muted);
  font-size: var(--wb-p3);
}

/* ===== Responsive ===== */
@media (max-width: 1023px) {
  .outcomes-section {
    padding: 8vh 5vw;
  }

  .hero__headline {
    font-size: var(--h2);
  }

  .pattern-section__title,
  .detail-section__title {
    font-size: var(--h4);
  }
}

@media (max-width: 640px) {
  .outcomes-section {
    padding: 6vh 1.5rem;
  }

  .hero-section {
    min-height: auto;
    padding-top: 4vh;
    padding-bottom: 4vh;
  }

  .hero__headline {
    font-size: var(--h3);
  }

  .hero__subhead {
    font-size: var(--wb-p2);
  }

  #hero-viz {
    max-width: 320px;
  }

  .pattern-section__title,
  .detail-section__title,
  .cta__headline {
    font-size: var(--h5);
  }

  .methodology__panel {
    padding: 1.5rem;
  }

  .hero__scroll-cue {
    display: none;
  }

  .site-header__title {
    display: none;
  }
}
