/* Borrower-facing payoff & refinance calculator. Standalone stylesheet --
   this page is public and consumer-styled, deliberately not the dashboard
   look. Light/dark follow the visitor's OS preference. */

:root {
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2f7d5a;          /* brand green, buttons/links only */
  --accent-ink: #ffffff;
  --good: #006300;
  --bad: #b32424;
  --series-cur: #2a78d6;      /* current loan */
  --series-refi: #eb6834;     /* refi scenario */
  --series-prin: #1baf7a;     /* payment -> principal */
  --series-int: #e34948;      /* payment -> interest */
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.05), 0 8px 24px rgba(11, 11, 11, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3f9a72;
    --good: #0ca30c;
    --bad: #e66767;
    --series-cur: #3987e5;
    --series-refi: #d95926;
    --series-prin: #199e70;
    --series-int: #e66767;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px 80px; }

/* --- Public nav (landing, calculators, about) --------------------------- */
.pubnav {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; flex-wrap: wrap;
  padding: 18px 0 0;
}
.pubnav-brand { font-weight: 750; font-size: 17px; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.pubnav-links { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.pubnav-links a { font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.pubnav-links a:hover, .pubnav-links a.active { color: var(--accent); }
.pubnav-signin {
  background: var(--accent); color: var(--accent-ink) !important;
  padding: 8px 18px; border-radius: 10px;
}
.pubnav-signin:hover { filter: brightness(1.07); }

/* --- Landing page -------------------------------------------------------- */
.landing-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; margin-top: 28px; }
.landing-cards .card { margin-top: 0; }
.landing-card { display: block; text-decoration: none; color: var(--ink); transition: transform 0.12s, box-shadow 0.15s, border-color 0.15s; }
a.landing-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.landing-card h2 { font-size: 18px; margin: 0 0 8px; }
.landing-card p { color: var(--ink-2); font-size: 14.5px; margin: 0 0 14px; }
.lc-emoji { font-size: 30px; margin-bottom: 10px; }
.lc-cta { font-weight: 650; color: var(--accent); font-size: 15px; }
.lc-soon {
  display: inline-block; vertical-align: middle;
  font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--border); border-radius: 999px;
  padding: 2px 10px; margin-left: 8px;
}
.landing-card-soon { opacity: 0.75; }
.landing-about .card-sub { font-size: 15px; }
.landing-about a { color: var(--accent); font-weight: 600; }

/* --- About page (placeholder) --------------------------------------------- */
.about-grid { display: grid; grid-template-columns: 180px 1fr; gap: 24px; align-items: start; }
.about-photo {
  aspect-ratio: 1; border: 2px dashed var(--border); border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 14px; background: var(--page);
}
@media (max-width: 560px) { .about-grid { grid-template-columns: 1fr; } .about-photo { max-width: 180px; } }

/* --- Hero ------------------------------------------------------------- */
.hero { padding: 56px 0 8px; text-align: center; }
.hero .eyebrow {
  display: inline-block;
  font-size: 13px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--accent);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 4px 14px; border-radius: 999px;
  margin-bottom: 18px;
}
.hero h1 { font-size: clamp(28px, 5vw, 42px); line-height: 1.15; margin: 0 0 12px; letter-spacing: -0.02em; }
.hero p { color: var(--ink-2); max-width: 520px; margin: 0 auto; font-size: 17px; }

/* --- Cards ------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px;
  margin-top: 28px;
}
.card > h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -0.01em; }
.card > .card-sub { margin: 0 0 20px; color: var(--muted); font-size: 14px; }

/* --- Inputs ----------------------------------------------------------- */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px 20px;
}
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--muted); }
.field .control { position: relative; }
.field .prefix, .field .suffix {
  position: absolute; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 15px; pointer-events: none;
}
.field .prefix { left: 12px; }
.field .suffix { right: 12px; }
.field input, .field select {
  width: 100%;
  font: inherit; font-size: 17px;
  color: var(--ink);
  background: var(--page);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field .control-pair { display: flex; gap: 8px; }
.field .control-pair select { min-width: 0; }
.field input.has-prefix { padding-left: 28px; }
.field input.has-suffix { padding-right: 30px; }
.field input:focus, .field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.field input::placeholder { color: var(--muted); }
/* strip number-input spinners; typing is the interaction here */
.field input::-webkit-outer-spin-button, .field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

.input-note { margin: 14px 0 0; font-size: 13px; color: var(--muted); }
.input-warning {
  margin: 14px 0 0; font-size: 14px; color: var(--bad);
  display: flex; gap: 8px; align-items: baseline;
}
.input-warning::before { content: "!"; font-weight: 700; flex: none; }

/* --- Stat tiles -------------------------------------------------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 22px; }
.tile {
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.tile .t-label { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
.tile .t-value { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.tile .t-detail { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }

/* Big highlight tiles for the refi comparison */
.tiles.highlights { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.tiles.highlights .tile { padding: 18px 20px; }
.tiles.highlights .t-value { font-size: 30px; }
.t-value.pos { color: var(--good); }
.t-value.neg { color: var(--bad); }

/* --- Charts ------------------------------------------------------------ */
.chart-block { margin-top: 26px; }
.chart-block h3 { margin: 0 0 2px; font-size: 15px; }
.chart-block .chart-sub { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.chart-box { position: relative; height: 260px; }
@media (max-width: 560px) { .chart-box { height: 220px; } }

.split-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 10px; }
.split-toggle button {
  font: inherit; font-size: 13px; font-weight: 600;
  color: var(--ink-2); background: transparent;
  border: none; padding: 6px 14px; cursor: pointer;
}
.split-toggle button.active { background: var(--accent); color: var(--accent-ink); }

/* --- CTA / buttons ------------------------------------------------------ */
.cta-row { text-align: center; margin-top: 26px; }
.btn {
  display: inline-block;
  font: inherit; font-size: 17px; font-weight: 650;
  background: var(--accent); color: var(--accent-ink);
  border: none; border-radius: 12px;
  padding: 14px 30px;
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* --- Rate pills --------------------------------------------------------- */
.rate-pills { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.rate-pill {
  font: inherit; text-align: left;
  background: var(--page);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.rate-pill .rp-term { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.rate-pill .rp-rate { font-size: 24px; font-weight: 650; color: var(--ink); letter-spacing: -0.01em; }
.rate-pill .rp-note { font-size: 12px; color: var(--muted); }
.rate-pill.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.custom-fields { margin: 4px 0 18px; }
.hidden { display: none !important; }

/* Lead form (nested inside the refi card, so the direct-child card rules miss it) */
#lead-form { margin-top: 26px; border-top: 1px solid var(--border); padding-top: 24px; }
#lead-form h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -0.01em; }
#lead-form .card-sub { margin: 0 0 20px; color: var(--muted); font-size: 14px; }

/* --- Amortization table (accessibility + power users) ------------------- */
details.amort { margin-top: 22px; }
details.amort summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.amort-scroll { overflow-x: auto; margin-top: 10px; }
.amort table { border-collapse: collapse; width: 100%; font-size: 13px; }
.amort th, .amort td { text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; font-variant-numeric: tabular-nums; }
.amort th:first-child, .amort td:first-child { text-align: left; }
.amort th { color: var(--muted); font-weight: 600; }

/* --- Footer -------------------------------------------------------------- */
.foot { margin-top: 48px; text-align: center; }
.foot .sig { font-weight: 600; color: var(--ink-2); }
.foot .disclaimer { max-width: 640px; margin: 14px auto 0; font-size: 12.5px; color: var(--muted); }
.foot .privacy-note { max-width: 640px; margin: 14px auto 0; font-size: 13px; color: var(--ink-2); }
.linklike {
  font: inherit; color: var(--accent); background: none; border: none;
  padding: 0; cursor: pointer; text-decoration: underline;
}
.foot a { color: var(--accent); }

/* Reveal animation for the refi section */
#refi-section { animation: rise 0.35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  #refi-section { animation: none; }
  html { scroll-behavior: auto; }
}
