/* ============================================================================
   ROI CALCULATOR — scoped styles (page: /roi-calculator, /fr/roi-calculator)

   Brief-mandated brand-kit hex values (Navy/Teal/Indigo) are NOT part of the
   sitewide token set (only Gold matches --color-primary exactly), so they are
   declared here as calculator-scoped CSS variables under .roi-tool and reused
   only within this component. Gold is intentionally NOT redeclared — it maps
   directly to the sitewide --color-primary variable so it stays theme-aware.

   Typography deviation (flagged to Pierre in the delivery report): this
   component uses Inter (headings/body) + JetBrains Mono (numeric readouts)
   via a system-font fallback stack, per the brief's explicit repeated
   mandate ("use the site's already-loaded Inter tokens... Fraunces is
   FORBIDDEN"). The site's ACTUAL sitewide fonts are Cabinet Grotesk +
   Satoshi (loaded via Fontshare) — Inter/JetBrains Mono are NOT loaded
   anywhere else on the site. No external font request is added here to
   respect the "no external font CDN request" instruction; both stacks
   gracefully degrade to system-ui / ui-monospace if the named fonts are not
   locally installed in the visitor's OS.
   ============================================================================ */

.roi-tool {
  --rt-navy: #0D2137;
  --rt-teal: #0E8A8A;
  --rt-teal-hover: #12a3a3;
  --rt-indigo: #3B4DB8;
  --rt-indigo-ring: oklch(from #3B4DB8 l c h / 0.35);
  --rt-gold: var(--color-primary); /* byte-identical to brief's #C9A84C */
  --rt-error: var(--color-error);

  /* Text-safe tints — WCAG contrast re-verification (checklist item 8) found
     the sitewide --color-text-faint (#5a5856) measures only 2.74:1 on this
     page's dark background, and raw brand Teal (#0E8A8A) measures 4.43:1 on
     the card surface — both below the required 4.5:1 for normal text. Per
     the brief's own instruction ("adjust text tints, never the brand hex
     values"), these are LOCAL, text-only tints used solely for small/body
     copy in this component; the brand hex values themselves (--rt-teal,
     and the sitewide --color-text-faint token used elsewhere on the site)
     are left untouched. Decorative/interactive uses of Teal (range slider
     accent-color, verdict borders) keep the pure brand hex.
     Verified: #269696 on #131316 = 5.20:1, on #0d0d0f = 5.44:1.
              #838280 on #131316 = 4.83:1, on #0d0d0f = 5.06:1. */
  --rt-teal-text: #269696;
  --rt-faint-text: #838280;

  --font-sans-rt: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono-rt: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  font-family: var(--font-sans-rt);
  max-width: var(--content-default);
  margin-inline: auto;
}

.roi-tool h1,
.roi-tool h2,
.roi-tool h3 { font-family: var(--font-sans-rt); }

/* ---------- masthead ---------- */
.roi-masthead { text-align: center; max-width: 720px; margin-inline: auto; }
.roi-masthead .badge { margin-bottom: var(--space-4); }
.roi-masthead h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-top: var(--space-4);
  line-height: 1.15;
}
.roi-masthead .roi-promise {
  color: var(--color-text-muted);
  font-size: var(--text-lg);
  margin-top: var(--space-4);
  line-height: 1.6;
}
.roi-masthead .roi-installnote {
  color: var(--rt-faint-text);
  font-size: var(--text-xs);
  margin-top: var(--space-3);
}

/* ---------- philosophy anchor ---------- */
.roi-philo {
  border-left: 3px solid var(--rt-teal);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-6);
  margin: var(--space-10) 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1.7;
}

/* ---------- layout grid ---------- */
.roi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  align-items: start;
  margin-top: var(--space-8);
}
@media (max-width: 800px) {
  .roi-grid { grid-template-columns: 1fr; }
}

.roi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}
.roi-card h2 {
  font-size: var(--text-base);
  font-weight: 700;
  margin: 0 0 var(--space-5) 0;
  color: var(--color-text);
}

/* ---------- form fields ---------- */
.roi-field { margin-bottom: var(--space-5); }
.roi-field:last-child { margin-bottom: 0; }
.roi-field label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}
.roi-field .roi-hint {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-1);
  font-weight: 400;
}
.roi-input-wrap { position: relative; display: flex; align-items: center; }
.roi-input-wrap .roi-prefix {
  position: absolute;
  left: var(--space-3);
  color: var(--color-text-muted);
  font-family: var(--font-mono-rt);
  font-size: var(--text-sm);
  pointer-events: none;
}
.roi-input-wrap.has-prefix input { padding-left: var(--space-8); }

.roi-tool input[type="number"],
.roi-tool input[type="text"],
.roi-tool input[type="email"] {
  width: 100%;
  min-height: 44px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: var(--font-mono-rt);
  font-size: var(--text-base);
  padding: var(--space-3) var(--space-4);
  transition: border-color var(--transition-interactive), box-shadow var(--transition-interactive);
}
.roi-tool input:focus-visible {
  outline: none;
  border-color: var(--rt-indigo);
  box-shadow: 0 0 0 3px var(--rt-indigo-ring);
}

/* range slider — Teal fill, Indigo focus ring */
.roi-tool input[type="range"] {
  width: 100%;
  height: 44px;
  background: transparent;
  accent-color: var(--rt-teal);
  cursor: pointer;
}
.roi-tool input[type="range"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--rt-indigo-ring);
  border-radius: var(--radius-full);
}
.roi-range-row { display: flex; align-items: center; gap: var(--space-3); }
.roi-range-row output {
  font-family: var(--font-mono-rt);
  font-weight: 700;
  color: var(--rt-teal-text);
  min-width: 3.5ch;
  text-align: right;
  font-size: var(--text-sm);
}

#roi-reset {
  min-height: 44px;
  min-width: 44px;
}

/* ---------- results card ---------- */
.roi-card.roi-results { border-color: color-mix(in oklch, var(--rt-gold) 30%, var(--color-border)); }

.roi-net-figure {
  font-family: var(--font-mono-rt);
  font-weight: 700;
  font-size: var(--text-2xl);
  color: var(--rt-gold);
  line-height: 1.1;
  margin-bottom: var(--space-1);
}
.roi-net-figure.roi-negative { color: var(--rt-error); }
.roi-net-caption {
  font-size: var(--text-xs);
  color: var(--rt-faint-text);
  margin-bottom: var(--space-6);
}

.roi-metricgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.roi-metric {
  background: var(--color-surface-2);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
}
.roi-metric .roi-metric-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}
.roi-metric .roi-metric-value {
  font-family: var(--font-mono-rt);
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--color-text);
}

.roi-verdict {
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-5);
  font-size: var(--text-sm);
  line-height: 1.6;
  border: 1px solid transparent;
}
.roi-verdict-strong {
  background: color-mix(in oklch, var(--rt-teal) 16%, var(--color-surface));
  border-color: color-mix(in oklch, var(--rt-teal) 45%, transparent);
  color: var(--color-text);
}
.roi-verdict-moderate {
  background: color-mix(in oklch, var(--rt-gold) 14%, var(--color-surface));
  border-color: color-mix(in oklch, var(--rt-gold) 40%, transparent);
  color: var(--color-text);
}
.roi-verdict-weak {
  background: color-mix(in oklch, var(--color-error) 14%, var(--color-surface));
  border-color: color-mix(in oklch, var(--color-error) 40%, transparent);
  color: var(--color-text);
}
.roi-verdict strong { display: block; margin-bottom: var(--space-1); font-size: var(--text-base); }

.roi-assumptions {
  font-size: var(--text-xs);
  color: var(--rt-faint-text);
  line-height: 1.6;
  margin: 0;
}

/* ---------- single CTA ---------- */
.roi-cta { text-align: center; margin-top: var(--space-10); }
.roi-cta .btn { min-height: 48px; }

/* ---------- optional email capture (secondary, below primary CTA) ---------- */
.roi-email-capture {
  max-width: 480px;
  margin: var(--space-6) auto 0;
  text-align: left;
}
.roi-email-capture h3 {
  font-size: var(--text-sm);
  font-weight: 600;
  margin: 0 0 var(--space-1) 0;
}
.roi-email-capture p {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-3) 0;
}
.roi-email-form { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.roi-email-form input { flex: 1; min-width: 180px; }
.roi-email-form button { min-height: 44px; white-space: nowrap; }

/* ---------- footer privacy line ---------- */
.roi-footnote {
  text-align: center;
  color: var(--rt-faint-text);
  font-size: var(--text-xs);
  margin-top: var(--space-10);
  line-height: 1.6;
}

/* ---------- mobile / 375px ---------- */
@media (max-width: 480px) {
  .roi-metricgrid { grid-template-columns: 1fr; }
  .roi-masthead h1 { font-size: var(--text-xl); }
  .roi-net-figure { font-size: var(--text-xl); }
  .roi-email-form { flex-direction: column; }
  .roi-email-form input,
  .roi-email-form button { width: 100%; }
}
