/* Free calculators: the buttons on the main page, and the full calculators on calculators.html.
   Uses the tokens in style.css (light and dark). */
.calc-launch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 2rem; }
.calc-launch a { display: flex; align-items: center; gap: .9rem; padding: 1.15rem 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); text-decoration: none; transition: transform .12s ease, border-color .12s ease; min-width: 0; }
.calc-launch a:hover, .calc-launch a:focus-visible { transform: translateY(-2px); border-color: var(--accent); }
.calc-launch .ico { flex: none; display: grid; place-items: center; width: 2.8rem; height: 2.8rem; border-radius: 12px; background: rgba(31, 111, 235, .1); color: var(--accent); }
.calc-launch .ico svg { width: 1.45rem; height: 1.45rem; }
.calc-launch span:not(.ico):not(.go) { min-width: 0; }
.calc-launch b { display: block; font-size: 1.02rem; }
.calc-launch small { display: block; color: var(--muted); font-size: .86rem; line-height: 1.35; }
.calc-launch .go { margin-left: auto; color: var(--accent); font-weight: 700; flex: none; }

.calc-hero { background: radial-gradient(1000px 420px at 85% -20%, rgba(31, 111, 235, .35), transparent 60%), linear-gradient(180deg, var(--navy) 0%, #13233b 100%); color: #fff; padding: 3rem 0 0; }
.calc-hero .eyebrow { color: #8fb8ff; }
.calc-hero h1 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); }
.calc-hero .lead { color: #c6d2e2; max-width: 720px; }
.calc-tabs { display: flex; gap: .35rem; overflow-x: auto; margin-top: 1.6rem; scrollbar-width: none; }
.calc-tabs::-webkit-scrollbar { display: none; }
.calc-tab { font: inherit; font-weight: 600; flex: none; padding: .75rem 1.15rem; border: 0; border-radius: 12px 12px 0 0; background: rgba(255, 255, 255, .08); color: #cfd8e5; cursor: pointer; }
.calc-tab:hover { color: #fff; background: rgba(255, 255, 255, .14); }
.calc-tab[aria-selected="true"] { background: var(--bg-alt); color: var(--text); }
.calc-section { background: var(--bg-alt); padding-top: 2rem; }

.calc-grid { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 1.25rem; align-items: start; }
.calc-grid > * { min-width: 0; }
.calc-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.35rem; min-width: 0; }
.calc-card h2 { font-size: 1.1rem; margin: 0; }
.calc-card h3 { font-size: .95rem; margin: 0 0 .6rem; }
.calc-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.link-btn { font: inherit; font-size: .9rem; background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; }
.calc-field { margin-bottom: .95rem; }
.calc-field label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .3rem; }
.calc-field .opt { font-weight: 400; color: var(--muted); }
.calc-field input, .calc-field select { font: inherit; width: 100%; color: var(--text); background: var(--bg); border: 1.5px solid var(--border); border-radius: 10px; padding: .6rem .75rem; }
.calc-field input:focus, .calc-field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(31, 111, 235, .15); }
.calc-input { display: flex; align-items: stretch; }
.calc-input .affix { display: grid; place-items: center; padding: 0 .7rem; background: var(--bg-alt); border: 1.5px solid var(--border); color: var(--muted); font-weight: 600; }
.calc-input .affix:first-child { border-right: 0; border-radius: 10px 0 0 10px; }
.calc-input .affix:last-child { border-left: 0; border-radius: 0 10px 10px 0; }
.calc-input input { border-radius: 0; min-width: 0; }
.calc-input input:first-child { border-radius: 10px 0 0 10px; }
.calc-input .affix + input:last-child { border-radius: 0 10px 10px 0; }
.calc-words, .calc-help { display: block; color: var(--muted); font-size: .8rem; margin-top: .25rem; }
.calc-words:empty { display: none; }
.calc-privacy { color: var(--muted); font-size: .8rem; margin: .4rem 0 0; }

.calc-results { display: grid; gap: 1.25rem; }
.calc-results[hidden] { display: none; }
.calc-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; }
.calc-stats .stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .8rem 1rem; min-width: 0; }
.calc-stats .stat small { display: block; color: var(--muted); font-size: .8rem; }
.calc-stats .stat b { font-size: 1.12rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.calc-stats .stat.main { grid-column: 1 / -1; background: linear-gradient(120deg, var(--navy), var(--navy-2)); border-color: transparent; color: #fff; }
.calc-stats .stat.main small { color: #c6d2e2; }
.calc-stats .stat.main b { font-size: 1.9rem; letter-spacing: -.01em; }
.calc-charts { display: grid; grid-template-columns: minmax(220px, 280px) 1fr; gap: 1.25rem; }
.calc-donut svg { display: block; width: 160px; height: 160px; margin: 0 auto .6rem; }
.donut-track { stroke: var(--bg-alt); }
.seg-0 { stroke: #1f6feb; background: #1f6feb; }
.seg-1 { stroke: #e8833a; background: #e8833a; }
.seg-2 { stroke: #8a63d2; background: #8a63d2; }
.calc-legend { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.calc-legend li { display: flex; align-items: center; gap: .45rem; padding: .2rem 0; flex-wrap: wrap; }
.calc-legend i { width: .75rem; height: .75rem; border-radius: 3px; flex: none; }
.calc-legend span { color: var(--muted); }
.calc-bars svg { display: block; width: 100%; height: 210px; }
.calc-bars .bar { fill: #1f6feb; opacity: .85; }
.calc-bars .bar:hover { opacity: 1; }
.calc-bars .bar-label { fill: var(--muted); font-size: 11px; }

.calc-table-card { margin-top: 1.25rem; padding: 0; overflow: hidden; }
.calc-table-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.calc-views { display: flex; gap: .35rem; flex-wrap: wrap; }
.calc-view { font: inherit; font-weight: 600; font-size: .9rem; padding: .45rem .95rem; border-radius: 999px; border: 2px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.calc-view[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.calc-export { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.calc-export span { color: var(--muted); font-size: .85rem; font-weight: 600; margin-right: .15rem; }
.calc-export .btn { cursor: pointer; background: var(--surface); font-family: inherit; }
.calc-export .btn:disabled { opacity: .55; cursor: progress; }
.calc-table-wrap { overflow: auto; max-height: 34rem; }
.calc-table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.calc-table th, .calc-table td { padding: .5rem .85rem; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.calc-table thead th { position: sticky; top: 0; background: var(--bg-alt); font-size: .8rem; color: var(--muted); z-index: 1; }
.calc-table .num { text-align: right; }
.calc-table tbody tr:hover td { background: rgba(31, 111, 235, .05); }
.calc-disclaimer { color: var(--muted); font-size: .84rem; margin: 1rem 0 0; }

@media (max-width: 960px) {
    .calc-launch { grid-template-columns: 1fr 1fr; }
    .calc-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .calc-launch { grid-template-columns: 1fr; }
    .calc-charts { grid-template-columns: 1fr; }
    .calc-stats { grid-template-columns: 1fr 1fr; }
    .calc-stats .stat.main b { font-size: 1.6rem; }
    .calc-table-head { padding: .85rem 1rem; }
}
@media (prefers-reduced-motion: reduce) {
    .calc-launch a { transition: none; }
}
@media print {
    .site-header, .calc-tabs, .calc-inputs, .calc-export, .cta-band, .site-footer, .calc-views { display: none !important; }
    .calc-hero { background: none; color: #000; padding: 0; }
    .calc-hero .lead { color: #333; }
    .calc-grid { grid-template-columns: 1fr; }
    .calc-card, .calc-stats .stat { box-shadow: none; }
    .calc-stats .stat.main { background: none; color: #000; border: 1px solid #ccc; }
    .calc-stats .stat.main small { color: #333; }
    .calc-table-wrap { max-height: none; overflow: visible; }
}
