/* The tax savings calculator. A standalone component for review at /preview/calculator.html; calculator.js
   does the arithmetic and draws the chart. The standard it is held to: hairlines, not boxes; figures at
   regular weight and modest size; nothing capitalised, nothing monospaced; one control style throughout.
   Every class and id is prefixed tc so it can be placed on the home page without meeting its names. */
.tc{
  --tc-ink:#111A20; --tc-soft:#66727E; --tc-faint:#6B7783;   /* both pass 4.5:1 on white at small sizes */
  --tc-hair:rgba(17,26,32,.09); --tc-hair-2:rgba(17,26,32,.06);
  --tc-fwd:#1D3A52; --tc-idx:#9FB0C5; --tc-up:#2F7259;   /* Forward in the site's navy, the fund in its slate */
  --tc-display:"Source Serif 4",Georgia,serif; --tc-sans:"Archivo",system-ui,sans-serif;
  color:var(--tc-ink); font-family:var(--tc-sans); font-variant-numeric:lining-nums tabular-nums;
}
.tc *{box-sizing:border-box}
.tc-frame{display:grid; grid-template-columns:minmax(300px,440px) minmax(0,1fr);
  background:#fff; border:1px solid var(--tc-hair); border-radius:12px; overflow:hidden}

/* inputs */
.tc-in{margin:0; padding:clamp(24px,3vw,40px); display:grid; gap:26px; align-content:start; border-right:1px solid var(--tc-hair)}
.tc .tc-h{margin:0 0 2px; max-width:none; font-family:var(--tc-display); font-variation-settings:"opsz" 32,"wght" 560;
  font-size:25px; line-height:1.15; letter-spacing:-.015em}
.tc-f{display:grid; gap:10px; margin:0; padding:0; border:0; min-width:0}
.tc-f > span,.tc-f > legend{padding:0; font-size:13.5px; line-height:1.3; color:var(--tc-soft)}
.tc-f input{width:100%; height:56px; margin:0; padding:0 18px; border:1px solid var(--tc-hair); border-radius:8px; background:#fff;
  color:var(--tc-ink); font-family:var(--tc-sans); font-size:15px; outline:none; box-shadow:0 1px 2px rgba(17,26,32,.03);
  transition:border-color .15s ease}
.tc-f input:hover{border-color:rgba(17,26,32,.22)}
.tc-f input:focus{border-color:var(--tc-ink)}
.tc-seg{display:grid; grid-auto-flow:column; grid-auto-columns:minmax(0,1fr); gap:8px}
.tc-seg button{height:56px; margin:0; padding:0 4px; border:1px solid var(--tc-hair); border-radius:8px; background:#fff; color:var(--tc-ink);
  font-family:var(--tc-sans); font-size:14px; cursor:pointer; box-shadow:0 1px 2px rgba(17,26,32,.03); transition:border-color .15s ease}
.tc-seg button:hover{border-color:rgba(17,26,32,.22)}
.tc-seg button[aria-pressed="true"]{border-color:var(--tc-ink)}
.tc button:focus-visible{outline:2px solid var(--tc-fwd); outline-offset:2px}

/* results */
.tc-out{display:grid; grid-template-rows:auto minmax(280px,1fr) auto; min-width:0}
.tc-top{display:flex; justify-content:space-between; align-items:flex-start; gap:16px; padding:clamp(22px,2.6vw,32px) 0 0 clamp(22px,2.6vw,32px)}
.tc-figs{display:flex; flex-wrap:wrap; gap:16px clamp(28px,4vw,56px)}
.tc-k{display:flex; align-items:center; gap:8px; font-size:13px; color:var(--tc-ink)}
.tc-k i{width:6px; height:6px; border-radius:50%; background:var(--tc-fwd)}
.tc-k i.tc-b{background:var(--tc-idx)}
.tc-n{display:block; margin-top:8px; font-size:clamp(24px,2.5vw,30px); line-height:1.1; letter-spacing:-.022em; font-variation-settings:"wght" 420}
.tc-g{display:block; margin-top:5px; font-size:11.5px; color:var(--tc-up)}
/* the chart type: two small square buttons tucked into the corner, joined by hairlines to the frame */
.tc-view{display:flex; flex:none; margin-top:calc(-1 * clamp(22px,2.6vw,32px)); border-left:1px solid var(--tc-hair); border-bottom:1px solid var(--tc-hair)}
.tc-view button{display:grid; place-items:center; width:44px; height:44px; margin:0; padding:0; border:0; background:#fff; color:#98A2AD; cursor:pointer;
  transition:color .15s ease, background-color .15s ease}
.tc-view button + button{border-left:1px solid var(--tc-hair)}
.tc-view button:hover{color:var(--tc-ink)}
.tc-view button[aria-pressed="true"]{color:var(--tc-ink); background:#F5F7FA}
.tc-view svg{width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:1.3; stroke-linecap:round; stroke-linejoin:round}

.tc-chart{position:relative; margin-top:clamp(14px,2vh,22px); min-height:240px; touch-action:pan-y}
#tcSvg{position:absolute; top:0; left:0; width:100%; height:100%; display:block}
#tcSvg text{font-family:var(--tc-sans); font-size:11px; fill:var(--tc-faint)}
#tcSvg .tc-grid{stroke:var(--tc-hair-2); stroke-width:1; shape-rendering:crispEdges}
#tcSvg .tc-cross{stroke:rgba(17,26,32,.28); stroke-width:1; shape-rendering:crispEdges}
#tcSvg rect{transition:opacity .15s ease}
#tcSvg .tc-dim{opacity:.38}
#tcSvg path{fill:none; stroke-width:1.6; stroke-linejoin:round; stroke-linecap:round}
.tc-tip{position:absolute; z-index:2; min-width:190px; padding:10px 12px; border:1px solid var(--tc-hair); border-radius:8px; background:#fff;
  box-shadow:0 8px 28px rgba(17,26,32,.09); pointer-events:none; font-size:12.5px; line-height:1.3}
.tc-tip[hidden]{display:none}
.tc-tip b{display:block; margin-bottom:6px; font-weight:400; font-size:11.5px; color:var(--tc-soft)}
.tc-tip div{display:flex; align-items:center; gap:8px; padding:2px 0}
.tc-tip i{width:6px; height:6px; border-radius:50%; background:var(--tc-fwd)}
.tc-tip i.tc-b{background:var(--tc-idx)}
.tc-tip span{margin-left:auto; padding-left:20px}

.tc-sr{position:absolute; width:1px; height:1px; margin:-1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap}

/* what the gap between the two is made of */
.tc-stats{display:flex; flex-wrap:wrap; gap:10px clamp(28px,4vw,56px); margin:0}
.tc-foot{display:flex; justify-content:space-between; align-items:center; gap:14px 24px; padding:14px clamp(22px,2.6vw,32px);
  border-top:1px solid var(--tc-hair)}
.tc-foot div{display:flex; align-items:baseline; gap:10px}
.tc-foot dt{font-size:13px; color:var(--tc-soft)}
.tc-foot dd{margin:0; font-size:14.5px}
/* the one filled control in the frame: where the number leads */
.tc .tc-cta{flex:none; display:inline-flex; align-items:center; justify-content:center; height:44px; padding:0 22px; border-radius:8px;
  background:var(--tc-ink); color:#fff; font-size:14.5px; font-variation-settings:"wght" 560; text-decoration:none; transition:background-color .15s ease}
.tc .tc-cta:hover{background:var(--tc-fwd)}
.tc .tc-cta:focus-visible{outline:2px solid var(--tc-fwd); outline-offset:2px}

/* closed by default; the text stays in the document for readers and crawlers */
.tc-fine{margin:14px 0 0; color:var(--tc-soft)}
.tc-fine summary{display:inline-flex; align-items:center; gap:8px; cursor:pointer; list-style:none; padding:6px 0; font-size:13px}
.tc-fine summary::-webkit-details-marker{display:none}
.tc-fine summary::after{content:""; width:5px; height:5px; border-right:1.2px solid currentColor; border-bottom:1.2px solid currentColor;
  transform:rotate(-45deg); transition:transform .2s ease}
.tc-fine[open] summary::after{transform:rotate(45deg) translate(-1px,-1px)}
.tc-fine summary:hover{color:var(--tc-ink)}
.tc-fine summary:focus-visible{outline:2px solid var(--tc-fwd); outline-offset:4px; border-radius:3px}
.tc-fine p{margin:8px 0 0; max-width:96ch; font-size:12px; line-height:1.55}

@media (max-width:820px){
  .tc-frame{grid-template-columns:1fr}
  .tc-in{border-right:0; border-bottom:1px solid var(--tc-hair); gap:20px}
  .tc-f input,.tc-seg button{height:50px}
  .tc-foot{flex-direction:column; align-items:stretch; padding-bottom:18px}
  .tc .tc-cta{height:50px}
}
@media (prefers-reduced-motion:reduce){ #tcSvg rect{transition:none} }
