/* core-e-llc.com — the Replication tools (/publications/tools/), 2026-11-24.
   Loaded only by the tool pages, after site.css, and built on its tokens. Phone first:
   most readers arrive from the Substack app. No animation anywhere, so
   prefers-reduced-motion has nothing to switch off.

   Chart colors: the spread wears Core Orange (the same line as the /publications hero
   loop); the long and short sides are a blue and a green checked against the navy
   surface for color-blind separation (dataviz validator, 2026-11-24); "before costs" on
   the stress test is a muted gray on purpose, because it is the reference line.
   Text never wears a series color: a short key beside it carries the identity. */

.tool{
  background:var(--surface);border:1px solid var(--line);border-radius:16px;
  padding:18px 16px;margin:22px 0 10px;box-shadow:var(--shadow);
}
.tool > h2{font-size:1.15rem;font-weight:800;margin-bottom:12px}
.needs-js{display:none}
.tool-live .needs-js{display:block}

.tool :focus-visible,.subscribe :focus-visible,.fine :focus-visible{
  outline:3px solid var(--accent);outline-offset:3px;border-radius:6px;
}

/* ---------- the stress test's layout ----------
   Phone: the cost slider, then the result right under it (the line has to move where the
   thumb is), then the other assumptions. Wide screens: controls in a left column, the
   result beside them. The reading and tab order is the phone order in both. */
.tool-live .bench{display:grid;gap:16px;grid-template-columns:minmax(0,1fr)}
.bench-more{display:grid;gap:14px}
.bench-more h3{font-size:1rem;font-weight:800;margin-top:4px}
@media (min-width:900px){
  .tool-live .bench{
    grid-template-columns:320px minmax(0,1fr);gap:16px 26px;align-items:start;
    grid-template-areas:"lead out" "more out";grid-template-rows:auto 1fr;
  }
  .bench-lead{grid-area:lead}
  .bench-out{grid-area:out}
  .bench-more{grid-area:more}
}

/* ---------- controls ---------- */
.control{
  background:var(--surface-2);border:1px solid var(--line);border-radius:12px;
  padding:14px 14px 12px;min-width:0;margin:0;
}
.control label,.control legend{font-weight:700;font-size:.95rem;color:var(--ink);padding:0}
.control output{display:block;color:var(--accent-ink);font-weight:800;font-size:1.05rem;margin:2px 0 6px}
.control .hint{color:var(--ink-faint);font-size:.8rem;line-height:1.45;margin-top:8px}
.control input[type=range],.scrub input[type=range]{
  width:100%;height:32px;margin:0;accent-color:var(--accent);background:transparent;
}
.control select{
  font:inherit;font-size:1rem;color:var(--ink);background:var(--bg2);
  border:1px solid var(--line-strong);border-radius:10px;padding:9px 10px;min-height:44px;
}
.control .row{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}
.presets{display:flex;gap:8px;flex-wrap:wrap;margin-top:6px}
.presets button,.reset{
  font:inherit;font-size:.88rem;font-weight:700;color:var(--ink);cursor:pointer;
  background:none;border:1px solid var(--line-strong);border-radius:999px;
  padding:8px 14px;min-height:40px;
}
.presets button:hover,.reset:hover{border-color:var(--accent);color:var(--accent-ink)}
.presets button[aria-pressed=true]{background:var(--chip-bg);border-color:var(--accent);color:var(--chip-ink)}
.choice{display:flex;align-items:center;gap:8px;min-height:36px;color:var(--ink-soft);font-size:.95rem}
.choice input{width:20px;height:20px;accent-color:var(--accent);flex:none}
.choice input:disabled + span{color:var(--ink-faint)}
.toggles{display:flex;gap:6px 20px;flex-wrap:wrap;margin-bottom:12px}

/* ---------- the result in words and in figures ---------- */
.summary{color:var(--ink);font-size:1rem;line-height:1.55;margin:4px 0 14px;max-width:70ch}
.tiles{display:grid;gap:10px;grid-template-columns:1fr 1fr;margin:0 0 18px}
@media (min-width:760px){.tiles{grid-template-columns:repeat(3,1fr)}}
.tiles div{background:var(--surface-2);border:1px solid var(--line);border-radius:12px;padding:12px 14px;min-width:0}
.tiles dt{color:var(--ink-soft);font-size:.8rem;font-weight:600;line-height:1.35}
.tiles dd{color:var(--ink);font-size:1.35rem;font-weight:700;line-height:1.3;margin-top:2px}
.tiles .lead{grid-column:1 / -1;border-color:var(--line-strong)}
@media (min-width:760px){.tiles .lead{grid-column:auto}}
.tiles .lead dd{font-size:2.6rem;line-height:1.15}
.tiles .wide{grid-column:1 / -1}
.tiles small{display:block;color:var(--ink-faint);font-size:.78rem;font-weight:400;line-height:1.45;margin-top:4px}

/* ---------- chart (built by /js/tools/chart.js) ---------- */
.chart{min-width:0}
.readout{min-height:96px;margin-bottom:6px}
.readout-month{color:var(--ink);font-weight:800;font-size:1rem}
.readout-values,.legend{list-style:none;display:flex;flex-wrap:wrap;gap:4px 18px}
.readout-values li{display:flex;align-items:center;gap:7px;font-size:.92rem;color:var(--ink-soft)}
.readout-values strong{color:var(--ink);font-size:1.05rem;font-variant-numeric:tabular-nums}
.readout-extra{color:var(--ink-faint);font-size:.82rem;line-height:1.45;margin-top:4px}
.legend{margin:2px 0 6px;font-size:.82rem;color:var(--ink-soft)}
.legend li{display:flex;align-items:center;gap:7px}
.key{display:inline-block;width:16px;height:3px;border-radius:2px;flex:none}
.plot svg{display:block;width:100%;height:auto;touch-action:pan-y;user-select:none;-webkit-user-select:none}
.plot .grid{stroke:var(--line);stroke-width:1}
.plot .grid.base{stroke:rgba(243,245,247,.3)}
.plot .tick{fill:var(--ink-faint);font-size:11px;font-variant-numeric:tabular-nums}
.plot .end{fill:var(--ink);font-size:12px;font-weight:700}
.plot .line{fill:none;stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.plot .dot{stroke:var(--surface);stroke-width:2}
.plot .cross{stroke:rgba(243,245,247,.4);stroke-width:1}
.plot .band{fill:rgba(243,245,247,.07)}
.plot .hit{fill:transparent;cursor:crosshair}
.scrub{display:block;margin-top:4px}
.scrub-label{display:block;color:var(--ink-faint);font-size:.78rem}
.chart-note{color:var(--ink-faint);font-size:.78rem;line-height:1.5;margin-top:12px;max-width:80ch}
.chart-note a,.fine a{color:var(--ink-soft)}

/* ---------- the words under the tool ---------- */
.fine h2{margin-top:6px}
.fine ul{color:var(--ink-soft);max-width:70ch;margin:0 0 12px 20px}
.fine li{margin-bottom:6px}
.fine details{max-width:70ch;margin:14px 0}
.fine summary,.tool summary{cursor:pointer;color:var(--ink);font-weight:700;padding:8px 0;min-height:40px}
.table-wrap{overflow-x:auto;max-height:420px;overflow-y:auto;border:1px solid var(--line);border-radius:12px;margin-top:8px}
.table-wrap table{border-collapse:collapse;width:100%;font-size:.84rem;font-variant-numeric:tabular-nums}
.table-wrap th,.table-wrap td{padding:7px 12px;text-align:right;white-space:nowrap;border-bottom:1px solid var(--line);color:var(--ink-soft)}
.table-wrap th[scope=row],.table-wrap thead th:first-child{text-align:left}
.table-wrap thead th{position:sticky;top:0;background:var(--surface-2);color:var(--ink);font-weight:700}
.subscribe{
  background:var(--surface);border:1px solid var(--line-strong);border-radius:16px;
  padding:24px 20px;margin:34px 0 10px;box-shadow:var(--shadow);
}
.subscribe h2{font-weight:800;font-size:1.3rem;margin-bottom:8px}
.subscribe p{color:var(--ink-soft);max-width:60ch;margin-bottom:16px}
.subscribe .btn{font-size:1.02rem;padding:13px 26px}
.tool-links{display:flex;gap:10px 22px;flex-wrap:wrap;margin-top:18px;font-size:.92rem}
.tool-links a{color:var(--ink-soft)}
