﻿:root {
  --bg: #F6F8FB;
  --panel: #FFFFFF;
  --panel2: #F1F5F9;
  --border: #D7DEE8;
  --text: #0F172A;
  --muted: #475569;
  --blue: #2B6CB0;
  --blue2: #3B82F6;
  --teal: #0F766E;
  --orange: #D97745;
  --green: #2F855A;
  --lras: #2B5FA8;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.10);
  --radius: 18px;
  --focus: 2px solid rgba(59, 130, 246, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 16%, rgba(59, 130, 246, 0.11), transparent 35%),
    radial-gradient(circle at 84% 76%, rgba(15, 118, 110, 0.07), transparent 34%),
    linear-gradient(160deg, #f9fbff 0%, #f6f8fb 40%, #edf3fa 100%);
}

.app {
  width: min(1120px, 92vw);
  margin: 0 auto;
  padding: 1.25rem 0 2rem;
  display: grid;
  gap: 1rem;
}

.hero {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 1rem;
}

.tag {
  margin: 0;
  color: var(--teal);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.hero h1 {
  margin: 0.34rem 0;
  font-family: "Sora", "Space Grotesk", sans-serif;
  font-size: clamp(1.4rem, 4.8vw, 2.2rem);
  line-height: 1.15;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.cases-link {
  display: inline-block;
  margin-top: 0.72rem;
  color: var(--blue);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dashed rgba(43, 108, 176, 0.42);
}

.cases-link:hover {
  color: #245993;
  border-bottom-color: rgba(36, 89, 147, 0.58);
}

.hero-links {
  margin-top: 0.72rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
}

h2 {
  margin: 0;
  font-size: 1.05rem;
}

.graph-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.82rem;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
}

.view-tools {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
}

.switch-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  font-size: 0.82rem;
  color: var(--muted);
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.6rem;
}

.switch-inline input {
  margin: 0;
  accent-color: var(--blue);
}

.pill,
.ghost,
.preset {
  border-radius: 999px;
  padding: 0.56rem 0.88rem;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 160ms ease, background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.pill {
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--blue), var(--blue2));
  color: #fff;
  box-shadow: 0 6px 18px rgba(43, 108, 176, 0.24);
}

.pill:hover {
  box-shadow: 0 8px 20px rgba(43, 108, 176, 0.3);
}

.ghost {
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--muted);
}

.ghost:hover {
  background: #e8eef7;
  color: var(--text);
}

.preset {
  border: 1px solid #d6e2f0;
  background: #ecf4ff;
  color: #25598f;
}

.pill:active,
.ghost:active,
.preset:active {
  transform: translateY(1px);
}

.pill:focus-visible,
.ghost:focus-visible,
.preset:focus-visible,
.mode-select:focus-visible,
.url-input:focus-visible {
  outline: var(--focus);
  outline-offset: 1px;
}

.pill:disabled,
.ghost:disabled,
.preset:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.ghost.is-active {
  background: #dce8f8;
  border-color: #bfd3ec;
  color: #1f4f84;
}

.graph-wrap {
  background: var(--panel2);
  border-radius: 16px;
  padding: 0.46rem;
  border: 1px solid var(--border);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}

.outcomes {
  margin-top: 0.86rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.62rem;
}

.outcomes article {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.58rem;
  text-align: center;
}

.outcomes p {
  margin: 0;
  color: var(--muted);
  font-size: 0.73rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.outcomes strong {
  display: block;
  margin-top: 0.15rem;
  font-family: "Sora", "Space Grotesk", sans-serif;
  font-size: 1rem;
}

.scenario-text,
.challenge-text {
  margin: 0.8rem 0 0;
  font-size: 0.9rem;
  color: #1e3a57;
}

.curve-focus-tools {
  margin-top: 0.66rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.curve-focus-tools .ghost {
  padding: 0.42rem 0.72rem;
  font-size: 0.8rem;
}

.answer-text {
  margin: 0.58rem 0 0;
  font-size: 0.86rem;
  color: #24415d;
  background: #eef5fd;
  border: 1px solid #d5e2f0;
  border-radius: 10px;
  padding: 0.56rem 0.62rem;
}

.qr-tools {
  margin-top: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.72rem;
  background: var(--panel2);
}

.qr-tools-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.qr-tools h3 {
  margin: 0;
  font-size: 0.95rem;
}

.qr-panel {
  margin-top: 0.68rem;
  display: grid;
  gap: 0.52rem;
}

.qr-panel[hidden] {
  display: none;
}

.qr-panel label {
  font-size: 0.85rem;
  color: var(--muted);
}

.url-input {
  width: 100%;
  border: 1px solid #c8d5e5;
  border-radius: 10px;
  padding: 0.58rem 0.65rem;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--panel);
}

.qr-row {
  margin-top: 0.12rem;
}

.qr-image {
  width: min(100%, 280px);
  border: 1px solid #d2deeb;
  border-radius: 12px;
  background: #fff;
  padding: 0.4rem;
}

.qr-status {
  margin: 0;
  color: #213f5b;
  font-size: 0.84rem;
}

.qr-hint {
  margin: 0;
  color: #3e5c79;
  font-size: 0.78rem;
  line-height: 1.35;
}

.controls-card {
  display: grid;
  gap: 0.88rem;
}

.control-row {
  background: var(--panel2);
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 0.74rem;
}

.control-row label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.92rem;
}

.control-help {
  margin: -0.15rem 0 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #d8e0eb;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: #d8e0eb;
}

input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: #d8e0eb;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  margin-top: -4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  background: var(--blue);
  box-shadow: 0 1px 8px rgba(43, 108, 176, 0.4);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  background: var(--blue);
  box-shadow: 0 1px 8px rgba(43, 108, 176, 0.4);
}

input[type="range"]:focus-visible {
  outline: none;
}

.mode-select {
  width: 100%;
  border: 1px solid #c8d5e5;
  border-radius: 10px;
  padding: 0.54rem 0.64rem;
  font-family: inherit;
  font-size: 0.87rem;
  color: var(--text);
  background: var(--panel);
}

.mini-scale {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.38rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.button-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.controls-actions .pill,
.controls-actions .ghost {
  min-height: 42px;
}

.secondary {
  margin-top: -0.2rem;
}

.policy-lab {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.72rem;
  background: var(--panel2);
}

.policy-lab h3 {
  margin: 0 0 0.52rem;
  font-size: 0.95rem;
}

.macro-inputs {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.72rem;
  background: var(--panel2);
}

.macro-inputs h3 {
  margin: 0;
  font-size: 0.95rem;
}

#baselineDateText {
  margin: 0.28rem 0 0.5rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.macro-inputs ul {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.28rem;
  color: #203a53;
  font-size: 0.82rem;
}

.macro-inputs strong {
  font-family: "Sora", "Space Grotesk", sans-serif;
  font-weight: 700;
}

.explanation-panel {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.74rem;
  background: var(--panel2);
  display: grid;
  gap: 0.55rem;
}

.explanation-panel[hidden] {
  display: none;
}

.explanation-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.explanation-head h3 {
  margin: 0;
  font-size: 0.95rem;
}

.explain-toggle {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.explain-toggle .ghost {
  padding: 0.42rem 0.72rem;
  font-size: 0.8rem;
}

.explanation-meta {
  margin: 0;
  font-size: 0.82rem;
  color: #294863;
}

.explanation-equation {
  margin: 0;
  font-family: "Sora", "Space Grotesk", sans-serif;
  font-size: 0.9rem;
  color: #183652;
}

.explanation-body {
  display: grid;
  gap: 0.45rem;
  color: #1f3c57;
  font-size: 0.84rem;
}

.explanation-body p {
  margin: 0;
}

.explanation-body ul {
  margin: 0;
  padding-left: 1.05rem;
  display: grid;
  gap: 0.2rem;
}

.explanation-body h4 {
  margin: 0;
  font-size: 0.84rem;
}

.triad-page .app {
  width: min(980px, 92vw);
}

.triad-card {
  display: grid;
  gap: 0.88rem;
}

.triad-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.triad-progress-wrap {
  min-width: 210px;
}

.triad-progress-wrap p {
  margin: 0 0 0.28rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.triad-progress {
  width: 100%;
  height: 8px;
  background: #d7e0ec;
  border-radius: 999px;
  overflow: hidden;
}

.triad-progress span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(135deg, var(--blue), var(--blue2));
  transition: width 160ms ease;
}

.triad-step h3 {
  margin: 0 0 0.32rem;
  font-size: 1rem;
}

.triad-step .subtitle {
  margin-bottom: 0.62rem;
}

.triad-readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.52rem;
}

.triad-readout article {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.55rem;
}

.triad-readout p {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.triad-readout strong {
  display: block;
  margin-top: 0.18rem;
  font-family: "Sora", "Space Grotesk", sans-serif;
  font-size: 0.96rem;
}

.triad-equation {
  margin: 0;
  font-family: "Sora", "Space Grotesk", sans-serif;
  color: #1f456b;
  font-size: 0.9rem;
}

.triad-action-row {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.triad-converge {
  margin-top: 0.42rem;
}

.triad-nav {
  margin-top: 0.2rem;
}

.triad-reset-row {
  display: flex;
  justify-content: flex-end;
}

.triad-notes {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  padding: 0.55rem 0.62rem;
}

.triad-notes summary {
  cursor: pointer;
  font-weight: 600;
  color: #1f3f5e;
  font-size: 0.88rem;
}

.triad-notes ul {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.22rem;
  color: #233f59;
  font-size: 0.84rem;
}

.cases-page .app {
  width: min(1150px, 94vw);
}

.case-grid {
  display: grid;
  gap: 0.88rem;
}

.case-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel2);
  padding: 0.82rem;
}

.case-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: flex-start;
}

.case-head h3 {
  margin: 0;
  font-size: 1rem;
}

.case-years {
  color: #375977;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.case-country {
  margin: 0.2rem 0 0.4rem;
  color: #3f607d;
  font-size: 0.82rem;
}

.case-summary {
  margin: 0;
  color: #274663;
  font-size: 0.87rem;
}

.case-notes {
  margin: 0.45rem 0;
  padding-left: 1.1rem;
  color: #233f59;
  font-size: 0.84rem;
  display: grid;
  gap: 0.24rem;
}

.case-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.fade-up {
  opacity: 0;
  transform: translateY(10px);
  animation: fadeUp 440ms ease forwards;
}

.fade-up:nth-child(2) {
  animation-delay: 120ms;
}

.fade-up:nth-child(3) {
  animation-delay: 200ms;
}

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 920px) {
  .app {
    grid-template-columns: 1.45fr 1fr;
    grid-template-areas:
      "hero hero"
      "graph controls";
  }

  .hero {
    grid-area: hero;
  }

  .graph-card {
    grid-area: graph;
  }

  .controls-card {
    grid-area: controls;
    align-content: start;
  }
}

@media (min-width: 920px) {
  .triad-page .app {
    grid-template-columns: 1fr;
    grid-template-areas: none;
  }
}

@media (max-width: 460px) {
  .button-row,
  .outcomes {
    grid-template-columns: 1fr;
  }

  .triad-action-row {
    flex-direction: column;
  }

  .triad-reset-row {
    justify-content: stretch;
  }

  .app {
    width: 94vw;
  }
}
