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

:root {
  color-scheme: light;
  --bg: #f6f2ec;
  --ink: #1f2420;
  --muted: #59615d;
  --accent: #0f6b4d;
  --accent-2: #f2a03d;
  --card: rgba(255, 255, 255, 0.88);
  --stroke: rgba(31, 36, 32, 0.08);
  --shadow: 0 30px 70px rgba(26, 32, 27, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Manrope', sans-serif;
  background: radial-gradient(circle at top left, #ffffff 0%, #f5efe7 45%, #eae2d6 100%);
  color: var(--ink);
  min-height: 100vh;
}

.bg-orbit {
  position: fixed;
  inset: -20% -20% auto auto;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(15, 107, 77, 0.12), transparent 70%);
  filter: blur(2px);
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 60px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    grid-template-areas:
        'intro intro'
        'kpis chart';
    gap: 24px;
    align-items: stretch;
}

.card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.intro-card {
    grid-area: intro;
    display: grid;
    gap: 14px;
}

.hero-kpis {
    grid-area: kpis;
}

.hero-card {
    grid-area: chart;
}

.hero-kpis,
.hero-card {
    display: flex;
    flex-direction: column;
}

    .hero-kpis .kpi-grid {
        margin-top: 2px;
        flex: 1;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

.eyebrow {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--muted);
}

h1, h2 {
  font-family: 'Fraunces', serif;
  margin: 0;
}

h1 {
    font-size: 40px;
    line-height: 1.1;
    text-align: center;
}

.lede {
    font-size: 16px;
    color: var(--muted);
    margin: 0;
    text-align: center;
}

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

.kpi {
  padding: 16px;
  border-radius: 16px;
  border: 1px dashed var(--stroke);
  background: rgba(255, 255, 255, 0.65);
}

.label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.value {
  font-size: 22px;
  font-weight: 700;
  margin-top: 6px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.card-title {
  font-weight: 600;
  font-size: 18px;
  line-height: 1.25;
  margin-bottom: 12px;
}

.card-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.card-footnote {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.section {
  margin-top: 32px;
  display: grid;
  gap: 16px;
}

.section-header h2 {
  font-size: 28px;
}

.section-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.insight-filter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  padding: 8px 12px;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.priority-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.priority-header .card-title {
  margin-bottom: 0;
}

.insight-filter label {
  display: block;
  white-space: nowrap;
}

.insight-filter select {
  min-width: 164px;
  padding: 7px 10px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  text-transform: none;
  letter-spacing: normal;
}

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

.insight-wide {
  margin-top: 12px;
  padding: 18px 20px;
}

.insight-explainer {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.insight-formula {
  margin-top: 8px;
  margin-bottom: 0;
  padding: 10px 12px 12px;
  border: 1px solid var(--stroke);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(15, 107, 77, 0.08), rgba(255, 255, 255, 0.82));
}

.formula-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
}

.formula-code {
  margin: 0 0 6px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(31, 36, 32, 0.12);
  background: rgba(31, 36, 32, 0.04);
  color: #2d3732;
  font-family: 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.35;
  white-space: pre;
  overflow-x: auto;
}

.formula-note {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.insight-legend {
  margin-top: 4px;
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.insight-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.insight-list li {
  display: flex;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--stroke);
  font-size: 14px;
}

.insight-list span.value {
  font-size: 14px;
  font-weight: 600;
}

.card.accent {
  background: linear-gradient(145deg, rgba(15, 107, 77, 0.12), rgba(242, 160, 61, 0.08));
}

.recommendation {
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 12px;
}

.recommendation-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 107, 77, 0.12);
  font-size: 12px;
  color: var(--accent);
}

.state-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 16px;
}

.state-card {
  display: grid;
  gap: 20px;
}

.state-body {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 24px;
  align-items: stretch;
  --state-chart-height: 260px;
}

.state-panel + .state-panel {
  border-left: 1px dotted rgba(31, 36, 32, 0.2);
  padding-left: 24px;
}

.state-header {
  display: grid;
  gap: 18px;
}

.state-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.state-header select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  font-size: 14px;
  background: #fff;
}

.state-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0 12px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(89, 97, 93, 0.25);
  cursor: pointer;
  transition: background 0.2s ease;
}

.switch-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 10px rgba(31, 36, 32, 0.2);
  transition: transform 0.2s ease;
}

.switch input:checked + .switch-slider {
  background: rgba(15, 107, 77, 0.5);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
}

.slider-group {
  margin-bottom: 18px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--muted);
}

.tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 6px;
  border-radius: 50%;
  background: rgba(15, 107, 77, 0.12);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  cursor: help;
  position: relative;
  top: -1px;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: -10px;
  transform: translate(-50%, -100%);
  min-width: 220px;
  max-width: 260px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #1f2420;
  color: #f6f2ec;
  font-size: 12px;
  line-height: 1.4;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 10;
}

.tooltip::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -6px;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #1f2420 transparent transparent transparent;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.tooltip:hover::after,
.tooltip:hover::before {
  opacity: 1;
  transform: translate(-50%, -110%);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.scenario-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.scenario-metrics .value {
  font-size: clamp(16px, 1.7vw, 20px);
  line-height: 1.1;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.scenario-panel {
  height: 100%;
}

.state-chart {
  flex: 1;
  height: var(--state-chart-height);
  min-height: var(--state-chart-height);
}

.state-chart canvas {
  width: 100%;
  height: 100% !important;
}

.state-chart-block {
  margin-top: auto;
  display: flex;
  flex-direction: column;
}

.chart-state-label {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  min-height: 18px;
}

.chart-state-label .state-name {
  font-weight: 700;
  color: var(--ink);
}

.note {
  display: grid;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.site-footer {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 24px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: rgba(31, 36, 32, 0.42);
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .state-grid {
    grid-template-columns: 1fr;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .hero-kpis .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  h1 {
    font-size: 32px;
  }
  .site-footer {
    font-size: 11px;
    padding-bottom: 20px;
  }
}

@media (max-width: 640px) {
  .priority-header {
    align-items: stretch;
  }

  .insight-filter {
    width: 100%;
    justify-content: space-between;
  }

  .insight-filter select {
    min-width: 0;
    flex: 1;
  }
}
