/* =============================================
   NYX HEALTH — PPD Dashboard Design System
   Inspired by Apple Design Language + Oura Ring
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ---- CSS Custom Properties ---- */
:root {
  --bg-primary: #FDFAF7;
  --bg-card: #FFFFFF;
  --bg-section-alt: #FFF5F0;
  --bg-section-soft: #FAF7F4;
  --accent-primary: #C0474D;
  --accent-warm: #E07868;
  --accent-deep: #7C2D35;
  --accent-blue: #3A6B8A;
  --accent-light: #F9E4E3;
  --text-primary: #1C1C1E;
  --text-secondary: #6E6E73;
  --text-tertiary: #A0A0A7;
  --border-subtle: rgba(0, 0, 0, 0.07);
  --border-card: rgba(0, 0, 0, 0.09);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.09);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.12);
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 28px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---- Navigation ---- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(253, 250, 247, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 40px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.nav-logo-mark {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-deep));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-logo-mark svg {
  width: 16px;
  height: 16px;
  fill: white;
}

.nav-logo-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
}

.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--text-primary);
}

.nav-cta {
  background: var(--accent-primary);
  color: white !important;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px !important;
  font-weight: 600 !important;
  transition: background 0.2s, transform 0.1s !important;
}

.nav-cta:hover {
  background: var(--accent-deep) !important;
  color: white !important;
  transform: translateY(-1px);
}

/* ---- Hero ---- */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 40px 80px;
  background: linear-gradient(180deg, #FFF8F5 0%, var(--bg-primary) 100%);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(192, 71, 77, 0.08) 0%, transparent 70%);
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-light);
  color: var(--accent-primary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 20px;
  margin-bottom: 28px;
}

.hero-badge-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-primary);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.5;
    transform: scale(0.8);
  }
}

.hero h1 {
  font-size: clamp(38px, 6vw, 68px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -2px;
  color: var(--text-primary);
  max-width: 820px;
  margin-bottom: 24px;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent-primary);
}

.hero-sub {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 820px;
  line-height: 1.6;
  margin-bottom: 48px;
  font-weight: 400;
}

.hero-stats {
  display: flex;
  gap: 48px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-stat {
  text-align: center;
}

.hero-stat-number {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -2px;
  color: var(--accent-primary);
  line-height: 1;
}

.hero-stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 6px;
  max-width: 120px;
  line-height: 1.4;
}

.hero-divider {
  width: 1px;
  height: 50px;
  background: var(--border-card);
}

.scroll-indicator {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  animation: bounce 2s infinite;
}

@keyframes bounce {

  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }

  50% {
    transform: translateX(-50%) translateY(6px);
  }
}

.scroll-indicator svg {
  width: 16px;
  height: 16px;
}

/* ---- Sections ---- */
section {
  padding: 100px 40px;
  max-width: 1240px;
  margin: 0 auto;
}

section.full-width {
  max-width: 100%;
  padding: 100px 60px;
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent-primary);
  margin-bottom: 12px;
}

.section-title {
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.section-sub {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 560px;
  margin-bottom: 60px;
}

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.3s, transform 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-header {
  padding: 24px 28px 0;
}

.card-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.card-title {
  font-size: 17px;
  font-weight: 650;
  color: var(--text-primary);
  line-height: 1.35;
}

.card-body {
  padding: 20px 28px 28px;
}

/* ---- Stat Callout Cards ---- */
.stat-card {
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-deep) 100%);
  border-radius: var(--radius-md);
  padding: 36px 32px;
  color: white;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  width: 180px;
  height: 180px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 50%;
  bottom: -40px;
  right: -40px;
}

.stat-number {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -3px;
  line-height: 1;
  margin-bottom: 8px;
}

.stat-unit {
  font-size: 22px;
  font-weight: 600;
  vertical-align: super;
  letter-spacing: -1px;
}

.stat-desc {
  font-size: 14px;
  line-height: 1.5;
  opacity: 0.82;
  max-width: 200px;
}

/* ---- Grid Layouts ---- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  align-items: start;
}

.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 24px;
}

/* ---- Problem Section ---- */
.problem-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 80px;
  align-items: center;
}

.problem-text .section-sub {
  margin-bottom: 32px;
}

.insight-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.insight-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--bg-section-soft);
  border-radius: var(--radius-sm);
}

.insight-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-light);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.insight-text strong {
  display: block;
  font-size: 14px;
  font-weight: 650;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.insight-text span {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---- Section alt background ---- */
.bg-alt {
  background: var(--bg-section-alt);
}

.bg-soft {
  background: var(--bg-section-soft);
}

.section-wrapper {
  padding: 100px 0;
}

.section-wrapper.bg-alt,
.section-wrapper.bg-soft {
  width: 100%;
}

.section-wrapper .inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 40px;
}

/* ---- Chart containers ---- */
.chart-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-sm);
  padding: 28px;
  transition: box-shadow 0.3s;
}

.chart-card:hover {
  box-shadow: var(--shadow-md);
}

.chart-card-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.chart-card-title {
  font-size: 17px;
  font-weight: 650;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 4px;
}

.chart-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.chart-area {
  display: flex;
  justify-content: center;
}

/* ---- Sankey full-width container ---- */
.sankey-container {
  width: 100%;
  overflow-x: auto;
}

/* ---- Racial Disparity Callout ---- */
.disparity-callout {
  background: linear-gradient(135deg, #3A1C20 0%, #5C2328 100%);
  border-radius: var(--radius-md);
  padding: 32px 36px;
  color: white;
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 32px;
}

.disparity-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.disparity-text h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.disparity-text p {
  font-size: 14px;
  opacity: 0.8;
  line-height: 1.5;
}

/* ---- Source citations ---- */
.source-note {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 12px;
}

/* ---- Footer ---- */
.footer {
  background: #111112;
  color: rgba(255, 255, 255, 0.45);
  padding: 40px 40px 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-top {
  margin-bottom: 32px;
}

.footer-brand h3 {
  font-size: 24px;
  font-weight: 800;
  color: white;
  margin-bottom: 16px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.footer-brand p {
  font-size: 15px;
  line-height: 1.6;
  max-width: 500px;
  color: rgba(255, 255, 255, 0.55);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 400;
}

.footer-links {
  display: flex;
  gap: 24px;
  align-items: center;
  color: rgba(255, 255, 255, 0.45);
}

.footer-links span {
  cursor: default;
}

/* Citations Style (Minor) */
.footer-citations {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-citations h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.3);
  margin-bottom: 16px;
}

.footer-citations ol {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px 40px;
  list-style: none;
}

.footer-citations li {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  line-height: 1.4;
}

.footer-citations a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(255, 255, 255, 0.1);
  transition: color 0.2s, text-decoration-color 0.2s;
}

.footer-citations a:hover {
  color: rgba(255, 255, 255, 0.7);
  text-decoration-color: rgba(255, 255, 255, 0.4);
}



/* ---- D3 Chart Global Overrides ---- */
/* Axes */
.axis path,
.axis line {
  fill: none;
  stroke: #D1D1D6;
  stroke-width: 1px;
}

.axis text {
  font-size: 11px;
  fill: var(--text-secondary);
  font-family: var(--font);
}

.axis-label {
  font-size: 12px;
  fill: var(--text-secondary);
  font-family: var(--font);
}

/* Tooltip — appended to body in all plot JS files, so position:fixed works correctly */
.tooltip {
  position: fixed;
  background: white;
  border: 1px solid var(--border-card);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 10px 14px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text-primary);
  pointer-events: none;
  z-index: 9999;
  line-height: 1.5;
  max-width: 220px;
}

/* Sankey links — stroke color/opacity set per-node by plot2.js JS */
.link {
  fill: none;
  stroke-opacity: 0.3;
  cursor: pointer;
  transition: stroke-opacity 0.2s;
}

.link:hover {
  stroke-opacity: 0.65;
}

/* Legend */
.legend rect {
  fill: none;
  stroke: var(--border-card);
}

.legend text {
  fill: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font);
}

/* The h2 titles injected by D3 */
.chart-injected-title {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 650;
  color: var(--text-primary);
  text-align: center;
  padding: 0 0 8px;
}

/* Hide the old h2 injected by plots (we use our own card titles) */
.plot-container>h2:first-child {
  display: none;
}

/* Bubble chart labels */
.label {
  font-family: var(--font);
  fill: white;
}

/* Line chart labels */
.line-label {
  font-family: var(--font);
  fill: var(--text-secondary);
  font-size: 11px;
}

/* Source text */
.source-text {
  font-size: 9px;
  fill: var(--text-tertiary);
}

.source-text a {
  fill: var(--text-tertiary);
}

/* ---- Scroll Reveal ---- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* ---- Divider ---- */
.section-divider {
  width: 48px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-warm));
  border-radius: 2px;
  margin-bottom: 20px;
}