/* ROI Calculator (the #roi-calculator view), rebuilt 07.11 (owner: "less information overload, so users only see
   what they need to know for the current moment when filling out, rather than a full form"). Same words, numbers
   and formulas. Two cards:
   01 your numbers, one question at a time (js/roi-steps.js): the question in hand with its hint on the left, the
      answer on the right, five steps as a bar at the top, Back and Next at the foot. Klaviyo's benchmarks fold
      away on the rate question. Without the script the five questions stand as a list.
   04 the answer, the last page: once the last question is answered the questions go and the black card the
      owner liked ("I like the style") shows alone, its ground an ASCII field in place of the film grain that
      sweeps in and drifts as the numbers rise (owner: "ascii style ... once the actual numbers are revealed",
      "put some of those animated backgrounds"). The total is the one big figure on the page; Flows and
      Campaigns unfold into their working (02 and 03) like an FAQ answer; the arrow goes back to the questions.
   Teal marks the steps, the slider and the gains only. */
.roi-wrap {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: calc(1040px + var(--gutter) * 2);
  margin: 56px auto 0;
  padding: 0 var(--gutter);
}
.roi .roi-step { font-size: var(--t-label); font-weight: 500; line-height: 1.2; color: var(--accent-words); }

/* 01: your numbers */
.roi-calc { padding: clamp(24px, 3.4vw, 40px); border-radius: var(--radius-lg); background: var(--surface); }
.roi-calc.is-moving { overflow: hidden; }
.roi-calc-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 24px; }
/* the five steps: a short bar each, teal once reached, black for the question in hand; a reached step opens again */
.roi-progress { display: flex; gap: 6px; }
.roi-progress[hidden] { display: none; }
.roi-seg { position: relative; width: 32px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; }
.roi-seg::before { content: ""; position: absolute; left: 0; right: 0; top: 10px; height: 4px; border-radius: var(--pill); background: var(--line); transition: background-color var(--hover) ease; }
.roi-seg.is-done::before { background: var(--accent); }
.roi-seg[aria-current="step"]::before { background: var(--fg); }
.roi-seg:disabled { cursor: default; }

/* a question: what it asks on the left, your answer on the right (stacked under 900px) */
.roi-q { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: 14px 48px; align-items: start; padding: 24px 0; }
.roi-q[hidden] { display: none; }   /* one at a time: the grid above must not keep a hidden question on screen */
.roi-q + .roi-q { border-top: 1px solid var(--line); }
.roi-ask { padding-top: 15px; }   /* the label's line sits level with the words in the field beside it */
.roi-label { display: block; font-size: 16px; font-weight: 500; line-height: 1.35; color: var(--fg); }
.roi .roi-note { max-width: 440px; margin-top: 6px; font-size: var(--t-label); line-height: 1.5; color: var(--fg-soft); text-wrap: pretty; }
/* one at a time: the question reads as the headline of its step */
.roi-calc.is-stepped .roi-q { padding: 36px 0 8px; border-top: 0; }
.roi-calc.is-stepped .roi-ask { padding-top: 11px; }
.roi-calc.is-stepped .roi-label { font-size: clamp(20px, 2vw, 24px); line-height: 1.25; letter-spacing: -0.02em; }
.roi-calc.is-stepped .roi-note { margin-top: 8px; font-size: 16px; }
.roi-q-rate .roi-bench { grid-column: 1 / -1; margin-top: 12px; }
.roi-q-rate .roi-ask { align-self: center; padding-top: 0; }

.roi-inputwrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 20px;
  border-radius: var(--pill);
  background: var(--white);
  border: 1px solid var(--line);
  transition: border-color var(--hover) ease;
}
.roi-inputwrap:focus-within { border-color: var(--accent); }
.roi-inputwrap input { flex: 1; width: 0; min-width: 0; padding: 12px 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px; color: var(--fg); }
.roi-inputwrap input::placeholder { color: var(--fg-soft); }
.roi-affix { font-size: var(--t-label); color: var(--fg-soft); white-space: nowrap; }
/* the currency on the first money answer (owner, 08.11): its code and a small chevron in Black, teal under the
   mouse or the keyboard; the real select lies unseen over them, so the open list is the browser's own */
.roi-currency { position: relative; flex: none; display: inline-flex; align-items: center; gap: 4px; }
.roi-currency select { position: absolute; inset: -14px -8px; width: calc(100% + 16px); height: calc(100% + 28px); margin: 0; padding: 0; border: 0; opacity: 0; font: inherit; font-size: 16px; cursor: pointer; -webkit-appearance: none; appearance: none; }
.roi-currency-code { font-size: var(--t-label); font-weight: 500; color: var(--fg); white-space: nowrap; transition: color var(--hover) ease; }
.roi-currency-chev { width: 12px; height: 12px; color: var(--fg); transition: color var(--hover) ease; }
.roi-currency:hover .roi-currency-code, .roi-currency:hover .roi-currency-chev,
.roi-currency select:focus-visible ~ .roi-currency-code, .roi-currency select:focus-visible ~ .roi-currency-chev { color: var(--accent-words); }
/* under an answer: its year figure (and for flows its share of revenue) in grey, and the double-check notes */
.roi .roi-derived { display: flex; flex-wrap: wrap; gap: 2px 16px; margin-top: 8px; padding: 0 20px; font-size: var(--t-label); font-weight: 500; line-height: 1.4; color: var(--fg-soft); }
.roi-derived[hidden] { display: none; }
.roi .roi-warn { margin-top: 8px; padding: 0 20px; font-size: var(--t-label); line-height: 1.45; color: var(--warn); }
.roi .roi-warn.roi-error { color: var(--error); }

/* the rate: the slider and its figure on one line. A flat track, Turquoise 3 up to the thumb (a hard stop, not
   a gradient), Light gray 1 after it */
.roi-rate { display: flex; align-items: center; gap: 20px; min-height: 52px; }
.roi-slider-value { flex: none; min-width: 52px; text-align: right; font-size: 16px; font-weight: 500; color: var(--accent-words); font-variant-numeric: tabular-nums; }
#porSlider {
  --fill: 30.6%;
  flex: 1;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
  display: block;
  height: 6px;
  margin: 0;
  border-radius: var(--pill);
  background: linear-gradient(to right, var(--accent) 0 var(--fill), var(--line) var(--fill) 100%);
  cursor: pointer;
}
#porSlider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 22px; height: 22px; border-radius: var(--pill); background: var(--white); border: 2px solid var(--accent); cursor: grab; }
#porSlider::-moz-range-thumb { width: 18px; height: 18px; border-radius: var(--pill); background: var(--white); border: 2px solid var(--accent); cursor: grab; }
#porSlider:focus-visible { outline-offset: 8px; }

/* the benchmarks, folded under their own title; they open like an FAQ answer (js/faq.js, the same plus) */
.roi-bench { border-top: 1px solid var(--line); }
.roi-bench summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; padding: 12px 0; list-style: none; cursor: pointer; }
.roi-bench summary::-webkit-details-marker { display: none; }
.roi-bench-title { font-size: var(--t-label); font-weight: 500; line-height: 1.3; color: var(--fg); }
.roi-bench .faq-icon { width: 36px; height: 36px; }
.roi-bench summary:hover .faq-icon { background: var(--press); color: var(--on-press); }
.roi-bench[open]:not(.is-closing) .faq-v { transform: rotate(90deg); }
.roi-bench.is-moving { overflow: hidden; }
.roi-bench-body { padding: 4px 0 8px; }
.roi-benchmarks-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 32px; }
.roi-benchmarks-grid span { display: flex; justify-content: space-between; gap: 8px; font-size: var(--t-label); line-height: 1.45; color: var(--fg-soft); }
.roi-benchmarks-grid em { font-style: normal; font-weight: 500; color: var(--fg); }
.roi-benchmarks-link { display: inline-block; margin-top: 8px; padding: 12px 0; font-size: var(--t-label); font-weight: 500; color: var(--accent-words); transition: color var(--hover) ease; }
.roi-benchmarks-link:hover { color: var(--fg); }

/* Back (the site's round arrow) and Next; Next waits, greyed, until the question has an answer */
.roi-stepnav { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 28px; }
.roi-stepnav[hidden] { display: none; }
.roi-next { min-width: 148px; }
.roi-next:disabled { background: var(--line); color: var(--fg-soft); cursor: not-allowed; }
.roi-next[hidden] { display: none; }

/* 04: the answer on the black card, its ground an ASCII field (the canvas, js/roi-steps.js) */
.roi-total { position: relative; overflow: hidden; isolation: isolate; min-height: 420px; padding: clamp(28px, 4vw, 56px); border-radius: var(--radius-xl); background: var(--hero-ground); color: var(--on-sky); }
.roi-total[hidden] { display: none; }
.roi-ascii { position: absolute; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; pointer-events: none; }
.roi-total > :not(.roi-ascii) { position: relative; z-index: 1; }
/* the last page's head: the arrow back to the questions, then the step */
.roi-total-top { display: flex; align-items: center; gap: 16px; min-height: 40px; }
.roi-total .roi-step { color: var(--accent-on-sky); }
.roi-again { flex: none; width: 40px; height: 40px; }
.roi-again[hidden] { display: none; }
/* the round arrows sit white on both cards (the soft card is the arrows' own grey); teal under the mouse on the black */
.roi .arrow-btn { background: var(--white); color: var(--fg); }
.roi-total .arrow-btn:hover { background: var(--hero-press); color: var(--on-hero-press); }
.roi-total-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
  grid-template-areas: "total cta" "rows rows";
  gap: 24px 64px;
  align-items: end;
  margin-top: 28px;
}
.roi-total-empty { grid-area: total; }
.roi-total-empty .roi-card-desc { max-width: 460px; font-size: var(--t-lead); line-height: 1.55; color: var(--on-sky-soft); text-wrap: pretty; }
.roi-total-body:not([hidden]) { display: contents; }
/* the total keeps to one line: its size follows its column (11% of it, 64px at most), so a nine-figure total fits;
   a longer one (eleven-figure yen, a currency code such as SGD) shrinks by its length, --len from js/roi.js (08.11) */
.roi-sumtotal { grid-area: total; display: flex; flex-direction: column; gap: 12px; container-type: inline-size; outline: none; }
.roi-sumtotal span:first-child { font-size: 16px; font-weight: 500; color: var(--on-sky-soft); }
#sumTotal { font-family: var(--f-head); font-weight: 500; font-size: min(64px, 11cqi * 16 / max(16, var(--len, 16))); line-height: 1; letter-spacing: -0.04em; color: var(--accent-on-sky); font-variant-numeric: tabular-nums; white-space: nowrap; }
.roi-cta { grid-area: cta; width: 100%; }
.roi-total .btn { background: var(--hero-press); color: var(--on-hero-press); }
.roi-total .btn:hover { background: var(--hero-press-hover); }

/* Flows and Campaigns: a row each with its gain, unfolding into the working behind it */
.roi-details { grid-area: rows; margin-top: 8px; }
.roi-detail { border-top: 1px solid var(--glass-line); }
.roi-detail:last-child { border-bottom: 1px solid var(--glass-line); }
.roi-detail summary { display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 10px 0; list-style: none; cursor: pointer; }
.roi-detail summary::-webkit-details-marker { display: none; }
.roi-detail-name { flex: 1; font-size: 16px; color: var(--on-sky-soft); }
.roi-detail-value { font-size: 18px; font-weight: 500; color: var(--on-sky); white-space: nowrap; font-variant-numeric: tabular-nums; }
.roi-detail .faq-icon { width: 36px; height: 36px; }
.roi-detail summary:hover .faq-icon { background: var(--hero-press); color: var(--on-hero-press); }
.roi-detail[open]:not(.is-closing) .faq-v { transform: rotate(90deg); }
.roi-detail.is-moving { overflow: hidden; }
.roi-detail-body { max-width: 760px; padding: 4px 0 28px; }
.roi-total .roi-card-title { margin-top: 10px; font-family: var(--f-head); font-weight: 500; font-size: 20px; line-height: 1.3; letter-spacing: -0.02em; color: var(--on-sky); text-wrap: balance; }
.roi-detail-body .roi-card-desc { margin-top: 8px; font-size: 16px; line-height: 1.55; color: var(--on-sky-soft); text-wrap: pretty; }
.roi-metrics { display: flex; flex-direction: column; margin-top: 18px; }
.roi-metrics:empty { display: none; }
.roi-metricrow { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; border-top: 1px solid var(--glass-line); }
.roi-mlabel { font-size: var(--t-label); line-height: 1.45; color: var(--on-sky-soft); }
.roi-mvalue { font-size: 16px; font-weight: 500; color: var(--on-sky); white-space: nowrap; font-variant-numeric: tabular-nums; }
.roi-mvalue.is-accent { color: var(--accent-on-sky); }
/* the gap is the last row: its words white, its figure teal, no box */
.roi-gaprow .roi-mlabel { font-weight: 500; color: var(--on-sky); }
.roi-gaprow .roi-mvalue { color: var(--accent-on-sky); }
.roi .roi-disclaimer { margin-top: 14px; font-size: var(--t-label); line-height: 1.5; color: var(--on-sky-soft); }

/* turning between the questions and the answer (js/roi-steps.js, owner 07.11: not a reload, not a fade-up): the
   two cards are pictured as one; the black spreads out of Calculate like ink over the grey, filling the answer
   card as it grows, and draws back into the arrow on the way back. The rest of the page holds still. */
html.is-roi-turning #roiSteps, html.is-roi-turning #roiSummaryCard,
html.is-roi-returning #roiSteps, html.is-roi-returning #roiSummaryCard { view-transition-name: roi-card; }
html.is-roi-turning::view-transition-old(root), html.is-roi-turning::view-transition-new(root),
html.is-roi-returning::view-transition-old(root), html.is-roi-returning::view-transition-new(root) { animation: none; }
html.is-roi-turning::view-transition-group(roi-card), html.is-roi-returning::view-transition-group(roi-card) { animation-duration: 760ms; animation-timing-function: cubic-bezier(0.65, 0, 0.35, 1); }
::view-transition-old(roi-card), ::view-transition-new(roi-card) { mix-blend-mode: normal; }
html.is-roi-turning::view-transition-old(roi-card) { animation: none; }
html.is-roi-turning::view-transition-new(roi-card) { animation: roi-ink-in 760ms cubic-bezier(0.65, 0, 0.35, 1) both; }
html.is-roi-returning::view-transition-new(roi-card) { animation: none; }
html.is-roi-returning::view-transition-old(roi-card) { z-index: 1; animation: roi-ink-out 620ms cubic-bezier(0.65, 0, 0.35, 1) both; }
@keyframes roi-ink-in {
  from { clip-path: circle(0 at var(--ink-x, 90%) var(--ink-y, 85%)); }
  to { clip-path: circle(var(--ink-r, 150%) at var(--ink-x, 90%) var(--ink-y, 85%)); }
}
@keyframes roi-ink-out {
  from { clip-path: circle(var(--ink-r, 150%) at var(--ink-x, 5%) var(--ink-y, 10%)); }
  to { clip-path: circle(0 at var(--ink-x, 5%) var(--ink-y, 10%)); }
}

@media (max-width: 900px) {
  .roi-q { grid-template-columns: 1fr; gap: 14px; }
  .roi-ask, .roi-calc.is-stepped .roi-ask { padding-top: 0; }
  .roi-calc.is-stepped .roi-q { padding-top: 28px; }
  .roi-total-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "total" "rows" "cta"; gap: 24px; }   /* never wider than the card, so the total can fit it */
  .roi-benchmarks-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .roi-wrap { margin-top: 40px; }
  .roi-benchmarks-grid { grid-template-columns: 1fr; }
  .roi-next { min-width: 0; flex: 1; }
}
