/* Copied from design/ab/index.html (page CSS of the AB mockup). Tokens and the site chrome are in site.css. */
/* Page: mortgage calculator. Tokens, base and the site chrome come from chrome.css (design/_tools). */

/* ---------- title ---------- */
h1 { font: 700 clamp(28px, 6vw, 38px)/1.15 var(--serif); letter-spacing: -.01em; text-wrap: balance; }
.lede { margin-top: 6px; color: var(--ink2); max-width: 66ch; }

/* ---------- the one sticky element: result row on phones ---------- */
.strip { position: sticky; top: 0; z-index: 20; background: var(--bg); margin: 14px -16px 0; padding: calc(8px + env(safe-area-inset-top)) 16px 8px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
@media (min-width: 720px) { .strip { margin-inline: -24px; padding-inline: 24px; } }
.strip .row1 { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.strip .k { font-size: var(--small); }
.strip .v { font-size: 28px; font-weight: 700; line-height: 1.1; }
.strip .p { font: var(--small)/1.35 var(--nums); color: var(--ink2); }
.strip .bad { font-size: 16px; }
@media (min-width: 960px) { .strip { display: none; } }

/* ---------- calculator grid (structure of B) ---------- */
.calc { display: grid; grid-template-columns: minmax(0, 1fr); margin-top: 16px; border-top: 1px solid var(--hair); }
.calc > * { min-width: 0; }
@media (min-width: 960px) {
  .calc { grid-template-columns: 360px minmax(0, 1fr); margin-top: 20px; border-top: 1px solid var(--ink); }
  .inputs { padding-right: 24px; align-self: start; }
  .inputs.stick { position: sticky; top: 0; }
  /* The column is taller than the window: only the main fields stay in view (owner, 2026-10-11); the optional blocks and
     the reset button scroll with the page. The form box is left out of the layout so the block sticks within the column. */
  .inputs.stickcore { align-self: stretch; }
  .inputs.stickcore > form { display: contents; }
  .inputs.stickcore .core { position: sticky; top: 0; z-index: 2; background: var(--bg); padding-bottom: 8px; }
  .outputs { padding-left: 28px; border-left: 1px solid var(--hair); }
  /* Compact total at the top of the sticky column while the big total is out of view (command 9, point 3.13). */
  .ctotal { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 8px; padding: 8px 0; border-bottom: 1px solid var(--hair); }
  .ctotal .k { margin: 0; }
  .ctotal .v { font-weight: 700; }
}
.ctotal[hidden] { display: none; }
@media (max-width: 959.98px) { .ctotal { display: none; } }
.inputs { padding-block: 14px 24px; }
.outputs > section { padding-block: 18px; border-top: 1px solid var(--hair); }
@media (min-width: 960px) { .outputs > section:first-child { border-top: 0; } }
h2.h { font: 700 21px/1.25 var(--serif); }
.shead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }

/* fields */
.f { padding-block: 12px; border-bottom: 1px solid var(--hair); }
.lrow { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; margin-bottom: 6px; }
.lbl { font-size: 17px; font-weight: 700; }
.ex { font: italic var(--small) var(--serif); color: var(--ink2); }
.help { font-size: var(--small); color: var(--ink2); margin-top: 6px; line-height: 1.45; }
.box { display: flex; align-items: stretch; border: 1px solid var(--border); background: var(--bg); min-height: 48px; }
.box:focus-within { outline: 3px solid var(--focus); outline-offset: 1px; }
.box:has([aria-invalid="true"]) { border: 2px solid var(--critical); }
.box input, .box select { flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; outline: 0; padding: 0 12px; font: 600 18px var(--nums); font-variant-numeric: tabular-nums lining-nums; }
.pre, .suf { display: flex; align-items: center; padding-inline: 12px; color: var(--ink2); font: 16px var(--nums); white-space: nowrap; }
.pre { padding-right: 0; } .suf { padding-left: 0; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) 108px; gap: 8px; }
.err { margin-top: 6px; font: 600 var(--small)/1.4 var(--nums); color: var(--critical); }
.err::before { content: "Error: "; }
.clampnote { margin-top: 4px; font: var(--small) var(--nums); color: var(--ink2); }
.loanline { margin-top: 6px; font: var(--small) var(--nums); }

/* slider: native range, styled */
.rng { margin-top: 4px; }
input[type="range"] { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 44px; margin: 0; background: transparent; cursor: pointer; touch-action: pan-y; --fill: 0%; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; background: linear-gradient(to right, var(--accent) 0 var(--fill), var(--border) var(--fill) 100%); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%; background: var(--ink); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--ink); }
input[type="range"]::-moz-range-track { height: 6px; background: var(--border); }
input[type="range"]::-moz-range-progress { height: 6px; background: var(--accent); }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--ink); }
input[type="range"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ends { display: flex; justify-content: space-between; font: var(--small) var(--nums); color: var(--ink2); margin-top: -4px; }

/* term buttons */
fieldset.f { border: 0; border-bottom: 1px solid var(--hair); margin: 0; padding-inline: 0; min-width: 0; }
fieldset.f legend { padding: 0; float: left; width: 100%; margin-bottom: 6px; }
.terms { clear: both; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.terms input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.terms label { display: flex; align-items: center; justify-content: center; min-height: 48px; border: 1px solid var(--border); margin-left: -1px; cursor: pointer; font: 600 17px var(--nums); }
.terms label:first-of-type { margin-left: 0; }
.terms input:checked + label { background: var(--ink); color: var(--bg); border-color: var(--ink); position: relative; }
.terms input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; position: relative; z-index: 1; }
.other { margin-top: 8px; }

details.blk { border-bottom: 1px solid var(--hair); }
details.blk > summary { display: flex; align-items: center; gap: 10px; min-height: 52px; cursor: pointer; font-weight: 700; list-style: none; }
details.blk > summary::-webkit-details-marker { display: none; }
details.blk > summary::before { content: "+"; width: 1em; font: 22px var(--nums); color: var(--accent); }
details.blk[open] > summary::before { content: "\2212"; }
details.blk > summary { flex-wrap: wrap; padding-block: 6px; }
details.blk > summary .sumt { flex: 1; }
details.blk > summary .edit { font: 600 var(--small) var(--nums); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
details.blk > summary .sumv { order: 3; flex-basis: 100%; padding-left: calc(1em + 10px); font: 400 var(--small)/1.4 var(--nums); color: var(--ink2); }
details.blk[open] > summary .sumv { display: none; }
details.blk .f:last-child { border-bottom: 0; }
.radios { border: 0; margin: 0; padding: 12px 0 0; }
.radios legend { font-weight: 700; padding: 0; margin-bottom: 4px; }
.radios label { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding-top: 10px; cursor: pointer; font-size: 16px; }
.radios input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--ink); flex: none; }
.resetrow { padding-top: 14px; }

/* result */
.sentence { font-size: 19px; line-height: 1.45; max-width: 52ch; }
.k { font: 600 var(--small)/1.3 var(--nums); color: var(--ink2); letter-spacing: .04em; text-transform: uppercase; margin-top: 12px; }
.total { font-size: clamp(44px, 11vw, 64px); font-weight: 700; line-height: 1.05; letter-spacing: -.02em; margin-top: 2px; }
.incl { font-size: var(--small); color: var(--ink2); margin-top: 6px; }
.tocheck { margin-top: 10px; font-size: var(--small); }
.tocheck a { display: inline-flex; align-items: center; min-height: 44px; }
.bar { display: flex; gap: 2px; height: 22px; margin-top: 16px; }
.bar span { min-width: 3px; }
table { width: 100%; border-collapse: collapse; font-family: var(--nums); font-variant-numeric: tabular-nums lining-nums; font-size: 16px; }
th, td { padding: 8px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--hair); }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
thead th { font-size: var(--small); font-weight: 600; color: var(--ink2); text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--ink); }
tbody th { font-weight: 400; }
tfoot th, tfoot td { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--ink); }
.legend { margin-top: 8px; }
.legend tr.sub th, .legend tr.sub td { font-weight: 700; }
.legend tr.sub th { padding-left: 20px; }
.sw { display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px; }
.pmiline, .extraline { margin-top: 10px; font-size: 16px; }
.cells { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 16px 0 0; border-top: 1px solid var(--hair); }
@media (min-width: 720px) { .cells { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cells div { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--hair); min-width: 0; }
.cells dt { font-size: var(--small); color: var(--ink2); }
.cells dd { margin: 2px 0 0; font-size: 21px; font-weight: 700; overflow-wrap: anywhere; }
.cells dd small { display: block; font-size: var(--small); font-weight: 400; color: var(--ink2); }
.noresult { border-left: 3px solid var(--critical); padding: 6px 0 6px 14px; margin-top: 12px; }
.noresult .total { color: var(--ink2); }

/* compare */
.cmpin { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-top: 10px; max-width: 460px; }
.cmpin .lbl { font-size: var(--small); display: block; margin-bottom: 4px; }
.cmp { margin-top: 12px; }
.cmp .diffrow th, .cmp .diffrow td { font-weight: 700; }
.cmp tbody th { white-space: normal; }
.cmp td { white-space: nowrap !important; }   /* "$226,382 less" stays on one line; the first column shrinks */
.cmp tbody th { width: 100%; }
.cmpsent { margin-top: 12px; max-width: 60ch; }

/* chart */
.seg { display: inline-flex; }
.seg button { min-height: 44px; min-width: 72px; padding: 0 14px; background: var(--bg); border: 1px solid var(--border); margin-left: -1px; cursor: pointer; font: 600 var(--small) var(--nums); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); position: relative; }
.summary { margin-top: 8px; max-width: 70ch; }
.readout { margin-top: 10px; font: 600 16px var(--nums); min-height: 1.5em; }
.chart { position: relative; margin-top: 4px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; cursor: crosshair; }
.ax { fill: var(--ink2); font: var(--small) var(--nums); font-variant-numeric: tabular-nums; }
.gl { stroke: var(--hair); } .axl { stroke: var(--border); }
.cross { stroke: var(--ink); stroke-dasharray: 3 3; }
.st-balance { stroke: var(--s-balance); } .st-base { stroke: var(--border); stroke-dasharray: 5 4; }
.f-balance { fill: var(--s-balance); }
.ring { stroke: var(--bg); stroke-width: 2; }
.emptymsg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; text-align: center; font-size: 17px; }
.emptymsg span { background: var(--bg); padding: 6px 10px; }
.hint { font: var(--small) var(--nums); color: var(--ink2); margin-top: 4px; }
/* One of the two pointer sentences: "Hover" where the main pointer can hover (mouse), "Tap" otherwise. */
.hint .h-hover { display: none; }
@media (hover: hover) { .hint .h-hover { display: inline; } .hint .h-touch { display: none; } }
.tablewrap { overflow-x: auto; margin-top: 10px; }
.tablewrap.tall { max-height: 420px; overflow-y: auto; }
.tablewrap.tall thead th { position: sticky; top: 0; background: var(--bg); }
.yt td:last-child, .yt th:last-child { text-align: left; padding-left: 16px; color: var(--ink2); }
.ymo { display: none; }
/* Phones: every column fits without horizontal scroll (the monthly schedule keeps its own scroll box). */
@media (max-width: 719px) {
  th, td { padding: 8px 5px; }
  .yt .mcol { display: none; }
  .yt td:first-child { white-space: normal; }
  thead th { white-space: normal; vertical-align: bottom; letter-spacing: 0; }
  .cmp td { white-space: normal; }
  /* 320 px: the breakdown labels ("Principal + interest") may wrap, so the table fits the screen. */
  .legend th[scope="row"] { white-space: normal; }
  .yt td:first-child, .yt th:first-child { width: 80px; }
  .ymo { display: block; font-size: 14px; color: var(--ink2); line-height: 1.3; }
  .ymo span { white-space: nowrap; }
  /* R1-a: the month line is 16 px whenever the table box is at least 333 px wide (16 px needs 333 px); 14 px only below. */
  .tablewrap:has(> .yt) { container-type: inline-size; }
}
@media (max-width: 719px) { @container (min-width: 333px) { .ymo { font-size: 16px; } } }
details.more > summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; font-weight: 700; margin-top: 8px; }
/* Every expandable row carries the same marker as the input blocks: "+" closed, "−" open. */
details.more > summary, .faq summary { gap: 10px; min-height: 44px; list-style: none; }
details.more > summary::-webkit-details-marker, .faq summary::-webkit-details-marker { display: none; }
details.more > summary::before, .faq summary::before { content: "+"; width: 1em; flex: none; font: 22px var(--nums); color: var(--accent); }
details.more[open] > summary::before, .faq details[open] > summary::before { content: "\2212"; }

/* below: method, FAQ, sources */
.below { border-top: 1px solid var(--ink); margin-top: 8px; padding-top: 18px; display: grid; gap: 22px; }
@media (min-width: 960px) { .below { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 40px; } }
.below section { min-width: 0; }
.below p + p, .below p + .formula, .below .formula + p, .below ul + p, .below ol + p { margin-top: 10px; }
.below h2 { margin-bottom: 8px; }
.formula { font: 16px/1.5 var(--nums); border-left: 3px solid var(--border); padding: 4px 0 4px 12px; overflow-x: auto; }
.formula sup { font-size: 1em; }
.faq details { border-bottom: 1px solid var(--hair); }
.faq summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; font-weight: 700; }
.faq details p { padding-bottom: 12px; }
.disclaimer { grid-column: 1 / -1; border-top: 1px solid var(--hair); padding-top: 14px; font-size: 16px; }


.bg-principal { background: var(--s-principal); } .bg-interest { background: var(--s-interest); }
.bg-tax { background: var(--s-tax); } .bg-ins { background: var(--s-ins); }
.bg-hoa { background: var(--s-hoa); } .bg-pmi { background: var(--s-pmi); }

/* Desktop: the collapsed input column fits a 900-px-tall window, so it can stay in view (REQUIREMENTS 12.4).
   Only spacing changes; labels, min/max labels and notes stay. Targets stay at least 44px. */
@media (min-width: 960px) {
  .inputs { padding-block: 8px 12px; }
  .inputs .f { padding-block: 6px; }
  .inputs .lrow { margin-bottom: 4px; }
  .inputs .box { min-height: 46px; }   /* the field inside, between the 1px borders, is 44px tall (C10) */
  .inputs .terms label { min-height: 44px; }
  .inputs .ends { margin-top: -10px; }
  .inputs .loanline, .inputs .help { margin-top: 2px; }
  .inputs details.blk > summary { min-height: 44px; padding-block: 2px; }
  .inputs .resetrow { padding-top: 8px; }
}

@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

@media print {
  :root, :root:not([data-theme="light"]), :root[data-theme="dark"] {
    --bg: #fff; --ink: #000; --ink2: #333; --hair: #bbb; --border: #555; --accent: #8c1d40;
    --s-principal: #1f4fa8; --s-interest: #d9590f; --s-tax: #0e7d5c; --s-ins: #5e4300; --s-hoa: #3c96b4; --s-pmi: #858585; --s-balance: #4a3aa7;
  }
  body { font-size: 11pt; }
  .mockbar, .skip, .site, .drawer, .crumbs, .strip, .inputs, .seg, .hint, .readout, .cmpin, details.more > summary, .first5, .site-foot .sitemap, .site-foot h2, .legal { display: none !important; }
  .calc { display: block; border: 0; }
  .outputs { padding: 0; }
  .print-only { display: block !important; }
  .bar, .sw { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .tablewrap.tall { max-height: none; overflow: visible; }
}
.print-only { display: none; }

/* ---------- What to check next (command 14 B): right after the result, two questions as links ---------- */
.nextlist { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 14px; }
.nextlist li { margin: 0; }
.nextlist .nq { font: 700 18px/1.35 var(--serif); display: inline-block; padding-block: 10px; }
.nextlist .why { margin: 0; color: var(--ink2); }
.nextlist .carry { margin: 2px 0 0; }
.nextlist .carry a { display: inline-block; padding-block: 10px; }
.nextlist .carry[hidden] { display: none; }
.carried { margin: 0 0 12px; padding: 8px 0; border-bottom: 1px solid var(--hair); }

/* ---------- two figures of equal weight next to each other (spec "also", command 14 C2) ---------- */
.pair { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 32px; }
.pair > div { flex: 0 1 auto; min-width: 0; }
.pair .total { font-size: clamp(36px, 9vw, 52px); }
.pair .sm .v { font-size: 22px; font-weight: 700; margin-top: 2px; }

/* ---------- Copy result (command 14 G) ---------- */
.copy { margin: 12px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.copymsg { font-size: var(--small); color: var(--ink2); }
@media print { .copy { display: none; } }
/* Long translated compounds must wrap without widening the page or the payment breakdown. */
html:not([lang="en"]) [data-page-kind="tool"] h1 { overflow-wrap: anywhere; hyphens: auto; }
@media(max-width:719px) {
  html:not([lang="en"]) .legend th { overflow-wrap: anywhere; hyphens: auto; }
}
