/* =============================================================================
   RV-CMP · Style sheet
   Color palette derived from the source Excel workbook (RV_Economics_Engine_v5).
   ============================================================================= */

:root {
  /* Ink ramp */
  --ink:     #1A1D23;
  --body:    #3D434C;
  --muted:   #545B66;
  --eyebrow: #8A929E;
  --hairline:#E3E6EA;
  --surface: #F6F7F8;
  --surface-soft: #FBFBFC;
  --white:   #FFFFFF;

  /* Accents */
  --green:   #0F5F3F;
  --green-soft: #E8F1ED;
  --lime:    #C8E847;
  --lime-deep: #A4C72E;

  /* Confidentiality */
  --conf-red: #C0392B;
  --conf-tint:#FEE2E2;

  /* Composition bar palette, aligned with the site's gradient-card system.
     Each colour is a saturated brand tone so segments read clearly against
     each other and against white text. */
  --p-h2:    #2B6CB0; /* blue,   H2 production / Direct H2 */
  --p-meoh:  #1A6B3C; /* green,  e-MeOH / Synthesis */
  --p-saf:   #B8860B; /* gold,   e-SAF */
  --p-caco3: #3FA8C7; /* cyan,   CaCO3 / Lime */
  --p-mgco3: #6B7AC4; /* indigo, MgCO3 / Brucite */
  --p-credit:#A4C72E; /* lime,   CDR credit / CO2 capture */
  --p-caas:  #1B2A4A; /* ink,    CaaS / Mineral elec */

  /* Typography */
  --font-display: ui-serif, "Iowan Old Style", "Apple Garamond", "Source Serif Pro", Georgia, serif;
  --font-body:    -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --font-mono:    ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;

  /* Spacing scale */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--body);
  background: var(--white);
  font-feature-settings: "kern", "liga", "tnum";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--green); }

/* ============================================================
   Confidentiality banner
   ============================================================ */
.conf-banner {
  background: var(--conf-tint);
  color: var(--conf-red);
  border-bottom: 1.5px solid var(--conf-red);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-align: center;
  padding: 6px 12px;
  text-transform: uppercase;
}

/* ============================================================
   Top navigation
   ============================================================ */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 48px;
  border-bottom: 1px solid var(--hairline);
  background: var(--white);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.brand-mark {
  display: inline-block;
  width: 22px; height: 22px;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--ink) 0%, var(--ink) 50%, var(--lime) 50%, var(--lime) 100%);
}
.brand-text { font-family: var(--font-body); font-weight: 700; letter-spacing: 0.02em; }

.nav-links { display: flex; gap: 28px; }
.nav-links a {
  font-size: 14px; color: var(--muted); font-weight: 500;
  transition: color 120ms ease;
}
.nav-links a:hover { color: var(--ink); }
.nav-disabled { opacity: 0.45; cursor: not-allowed; }

.nav-cta {
  background: var(--ink);
  color: var(--white) !important;
  font-size: 13px; font-weight: 600;
  padding: 9px 16px; border-radius: 6px;
  transition: background 120ms ease;
}
.nav-cta:hover { background: var(--green); }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  padding: 72px 48px 96px;
  border-bottom: 1px solid var(--hairline);
  background: var(--white);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 64px;
  max-width: 1240px;
  margin: 0 auto;
  align-items: center;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--eyebrow);
  text-transform: uppercase;
  margin-bottom: 16px;
}
.hero-h1 {
  font-family: var(--font-display);
  font-size: clamp(40px, 5.2vw, 64px);
  line-height: 1.06;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-weight: 600;
  margin: 0 0 24px;
}
.hero-h1-accent {
  display: inline-block;
  background: linear-gradient(transparent 62%, var(--lime) 62%);
  padding: 0 4px;
  font-style: italic;
}
.hero-sub {
  font-size: 18px;
  color: var(--muted);
  line-height: 1.55;
  max-width: 520px;
  margin: 0 0 32px;
}
.hero-ctas { display: flex; gap: 12px; margin-bottom: 28px; }
.btn {
  display: inline-flex; align-items: center;
  padding: 14px 22px;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 600;
  transition: all 140ms ease;
  cursor: pointer;
  border: none;
}
.btn-primary {
  background: var(--ink);
  color: var(--white) !important;
}
.btn-primary:hover { background: var(--green); transform: translateY(-1px); }
.btn-secondary {
  background: transparent;
  color: var(--ink) !important;
  border: 1.5px solid var(--ink);
}
.btn-secondary:hover { background: var(--ink); color: var(--white) !important; }

.trust-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  font-size: 13px;
  color: var(--muted);
}
.trust-dot {
  width: 4px; height: 4px;
  background: var(--green);
  border-radius: 50%;
  display: inline-block;
}
.trust-row > .trust-dot:first-child { display: none; }

/* Hero card */
.hero-card {
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 8px 32px -8px rgba(26,29,35,0.08), 0 2px 4px rgba(26,29,35,0.04);
}
.hero-card-header {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--eyebrow);
  text-transform: uppercase;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--hairline);
  display: flex; align-items: center;
}
.hero-card-header::before {
  content: ''; width: 6px; height: 6px;
  background: var(--green); border-radius: 50%;
  margin-right: 8px;
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.hero-card-metrics { display: grid; gap: 14px; }
.metric {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--hairline);
}
.metric:last-child { border-bottom: none; padding-bottom: 0; }
.metric-label { font-size: 13px; color: var(--muted); }
.metric-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.metric-small { font-size: 14px; font-weight: 500; }
.metric-accent { color: var(--green); font-size: 22px; }

.hero-card-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.tests-badge {
  display: block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
}
.tests-pass { color: var(--green); }
.tests-fail { color: var(--conf-red); }

/* ============================================================
   Generic section
   ============================================================ */
.section {
  padding: 96px 48px;
  border-bottom: 1px solid var(--hairline);
}
.section-tinted { background: var(--surface-soft); }
.section-head {
  max-width: 1240px;
  margin: 0 auto 48px;
}
.section-h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.2vw, 42px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-weight: 600;
  margin: 0;
  max-width: 780px;
}
.section-h2 em {
  font-style: italic;
  color: var(--green);
}

/* Three-column cards */
.three-col {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.card {
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 32px;
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px -12px rgba(26,29,35,0.12);
}
.card-icon {
  font-size: 28px;
  margin-bottom: 18px;
  color: var(--green);
}
.card h3 {
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  line-height: 1.35;
}
.card-accent { color: var(--green); margin-bottom: 12px !important; }
.card p {
  font-size: 14.5px;
  color: var(--muted);
  margin: 12px 0 0;
  line-height: 1.6;
}

/* Capabilities grid */
.caps-grid {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}
.cap-tile {
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 24px;
}
.cap-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--lime-deep);
  margin-bottom: 18px;
}
.cap-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 10px;
  line-height: 1.3;
}
.cap-body {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

/* Audience */
.audience-grid {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
}
.aud h4 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 12px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ink);
  display: inline-block;
}
.aud p {
  font-size: 14.5px;
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  background: var(--ink);
  color: rgba(255,255,255,0.7);
  padding: 56px 48px 32px;
}
.footer-grid {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 32px;
  align-items: start;
}
.footer-brand {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--white);
  font-weight: 600;
  margin-bottom: 6px;
}
.footer-tag {
  font-size: 13px;
  color: rgba(255,255,255,0.5);
}
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-links a {
  color: rgba(255,255,255,0.7) !important;
  font-size: 14px;
}
.footer-links a:hover { color: var(--lime) !important; }
.footer-legal {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  font-family: var(--font-mono);
  line-height: 1.6;
  text-align: right;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 980px) {
  .topnav { padding: 14px 24px; }
  .nav-links { display: none; }
  .hero { padding: 48px 24px 64px; }
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .section { padding: 64px 24px; }
  .three-col, .caps-grid, .audience-grid {
    grid-template-columns: 1fr;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
  .footer-legal { text-align: left; }
}

/* ============================================================
   Platform.html specific
   ============================================================ */
.platform-shell {
  display: grid;
  grid-template-columns: 320px 1fr 320px;
  gap: 0;
  min-height: calc(100vh - 90px);
}

/* Left panel */
.left-panel {
  background: var(--surface-soft);
  border-right: 1px solid var(--hairline);
  padding: 24px 20px;
  overflow-y: auto;
  position: sticky;
  top: 0;
  height: calc(100vh - 90px);
}
.panel-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--hairline);
}
.panel-section:last-child { border-bottom: none; }
.panel-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--eyebrow);
  text-transform: uppercase;
  margin-bottom: 14px;
}
.input-row {
  margin-bottom: 14px;
}
.input-row:last-child { margin-bottom: 0; }
.input-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12.5px;
  color: var(--body);
  margin-bottom: 6px;
}
.input-value {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.input-row input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  background: transparent;
  margin: 4px 0;
}
.input-row input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  background: var(--hairline);
  border-radius: 3px;
}
.input-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 16px; width: 16px;
  border-radius: 50%;
  background: var(--ink);
  margin-top: -6.5px;
  cursor: pointer;
  transition: background 120ms;
}
.input-row input[type="range"]::-webkit-slider-thumb:hover { background: var(--green); }
.input-row input[type="range"]::-moz-range-track {
  height: 3px; background: var(--hairline); border-radius: 3px;
}
.input-row input[type="range"]::-moz-range-thumb {
  height: 16px; width: 16px; border: none;
  border-radius: 50%; background: var(--ink); cursor: pointer;
}
.input-row input[type="number"], .input-row select {
  width: 100%;
  padding: 7px 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  border: 1px solid var(--hairline);
  border-radius: 5px;
  background: var(--white);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.input-row input[type="number"]:focus, .input-row select:focus {
  outline: none;
  border-color: var(--ink);
}
.range-anchors {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--eyebrow);
}

.pathway-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.pathway-btn {
  padding: 10px 8px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--white);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 120ms ease;
}
.pathway-btn:hover { color: var(--ink); }
.pathway-btn.active {
  background: var(--ink);
  color: var(--white);
  border-color: var(--ink);
}

.panel-btn {
  width: 100%;
  padding: 12px;
  background: var(--lime);
  color: var(--ink);
  border: none;
  border-radius: 6px;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 120ms ease;
}
.panel-btn:hover { background: var(--lime-deep); }
.panel-btn-secondary {
  background: var(--white);
  border: 1px solid var(--hairline);
  color: var(--ink);
  margin-top: 8px;
  font-weight: 500;
}

.scenarios-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}
.scenarios-row button {
  padding: 7px;
  border: 1px solid var(--hairline);
  background: var(--white);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: all 120ms;
}
.scenarios-row button:hover {
  color: var(--ink);
  border-color: var(--ink);
}
.scenarios-row button.active {
  background: var(--ink); color: var(--white); border-color: var(--ink);
}

/* Center area */
.center-panel {
  padding: 24px 32px;
  overflow-y: auto;
}
.tabs-bar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 28px;
  overflow-x: auto;
}
.tab-btn {
  background: none; border: none;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 120ms;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
  font-weight: 600;
}
.tab-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* KPI tiles */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
.kpi {
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 18px;
}
.kpi-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--eyebrow);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.kpi-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.kpi-value.pos { color: var(--green); }
.kpi-value.neg { color: var(--conf-red); }
.kpi-sub {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  font-family: var(--font-mono);
}

/* Revenue/cost composition */
.composition-card {
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}
.composition-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 16px;
}
.composition-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.composition-total {
  font-family: var(--font-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.stack-bar {
  display: flex;
  height: 34px;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  margin-bottom: 10px;
}
.stack-seg {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
  transition: filter 160ms;
}
.stack-seg:hover { filter: brightness(1.08); }
/* Lime is bright enough that white text loses contrast; use ink instead. */
.stack-seg.stack-seg-credit { color: #0d1421; text-shadow: 0 1px 1px rgba(255,255,255,0.35); }
.stack-seg-h2     { background: var(--p-h2); }
.stack-seg-meoh   { background: var(--p-meoh); }
.stack-seg-saf    { background: var(--p-saf); }
.stack-seg-caco3  { background: var(--p-caco3); }
.stack-seg-mgco3  { background: var(--p-mgco3); }
.stack-seg-credit { background: var(--p-credit); }
.stack-seg-caas   { background: var(--p-caas); }

.legend {
  display: flex; flex-wrap: wrap; gap: 12px;
  font-size: 12px;
  color: var(--muted);
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch {
  width: 11px; height: 11px; border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.5) inset, 0 1px 2px rgba(0,0,0,0.08);
}

/* Detail table */
.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.detail-table th, .detail-table td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--hairline);
}
.detail-table th {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--eyebrow);
  text-transform: uppercase;
  background: var(--surface-soft);
}
.detail-table td.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.detail-table tr.total td {
  background: var(--surface);
  font-weight: 700;
  color: var(--ink);
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}

/* Right panel: live summary */
.right-panel {
  background: var(--white);
  border-left: 1px solid var(--hairline);
  padding: 24px 20px;
  position: sticky;
  top: 0;
  height: calc(100vh - 90px);
  overflow-y: auto;
}
.summary-header {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--eyebrow);
  text-transform: uppercase;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--hairline);
}
.summary-scenario {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 20px;
}
.summary-block {
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--hairline);
}
.summary-block:last-of-type { border-bottom: none; }
.summary-block-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--eyebrow);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.summary-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px;
  padding: 4px 0;
}
.summary-row-label { color: var(--muted); }
.summary-row-value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.summary-row.headline .summary-row-value {
  font-size: 18px;
  color: var(--green);
}

.audit-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--green-soft);
  color: var(--green);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 4px;
}
.audit-pill::before {
  content: '✓'; font-weight: 700;
}

@media (max-width: 1100px) {
  .platform-shell {
    grid-template-columns: 1fr;
  }
  .left-panel, .right-panel {
    position: static; height: auto;
    border-right: none; border-left: none;
    border-bottom: 1px solid var(--hairline);
  }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
