/* ── ROI Calculator page (page-roi-calculator.php) ───────────────────
   Scoped to .roi-page. Uses design-system tokens throughout.
   Custom CSS here covers only what the shared components can't handle:
   the tab switcher, custom range sliders, results grid, and the
   methodology disclosure. Hero / section / CTA band come from
   components.css unchanged.
──────────────────────────────────────────────────────────────────── */

/* Center the hero (premium-main left-aligns by default) */
.roi-page .ns-hero { text-align: center; }
.roi-page .ns-hero .ns-lead { margin-inline: auto; }
.roi-page .ns-hero__actions { justify-content: center; }

/* ── Calculator card ─────────────────────────────────────────────── */
.roi-calc {
  background: var(--bg-elev);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  padding: var(--space-7);
  box-shadow: var(--shadow-md);
}

/* ── Mode tabs ───────────────────────────────────────────────────── */
.roi-calc__tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-deep);
  border-radius: var(--r-pill);
  padding: 4px;
  margin-bottom: var(--space-7);
}

.roi-calc__tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px var(--space-5);
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--ink-40);
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}

.roi-calc__tab--active {
  background: var(--bg-elev-2);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.roi-calc__tab svg { flex-shrink: 0; stroke: currentColor; }
.roi-calc__tab--active svg { stroke: var(--periwinkle); }

.roi-calc__tab:focus-visible {
  outline: 2px solid var(--periwinkle);
  outline-offset: 2px;
}

/* ── Panels ──────────────────────────────────────────────────────── */
.roi-calc__panel--hidden { display: none; }

/* ── Slider groups ───────────────────────────────────────────────── */
.roi-calc__sliders {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  margin-bottom: var(--space-7);
}

.roi-calc__slider-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.roi-calc__slider-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  font-size: var(--fs-body);
  color: var(--ink-80);
}

.roi-calc__slider-val {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  color: var(--periwinkle);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Custom range input ──────────────────────────────────────────── */
.roi-calc__range {
  --pct: 0%;
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 4px;
  background: linear-gradient(
    to right,
    var(--indigo) 0%,
    var(--indigo) var(--pct),
    var(--line-3) var(--pct),
    var(--line-3) 100%
  );
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}

.roi-calc__range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--indigo);
  border: 2px solid var(--bg-elev);
  box-shadow: 0 0 0 3px rgba(77, 97, 254, .25);
  cursor: pointer;
  transition: box-shadow var(--dur-fast) var(--ease-out);
}

.roi-calc__range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--indigo);
  border: 2px solid var(--bg-elev);
  box-shadow: 0 0 0 3px rgba(77, 97, 254, .25);
  cursor: pointer;
  transition: box-shadow var(--dur-fast) var(--ease-out);
}

.roi-calc__range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 5px rgba(77, 97, 254, .45);
}
.roi-calc__range:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 5px rgba(77, 97, 254, .45);
}

.roi-calc__slider-ticks {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-40);
  margin-top: 2px;
}

/* ── Results grid ────────────────────────────────────────────────── */
.roi-calc__results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  border-top: 1px solid var(--line-2);
  padding-top: var(--space-6);
  margin-bottom: var(--space-6);
}

.roi-calc__result {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-3);
  border-radius: var(--r-md);
  background: var(--bg-glass);
  border: 1px solid var(--line-2);
}

.roi-calc__result-num {
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.roi-calc__result-label {
  font-size: 13px;
  color: var(--ink-60);
  line-height: var(--lh-relaxed);
}

/* ── Methodology disclosure ──────────────────────────────────────── */
.roi-calc__method {
  border-top: 1px solid var(--line-2);
  padding-top: var(--space-4);
}

.roi-calc__method > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
  color: var(--ink-40);
  cursor: pointer;
  user-select: none;
  transition: color var(--dur-fast) var(--ease-out);
}
.roi-calc__method > summary::-webkit-details-marker { display: none; }

.roi-calc__method > summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  transition: transform var(--dur-fast) var(--ease-out);
}

.roi-calc__method[open] > summary::before { content: "−"; }
.roi-calc__method > summary:hover { color: var(--ink-60); }

.roi-calc__method-body {
  padding-top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.roi-calc__method-body p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-60);
  line-height: var(--lh-relaxed);
}

/* ── Mobile ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .roi-calc { padding: var(--space-6) var(--space-5); }

  .roi-calc__tabs {
    flex-direction: column;
    border-radius: var(--r-lg);
  }

  .roi-calc__tab { justify-content: flex-start; font-size: 13px; }

  .roi-calc__results {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .roi-calc__result {
    flex-direction: row;
    text-align: left;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
  }

  .roi-calc__result-label { text-align: right; max-width: 130px; }
}
