/* =====================================================================
   Free Tools: the /calculators hub (page-tools.php) and every calculator
   page (page-calc.php, template-parts/calcs/*). The Copy's tool view in
   the x3 look: a paper inputs panel joined to a deep navy results panel,
   gold numbers, mono labels. Prefix: .tl-
   ===================================================================== */

.tl{--tl-wa:#15803D; --tl-wa2:#116A33}

/* ---------- hero ---------- */
.tl-hero .v3-lead{max-width:60ch}
.tl-hero.is-tool{padding-bottom:clamp(48px,5.5vw,80px)}
.tl-hero.is-tool .v3-h1{margin-top:14px}
.tl-back{display:flex; width:max-content; align-items:center; gap:10px; min-height:44px; margin:0 0 14px -2px; font-family:var(--mono); font-size:12px; letter-spacing:.14em; text-transform:uppercase; color:var(--muted-d); transition:color .2s ease}
.tl-back:hover{color:var(--g2)}
.tl-back .v3-i{width:18px; height:18px; transform:scaleX(-1); transition:transform .3s var(--ease)}
.tl-back:hover .v3-i{transform:scaleX(-1) translateX(4px)}

/* ---------- hub: decision tools, then calculators (client change 10) ---------- */
.tl-hubsec{padding-top:var(--sp-5)}
.tl-tsec+.tl-tsec{margin-top:clamp(44px,5vw,64px)}
.tl-tsh{display:flex; align-items:baseline; flex-wrap:wrap; gap:6px 18px; margin-bottom:20px; padding-bottom:16px; border-bottom:1px solid var(--line-l)}
.tl-tsh-h{font-size:clamp(26px,2.8vw,36px); line-height:1.1; letter-spacing:-.03em}
.tl-tsh p{font-size:16px; line-height:1.5; color:var(--muted-l)}
.tl-tgrid{list-style:none; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px}
@media (max-width:980px){ .tl-tgrid{grid-template-columns:repeat(2,minmax(0,1fr))} }
@media (max-width:600px){ .tl-tgrid{grid-template-columns:1fr; gap:10px} }
/* two columns: an odd last tool (15 calculators) takes the full row instead of sitting alone */
@media (min-width:601px) and (max-width:980px){ .tl-tgrid>li:last-child:nth-child(odd){grid-column:1 / -1} }
.tl-tgrid>li{display:flex; min-width:0}
.tl-ti{position:relative; display:grid; grid-template-columns:44px minmax(0,1fr) 20px; gap:14px; align-items:center; width:100%; min-height:76px; padding:14px 16px; border-radius:18px; background:var(--paper); border:1px solid var(--line-l); color:var(--ink); transition:transform .45s var(--ease),box-shadow .45s var(--ease),border-color .3s ease}
.tl-ti:hover{transform:translateY(-2px); border-color:rgba(19,26,37,.26); box-shadow:0 24px 48px -34px rgba(8,17,31,.45)}
.tl-ti-ic{display:grid; place-items:center; width:44px; height:44px; border-radius:13px; background:var(--n1); color:var(--g)}
.tl-ti-ic .v3-i{width:21px; height:21px}
.tl-ti-ic .tl-dti{stroke-width:2}
.tl-ti-t{min-width:0}
.tl-ti-t b{display:block; font-size:16.5px; font-weight:700; line-height:1.3; letter-spacing:-.01em}
.tl-ti-t small{display:block; margin-top:3px; font-size:14px; line-height:1.4; color:var(--muted-l)}
.tl-ti-go{color:var(--g-ink)}
.tl-ti-go .v3-i{width:18px; height:18px; transition:transform .35s var(--ease)}
.tl-ti:hover .tl-ti-go .v3-i{transform:translateX(3px)}
.tl-ti.is-dt{min-height:88px; overflow:hidden; background:var(--n1); border-color:var(--n1); color:var(--c0)}
.tl-ti.is-dt::before{content:''; position:absolute; inset:0; background:radial-gradient(80% 90% at 100% 0%,rgba(227,169,60,.16),transparent 70%); pointer-events:none}
.tl-ti.is-dt>*{position:relative}
.tl-ti.is-dt .tl-ti-ic{background:var(--g); color:var(--n0)}
.tl-ti.is-dt small{color:var(--muted-d)}
.tl-ti.is-dt .tl-ti-go{color:var(--g2)}
.tl-ti.is-dt:hover{border-color:var(--g3); box-shadow:0 26px 50px -30px rgba(8,17,31,.7)}
.tl-disc{margin-top:28px; max-width:80ch}

/* ---------- calculator: one card, inputs (paper) + results (navy) ---------- */
.tl-toolsec{padding-top:var(--sp-5)}
.tl-tool{display:grid; grid-template-columns:minmax(0,.92fr) minmax(0,1.08fr); background:var(--paper); border:1px solid var(--line-l); border-radius:28px; overflow:clip; box-shadow:0 60px 120px -84px rgba(8,17,31,.55)}
@media (max-width:920px){ .tl-tool{grid-template-columns:1fr; border-radius:24px} }

/* inputs */
.tl-in{display:grid; gap:22px; align-content:start; align-self:start; padding:clamp(22px,3.2vw,44px)}
/* tablet, one card wide: the fields sit two by two so the result is not a long scroll away */
@media (min-width:641px) and (max-width:920px){ .tl-in{grid-template-columns:repeat(2,minmax(0,1fr)); column-gap:36px} .tl-in>.tl-fld:last-child:nth-child(odd){grid-column:1 / -1} }
.tl-in.is-sticky{position:sticky; top:calc(var(--header-h) + 20px)}
@media (max-width:920px){ .tl-in.is-sticky{position:static} }
.tl-fld{border:0; margin:0; padding:0; min-width:0}
/* an alias page's point (e.g. the step-up on /calculators/step-up-sip-calculator) */
.tl-fld.is-focus{margin:-12px -14px; padding:12px 14px 10px; border-radius:16px; background:rgba(227,169,60,.13); box-shadow:inset 3px 0 0 var(--g)}
.tl-lrow{display:flex; justify-content:space-between; align-items:center; gap:14px}
.tl-fld label,.tl-fld legend{font-size:15px; font-weight:600; line-height:1.35; color:var(--ink); padding:0}
/* a long label wraps before the number box shrinks */
.tl-lrow label{flex:1 1 0}
/* the narrowest phones: the label sits above a full-width box, so a long label is not squeezed into five lines */
@media (max-width:359px){ .tl-lrow{flex-direction:column; align-items:stretch; gap:8px} .tl-lrow label{flex:none} .tl-box input{flex:1 1 auto} }
.tl-box{display:inline-flex; align-items:center; gap:4px; min-width:0; padding:0 12px; border:1px solid rgba(19,26,37,.5); border-radius:12px; background:var(--c0); flex:0 1 auto; transition:border-color .2s ease,box-shadow .2s ease}
.tl-box:focus-within{border-color:var(--g-ink); box-shadow:0 0 0 3px rgba(227,169,60,.25)}
.tl-box i{font-style:normal; font-family:var(--mono); font-size:14px; color:var(--muted-l)}
.tl-box input{width:9ch; min-width:0; min-height:44px; padding:0; border:0; background:transparent; font-family:var(--font); font-size:17px; font-weight:700; color:var(--ink); text-align:right; outline:none; font-variant-numeric:tabular-nums}
.tl-range{-webkit-appearance:none; appearance:none; display:block; width:100%; height:44px; margin:0 0 -8px; padding:0; cursor:pointer; background:linear-gradient(90deg,var(--g) var(--p,50%),rgba(19,26,37,.12) var(--p,50%)) center/100% 4px no-repeat; border-radius:4px}
.tl-range::-webkit-slider-runnable-track{height:44px; background:transparent}
.tl-range::-webkit-slider-thumb{-webkit-appearance:none; width:22px; height:22px; margin-top:11px; border-radius:50%; background:#fff; border:0; box-shadow:0 0 0 3px var(--g),0 3px 8px rgba(8,17,31,.25); transition:transform .2s var(--ease)}
.tl-range:hover::-webkit-slider-thumb{transform:scale(1.1)}
.tl-range:active::-webkit-slider-thumb{transform:scale(1.18)}
.tl-range::-moz-range-track{background:transparent}
.tl-range::-moz-range-thumb{width:16px; height:16px; border-radius:50%; background:#fff; border:3px solid var(--g); box-shadow:0 3px 8px rgba(8,17,31,.25)}
.tl-range:focus-visible{outline:2px solid var(--g-ink); outline-offset:2px}
.tl-hint{min-height:18px; font-family:var(--mono); font-size:13px; color:var(--muted-l)}
.tl-seg{display:flex; flex-wrap:wrap; gap:8px; margin-top:12px}
.tl-seg button{min-height:44px; padding:10px 16px; border-radius:999px; border:1px solid var(--line-l); background:var(--paper); color:var(--ink); font-size:14.5px; font-weight:600; line-height:1.3; text-align:left; transition:background .25s ease,color .25s ease,border-color .25s ease}
.tl-seg button:hover{border-color:rgba(19,26,37,.32)}
.tl-seg button[aria-pressed="true"]{background:var(--n1); border-color:var(--n1); color:var(--c0)}

/* results */
.tl-out{--s-g:#E3A93C; --s-n:#A9B8CF; --s-o:#F07A5A; --s-r:#E5534B; --s-y:#F3CD80; --s-m:#7F8CA3;
  position:relative; display:flex; flex-direction:column; gap:22px; min-width:0; padding:clamp(22px,3.2vw,44px); background:radial-gradient(120% 60% at 100% 0%,#13294A 0%,var(--n1) 55%,var(--n0) 100%); color:var(--c0)}
.tl-res{display:flex; flex-direction:column; gap:22px}
.tl-big{padding-bottom:20px; border-bottom:1px solid var(--line-d)}
.tl-big-l{display:block; font-family:var(--mono); font-size:12px; letter-spacing:.14em; text-transform:uppercase; color:var(--g)}
.tl-big-v{display:block; margin-top:10px; font-size:clamp(38px,4.8vw,60px); font-weight:700; line-height:1.05; letter-spacing:-.035em; color:var(--g2); font-variant-numeric:tabular-nums; overflow-wrap:anywhere}
.tl-rows{margin:0; display:grid}
.tl-rows>div{display:flex; justify-content:space-between; align-items:baseline; gap:16px; padding:12px 0; border-bottom:1px dashed var(--line-d)}
.tl-rows>div:last-child{border-bottom:0}
.tl-rows dt{font-size:15px; line-height:1.4; color:var(--muted-d)}
.tl-rows dd{min-width:0; overflow-wrap:anywhere; margin:0; font-size:16px; font-weight:700; text-align:right; color:var(--c0); font-variant-numeric:tabular-nums}
.tl-ratios{list-style:none; display:grid; gap:10px}
.tl-rt{display:grid; grid-template-columns:auto minmax(0,1fr) auto; grid-template-areas:"st b v" "st s s"; gap:2px 14px; align-items:center; padding:14px 16px; border-radius:16px; border:1px solid var(--line-d); background:rgba(251,246,235,.03)}
.tl-st{grid-area:st; min-width:76px; text-align:center; padding:6px 11px; border-radius:999px; font-size:12px; font-weight:700; letter-spacing:.02em; background:rgba(31,143,90,.24); color:#86EFAC}
.tl-rt.is-mid .tl-st{background:rgba(194,65,12,.28); color:#FDBA74}
.tl-rt.is-bad .tl-st{background:rgba(192,53,43,.32); color:#FCA5A5}
.tl-rt b{grid-area:b; font-size:15.5px; font-weight:600}
.tl-rt strong{grid-area:v; font-size:18px; font-weight:700; color:var(--g2)}
.tl-rt small{grid-area:s; font-size:13px; color:var(--muted-d)}
/* phones: status and value on top, so a long name ("Emergency months") gets the full width */
@media (max-width:480px){ .tl-rt{grid-template-columns:auto minmax(0,1fr); grid-template-areas:"st v" "b b" "s s"; gap:4px 12px} .tl-st{justify-self:start} .tl-rt strong{justify-self:end; text-align:right} .tl-rt b{margin-top:6px} }
.tl-note{font-size:14.5px; line-height:1.55; color:rgba(251,246,235,.84); background:rgba(251,246,235,.06); border-left:2px solid var(--g); border-radius:4px 12px 12px 4px; padding:12px 16px}
.tl-tool.is-gerr .tl-rows,.tl-tool.is-gerr .tl-chart,.tl-tool.is-gerr .tl-note,.tl-tool.is-gerr .tl-ratios{display:none}

/* chart (SVG drawn at its real pixel width by tools.js) */
.tl-chart{min-width:0}
.tl-leg{display:flex; flex-wrap:wrap; align-items:center; gap:6px 18px; margin-bottom:8px; font-size:13.5px; font-weight:600; color:rgba(251,246,235,.82)}
.tl-leg span{display:inline-flex; align-items:center; gap:8px}
.tl-leg i{width:16px; height:4px; border-radius:2px; background:var(--s-g)}
.tl-leg .tl-leg-x{margin-left:auto; font-family:var(--mono); font-size:12px; font-weight:400; color:var(--muted-d)}
.tl-svg{display:block; width:100%; overflow:visible}
.tl-gl{stroke:var(--line-d); stroke-width:1}
.tl-ax{font-family:var(--mono); font-size:11px; fill:rgba(251,246,235,.66)}
.tl-cv{font-family:var(--font); font-size:12px; font-weight:700; fill:var(--c0)}
.tl-cl{font-family:var(--font); font-size:13px; font-weight:600; fill:rgba(251,246,235,.84)}
.tl-line{fill:none; stroke-width:3; stroke-linejoin:round; stroke-linecap:round}
.tl-area{stroke:none; opacity:.2}
.tl-area[data-s="1"]{opacity:.1}
.tl-mark{stroke:var(--g2); stroke-width:1.5; stroke-dasharray:4 5}
.tl-bar.is-neg{opacity:.45}
.tl-xl{display:grid; grid-template-columns:repeat(var(--n,3),minmax(0,1fr)); margin-top:6px; padding:0 14px 0 58px; font-size:12.5px; line-height:1.3; text-align:center; color:var(--muted-d)}
/* one column per bar; a word longer than its column spills evenly into the gaps beside it */
.tl-xl>span{display:flex; justify-content:center; min-width:0; padding:0 2px}
.tl-xl>span>span{text-align:center}
@media (max-width:480px){ .tl-xl{font-size:12px} }
.is-g{--c:var(--s-g)} .is-n{--c:var(--s-n)} .is-o{--c:var(--s-o)} .is-r{--c:var(--s-r)} .is-y{--c:var(--s-y)} .is-m{--c:var(--s-m)}
.tl-leg i[class]{background:var(--c)}
.tl-line[class*="is-"]{stroke:var(--c)}
.tl-area[class*="is-"],.tl-dot[class*="is-"],.tl-bar[class*="is-"]{fill:var(--c)}
.tl-dot{stroke:var(--n1); stroke-width:2}

/* hand-off */
.tl-cta{padding-top:22px; border-top:1px solid var(--line-d)}
.tl-cta p{font-size:15px; line-height:1.55; color:var(--muted-d)}
.tl-cta p b{color:var(--c0); font-weight:600}
.tl-cta-btns{display:flex; flex-wrap:wrap; gap:10px; margin-top:16px}
.tl-cta .v3-btn{min-height:48px; padding:12px 20px; font-size:15px}
.tl-cta .v3-btn-wa{background:var(--tl-wa)}
.tl-cta .v3-btn-wa::after{background:var(--tl-wa2)}
.tl-cta-note{display:block; margin-top:12px; font-size:13px; line-height:1.5; color:var(--muted-d)}
.tl-risk{margin-top:auto; padding-top:16px; border-top:1px solid var(--line-d); font-size:13px; line-height:1.55; color:var(--muted-d)}
@media (max-width:480px){ .tl-cta .v3-btn{flex:1 1 100%} }

/* phones: sticky result bar */
.tl-mbar{display:none}
@media (max-width:920px){
  .tl-mbar{position:fixed; z-index:95; left:0; right:0; bottom:0; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px max(16px,env(safe-area-inset-right,0px)) calc(10px + env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px)); background:rgba(8,17,31,.97); color:var(--c0); border-top:1px solid var(--line-d); box-shadow:0 -14px 36px -12px rgba(0,0,0,.45); transform:translateY(110%); visibility:hidden; transition:transform .4s var(--ease),visibility .4s}
  .tl-mbar.is-on{transform:none; visibility:visible}
  .tl-mres{display:block; min-width:0; min-height:44px; color:inherit}
  .tl-mres .tl-ml{display:block; font-size:13px; font-weight:600; color:var(--muted-d); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
  .tl-mres b{display:block; font-size:20px; line-height:1.2; color:var(--g2); letter-spacing:-.02em; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
  .tl-mwa{flex:none; display:inline-flex; align-items:center; min-height:44px; padding:0 16px; border-radius:999px; background:var(--tl-wa); color:#fff; font-size:14px; font-weight:700; white-space:nowrap}
  body.tl-mbar-on .v3-ask{visibility:hidden; pointer-events:none}
}
@media (prefers-reduced-motion:reduce){ .tl-mbar{transition:none} }

.tl-toolsec .tl-disc{margin-top:20px}

/* ---------- the page's own article ---------- */
.tl-artsec{border-top:1px solid var(--line-l)}
.tl-article{max-width:72ch; font-size:17px; line-height:1.7; color:var(--ink2)}
.tl-article>*+*{margin-top:1em}
.tl-article h2{margin-top:1.8em; font-size:clamp(26px,2.6vw,34px); line-height:1.15; color:var(--ink)}
.tl-article h3{margin-top:1.5em; font-size:clamp(20px,1.9vw,24px); line-height:1.25; color:var(--ink)}
.tl-article h2:first-child,.tl-article h3:first-child{margin-top:0}
.tl-article strong,.tl-article b{color:var(--ink)}
.tl-article img{max-width:100%; height:auto; border-radius:12px}
.tl-article iframe{display:block; width:100%; max-width:100%; height:auto; aspect-ratio:16/9; border:0; border-radius:14px}
.tl-article .v3-table{margin:1.4em 0}
.tl-article .v3-table table,.tl-article .v3-table th,.tl-article .v3-table td{border:0; width:auto}
.tl-article .v3-table table{width:100%}
.tl-article .v3-table th,.tl-article .v3-table td{border-bottom:1px solid var(--line-l)}
.tl-article .v3-table th+th,.tl-article .v3-table td+td{border-left:1px solid var(--line-l)}
.tl-article .v3-table tr:last-child td{border-bottom:0}
.tl-article .v3-table td>:first-child{margin-top:0}
.tl-article .v3-table td>:last-child{margin-bottom:0}
.tl-article .v3-table td ul{padding-left:1.1em}
.tl-article li+li{margin-top:.35em}

/* ---------- try next ---------- */
.tl-more-h{margin:0 0 20px}
.tl-mgrid{list-style:none; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px}
@media (max-width:900px){ .tl-mgrid{grid-template-columns:1fr} }
.tl-mgrid>li{display:flex; min-width:0}
.tl-mini{display:flex; align-items:flex-start; gap:14px; width:100%; padding:20px; border-radius:18px; background:var(--paper); border:1px solid var(--line-l); color:var(--ink); transition:border-color .25s ease,transform .45s var(--ease)}
.tl-mini:hover{border-color:rgba(19,26,37,.28); transform:translateY(-2px)}
.tl-mini>.v3-i{margin-top:2px; color:var(--g-ink)}
.tl-mini>.tl-dti{stroke-width:2}
.tl-mini b{display:block; font-size:16.5px; font-weight:700; line-height:1.3}
.tl-mini small{display:block; margin-top:4px; font-size:14px; line-height:1.45; color:var(--muted-l)}
.tl-also{margin:20px 0 0}
