/* ============================================================
   Tools and market data pages.

   Built on pages.css and reads brand values from brand.css only;
   declares no color of its own. These pages are house surfaces:
   the neutral accent carried by form. A product's color appears
   only where that product is named (its mark and the act that
   enters it). Nothing here uses color to show state: the lowest-
   cost option is marked with a word and weight, never a hue.
   ============================================================ */

[hidden] { display: none !important; }

/* ---------- Short hero (tools hub, data hub) --------------- */
.hero.hero-short { min-height: 0; }
.hero.hero-short .hero-inner { padding-top: 96px; padding-bottom: 80px; }
.hero .hero-links { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 36px; font-size: 15px; }
.hero .hero-links a { color: var(--white); }

/* ---------- Page head (tool and data pages) ---------------- */
.page-head { padding: 56px 0 48px; border-bottom: 1px solid var(--line-on-paper); }
.crumbs { font-size: var(--t-label); color: var(--muted-on-paper); margin-bottom: 18px; }
.crumbs a { color: inherit; }
.crumbs span[aria-hidden] { margin: 0 8px; }
.page-head h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 4vw, 52px); line-height: 1.1; letter-spacing: -0.015em; max-width: 880px; }
.page-head .lede { margin-top: 18px; color: var(--muted-on-paper); max-width: 700px; }
.page-head .for-line { margin-top: 14px; font-size: 14px; font-weight: 600; }
.product-tag { display: inline-flex; align-items: center; gap: 8px; font-size: var(--t-label); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 14px; }
.product-tag .mark-lintel { width: 12px; height: 12px; }

/* ---------- Tool layout ------------------------------------ */
.tool { padding: 48px 0 88px; }
.tool-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 40px; align-items: start; }
@media (max-width: 980px) { .tool-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; } }
.panel { border: 1px solid var(--line-on-white); border-radius: 8px; background: var(--white); padding: 28px; }
@media (max-width: 700px) { .panel { padding: 22px 18px; } }
.panel + .panel { margin-top: 20px; }
.panel h2, .panel h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.panel .hint { font-size: 14px; color: var(--muted-on-white); margin: -8px 0 16px; }
.results { position: sticky; top: 92px; }
@media (max-width: 980px) { .results { position: static; } }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 14px; }
.fields .full { grid-column: 1 / -1; }
@media (max-width: 480px) { .fields { grid-template-columns: 1fr; } }
.field .help { font-size: 13px; color: var(--muted-on-white); line-height: 1.45; }
.affix { position: relative; display: flex; align-items: center; }
.affix input { width: 100%; }
.affix .pre, .affix .post { position: absolute; font-size: 15px; color: var(--muted-on-white); pointer-events: none; }
.affix .pre { left: 12px; } .affix.has-pre input { padding-left: 26px; }
.affix .post { right: 12px; } .affix.has-post input { padding-right: 40px; }
input[type="number"] { -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field input, .field select { font-variant-numeric: tabular-nums; }

.group-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 24px 0 12px; padding-top: 20px; border-top: 1px solid var(--line-on-white); }
.group-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.group-title h3 { margin: 0; }
.link-btn { background: none; border: 0; padding: 4px 0; font: 600 14px var(--sans); color: var(--navy); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.btn-small { min-height: 40px; padding: 8px 16px; font-size: 14px; }

/* Options side by side (loan comparison) */
.opts { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .opts { grid-template-columns: 1fr; } }
.opt { border: 1px solid var(--line-on-white); border-radius: 6px; padding: 14px; display: grid; gap: 12px; }
.opt-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; }

/* ---------- Results ---------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 20px; }
.stat { border: 1px solid var(--line-on-white); border-radius: 6px; padding: 14px 16px; }
.stat .k { font-size: 13px; color: var(--muted-on-white); line-height: 1.35; }
.stat .v { font-size: clamp(22px, 2.4vw, 28px); font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat.lead { border: 2px solid var(--navy); }
.answer { font-family: var(--serif); font-size: clamp(20px, 2vw, 25px); line-height: 1.35; margin-bottom: 20px; }
.answer strong { font-family: var(--sans); font-weight: 800; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; }
table.grid { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
table.grid th, table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line-on-white); text-align: right; white-space: nowrap; }
table.grid th:first-child, table.grid td:first-child { text-align: left; white-space: normal; }
table.grid thead th { font-size: 13px; font-weight: 700; color: var(--muted-on-white); border-bottom: 2px solid var(--navy); vertical-align: bottom; }
table.grid tbody th { font-weight: 600; }
table.grid tr.total td, table.grid tr.total th { font-weight: 800; border-top: 2px solid var(--navy); }
table.grid .lowest { font-weight: 800; }
@media (max-width: 560px) {
  table.grid { font-size: 13px; }
  table.grid th, table.grid td { padding: 8px 6px; }
  table.grid th:first-child, table.grid td:first-child { position: sticky; left: 0; background: var(--white); z-index: 1; max-width: 118px; }
  .badge { display: block; width: max-content; margin: 4px 0 0 auto; }
}
.badge { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; border: 1.5px solid var(--navy); border-radius: 3px; padding: 2px 6px; margin-left: 6px; vertical-align: 2px; white-space: nowrap; }
.flag { border-left: 3px solid var(--navy); padding: 10px 14px; background: var(--paper); font-size: 14px; margin: 12px 0; }

.chart { margin: 8px 0 4px; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart text { font: 12px var(--sans); fill: var(--muted-on-white); }
.chart .axis { stroke: var(--line-on-white); }
.chart .s0 { stroke: var(--navy); stroke-width: 2.5; fill: none; }
.chart .s1 { stroke: var(--navy); stroke-width: 2; stroke-dasharray: 7 5; fill: none; }
.chart .s2 { stroke: var(--muted-on-white); stroke-width: 2; stroke-dasharray: 2 4; fill: none; }
.chart .mark { stroke: var(--muted-on-white); stroke-dasharray: 3 3; }
.chart .zero { stroke: var(--navy); stroke-width: 1; }
.data-body .chart text { font-size: 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 13px; color: var(--muted-on-white); margin-top: 6px; }
.legend i { display: inline-block; width: 26px; height: 0; border-top: 2.5px solid var(--navy); vertical-align: middle; margin-right: 6px; }
.legend i.l1 { border-top: 2px dashed var(--navy); }
.legend i.l2 { border-top: 2px dotted var(--muted-on-white); }

/* ---------- Share, print, your details --------------------- */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.actions .btn { min-height: 42px; padding: 9px 18px; font-size: 14px; }
.status { font-size: 14px; min-height: 1.4em; margin-top: 8px; }
details.profile { margin-top: 16px; border-top: 1px solid var(--line-on-white); padding-top: 14px; }
.panel > details.profile:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
details.profile summary { cursor: pointer; font-weight: 600; font-size: 15px; }
details.profile .fields { margin-top: 14px; }
.prepared { display: none; }
.prepared.show { display: block; border: 1px solid var(--line-on-white); border-radius: 6px; padding: 14px 16px; margin-bottom: 20px; font-size: 15px; }
.prepared .who { font-weight: 700; }
.shared-note { background: var(--paper); border-bottom: 1px solid var(--line-on-paper); padding: 12px 0; font-size: 15px; }

/* An explanation offered as a question; opened only if wanted */
details.ask { margin-top: 12px; }
details.ask > summary { cursor: pointer; font-weight: 600; font-size: 15px; list-style: none; display: inline-flex; align-items: center; gap: 8px; text-decoration: underline; text-underline-offset: 3px; }
details.ask > summary::-webkit-details-marker { display: none; }
details.ask > summary::before { content: '?'; display: inline-grid; place-items: center; width: 20px; height: 20px; border: 1.5px solid currentColor; border-radius: 50%; font-size: 12px; font-weight: 800; text-decoration: none; }
details.ask[open] > summary::before { content: '–'; }
details.ask .ask-body { margin-top: 10px; padding: 14px 16px; border: 1px solid var(--line-on-white); border-radius: 6px; background: var(--white); font-size: 15px; color: var(--navy); max-width: 720px; }
details.ask .ask-body p + p, details.ask .ask-body p + .formula, details.ask .ask-body .formula + p { margin-top: 10px; }
.asks { padding: 40px 0 56px; }
.asks .container > * + * { margin-top: 6px; }
.asks h2 { font-size: var(--t-note); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-on-paper); margin-bottom: 8px; }

/* Required on every result that shows a rate, payment or cost */
.reg-notice { font-size: 14px; font-weight: 600; border: 1px solid var(--navy); border-radius: 4px; padding: 10px 14px; margin: 0 0 18px; }
.print-reg { display: none; }

/* A shared result, opened by the borrower: the answer first, and none
   of the loan officer's own controls or the product pitch. */
@media (max-width: 980px) { .is-shared .results { order: -1; } }
.is-shared .profile-panel, .is-shared .lo-only, .is-shared .next-step, .is-shared .related, .is-shared .product-tag, .is-shared .feed-bar, .is-shared .page-head .lede, .is-shared .usage-note { display: none !important; }

/* Decision capture */
fieldset.choice { border: 0; margin: 0; padding: 0; }
fieldset.choice legend { font-size: var(--t-label); font-weight: 600; margin-bottom: 8px; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--muted-on-white); border-radius: 3px; padding: 8px 12px; font-size: 14px; cursor: pointer; }
.chips input { accent-color: var(--navy); margin: 0; }
.chips label:has(input:checked) { border: 2px solid var(--navy); padding: 7px 11px; font-weight: 700; }

/* ---------- Explanation and next step --------------------- */
.explain { padding: 88px 0; }
.explain .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; }
@media (max-width: 900px) { .explain .cols { grid-template-columns: 1fr; gap: 36px; } }
.explain h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 2.8vw, 36px); line-height: 1.2; margin-bottom: 20px; }
.explain h3 { font-size: 17px; font-weight: 700; margin: 24px 0 8px; }
.explain p, .explain li { color: var(--muted-on-paper); font-size: 16px; }
.explain ol { list-style: decimal; padding-left: 22px; }
.explain ul.dash li { padding-left: 18px; position: relative; margin-bottom: 8px; }
.explain ul.dash li::before { content: '—'; position: absolute; left: 0; }
.explain li + li { margin-top: 8px; }
.formula { font-family: var(--sans); font-variant-numeric: tabular-nums; background: var(--white); border: 1px solid var(--line-on-paper); border-radius: 4px; padding: 10px 14px; margin: 10px 0; font-size: 15px; color: var(--navy); }
.source { font-size: 13px; color: var(--muted-on-paper); margin-top: 18px; }

.next-step { padding: 88px 0; }
.next-card { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: start; border: 1px solid var(--line-on-white); border-radius: 8px; padding: 40px; }
@media (max-width: 900px) { .next-card { grid-template-columns: 1fr; gap: 24px; padding: 28px 22px; } }
.next-card h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 2.6vw, 34px); line-height: 1.2; margin-bottom: 14px; }
.next-card p { color: var(--muted-on-white); }
.next-card ul li { padding: 9px 0; border-top: 1px solid var(--line-on-white); font-size: 15px; }
.next-card ul li:last-child { border-bottom: 1px solid var(--line-on-white); }
.next-card .btn-row { margin-top: 24px; }

.related { padding: 0 0 96px; }
.related h2 { font-size: var(--t-note); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-on-white); margin-bottom: 18px; }

/* ---------- Tool cards (hub and related) ------------------- */
.tool-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.tool-card { display: flex; flex-direction: column; border: 1px solid var(--line-on-white); border-radius: 8px; padding: 26px; background: var(--white); text-decoration: none; color: var(--navy); }
.tool-card:hover { border-color: var(--navy); text-decoration: none; }
.tool-card:hover h3 { text-decoration: underline; text-underline-offset: 3px; }
.tool-card h3 { font-size: 19px; font-weight: 700; line-height: 1.3; margin-bottom: 8px; }
.tool-card p { font-size: 15px; color: var(--muted-on-white); }
.tool-card .meta { margin-top: auto; padding-top: 18px; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.tool-card .meta .mark-lintel { width: 10px; height: 10px; }
/* A free tool's card carries the color of the product it feeds */
.tool-card.feeds-purple { border-top: 4px solid var(--purple); }
.tool-card.feeds-clay { border-top: 4px solid var(--clay); }
.hub-group + .hub-group { margin-top: 72px; }
.hub-group .section-head { margin-bottom: 28px; }
.hub-group .section-head h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 2.8vw, 36px); line-height: 1.2; }
.hub-group .section-head p { color: var(--muted-on-white); margin-top: 10px; max-width: 640px; }

/* ---------- Data pages ------------------------------------- */
.data-body { padding: 48px 0 96px; }
.lookup { display: grid; grid-template-columns: 1fr 2fr; gap: 14px; max-width: 760px; }
@media (max-width: 560px) { .lookup { grid-template-columns: 1fr; } }
.state-index { columns: 4 200px; column-gap: 32px; margin-top: 20px; }
.state-index li { break-inside: avoid; padding: 6px 0; border-bottom: 1px solid var(--line-on-white); font-size: 15px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 8px 0 28px; }
.data-note { font-size: 14px; color: var(--muted-on-white); max-width: 760px; }
.updated { font-size: 13px; font-weight: 600; margin-top: 14px; }
details.all-counties { margin-top: 24px; }
details.all-counties summary { cursor: pointer; font-weight: 600; margin-bottom: 14px; }
.data-body h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(24px, 2.4vw, 32px); line-height: 1.2; margin: 56px 0 16px; }
.data-body h2:first-child { margin-top: 0; }
.cross { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.usage-note { font-size: 13px; color: var(--muted-on-white); margin-top: 28px; max-width: 760px; }

/* ---------- Print: the result only, with the preparer ----- */
@media print {
  .print-reg { display: block !important; font-size: 12pt !important; font-weight: 700; border: 1.5pt solid #000; padding: 8pt 10pt; margin: 0 0 12pt; }
  .results .reg-notice { display: none !important; }
  .lo-only, #decision-line { display: none !important; }
  .chart, .table-wrap, .stats { break-inside: avoid; }
  .print-summary { display: block !important; font-size: 10.5pt; margin: 0 0 10pt; }
  .asks { display: none !important; }
  .nav, .footer, .skip-link, .page-head .lede, .no-print, .explain, .next-step, .related, .shared-note, .actions, details.profile, .usage-note, fieldset.choice { display: none !important; }
  body { font-size: 12pt; }
  .tool { padding: 0; }
  .tool-grid { display: block; }
  .inputs-panel { display: none; }
  .results { position: static; }
  .panel { border: 0; padding: 0; }
  .prepared { display: block !important; border: 1px solid #000; }
  .print-only { display: block !important; }
  .page-head { padding: 0 0 12px; border: 0; }
  .page-head h1 { font-size: 22pt; }
  a { text-decoration: none; }
}
.print-only { display: none; }
.print-summary { display: none; }
