/* ==========================================================================
   Revenue leak calculator.

   Loaded after case-studies.css, which supplies the shell (tokens, header,
   footer, .btn, .kicker). Only the tool's own components live here.
   ========================================================================== */

/* --- Page head ----------------------------------------------------------- */

.calc-crumb {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 13px;
}
.calc-crumb a { color: var(--muted); }
.calc-crumb a:hover { color: var(--accent); }
.calc-crumb span { margin: 0 7px; opacity: .55; }

.calc-hero { padding: 42px 0 10px; }

.calc-hero h1 {
  margin: 0;
  max-width: 17ch;
  font-size: clamp(31px, 4.4vw, 56px);
  line-height: 1.02;
}
.calc-hero .calc-lead {
  margin: 22px 0 0;
  max-width: 62ch;
  color: var(--soft);
  font-size: clamp(16px, 1.5vw, 18px);
  line-height: 1.62;
}

.calc-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
}
.calc-facts li {
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
}

/* --- App shell ------------------------------------------------------------

   scroll-margin-top keeps the result clear of the 75px sticky header when
   render() calls scrollIntoView; block:'start' ignores a sticky header. */

.calc-app {
  scroll-margin-top: 95px;
  margin: 40px 0 10px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--card);
  box-shadow: var(--shadow);
}

/* --- Gate (no result yet) -------------------------------------------------- */

.calc-gate h2 {
  margin: 0 0 12px;
  font-size: clamp(21px, 2.4vw, 28px);
}
.calc-gate p { margin: 0 0 20px; max-width: 58ch; color: var(--muted); line-height: 1.6; }
.calc-gate-alt { margin-top: 28px !important; font-size: 14px; }

.calc-paste { display: flex; flex-wrap: wrap; gap: 10px; }
.calc-paste input {
  flex: 1 1 280px;
  min-width: 0;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.calc-paste input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.calc-error:empty { display: none; }
.calc-error {
  margin: 14px 0 0;
  color: #ff9d9d;
  font-size: 14px;
  line-height: 1.5;
}

/* --- Revenue form ---------------------------------------------------------- */

.calc-score {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.calc-score strong { font-size: 30px; font-family: var(--display); }
.calc-score span { color: var(--muted); font-size: 15px; }

.calc-input h2 {
  margin: 0 0 10px;
  font-size: clamp(21px, 2.4vw, 29px);
  max-width: 20ch;
}
.calc-hint { margin: 0 0 22px; max-width: 54ch; color: var(--muted); font-size: 14.5px; line-height: 1.6; }

.calc-form { display: flex; flex-wrap: wrap; gap: 12px; }
.calc-field {
  display: flex;
  align-items: center;
  flex: 1 1 260px;
  min-width: 0;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, .05);
}
.calc-field:focus-within { border-color: var(--accent); }
.calc-prefix { color: var(--muted); font-size: 16px; margin-right: 10px; }
.calc-field input {
  flex: 1;
  min-width: 0;
  padding: 15px 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 19px;
  letter-spacing: .01em;
}
.calc-field input:focus { outline: none; }

/* --- Result ---------------------------------------------------------------- */

.calc-hero-figure {
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
.calc-kicker {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.calc-range {
  margin-top: 12px;
  font-family: var(--display);
  font-size: clamp(27px, 4.1vw, 48px);
  line-height: 1.08;
  color: var(--mint);
}
.calc-year { margin-top: 12px; color: var(--muted); font-size: 15px; }

.calc-lead {
  margin: 24px 0 0;
  max-width: 58ch;
  color: var(--soft);
  font-size: 16px;
  line-height: 1.6;
}
.calc-lead strong { color: var(--text); }

.calc-rows { margin-top: 30px; display: grid; gap: 22px; }

.calc-row-head {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: baseline;
  justify-content: space-between;
}
.calc-row-name { font-weight: 560; font-size: 15.5px; }
.calc-row-money { color: var(--muted); font-size: 14px; }

.calc-bar {
  margin-top: 10px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
}
.calc-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}
/* The biggest leak is the point of the page, so it gets the warm colour. */
.calc-row:first-child .calc-bar span { background: var(--gold); }

.calc-row-note { margin: 9px 0 0; color: var(--muted); font-size: 13.5px; }
.calc-row-note a { color: var(--accent); }
.calc-row-note a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* --- Method ---------------------------------------------------------------- */

.calc-how {
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.calc-how summary {
  cursor: pointer;
  color: var(--soft);
  font-size: 14.5px;
  font-weight: 560;
}
.calc-how summary:hover { color: var(--text); }
.calc-how > div { margin-top: 16px; }
.calc-how p { margin: 0 0 14px; max-width: 62ch; color: var(--muted); font-size: 14.5px; line-height: 1.62; }
.calc-how ul { margin: 0 0 16px; padding-left: 20px; color: var(--muted); font-size: 14.5px; line-height: 1.75; }

.calc-actions { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 11px; }

/* --- Responsive ------------------------------------------------------------ */

@media (max-width: 720px) {
  .calc-app { padding: 24px 20px; border-radius: 20px; }
  .calc-form .btn, .calc-paste .btn, .calc-actions .btn { width: 100%; justify-content: center; }

  /* Always stack name over figure. Left to flex-wrap, a short name like
     "AI leverage" keeps its figure on the same line while longer ones wrap,
     and the rows stop lining up with each other. */
  .calc-row-head { display: block; }
  .calc-row-money { display: block; margin-top: 3px; font-size: 13px; }
}

/* --- Method, written into the page as static text -------------------------

   This section exists without JavaScript on purpose: the assumptions are
   the arguable part of the tool, so they should be readable and indexable
   whether or not the calculator ever runs. */

.calc-method { padding: 58px 0 10px; }
.calc-method h2 { margin: 0 0 16px; font-size: clamp(23px, 2.8vw, 34px); max-width: 22ch; }
.calc-method-lead {
  margin: 0 0 34px;
  max-width: 68ch;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.68;
}

.calc-method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
  gap: 16px;
}
.calc-method-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
}
.calc-method-card h3 {
  margin: 0 0 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
  font-size: 16.5px;
}
.calc-method-card h3 span {
  color: var(--gold);
  font-size: 13px;
  font-weight: 460;
  letter-spacing: .02em;
}
.calc-method-card p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.64; }
.calc-method-card p a { color: var(--accent); white-space: nowrap; }
.calc-method-card p a:hover { text-decoration: underline; text-underline-offset: 3px; }

.calc-method-foot {
  margin: 28px 0 0;
  max-width: 72ch;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.68;
}

@media (max-width: 720px) {
  .calc-method { padding-top: 44px; }
}

/* A perfect score has no figure to show and no bars worth drawing. */
.calc-range-clean { color: var(--mint); font-size: clamp(24px, 3.2vw, 38px); }
.calc-rows.is-empty { display: none; }
