/* Traditional vs Roth 401(k) calculator. Loaded after site.css (same paper / ink palette). No inline styles:
   the page is served under style-src 'self'. */
/* --taxable: the chart's third part, money outside the 401(k): a warm gray, unlike the teal and orange in lightness
   and colour, 3.5:1 on the paper */
.calc { --taxable: #8a7f6a; display: grid; gap: clamp(1.5rem, 3vw, 3rem); grid-template-columns: minmax(0, 1fr); margin-top: 2.5rem; }
@media (min-width: 60rem) { .calc { grid-template-columns: minmax(0, 23rem) minmax(0, 1fr); align-items: start; } }

.calc-form { background: var(--paper-deep); border: 1px solid var(--rule); border-radius: 14px; padding: 1.4rem 1.4rem 1.2rem; }
.calc-form fieldset { border: 0; margin: 0 0 1.1rem; padding: 0; }
.calc-form legend { font-weight: 700; margin-bottom: 0.45rem; padding: 0; }
.calc-form .field { display: grid; gap: 0.3rem; margin-bottom: 0.95rem; }
.calc-form .field[hidden] { display: none; }   /* the spouse's boxes, single */
.calc-form label { font-weight: 700; font-size: 0.95rem; }
.calc-form .hint { color: var(--muted); font-size: 0.82rem; line-height: 1.45; }
.calc-form input[type=number] { font: inherit; font-variant-numeric: tabular-nums; width: 100%; padding: 0.55rem 0.7rem;
  border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); color: var(--ink); }
.calc-form input[type=number]:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.calc-form .radios { display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; }
.calc-form .radios label { font-weight: 400; display: inline-flex; gap: 0.4rem; align-items: center; }

.calc-form .reset { font: inherit; font-size: 0.9rem; background: none; border: 1px solid var(--ink-soft); color: var(--ink);
  border-radius: 999px; padding: 0.4rem 1rem; cursor: pointer; }
.calc-form .reset:hover { background: var(--paper); }

.calc-results { min-width: 0; }
/* Wide screens: the form and the results are two panes a window high that scroll on their own, so the results stay
   in view to the last box (a sticky column is pushed off at the end of the form). At a pane's end the page goes on
   scrolling. Phones: a summary bar at the bottom while the results are off screen (app.js). */
@media (min-width: 60rem) {
  .calc { height: calc(100vh - 1.5rem); align-items: stretch; }
  .calc-form, .calc-results { min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
  .calc-results { padding: 0 0.7rem 1.5rem 0; }
}
.summary-bar { position: fixed; left: 0.75rem; right: 0.75rem; bottom: 0.75rem; z-index: 30; display: flex; flex-wrap: wrap;
  align-items: baseline; gap: 0.2rem 0.8rem; padding: 0.7rem 1rem; border-radius: 12px; background: var(--ink); color: var(--paper);
  text-decoration: none; box-shadow: 0 16px 34px -18px rgba(29, 27, 24, 0.7); }
.summary-bar[hidden] { display: none; }
.summary-bar .sb-label { font-size: 0.8rem; opacity: 0.8; }
.summary-bar .sb-value { font-size: 1.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.summary-bar .sb-verdict { flex: 1 1 10rem; font-size: 0.85rem; }
.summary-bar .sb-go { margin-left: auto; font-weight: 700; }
.summary-bar:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
@media (min-width: 60rem) { .summary-bar, .summary-bar[hidden] { display: none; } }
.calc-page.has-summary .site-foot { padding-bottom: 6rem; }
.calc-results h2 { margin-bottom: 0.6rem; }
/* "Your plan" first: one big number, with what goes in and what it costs in take-home pay underneath */
.plan-card { border: 1px solid var(--rule); border-left: 6px solid var(--ink); border-radius: 14px; padding: 1rem 1.2rem;
  background: var(--paper); max-width: 42rem; }
.plan-card:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.plan-card .label { display: block; font-weight: 700; font-size: 0.9rem; color: var(--ink-soft); }
.plan-card .value { display: block; font-size: clamp(2.2rem, 1.6rem + 2.6vw, 3.2rem); font-weight: 700;
  font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 0.2rem; }
.plan-card .unit { display: block; color: var(--muted); font-size: 0.9rem; }
.plan-card .mix { display: block; margin-top: 0.5rem; color: var(--ink-soft); font-size: 0.92rem; }
.calc-results .prices { font-size: 0.9rem; margin: -0.2rem 0 1rem; }
.calc-results .cmp-h { margin: 2rem 0 0.3rem; font-size: 1.15rem; }
.verdict { font-size: clamp(1.1rem, 1rem + 0.5vw, 1.3rem); font-weight: 700; margin: 1.3rem 0 0.4rem; }
.calc-results .note { color: var(--ink-soft); margin: 0.3rem 0; max-width: var(--measure); }

.chart { margin: 1.2rem 0 0.4rem; max-width: 42rem; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .bar-trad { fill: var(--asian); }
.chart .bar-roth { fill: var(--hispanic); }
.chart .bar-name { font-size: 14px; fill: var(--ink-soft); }
.chart .bar-name.is-plan { font-weight: 700; fill: var(--ink); }
.chart .bar-value { font-weight: 700; font-size: 15px; fill: var(--ink); font-variant-numeric: tabular-nums; }
.chart .bar-tx { fill: var(--taxable); stroke: var(--paper); stroke-width: 1.5px; }   /* a seam next to the orange */
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.5rem; margin: 0 0 0.6rem; font-size: 0.82rem;
  color: var(--muted); }
.legend .key { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 2px; }
.legend .key-trad { background: var(--asian); }
.legend .key-roth { background: var(--hispanic); margin-left: 0.8rem; }
.legend .legend-tx { display: inline-flex; align-items: center; gap: 0.5rem; margin-left: 0.8rem; }
.legend .legend-tx[hidden] { display: none; }
.legend .key-tx { background: var(--taxable); }

.details { width: 100%; min-width: 0; max-width: 42rem; table-layout: fixed; border-collapse: collapse; margin-top: 1.4rem; font-size: 0.95rem; }
.details caption { text-align: left; font-weight: 700; margin-bottom: 0.4rem; }
.details th, .details td { border-top: 1px solid var(--rule); padding: 0.5rem 0; text-align: left; font-weight: 400; }
.details th { width: 70%; }
.details td { width: 30%; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 1rem; }
.details tbody th { white-space: normal; position: static; background: none; }   /* site.css pins table row heads */

.calc-notes { margin-top: var(--space-section); }
.calc-notes h2 { margin-top: 2.2rem; }
.calc-notes ul { padding-left: 1.2rem; }
.calc-notes li { margin: 0.35rem 0; }
.noscript { border: 1px solid var(--rule); border-radius: 10px; padding: 0.8rem 1rem; background: var(--paper-deep); }

/* ---- the two-account primer, contribution helpers, warnings, split table */
.basics { margin-top: 2.2rem; }
.basics h2 { font-size: 1.15rem; margin-bottom: 0.8rem; }
.basics-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.basic { border-left: 4px solid var(--rule); padding: 0.2rem 0 0.2rem 0.9rem; }
.basic:nth-child(1) { border-left-color: var(--asian); }
.basic:nth-child(2) { border-left-color: var(--hispanic); }
.basic h3 { margin: 0 0 0.25rem; }
.basic p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }
/* the two contributions: Traditional (teal) and Roth (orange), each a percent / dollars pair */
.calc-form .contrib { margin-bottom: 1rem; }
.calc-form .contrib h3 { font-size: 1rem; margin: 0 0 0.3rem; }
.calc-form .contrib-hint { display: block; margin: 0 0 0.8rem; }
.calc-form .acct { border-left: 4px solid var(--rule); padding: 0.1rem 0 0.1rem 0.8rem; margin-bottom: 0.9rem; }
.calc-form .acct-trad { border-left-color: var(--asian); }
.calc-form .acct-roth { border-left-color: var(--hispanic); }
.calc-form .acct-tx { border-left: 4px solid var(--taxable); padding: 0.1rem 0 0.1rem 0.8rem; margin-bottom: 0.9rem; }
.calc-form .acct h4 { margin: 0 0 0.35rem; font-size: 0.95rem; }
.calc-form .pair { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 0.6rem; align-items: end; }
.calc-form .pair .field { margin-bottom: 0.4rem; }
.calc-form .pair label { font-size: 0.82rem; font-weight: 400; color: var(--ink-soft); }
.calc-form .acct-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.3rem 0.6rem; }
.calc-form .month { margin: 0; font-size: 0.85rem; color: var(--muted); }
.calc-form .fill { font: inherit; font-size: 0.8rem; border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
  border-radius: 999px; padding: 0.15rem 0.65rem; cursor: pointer; }
.calc-form .fill:hover { border-color: var(--ink-soft); }
.calc-form .total { margin: 0; font-size: 0.88rem; font-weight: 700; color: var(--ink); }
.calc-form .ages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; align-items: end; }
.calc-form .ages label { font-size: 0.85rem; }
.calc-form .warn { margin: 0 0 1rem; padding: 0.55rem 0.75rem; border-radius: 8px; background: #fbe9dc; color: #7a3410;
  font-size: 0.88rem; border: 1px solid #efc6a8; }
.details.split { margin-top: 0.4rem; }
.details.split th, .details.split td { font-size: 0.92rem; width: 26%; vertical-align: top; }
.details.split th:first-child { width: 48%; }
.details.split thead th { color: var(--muted); font-weight: 700; font-size: 0.8rem; border-top: 0; white-space: normal; }
.details.split thead th:not(:first-child) { text-align: right; }
.details.split tbody th small { display: block; color: var(--muted); font-size: 0.8rem; }
.details.split tr.plan .split-name { font-weight: 700; }
.details.split tr.best th, .details.split tr.best td { background: var(--paper-deep); }
.details.split tr.best td:nth-child(2) { font-weight: 700; }
.details.split tbody th small.why { color: var(--ink-soft); }
.calc-results .now-notes p { margin: 0 0 0.5rem; }
.calc-results .now-notes p:last-child { margin-bottom: 0; }
.calc-results .over-note, .calc-results .backdoor, .calc-results .caveat { border-left: 3px solid #efc6a8; padding-left: 0.7rem; }
.calc-form .check { display: grid; gap: 0.25rem; margin: 0 0 0.9rem; }
.calc-form .check[hidden] { display: none; }
.calc-form .check label { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.9rem; }
.calc-form .check input { margin-top: 0.25rem; accent-color: var(--asian); }

/* ---- hints that sit outside a .field, and the Social Security group (explanation, where the estimate comes from,
   "back to the estimate", the link to the reader's own SSA record) */
.calc-form fieldset .hint { display: block; margin: 0.45rem 0 0; }
.calc-form .ages-hint { margin: -0.5rem 0 0.95rem; }
/* groups that fold: Social Security, other money, more assumptions; the summary line says what is in them */
.calc-form details.group { border-top: 1px solid var(--rule); padding-top: 0.85rem; margin: 0.2rem 0 0.9rem; }
.calc-form details.group > summary { display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 0.6rem; list-style: none;
  cursor: pointer; margin-bottom: 0.2rem; }
.calc-form details.group > summary::-webkit-details-marker { display: none; }
.calc-form details.group > summary::after { content: "+"; grid-column: 2; grid-row: 1; font-weight: 700; color: var(--ink-soft); }
.calc-form details.group[open] > summary::after { content: "–"; }
.calc-form details.group[open] > summary { margin-bottom: 0.8rem; }
.calc-form details.group > summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.calc-form .group-name { font-weight: 700; }
.calc-form .group-sum { grid-column: 1 / -1; font-size: 0.84rem; color: var(--muted); font-weight: 400; }
.calc-form .ss-what, .calc-form .other-what, .calc-form .state-what, .calc-form .now-what { display: block; margin: 0 0 0.9rem; color: var(--ink-soft); }
.calc-form .ss-basis { margin: 0; font-size: 0.82rem; line-height: 1.45; color: var(--ink-soft); }
.calc-form .ss-auto { justify-self: start; font: inherit; font-size: 0.85rem; border: 1px solid var(--asian); background: var(--paper);
  color: var(--asian); border-radius: 999px; padding: 0.2rem 0.8rem; cursor: pointer; }
.calc-form .ss-auto:hover { background: var(--asian); color: var(--paper); }
.calc-form .ss-exact { display: block; margin: -0.3rem 0 0; }
.calc-form .ss-exact a { color: var(--asian); font-weight: 700; }

/* ---- filing jointly: a tab per person; the summary under each name (salary) so the other tab isn't forgotten */
.calc-form .tabs { display: flex; gap: 0.3rem; margin: 0 0 1rem; border-bottom: 1px solid var(--rule); }
.calc-form .tabs[hidden] { display: none; }
.calc-form [role=tab] { font: inherit; display: grid; gap: 0.05rem; text-align: left; padding: 0.45rem 0.95rem 0.55rem;
  margin-bottom: -1px; border: 1px solid transparent; border-bottom: 0; border-radius: 10px 10px 0 0; background: none;
  color: var(--ink-soft); cursor: pointer; }
.calc-form [role=tab]:hover { color: var(--ink); }
.calc-form [role=tab][aria-selected=true] { background: var(--paper); border-color: var(--rule); color: var(--ink); }
.calc-form [role=tab] .tab-name { font-weight: 700; }
.calc-form [role=tab] .tab-sum { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.calc-form [role=tab]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.calc-form .person[hidden] { display: none; }
.calc-form .household { border-top: 1px solid var(--rule); padding-top: 1rem; }

/* ---- "find the best split", and "use this split" in the comparison table */
.calc-form .best { display: grid; gap: 0.35rem; margin: 0.1rem 0 1rem; }
.calc-form .best-btn { justify-self: start; font: inherit; font-size: 0.92rem; font-weight: 700; border: 0; border-radius: 999px;
  padding: 0.5rem 1.05rem; background: var(--asian); color: var(--paper); cursor: pointer; }
.calc-form .best-btn:hover { background: #0b4f57; }
.calc-form .best-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.calc-form .best-note { margin: 0; font-size: 0.88rem; font-weight: 700; color: var(--asian); }
.calc-form .best-note:empty { display: none; }
.details.split .use { display: inline-block; margin-top: 0.3rem; font: inherit; font-size: 0.78rem; border: 1px solid var(--rule);
  background: var(--paper); color: var(--ink); border-radius: 999px; padding: 0.1rem 0.6rem; cursor: pointer; }
.details.split .use:hover { border-color: var(--ink-soft); }

/* "? more": the full explanation of a box, folded under its one-line hint */
.calc-form .tip { margin: 0.05rem 0 0; }
.calc-form .tip > summary { display: inline-flex; align-items: center; gap: 0.3rem; list-style: none; cursor: pointer;
  font-size: 0.8rem; color: var(--ink-soft); }
.calc-form .tip > summary::-webkit-details-marker { display: none; }
.calc-form .tip-q { display: inline-grid; place-items: center; width: 1.05rem; height: 1.05rem; border-radius: 50%;
  border: 1px solid var(--ink-soft); font-size: 0.72rem; font-weight: 700; line-height: 1; }
.calc-form .tip > summary:hover { color: var(--ink); }
.calc-form .tip > summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.calc-form .tip[open] > summary { margin-bottom: 0.25rem; }
.calc-form .tip-text { display: block; }

/* the answer first; the example note until the reader changes something; copy a link to the plan */
.calc-results .answer { font-size: clamp(1.15rem, 1rem + 0.6vw, 1.4rem); line-height: 1.4; font-weight: 700; margin: 0 0 1rem;
  max-width: 42rem; }
.calc-results .answer:empty { display: none; }
.calc-results .example { margin: 0 0 0.8rem; padding: 0.45rem 0.75rem; border-radius: 8px; background: var(--paper-deep);
  border: 1px dashed var(--rule); color: var(--ink-soft); font-size: 0.88rem; max-width: 42rem; }
.calc-results .example[hidden] { display: none; }
.calc-results .share { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; margin: 0.7rem 0 0; }
.calc-results .copy-link { font: inherit; font-size: 0.85rem; border: 1px solid var(--ink-soft); background: var(--paper);
  color: var(--ink); border-radius: 999px; padding: 0.3rem 0.9rem; cursor: pointer; }
.calc-results .copy-link:hover { background: var(--paper-deep); }
.calc-results .copy-link:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.calc-results .copy-done { font-size: 0.85rem; color: var(--asian); font-weight: 700; }
