/* The two calculators at the bottom of the HSA write-up. Same white paper, ink and
   system font as the rest of the site. Chart lines: ink for "paid from HSA",
   vermilion for "paid out of pocket", muted for the expense line. */
.calc {
  --ink: #000;
  --ink-2: #555;
  --muted: #707070;
  --hairline: rgba(0, 0, 0, .15);
  --s1: #1f2366;
  --s2: #b23b2a;
  --panel: #f5f6f8; /* a faint cool grey, so the interactive pieces read apart from the article */
  display: grid;
  gap: 16px;
  min-width: 0;
  padding: 20px;
  background: var(--panel);
  border: 1px solid rgba(0, 0, 0, .06);
  border-radius: 10px;
}
@media (max-width: 480px) { .calc { padding: 16px 12px; } }
.calc :focus-visible { outline: 2px solid var(--ink-2); outline-offset: 2px; }

/* Number fields with a $ or % beside them. */
.calc .field { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--hairline); border-radius: 6px; padding: 0 8px; background: #fff; }
.calc .field:focus-within { border-color: var(--ink-2); }
.calc .field span { color: var(--muted); font-size: .95rem; }
.calc .field input { width: 5.5em; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 1rem; font-weight: 600; padding: 6px 0; font-variant-numeric: tabular-nums; }
.calc .field input:focus { outline: none; }
.calc input[type="range"] { width: 100%; margin: 0; accent-color: var(--ink); }
.prose .calc-hint { font-size: .9rem; line-height: 1.4; color: var(--muted); }
.prose .calc-note { font-size: .95rem; line-height: 1.5; color: var(--ink-2); }

/* Plan comparison: the inputs table mirrors the example plan table above it. */
.prose .calc-inputs th, .prose .calc-inputs td { vertical-align: middle; }
.calc-inputs .none { color: var(--muted); }
@media (max-width: 480px) { .calc-inputs .field input { width: 3.6em; } }
.calc-extras { display: flex; flex-wrap: wrap; gap: 14px 32px; }
.calc-extras > div { display: grid; gap: 6px; align-content: start; max-width: 260px; }
.calc-extras label { font-weight: 600; }
.calc-extras .field { justify-self: start; }
.prose .calc-summary { font-size: 1.05rem; }
.prose .calc-summary strong { font-weight: 600; }

/* Earn-back chart: three levers, the answer, then the chart. */
.calc-levers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
@media (max-width: 560px) { .calc-levers { grid-template-columns: minmax(0, 1fr); } }
.calc-levers > div { display: grid; gap: 8px; align-content: start; }
.calc-levers label { font-weight: 600; }
.calc-levers .field { display: flex; }
.calc-levers .field input { flex: 1; width: auto; }
.calc-answer { display: grid; gap: 6px; }
.calc-big { display: flex; align-items: baseline; gap: 8px; }
.calc-big .num { font-size: 3rem; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.calc-big .unit { font-size: 1.15rem; color: var(--ink-2); }
.calc-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .9rem; color: var(--ink-2); }
.calc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.calc .key { display: inline-block; width: 16px; height: 3px; border-radius: 2px; flex: none; }
.calc .key.s1 { background: var(--s1); }
.calc .key.s2 { background: var(--s2); }
.calc .key.ref { background: var(--muted); height: 1.5px; }
.calc-chart { position: relative; width: 100%; height: 260px; touch-action: pan-y; }
.calc-chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.calc-chart svg:focus { outline: none; }
.calc-chart svg:focus-visible { outline: 2px solid var(--ink-2); outline-offset: 6px; }
.calc-chart .grid { stroke: var(--hairline); stroke-width: 1; }
.calc-chart .baseline { stroke: rgba(0, 0, 0, .4); stroke-width: 1; }
.calc-chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.calc-chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.calc-chart .line.s1 { stroke: var(--s1); }
.calc-chart .line.s2 { stroke: var(--s2); }
.calc-chart .ref { stroke: var(--muted); stroke-width: 1.5; }
.calc-chart .dot { stroke: var(--panel); stroke-width: 2; }
.calc-chart .dot.s1 { fill: var(--s1); }
.calc-chart .dot.s2 { fill: var(--s2); }
.calc-chart .mark-label { fill: var(--ink); font-size: 12px; font-weight: 600; }
.calc-chart .cross { stroke: rgba(0, 0, 0, .3); stroke-width: 1; }
.prose .calc-axis { font-size: .85rem; color: var(--muted); padding-left: 52px; }
.calc-tip {
  position: absolute; top: 6px; z-index: 2; pointer-events: none;
  display: grid; gap: 3px; padding: 6px 10px;
  border: 1px solid var(--hairline); border-radius: 4px; background: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
  font-size: 13px; line-height: 1.35; white-space: nowrap;
}
.calc-tip[hidden] { display: none; }
.calc-tip .tip-year { color: var(--muted); font-size: 12px; }
.calc-tip .row { display: flex; align-items: center; gap: 8px; }
.calc-tip b { font-weight: 600; font-variant-numeric: tabular-nums; }
.calc-tip .row span:last-child { color: var(--ink-2); }
