:root {
  --navy: #17233f;
  --navy-deep: #0e172b;
  --blue: #2764b8;
  --blue-soft: #eaf2ff;
  --gold: #ffd400;
  --cream: #f7f4ed;
  --paper: #ffffff;
  --ink: #17233f;
  --muted: #69768c;
  --line: #dce2ec;
  --green: #18744e;
  --green-soft: #e8f5ef;
  --red: #a43b34;
  --red-soft: #fbebea;
  --shadow: 0 18px 52px rgba(23, 35, 63, 0.1);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: "DM Sans", sans-serif;
  line-height: 1.5;
}
button, input, select { font: inherit; }
[hidden] { display: none !important; }
.wrap { width: min(1080px, calc(100% - 36px)); margin: 0 auto; }

.hero {
  position: relative;
  overflow: hidden;
  padding: 42px 0 72px;
  color: #fff;
  background:
    radial-gradient(circle at 84% 18%, rgba(72, 127, 204, 0.42), transparent 31%),
    linear-gradient(135deg, var(--navy-deep), var(--navy));
}
.hero::after {
  content: "";
  position: absolute;
  right: -125px;
  bottom: -220px;
  width: 360px;
  height: 360px;
  border: 58px solid rgba(217, 170, 65, 0.15);
  border-radius: 50%;
}
.hero-inner { position: relative; z-index: 1; }
.logo-hero { width: min(390px, 72vw); height: auto; margin-bottom: 52px; }
.eyebrow, .kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
h1, h2, h3 {
  font-family: "Archivo", sans-serif;
  font-stretch: condensed;
  letter-spacing: -0.035em;
}
.hero h1 {
  max-width: 870px;
  margin: 0;
  font-size: clamp(40px, 7vw, 70px);
  font-weight: 900;
  line-height: 0.98;
}
.lo-line { margin-top: 26px; color: #afbdd2; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; }

.section { padding: 72px 0; }
.section-heading { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 26px; }
.section-heading h2 { margin: 0; font-size: clamp(40px, 6vw, 58px); line-height: 0.98; }
.section-heading .kicker { color: var(--blue); }
.step {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
  font-family: "Archivo", sans-serif;
  font-weight: 900;
}

.price-panel {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 18px;
  border: 1px solid rgba(23, 35, 63, 0.08);
  border-radius: var(--radius);
  padding: 28px 30px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.price-panel > label { color: var(--muted); font-size: 13px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.price-input { display: flex; align-items: center; color: var(--navy); font-family: "Archivo", sans-serif; font-size: clamp(36px, 5.5vw, 52px); font-weight: 900; line-height: 1; }
.price-input > span { color: var(--gold); font-size: 1.12em; }
.price-input input {
  width: min(540px, 70vw);
  border: 0;
  outline: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: right;
}
.price-input:focus-within { border-bottom: 3px solid var(--blue); }

.structure-grid { display: grid; grid-template-columns: 0.8fr 1fr 1.35fr; gap: 16px; }
.structure-tile {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(23, 35, 63, 0.08);
  border-radius: var(--radius);
  padding: 25px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.structure-tile::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: var(--blue); }
.second-tile::before { background: var(--gold); }
.tile-number { position: absolute; top: 18px; right: 20px; color: #d6dce6; font-family: "Archivo", sans-serif; font-size: 28px; font-weight: 900; }
.structure-tile > p { margin: 0 0 16px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.tile-amount { display: block; font-family: "Archivo", sans-serif; font-size: clamp(29px, 4vw, 40px); line-height: 1; }
.second-tile .tile-amount { color: var(--blue); }
.cap-label, .portion-label { display: block; min-height: 35px; margin: 8px 0 18px; color: var(--muted); font-size: 11px; font-weight: 700; }
.cap-label { color: var(--blue); }
.large-percent { display: inline-flex; align-items: baseline; max-width: 100%; color: var(--navy); }
.large-percent input { width: 128px; min-width: 0; overflow: visible; border: 0; border-bottom: 2px solid var(--line); outline: 0; padding: 0 4px 2px 0; color: inherit; background: transparent; font-family: "Archivo", sans-serif; font-size: 46px; font-weight: 900; line-height: 1.08; }
.large-percent span { flex: 0 0 auto; margin-left: 3px; font-family: "Archivo", sans-serif; font-size: 27px; font-weight: 900; }
.large-percent:focus-within input { border-color: var(--blue); }
.down-tile > strong { display: block; margin-top: 6px; color: var(--blue); font-size: 20px; }
.down-tile > small { display: block; margin-top: 16px; color: var(--muted); font-size: 11px; }
.second-amount-input { display: flex; align-items: center; color: var(--blue); font-family: "Archivo", sans-serif; font-size: clamp(29px, 4vw, 40px); font-weight: 900; line-height: 1; }
.second-amount-input > span { color: var(--gold); font-size: 1.12em; }
.second-amount-input input { min-width: 0; width: 100%; border: 0; border-bottom: 2px solid var(--line); outline: 0; padding: 0; color: inherit; background: transparent; font: inherit; }
.second-amount-input:focus-within input { border-color: var(--blue); }
.amount-limit-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 7px; }
.amount-limit-line span { color: var(--blue); font-size: 11px; font-weight: 700; }
.amount-limit-line button, .reset-amount { border: 0; padding: 0; color: var(--blue); background: transparent; font-size: 10px; font-weight: 900; text-decoration: underline; cursor: pointer; }
.second-cap-note { margin: 11px 0 0; border-radius: 9px; padding: 10px 12px; color: #8a3d36; background: var(--red-soft); font-size: 11px; font-weight: 800; line-height: 1.4; }

.compact-field { display: flex; min-width: 0; flex-direction: column; gap: 7px; }
.compact-field > span:first-child { color: #40506a; font-size: 12px; font-weight: 800; }
.compact-field small { color: var(--muted); font-size: 11px; }
.input-shell { position: relative; display: block; }
.input-shell::before, .input-shell::after { position: absolute; top: 50%; z-index: 1; transform: translateY(-50%); color: #8090a9; font-weight: 700; }
.input-shell.money::before { content: "$"; left: 13px; }
.input-shell.percent::after { content: "%"; right: 13px; }
.input-shell input, .input-shell select {
  width: 100%;
  height: 46px;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  outline: none;
  color: var(--ink);
  background: #fbfcfe;
  font-weight: 700;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.input-shell input { padding: 0 13px; }
.input-shell.money input { padding-left: 29px; }
.input-shell.percent input { padding-right: 30px; }
.input-shell select { padding: 0 36px 0 13px; appearance: none; cursor: pointer; }
.select-shell::after { content: "⌄"; right: 14px; color: var(--ink); pointer-events: none; }
.input-shell input:focus, .input-shell select:focus { border-color: var(--blue); background: #fff; box-shadow: 0 0 0 4px rgba(39, 100, 184, 0.12); }
.second-fields { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 10px; }

.assumption-panel {
  display: grid;
  grid-template-columns: 1fr 1fr 1.1fr;
  gap: 18px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px;
  background: rgba(255,255,255,.72);
}
.tax-readout { border-left: 1px solid var(--line); padding-left: 22px; }
.tax-readout span, .tax-readout small { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.tax-readout strong { display: block; margin: 3px 0; color: var(--blue); font-family: "Archivo", sans-serif; font-size: 28px; }

.payment-breakdown {
  display: grid;
  grid-template-columns: 0.9fr 1.2fr;
  gap: 40px;
  margin-top: 22px;
  border-radius: var(--radius);
  padding: 28px 30px;
}
.purchase-breakdown { border: 1px solid rgba(23,35,63,.1); color: #fff; background: var(--navy); }
.breakdown-heading h3 { margin: 0; font-size: clamp(25px, 4vw, 36px); line-height: 1.06; }
.payment-lines { margin: 0; }
.payment-lines > div { display: flex; justify-content: space-between; gap: 20px; padding: 9px 0; border-bottom: 1px dashed rgba(255,255,255,.18); }
.payment-lines dt { color: #bdc8d9; font-size: 13px; }
.payment-lines dd { margin: 0; font-weight: 800; text-align: right; }
.payment-lines .payment-total { margin-top: 7px; padding-top: 14px; border-top: 2px solid rgba(255,255,255,.5); border-bottom: 0; }
.payment-lines .payment-total dt { color: #fff; font-weight: 800; }
.payment-lines .payment-total dd { color: var(--gold); font-family: "Archivo", sans-serif; font-size: 31px; font-weight: 900; }
.balloon-note { grid-column: 1 / -1; margin: 0; border-radius: 9px; padding: 11px 13px; color: #7c3e37; background: var(--red-soft); font-size: 12px; font-weight: 700; }

.heloc-section { color: #fff; background: var(--navy); }
.light-heading .step { color: var(--navy); background: var(--gold); }
.light-heading .kicker { color: var(--gold); }
.light-heading h2 { color: #fff; }
.heloc-layout { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 18px; align-items: stretch; }
.rental-input-panel, .equity-card, .heloc-breakdown {
  border: 1px solid rgba(255,255,255,.15);
  border-radius: var(--radius);
  background: rgba(255,255,255,.07);
}
.rental-input-panel { padding: 26px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 16px; }
.heloc-section .compact-field > span:first-child, .heloc-section .compact-field small { color: #c2cddd; }
.heloc-section .input-shell input { border-color: rgba(255,255,255,.18); color: #fff; background: rgba(255,255,255,.08); }
.heloc-section .input-shell input:focus { border-color: #79a9e8; background: rgba(255,255,255,.12); }
.equity-card { padding: 27px; background: #fff; color: var(--ink); }
.equity-card > p { margin: 0 0 5px; color: var(--blue); font-size: 12px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.heloc-amount-input { display: flex; align-items: center; width: 100%; margin-bottom: 3px; color: var(--ink); font-family: "Archivo", sans-serif; font-size: clamp(34px, 5vw, 46px); font-weight: 900; line-height: 1; }
.heloc-amount-input > span { color: var(--gold); font-size: 1.12em; }
.heloc-amount-input input { min-width: 0; width: 100%; border: 0; border-bottom: 2px solid var(--line); outline: 0; padding: 0; color: inherit; background: transparent; font: inherit; }
.heloc-amount-input:focus-within input { border-color: var(--blue); }
.heloc-limit { display: block; margin-bottom: 22px; color: var(--muted); font-size: 11px; font-weight: 700; }
.reset-amount { display: block; margin: -15px 0 20px auto; }
.ltv-track { position: relative; display: flex; overflow: hidden; height: 17px; border-radius: 999px; background: #e8edf4; }
.ltv-track span { display: block; transition: width .25s ease; }
.balance-segment { background: var(--navy); }
.equity-segment { background: var(--blue); }
.ltv-track i { position: absolute; inset: 0 auto 0 80%; border-left: 2px dashed var(--red); }
.ltv-labels { display: flex; gap: 13px; margin: 8px 0 19px; color: var(--muted); font-size: 10px; font-weight: 700; }
.ltv-labels span:nth-child(2) { color: var(--blue); }
.ltv-labels b { margin-left: auto; color: var(--red); }
.equity-card dl { margin: 0; }
.equity-card dl > div { display: flex; justify-content: space-between; gap: 18px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.equity-card dt { color: var(--muted); font-size: 12px; }
.equity-card dd { margin: 0; font-weight: 800; text-align: right; }
.equity-card dl > div:nth-last-child(-n+2) dd { color: var(--blue); }

.heloc-breakdown { display: block; margin-top: 18px; padding: 28px 30px; }
.heloc-breakdown .breakdown-heading { margin-bottom: 20px; }
.rental-formula { display: grid; grid-template-columns: 1fr; overflow: hidden; border: 1px solid rgba(255,255,255,.16); border-radius: 12px; }
.rental-formula > div { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 19px 21px; background: rgba(255,255,255,.06); }
.rental-formula > div + div { border-top: 1px solid rgba(255,255,255,.16); }
.rental-formula .minus::before { content: "−"; position: absolute; left: 50%; top: -12px; display: grid; width: 24px; height: 24px; place-items: center; transform: translateX(-50%); border-radius: 50%; color: var(--navy); background: var(--gold); font-weight: 900; }
.rental-formula span { display: block; margin-bottom: 4px; color: #b9c5d7; font-size: 12px; font-weight: 700; }
.rental-formula strong { font-family: "Archivo", sans-serif; font-size: clamp(22px, 3vw, 31px); }
.rental-result { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 14px; border-radius: 12px; padding: 17px 20px; }
.rental-result span { font-weight: 800; }
.rental-result strong { font-family: "Archivo", sans-serif; font-size: 31px; }
.rental-result.positive { color: #bff0d6; background: rgba(24,116,78,.34); }
.rental-result.negative { color: #ffd0cb; background: rgba(164,59,52,.33); }
.combined-line { display: flex; align-items: center; justify-content: space-between; gap: 28px; margin-top: 18px; border: 1px solid rgba(255,255,255,.18); border-radius: var(--radius); padding: 26px 30px; background: linear-gradient(135deg, rgba(255,255,255,.08), rgba(39,100,184,.22)); }
.combined-line h3 { margin: 0; font-size: clamp(24px, 4vw, 36px); }
.combined-line > strong { color: var(--gold); font-family: "Archivo", sans-serif; font-size: clamp(40px, 6vw, 56px); line-height: 1; }

.close-section { padding: 56px 0; }
.close-card { display: grid; grid-template-columns: 250px 1fr auto; align-items: center; gap: 36px; border: 1px solid rgba(23,35,63,.08); border-radius: var(--radius); padding: 34px 38px; background: #fff; box-shadow: var(--shadow); }
.close-card img { width: 235px; max-width: 100%; }
.close-card h2 { margin: 0; font-size: 30px; }
.close-card p:not(.kicker) { margin: 7px 0 0; color: var(--muted); }
.button, .print-button { border: 0; border-radius: 9px; padding: 13px 18px; color: var(--navy); background: var(--gold); font-weight: 800; text-decoration: none; cursor: pointer; transition: filter 150ms ease, transform 150ms ease; }
.button:hover, .print-button:hover { filter: brightness(1.05); transform: translateY(-1px); }
footer { padding: 0 0 48px; color: #7c8798; font-size: 11px; line-height: 1.65; }
footer b { color: #535f73; }
.print-button { position: fixed; right: 18px; bottom: 18px; z-index: 10; box-shadow: 0 10px 28px rgba(23,35,63,.22); }

@media (max-width: 920px) {
  .structure-grid { grid-template-columns: 1fr 1fr; }
  .second-tile { grid-column: 1 / -1; }
  .heloc-layout { grid-template-columns: 1fr; }
  .close-card { grid-template-columns: 210px 1fr; }
  .close-card img { width: 195px; }
  .close-card .button { grid-column: 2; justify-self: start; }
}

@media (max-width: 680px) {
  .hero { padding: 30px 0 58px; }
  .logo-hero { width: min(310px, 82vw); margin-bottom: 38px; }
  .section { padding: 54px 0; }
  .section-heading h2 { font-size: clamp(38px, 11vw, 48px); }
  .price-panel { align-items: flex-start; flex-direction: column; gap: 10px; padding: 22px; }
  .price-input input { width: calc(100vw - 92px); text-align: left; }
  .structure-grid, .assumption-panel, .field-grid { grid-template-columns: 1fr; }
  .second-tile { grid-column: auto; }
  .second-fields { grid-template-columns: 1fr; }
  .tax-readout { border-top: 1px solid var(--line); border-left: 0; padding-top: 16px; padding-left: 0; }
  .payment-breakdown { grid-template-columns: 1fr; gap: 20px; padding: 23px 20px; }
  .balloon-note { grid-column: auto; }
  .combined-line { align-items: flex-start; flex-direction: column; }
  .close-card { grid-template-columns: 1fr; text-align: center; }
  .close-card img { width: min(240px, 80vw); margin: 0 auto; }
  .close-card .button { grid-column: auto; justify-self: center; }
  .print-button { position: static; display: block; margin: 0 auto 28px; }
}

@media print {
  .hero { padding: 24px 0; }
  .hero h1 { font-size: 40px; }
  .section { padding: 24px 0; }
  .price-panel, .structure-tile, .payment-breakdown, .equity-card, .combined-line, .close-card { break-inside: avoid; box-shadow: none; }
  .print-button, .close-section { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
