/* homeloanmadesimple.com — shared design system
   Layout: civic document — single reading column, full-bleed data bands, figures set as evidence */

:root {
  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --surface-sunk: #F2F4F0;
  --ink: #17201B;
  --muted: #5C675F;
  --line: #DEE3DB;
  --accent: #15613C;
  --accent-soft: #E7F0E9;
  --flag: #7A5A12;
  --flag-soft: #F6EFDD;
  --crit: #8F2B2B;
  --font-display: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-body: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11150F; --surface: #191E19; --surface-sunk: #151A15;
    --ink: #E9EEE6; --muted: #98A598; --line: #2B332B;
    --accent: #74C996; --accent-soft: #1A2E20;
    --flag: #D7B468; --flag-soft: #2B2516; --crit: #E08585;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11150F; --surface: #191E19; --surface-sunk: #151A15;
  --ink: #E9EEE6; --muted: #98A598; --line: #2B332B;
  --accent: #74C996; --accent-soft: #1A2E20;
  --flag: #D7B468; --flag-soft: #2B2516; --crit: #E08585;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; margin: 0;
}
img { max-width: 100%; }
[hidden] { display: none !important; }

.wrap { max-width: 760px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter-r); }
.wrap-wide { max-width: 980px; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; line-height: 1.15; }
h1 { font-size: clamp(2rem, 5.5vw, 3rem); font-weight: 700; letter-spacing: -0.015em; }
h2 { font-size: clamp(1.4rem, 3.4vw, 1.85rem); font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.eyebrow { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* masthead */
.masthead { background: var(--surface); border-bottom: 1px solid var(--line); }
.masthead .wrap {
  padding-block: 14px; display: flex; flex-wrap: wrap;
  gap: 10px 22px; align-items: baseline; justify-content: space-between;
}
.brand {
  font-family: var(--font-display); font-weight: 700; font-size: 1.12rem;
  letter-spacing: -0.02em; color: var(--ink); text-decoration: none;
}
.brand span { color: var(--accent); }
nav { display: flex; gap: 18px; flex-wrap: wrap; }
nav a { font-size: 0.9rem; font-weight: 600; color: var(--muted); text-decoration: none; }
nav a:hover, nav a[aria-current="page"] { color: var(--accent); }

/* lender strip */
.lender-bar { background: var(--surface-sunk); border-bottom: 1px solid var(--line); }
.lender-bar .wrap { padding-block: 9px; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.lender-name { font-weight: 700; font-size: 0.82rem; letter-spacing: -0.01em; }
.lender-meta { font-size: 0.74rem; color: var(--muted); }

section > .wrap { padding-block: clamp(36px, 6vw, 60px); }
.band { background: var(--surface); border-block: 1px solid var(--line); }
.hero .wrap { display: flex; flex-direction: column; gap: 20px; padding-block: clamp(32px, 6vw, 56px); }
.lede { font-size: 1.1rem; color: var(--muted); max-width: 62ch; }
.asof {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  font-size: 0.78rem; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 12px; background: var(--surface);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.card {
  border: 1px solid var(--line); border-radius: 11px; background: var(--bg);
  padding: 20px; display: flex; flex-direction: column; gap: 9px; min-width: 0;
  text-decoration: none; color: inherit;
}
a.card:hover { border-color: var(--accent); }
.card h3 { font-size: 1.15rem; }
.card p { font-size: 0.9rem; color: var(--muted); }
.card .more { font-size: 0.85rem; font-weight: 600; color: var(--accent); margin-top: auto; }

.tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.tier {
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  padding: 18px; display: flex; flex-direction: column; gap: 8px; min-width: 0;
}
.tier.hi { border-color: var(--accent); background: var(--accent-soft); }
.tier-amt { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; }
.tier-rule { font-size: 0.82rem; color: var(--muted); }
.tier-who { font-size: 0.9rem; }

/* tools */
.tool {
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  padding: clamp(18px, 3.5vw, 26px); display: flex; flex-direction: column; gap: 18px;
}
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
label { font-size: 0.82rem; font-weight: 600; }
select, input[type="number"], input[type="text"], input[type="tel"], input[type="email"] {
  font: inherit; font-size: 0.95rem; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 7px; padding: 9px 10px; width: 100%;
}
.checks { display: flex; flex-direction: column; gap: 9px; }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 0.9rem; }
.check input { margin: 3px 0 0; flex: none; }
button {
  font: inherit; font-weight: 600; font-size: 0.95rem; cursor: pointer;
  background: var(--accent); color: var(--bg);
  border: 1px solid var(--accent); border-radius: 7px; padding: 11px 20px; align-self: flex-start;
}
button:hover { filter: brightness(1.08); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.readout { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.cell {
  border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px;
  background: var(--surface-sunk); padding: 14px; display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.cell-k { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.cell-v { font-family: var(--font-display); font-size: 1.35rem; font-weight: 700; }
.cell-n { font-size: 0.78rem; color: var(--muted); }
.result {
  border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px;
  background: var(--surface-sunk); padding: 16px 18px; display: flex; flex-direction: column; gap: 9px;
}
.result.stop { border-left-color: var(--crit); }
.result-amt { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; }
.result ul { margin: 0; padding-left: 18px; font-size: 0.9rem; display: flex; flex-direction: column; gap: 5px; }

/* programs grid */
.progs { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.prog {
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  padding: 17px; display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.prog h3 { font-size: 1rem; }
.prog p { font-size: 0.88rem; color: var(--muted); }
.prog .tag { font-size: 0.78rem; font-weight: 600; color: var(--accent); }

/* tables */
.tscroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th {
  background: var(--surface-sunk); font-size: 0.74rem; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
td:first-child { font-weight: 600; white-space: nowrap; }

/* facts */
.facts { display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--line); }
.fact { display: grid; grid-template-columns: 1fr; gap: 4px; padding-block: 14px; border-bottom: 1px solid var(--line); }
@media (min-width: 620px) { .fact { grid-template-columns: 210px 1fr; gap: 20px; } }
.fact dt { font-weight: 600; font-size: 0.92rem; }
.fact dd { margin: 0; color: var(--muted); font-size: 0.93rem; }

.steps { counter-reset: s; display: flex; flex-direction: column; gap: 14px; }
.step { display: grid; grid-template-columns: 30px 1fr; gap: 14px; align-items: start; }
.step::before {
  counter-increment: s; content: counter(s);
  font-family: var(--font-display); font-weight: 700; font-size: 0.95rem;
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent);
}
.step h3 { margin-bottom: 2px; }
.step p { font-size: 0.93rem; color: var(--muted); }

.consent { font-size: 0.78rem; color: var(--muted); line-height: 1.5; }
.payload {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem;
  background: var(--surface-sunk); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px; overflow-x: auto; white-space: pre; color: var(--ink);
}
.buildnote {
  font-size: 0.78rem; color: var(--flag); background: var(--flag-soft);
  border: 1px solid var(--flag); border-radius: 7px; padding: 9px 12px;
}
.sources { font-size: 0.85rem; color: var(--muted); display: flex; flex-direction: column; gap: 7px; }

footer { background: var(--surface); border-top: 1px solid var(--line); }
footer .wrap { padding-block: 28px; display: flex; flex-direction: column; gap: 14px; }
.legal { font-size: 0.75rem; color: var(--muted); line-height: 1.6; }
.legal strong { color: var(--ink); font-weight: 600; }
.ehl { display: inline-flex; align-items: center; gap: 7px; font-size: 0.75rem; font-weight: 600; color: var(--ink); }
.ehl svg { flex: none; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
