/* CalcEvidence — plain CSS, no framework */
:root {
  --bg: #f7f9fc;
  --card: #ffffff;
  --ink: #16233a;
  --muted: #5c6b82;
  --line: #e3e9f2;
  --blue: #1f5fd6;
  --blue-soft: #eaf1ff;
  --green: #0d8f6d;
  --green-soft: #e8f7f1;
  --amber: #b06a00;
  --amber-soft: #fff5e3;
  --shadow: 0 1px 2px rgba(20,36,64,.05), 0 8px 24px rgba(20,36,64,.05);
  --radius: 14px;
  --page-gutter: clamp(14px, 3vw, 24px);
  --panel-padding: clamp(12px, 2.4vw, 18px);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding-inline: var(--page-gutter); }

/* nav */
.nav { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.nav-in { width: 100%; max-width: 1120px; min-height: 60px; margin: 0 auto; padding: 6px var(--page-gutter); display: flex; align-items: center; gap: clamp(12px, 2.4vw, 28px); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 750; font-size: 18px; letter-spacing: -.3px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand span { color: var(--blue); }
.brand-logo { width: 28px; height: 28px; display: block; flex: none; }
.nav-links { display: flex; flex-wrap: wrap; column-gap: clamp(12px, 2vw, 22px); font-size: 14px; color: var(--muted); }
.nav-links a { display: inline-flex; align-items: center; min-height: 40px; color: var(--muted); }
.nav-links a:hover { color: var(--blue); text-decoration: none; }
.nav-tag { margin-left: auto; font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }
.country-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 0 10px; }
.country-opt { color: var(--muted); }
a.country-opt:hover { color: var(--blue); text-decoration: none; }
.country-opt.active { color: var(--ink); font-weight: 700; }
.country-sep { color: var(--line); }
.country-switch .country-opt { display: inline-flex; align-items: center; min-height: 36px; }

.calculation-error { margin: 0 16px 16px; color: #9f2020; font-size: 14px; }
[data-calculation-output][hidden] { display: none; }

/* hero */
.hero { padding: clamp(26px, 5vw, 56px) 0 clamp(18px, 3vw, 30px); }
.hero h1 { font-size: clamp(27px, 4vw, 38px); line-height: 1.22; letter-spacing: -.8px; margin: 0 0 14px; max-width: 760px; }
.hero p.lead { font-size: clamp(15px, 2vw, 17px); color: var(--muted); max-width: 700px; margin: 0 0 24px; }
.hero .cta { display: inline-flex; gap: 10px; flex-wrap: wrap; }
.btn { display: inline-block; border-radius: 9px; padding: 10px 18px; font-weight: 650; font-size: 14px; cursor: pointer; border: 1px solid transparent; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #174fb0; text-decoration: none; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--blue); text-decoration: none; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* US home */
.us-home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: start;
  padding-bottom: 24px;
}
.us-home-hero h1 { font-size: clamp(30px, 4.2vw, 52px); line-height: 1.08; letter-spacing: -.045em; max-width: 16ch; }
.us-home-hero p.lead { margin-bottom: 20px; max-width: 46ch; }
.us-home-hero #tools { display: grid; gap: 8px; margin: 0; }
.home-tool {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
}
.home-tool:hover, .home-tool:focus-visible { border-color: var(--blue); text-decoration: none; }
.home-tool strong, .home-tool small { display: block; }
.home-tool small { color: var(--muted); line-height: 1.4; }
.home-tool-arrow { color: var(--blue); font-size: 19px; }
.home-tool-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; background: var(--blue-soft); color: var(--blue); }
.home-tool-icon span { position: relative; display: block; }
.home-tool-icon--mortgage span { width: 13px; height: 10px; border: 1.5px solid; border-top: 0; margin-top: 6px; }
.home-tool-icon--mortgage span::before { content: ""; position: absolute; width: 10px; height: 10px; border: solid; border-width: 1.5px 0 0 1.5px; transform: rotate(45deg); top: -5px; left: 0; }
.home-tool-icon--pay span { width: 16px; height: 12px; border: 1.5px solid; border-radius: 2px; }
.home-tool-icon--pay span::before { content: ""; display: block; width: 100%; border-top: 1.5px solid; margin-top: 2px; }
.home-tool-icon--growth span { width: 16px; height: 14px; background: linear-gradient(currentColor,currentColor) left bottom/4px 6px, linear-gradient(currentColor,currentColor) center bottom/4px 10px, linear-gradient(currentColor,currentColor) right bottom/4px 14px; background-repeat: no-repeat; }
.home-example { align-self: center; padding: clamp(18px, 3.3vw, 34px); background: linear-gradient(145deg, #eaf1ff, #fff 75%); border: 1px solid #d3dff5; border-radius: 20px; box-shadow: var(--shadow); }
.home-example h2 { margin: 0 0 6px; color: #335482; font-size: 14px; }
.home-example-amount { font-size: clamp(30px, 4vw, 44px); font-weight: 760; letter-spacing: -.045em; line-height: 1.15; margin: 0; font-variant-numeric: tabular-nums; }
.home-example-amount span { color: var(--muted); font-size: 14px; letter-spacing: normal; font-weight: 500; white-space: nowrap; }
.home-example-inputs { color: var(--muted); margin: 8px 0 18px; font-size: 13px; }
.home-example > a { display: inline-block; margin-top: 12px; font-weight: 650; font-size: 14px; }
.home-trust { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 24px; border-block: 1px solid var(--line); padding-block: 16px; }
.home-trust p { margin: 0; font-size: 13px; }
.home-trust strong, .home-trust span { display: block; }
.home-trust span, .home-state-directory p { color: var(--muted); }
.home-state-directory { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.home-state-directory h2, .home-state-directory p { margin: 0; }

/* sections */
section { margin: clamp(24px, 4vw, 40px) 0; }
.sec-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 16px; }
.sec-head h2 { font-size: clamp(19px, 2.5vw, 22px); margin: 0; letter-spacing: -.3px; }
.sec-head span { color: var(--muted); font-size: 13px; }

/* tool grid */
.group-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 26px 0 10px; }
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.country-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.country-grid ul { padding-inline-start: 1.3em; }
.tool-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.tool-card:hover { transform: translateY(-2px); border-color: #b9cdf0; text-decoration: none; }
.tool-card h3 { margin: 0 0 6px; font-size: 15px; color: var(--ink); }
.tool-card p { margin: 0 0 12px; color: var(--muted); font-size: 13px; min-height: 40px; }
.tool-card .url { font-size: 11px; color: #8b9ab0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
.badge { display: inline-block; font-size: 11px; border-radius: 999px; padding: 2px 8px; margin-right: 6px; font-weight: 650; }
.badge.formula { background: var(--blue-soft); color: var(--blue); }
.badge.tax { background: var(--amber-soft); color: var(--amber); }
.badge.live { background: var(--green-soft); color: var(--green); }

/* calculator layout */
.crumb { font-size: 13px; color: var(--muted); margin: 22px 0 8px; }
.crumb a { color: var(--muted); }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: clamp(24px, 3.5vw, 30px); line-height: 1.25; letter-spacing: -.5px; margin: 0 0 8px; }
.page-head p { color: var(--muted); margin: 0; max-width: 760px; }
.calc-grid { display: grid; grid-template-columns: minmax(248px, 0.72fr) minmax(0, 1fr); gap: clamp(12px, 2vw, 18px); align-items: start; }
.embed-builder-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 0.86fr); }
.embed-calculator-frame { display: block; width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.calc-grid > * { min-width: 0; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-h { padding: 12px var(--panel-padding); border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14px; display: flex; flex-wrap: wrap; gap: 2px 12px; justify-content: space-between; align-items: center; }
.panel-h > * { min-width: 0; overflow-wrap: anywhere; }
.panel-b { padding: var(--panel-padding); }
.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 13px; font-weight: 650; margin-bottom: 6px; }
.field .hint { font-size: 11px; color: var(--muted); font-weight: 400; }
.field input, .field select {
  width: 100%; min-width: 0; min-height: 42px; padding: 9px 11px; border: 1px solid #d5dfec; border-radius: 8px;
  font: inherit; font-size: 14px; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.row2 > .field { margin-bottom: 15px; }
.checkline { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.checkline input { width: 16px; height: 16px; }

.result-hero { background: linear-gradient(135deg, #f0f6ff, #f8fbff); border: 1px solid #d7e5fb; border-radius: 12px; padding: clamp(12px, 3vw, 20px); margin-bottom: 16px; }
.result-hero .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.result-hero .value { font-size: clamp(25px, 4vw, 34px); font-weight: 760; letter-spacing: -.8px; color: var(--blue); line-height: 1.25; overflow-wrap: anywhere; }
.result-hero .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.result-chart { margin: 12px 0; }
.result-chart h3, .growth-chart figcaption { font-size: 14px; font-weight: 700; margin: 0 0 8px; }
.chart-bar { display: flex; overflow: hidden; height: 11px; border-radius: 999px; background: var(--line); }
.chart-bar span { flex: 0 0 0; background: var(--chart-color); }
.chart-bar span:nth-child(5n + 1), .chart-legend li:nth-child(5n + 1) { --chart-color: #1f5fd6; }
.chart-bar span:nth-child(5n + 2), .chart-legend li:nth-child(5n + 2) { --chart-color: #16846b; }
.chart-bar span:nth-child(5n + 3), .chart-legend li:nth-child(5n + 3) { --chart-color: #976018; }
.chart-bar span:nth-child(5n + 4), .chart-legend li:nth-child(5n + 4) { --chart-color: #7555b1; }
.chart-bar span:nth-child(5n + 5), .chart-legend li:nth-child(5n + 5) { --chart-color: #607190; }
.chart-legend { list-style: none; padding: 0; margin: 9px 0 0; }
.chart-legend li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font-size: 13px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.chart-legend li > span::before, .growth-legend li::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; background: var(--chart-color); }
.chart-legend strong { text-align: right; }
.growth-chart { margin: 0 0 18px; }
.growth-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; padding: 0; margin: 0 0 10px; font-size: 13px; }
.growth-legend li:first-child { --chart-color: var(--blue); }
.growth-legend li:last-child { --chart-color: var(--green); }
.growth-plot { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.growth-plot svg { display: block; width: 100%; height: clamp(105px, 20vw, 180px); background: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 25%); border-bottom: 1px solid var(--line); }
.growth-plot polyline { fill: none; stroke: var(--blue); stroke-width: 2.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.growth-plot [data-series="contributed"] { stroke: var(--green); stroke-dasharray: 5 4; }
.growth-plot p { display: flex; justify-content: space-between; margin: 3px 0 0; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.kpi { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; }
.kpi .k { font-size: 11px; color: var(--muted); }
.kpi .v { font-size: 17px; font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #fafcff; }
tbody tr:hover { background: #fafcff; }
.scroll { max-height: 380px; max-width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.scroll th, .scroll td { white-space: nowrap; }
.scroll:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.scroll table th { position: sticky; top: 0; z-index: 1; }
.breakdown { table-layout: fixed; }
.breakdown th, .breakdown td { overflow-wrap: anywhere; }
.breakdown th:first-child, .breakdown td:first-child { width: 56%; color: var(--muted); }
.breakdown th[scope="row"] { font-size: inherit; text-transform: none; letter-spacing: normal; background: transparent; }
.breakdown tr.total td { font-weight: 750; color: var(--ink); background: #f6f9fe; }

/* content blocks */
.block { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(14px, 3vw, 22px); margin-bottom: 16px; box-shadow: var(--shadow); overflow-wrap: anywhere; }
.block h2 { font-size: 18px; margin: 0 0 12px; }
.block h3 { font-size: 14px; margin: 18px 0 6px; }
.block p, .block li { font-size: 14px; color: #3b4a61; }
.block p { margin: 0 0 10px; }
.block ul { margin: 0; padding-left: 20px; }
.notice { border-left: 3px solid var(--amber); background: var(--amber-soft); padding: 12px 14px; border-radius: 0 8px 8px 0; font-size: 13px; color: #6b4a12; margin: 14px 0; }
.notice strong { color: #4d350b; }
.trust { background: #f3f8f5; border: 1px solid #d6ebe0; border-radius: 12px; padding: 16px 18px; font-size: 13px; color: #33584a; }
.trust .row { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.trust b { color: #214a39; }
details { border-bottom: 1px solid var(--line); padding: 10px 0; }
details:last-child { border-bottom: 0; }
summary { cursor: pointer; font-weight: 650; font-size: 14px; }
details p { margin: 8px 0 0; }
code { background: #f0f4fa; border-radius: 5px; padding: 2px 5px; font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
pre { background: #16233a; color: #dbe7f7; border-radius: 10px; padding: 14px; max-width: 100%; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.6; }
pre code { background: transparent; color: inherit; padding: 0; }
footer { border-top: 1px solid var(--line); padding: 26px 0 40px; margin-top: 50px; color: var(--muted); font-size: 12px; }
footer a { color: var(--muted); }

@media (max-width: 1023px) {
  html { scroll-padding-top: 0; }
  .nav { position: static; }
  .nav-in { flex-wrap: wrap; gap: 4px 16px; padding-block: 8px; }
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .calc-grid { grid-template-columns: minmax(0, 1fr); }
  .us-home-hero { grid-template-columns: minmax(0, 1fr); }
  .field input, .field select { min-height: 44px; font-size: 16px; }
  .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; }
}
@media (pointer: coarse) {
  .field input, .field select { min-height: 44px; font-size: 16px; }
  .nav-links a, .country-switch .country-opt, .btn { min-height: 44px; }
}
@media (max-width: 599px) {
  .nav-links { flex-basis: 100%; order: 1; }
  .nav-tag { margin-left: auto; }
  .country-switch { order: 2; }
  .country-switch .country-opt, .nav-links a { min-height: 44px; }
  .tool-grid, .country-grid, .home-trust { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(auto-fit, minmax(min(112px, 100%), 1fr)); }
  .tool-card p { min-height: 0; }
  footer { margin-top: 32px; }
}
@media (max-width: 379px) {
  .row2 { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .breakdown th, .breakdown td { padding-inline: 5px; }
  .chart-legend li { grid-template-columns: minmax(0, 1fr) minmax(0, max-content); }
}
