/* ===== Токени ===== */
:root {
  --ink: #0e1230;          /* глибокий індиго — фон "табло" */
  --ink-2: #171d45;
  --page: #f3f4f9;
  --surface: #ffffff;
  --text-primary: #14162b;
  --text-secondary: #4a4e66;
  --text-muted: #7a7e96;
  --grid: #e3e5ef;
  --baseline: #c6c9d9;
  --border: rgba(20, 22, 43, 0.10);
  --accent: #2e5bff;       /* кобальт — єдиний колір даних */
  --accent-deep: #1e3ab8;
  --accent-soft: #e6ecff;
  --amber: #f2b04c;        /* тільки текстовий акцент на темному */
  --good-text: #0a7a3d;
  --critical: #d03b3b;
  --font-display: "Unbounded", "Manrope", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 22, 43, 0.05), 0 8px 24px -12px rgba(20, 22, 43, 0.12);
}

* { box-sizing: border-box; }

::selection { background: var(--accent-soft); color: var(--accent-deep); }

a {
  color: var(--accent-deep);
  text-decoration: underline;
  text-decoration-color: var(--baseline);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s;
}

a:hover { text-decoration-color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Hero: курс-табло ===== */
.hero {
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(46, 91, 255, 0.32), transparent 65%),
    radial-gradient(700px 380px at -10% 110%, rgba(120, 82, 255, 0.18), transparent 60%),
    linear-gradient(160deg, var(--ink) 0%, var(--ink-2) 100%);
  color: #edeffa;
  padding: 72px 0 56px;
  position: relative;
  overflow: hidden;
}

/* сітка міліметрівки — натяк на розрахунок, не декорація поверх тексту */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.035) 0 1px, transparent 1px 44px);
  pointer-events: none;
}

.hero .container { position: relative; }

.hero-kicker {
  margin: 0 0 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
}

.hero h1 {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 36px;
  line-height: 1.22;
  letter-spacing: -0.005em;
  color: #ffffff;
  max-width: 860px;
}

.hero-lead {
  margin: 0 0 40px;
  max-width: 700px;
  font-size: 17px;
  line-height: 1.7;
  color: #b9bfd9;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.kpi {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius);
  padding: 18px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  backdrop-filter: blur(2px);
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

/* останній KPI — сума запиту: підсвічена, як головний курс на табло */
.kpi:last-child { border-color: rgba(242, 176, 76, 0.45); }
.kpi:last-child .kpi-value { color: var(--amber); }

.kpi-label {
  font-size: 12.5px;
  line-height: 1.45;
  color: #8e96b8;
}

/* ===== Секції ===== */
section {
  padding: 56px 0 16px;
  border-bottom: 1px solid var(--grid);
}

section:last-of-type { border-bottom: none; }

h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 23px;
  line-height: 1.35;
  margin: 0 0 18px;
  letter-spacing: -0.005em;
}

h2[data-index]::before {
  content: attr(data-index);
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--accent);
  margin-bottom: 10px;
}

h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 24px 0 8px;
}

p { margin: 0 0 16px; }

strong { font-weight: 700; }

code {
  font-family: var(--font-mono);
  background: var(--surface);
  border: 1px solid var(--grid);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 13.5px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.note {
  font-size: 14px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  padding: 12px 16px;
  margin: 16px 0 28px;
}

.note.warn {
  border-left-color: var(--critical);
  color: var(--critical);
}

/* ===== Етапи стратегії ===== */
.stages {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 28px 0;
}

.stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--grid);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.stage:first-child { border-top-color: var(--accent); }

.stage-num {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.stage h3 { margin: 6px 0 8px; font-size: 15.5px; }

.stage p {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0 0 14px;
  flex: 1;
}

.stage-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  border: 1px solid var(--grid);
  border-radius: 99px;
  padding: 3px 10px;
  align-self: flex-start;
}

.stage-tag-now {
  color: var(--accent-deep);
  border-color: transparent;
  background: var(--accent-soft);
  font-weight: 600;
}

/* ===== Діаграми (горизонтальні бари) ===== */
.chart-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  margin: 0 0 24px;
  box-shadow: var(--shadow);
}

.chart-block h3 { margin-top: 0; }

.chart-sub {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 18px;
}

.chart-note {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--grid);
}

.bar-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  align-items: center;
  gap: 12px;
  padding: 3px 0;
}

.bar-row:hover .bar-fill { background: var(--accent-deep); }

.bar-label {
  font-size: 13.5px;
  color: var(--text-secondary);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 24px;
  border-left: 2px solid var(--baseline);
  padding-left: 1px;
}

.bar-fill {
  height: 18px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
  min-width: 2px;
  transition: background 0.15s;
}

.bar-value {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ===== Таблиці ===== */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--grid);
  vertical-align: top;
}

th {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  background: #f8f9fd;
}

td.num, th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td.num { font-family: var(--font-mono); font-size: 13px; }

tbody tr:hover td { background: #f8f9fd; }

tr.total td {
  font-weight: 700;
  border-top: 2px solid var(--accent);
  background: var(--accent-soft);
}

tr.total:hover td { background: var(--accent-soft); }

/* виділений рядок — headline-кейс сценарної таблиці */
tr.base td {
  font-weight: 700;
  background: var(--accent-soft);
  border-top: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
}

tr.base:hover td { background: var(--accent-soft); }

tbody tr:last-child td { border-bottom: none; }

/* ===== Сценарії downside ===== */
.scenario-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 28px 0;
}

.scenario-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.scenario-card h3 {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.scenario-num {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--accent-deep);
  font-variant-numeric: tabular-nums;
}

.scenario-card p:last-child {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
}

/* ===== Апсайд-блок ===== */
.upside {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--amber);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 18px 22px;
  margin: 0 0 28px;
  box-shadow: var(--shadow);
}

.upside h3 { margin-top: 0; }

.upside p {
  font-size: 14.5px;
  color: var(--text-secondary);
}

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

/* ===== Моделі фінансування ===== */
.funding-models {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 28px 0;
}

.funding-model {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--grid);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.funding-model-primary { border-top-color: var(--accent); }

.funding-label {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-deep);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.funding-model h3 { margin: 0 0 10px; }

.funding-thesis {
  min-height: 72px;
  color: var(--text-secondary);
  font-size: 14px;
}

.funding-model dl { margin: 0; }

.funding-model dl div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--grid);
}

.funding-model dt {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.funding-model dd {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.funding-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr) 24px minmax(0, 1.25fr) 24px minmax(0, 1.1fr);
  align-items: stretch;
  gap: 6px;
  margin: 18px 0 20px;
}

.flow-node {
  display: flex;
  min-width: 0;
  min-height: 92px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
}

.flow-node strong { font-size: 13px; }

.flow-node span {
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.flow-arrow {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
}

/* ===== Калькулятор ===== */
.calc {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 28px 0 16px;
}

.calc-controls {
  background: var(--ink);
  border-radius: var(--radius);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.calc-control label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
  color: #b9bfd9;
  margin-bottom: 8px;
}

.calc-control output {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.calc-control input[type="range"] {
  width: 100%;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
  outline-offset: 6px;
  cursor: pointer;
}

.calc-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  cursor: grab;
}

.calc-control input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  cursor: grab;
}

.calc-control input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
}

.calc-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-content: start;
}

.calc-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: var(--shadow);
}

.calc-result-label {
  font-size: 12.5px;
  color: var(--text-muted);
}

.calc-result-value {
  font-family: var(--font-mono);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--accent-deep);
}

.calc-result-value.negative { color: var(--critical); }

.calc-result-unit {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-secondary);
}

/* ===== Таймлайн ===== */
.timeline {
  display: grid;
  gap: 0;
  margin: 28px 0;
}

.timeline-item {
  position: relative;
  padding: 0 0 28px 32px;
  border-left: 2px solid var(--grid);
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-item::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--page);
}

.timeline-period {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-deep);
}

.timeline-item h3 { margin: 6px 0 6px; }

.timeline-item p {
  font-size: 14.5px;
  color: var(--text-secondary);
  margin: 0;
}

/* ===== Чесність ===== */
.honesty-list {
  margin: 0 0 16px;
  padding-left: 0;
  list-style: none;
}

.honesty-list li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.honesty-list li::before {
  content: "—";
  position: absolute;
  left: 0;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
}

/* ===== Footer ===== */
footer {
  padding: 36px 0 56px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== Анімація завантаження hero ===== */
@media (prefers-reduced-motion: no-preference) {
  @keyframes hero-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
  }
  .hero-kicker, .hero h1, .hero-lead, .kpi-row { animation: hero-in 0.6s ease both; }
  .hero h1 { animation-delay: 0.08s; }
  .hero-lead { animation-delay: 0.16s; }
  .kpi-row { animation-delay: 0.26s; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ===== Responsive ===== */
@media (max-width: 820px) {
  .kpi-row, .stages { grid-template-columns: repeat(2, 1fr); }
  .scenario-cards { grid-template-columns: 1fr; }
  .funding-flow { grid-template-columns: 1fr; }
  .flow-node { min-height: 74px; }
  .flow-arrow { min-height: 18px; transform: rotate(90deg); }
  .calc { grid-template-columns: 1fr; }
  .hero h1 { font-size: 28px; }
}

@media (max-width: 520px) {
  .kpi-row, .stages, .funding-models { grid-template-columns: 1fr; }
  .funding-thesis { min-height: 0; }
  .funding-model dl div { grid-template-columns: 1fr; gap: 3px; }
  .calc-results { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 110px 1fr; }
  .bar-label { font-size: 12px; }
  .hero { padding: 48px 0 36px; }
  .hero h1 { font-size: 23px; }
  h2 { font-size: 19px; }
}
