/* =========================================================
   mortgagecalconline.com — Unified stylesheet
   Used by: /index.html, /pages/*.html
   ========================================================= */

:root {
  --bg: #f2f7f5;
  --surface: #ffffff;
  --surface-2: #f6faf8;
  --border: #dce8e3;
  --text: #0b1f1a;
  --text-muted: #5b7269;
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-soft: #d1fae5;
  --accent: #f97316;
  --danger: #dc2626;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(15, 35, 30, 0.06);
  --shadow: 0 1px 3px rgba(15, 35, 30, 0.06), 0 4px 24px rgba(13, 148, 136, 0.06);
  --shadow-lg: 0 1px 3px rgba(15, 35, 30, 0.06), 0 20px 48px rgba(13, 148, 136, 0.12);
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #07141a;
  --surface: #0f1f26;
  --surface-2: #152a33;
  --border: #1f3a44;
  --text: #e0f2f1;
  --text-muted: #8ba7a2;
  --primary: #2dd4bf;
  --primary-dark: #14b8a6;
  --primary-soft: #0e3934;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 24px rgba(0,0,0,0.3);
  --shadow-lg: 0 1px 3px rgba(0,0,0,0.3), 0 20px 48px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }

/* ---------- Layout ---------- */
.page { max-width: 1200px; margin: 0 auto; padding: 20px 24px 40px; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.section { padding: 48px 0; }

/* ---------- Header / nav ---------- */
header.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand:hover { color: var(--primary); text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #14b8a6, #22c55e);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700;
  flex-shrink: 0;
}
.brand-title { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; margin: 0; line-height: 1.15; }
.brand-sub { font-size: 0.78rem; color: var(--text-muted); }

nav.site-nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
nav.site-nav a {
  color: var(--text-muted); text-decoration: none;
  padding: 8px 12px; border-radius: 8px; font-size: 0.9rem; font-weight: 500;
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
nav.site-nav a:hover { color: var(--primary); background: var(--surface); border-color: var(--border); text-decoration: none; }
nav.site-nav a[aria-current="page"] {
  color: var(--primary-dark); background: var(--surface);
  border-color: var(--border); font-weight: 600;
}

.theme-btn {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); cursor: pointer; font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Breadcrumbs ---------- */
nav.crumbs { font-size: 0.85rem; color: var(--text-muted); margin: 4px 0 10px; }
nav.crumbs a { color: var(--text-muted); }
nav.crumbs a:hover { color: var(--primary); }
nav.crumbs span[aria-current] { color: var(--text); }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  max-width: 820px;
  margin: 16px auto 40px;
  padding: 0 20px;
}
.hero h1 {
  font-size: clamp(2rem, 3.5vw + 1rem, 3.3rem);
  font-weight: 800;
  letter-spacing: -0.022em;
  margin: 0 0 16px;
  line-height: 1.08;
}
.hero p {
  color: var(--text-muted);
  font-size: clamp(1.05rem, .5vw + .95rem, 1.25rem);
  margin: 0 0 24px;
}
.hero .cta-row { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px;
  font-weight: 600; font-size: 0.95rem; font-family: inherit;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  text-decoration: none; cursor: pointer;
  transition: transform .12s, box-shadow .12s, background .12s, border-color .12s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); text-decoration: none; border-color: var(--primary); color: var(--text); }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

/* ---------- Calculator cards grid (homepage) ---------- */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin: 24px 0;
}
.calc-card {
  display: block;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  position: relative;
  overflow: hidden;
}
.calc-card::before {
  content: "";
  position: absolute; inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), #22c55e);
  opacity: 0; transition: opacity .15s;
}
.calc-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary); text-decoration: none; color: var(--text); }
.calc-card:hover::before { opacity: 1; }
.calc-card .icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--primary-soft); color: var(--primary-dark);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.calc-card h3 { font-size: 1.15rem; margin: 0 0 6px; font-weight: 700; letter-spacing: -0.01em; }
.calc-card p { margin: 0 0 10px; color: var(--text-muted); font-size: 0.94rem; }
.calc-card .arrow { color: var(--primary); font-weight: 600; font-size: 0.9rem; }

/* ---------- Section headings ---------- */
.section-title {
  text-align: center; max-width: 760px; margin: 0 auto 28px;
}
.section-title h2 {
  font-size: clamp(1.6rem, 2vw + 1rem, 2.2rem);
  font-weight: 800; letter-spacing: -0.015em; margin: 0 0 10px;
}
.section-title p { color: var(--text-muted); font-size: 1.02rem; margin: 0; }

/* ---------- Feature list ---------- */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin: 18px 0;
}
.feature {
  padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.feature h4 { margin: 0 0 6px; font-size: 1.02rem; font-weight: 700; color: var(--primary-dark); }
.feature p { margin: 0; color: var(--text-muted); font-size: 0.92rem; }

/* ---------- Calculator shells (standalone pages) ---------- */
.calc-page-hero { text-align: center; max-width: 820px; margin: 8px auto 28px; padding: 0 20px; }
.calc-page-hero h1 {
  font-size: clamp(1.9rem, 3vw + 1rem, 2.8rem);
  font-weight: 800; letter-spacing: -0.022em; margin: 0 0 14px; line-height: 1.12;
}
.calc-page-hero p { color: var(--text-muted); font-size: clamp(1rem, .4vw + .9rem, 1.12rem); margin: 0; }

.calc-shell {
  max-width: 1100px; margin: 0 auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 26px;
}
@media (max-width: 860px) {
  .calc-shell { grid-template-columns: 1fr; padding: 20px; }
}
.calc-shell h2 { font-size: 1.08rem; font-weight: 700; margin: 0 0 14px; }

/* ---------- Inputs (shared between calculators) ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; position: relative; }
.field label { font-size: 0.86rem; font-weight: 600; color: var(--text); }
.field input[type="number"],
.field select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  appearance: textfield; -webkit-appearance: none; -moz-appearance: textfield;
}
.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field input:focus, .field select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, .15);
}

/* Prefix/suffix unit inside input */
.input-unit { position: relative; }
.input-unit .unit {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-size: 0.95rem; font-weight: 500;
  pointer-events: none; line-height: 1;
}
.input-unit input[type="number"] { padding-left: 32px; }
.input-unit.suffix .unit { left: auto; right: 14px; }
.input-unit.suffix input[type="number"] { padding-left: 14px; padding-right: 32px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }

/* Segmented toggle (for % / $ switches) */
.toggle {
  display: inline-flex; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px; gap: 2px;
}
.toggle button {
  border: 0; background: transparent; padding: 4px 10px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600; font-family: inherit;
  color: var(--text-muted); cursor: pointer;
}
.toggle button.active { background: var(--primary); color: #fff; }

/* ---------- Results panel ---------- */
.result-hero {
  text-align: center; padding: 22px 16px;
  background: linear-gradient(135deg, var(--primary), #14b8a6);
  border-radius: var(--radius); color: #fff; margin-bottom: 16px;
}
.result-hero .label {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em;
  opacity: 0.9; margin-bottom: 6px;
}
.result-hero .amount {
  font-size: clamp(2.2rem, 4vw + 1rem, 3.2rem);
  font-weight: 800; letter-spacing: -0.02em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.result-hero .sub { font-size: 0.85rem; opacity: 0.9; margin-top: 6px; }

.breakdown { list-style: none; padding: 0; margin: 0; }
.breakdown li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 4px; border-bottom: 1px solid var(--border); font-size: 0.94rem;
}
.breakdown li:last-child { border-bottom: 0; padding-top: 12px; font-weight: 700; }
.breakdown .lbl { color: var(--text-muted); }
.breakdown .val { font-variant-numeric: tabular-nums; }

.stat-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px;
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 10px; text-align: center;
}
.stat .stat-lbl {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); margin-bottom: 4px;
}
.stat .stat-val { font-size: 0.95rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Affordability 3-column results ---------- */
.scenario-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
@media (max-width: 760px) { .scenario-grid { grid-template-columns: 1fr; } }
.scenario {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 14px; text-align: center;
}
.scenario.recommended {
  background: linear-gradient(135deg, var(--primary), #14b8a6);
  color: #fff; border-color: var(--primary);
}
.scenario .tier-label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  opacity: 0.85; margin-bottom: 2px;
}
.scenario .tier-name { font-size: 1.05rem; font-weight: 700; margin-bottom: 10px; }
.scenario .tier-amount { font-size: clamp(1.5rem, 1.5vw + 1rem, 2.1rem); font-weight: 800; letter-spacing: -0.015em; line-height: 1; font-variant-numeric: tabular-nums; }
.scenario .tier-est { font-size: 0.78rem; opacity: 0.85; margin-top: 4px; }
.scenario .tier-row {
  display: flex; justify-content: space-between; font-size: 0.82rem;
  padding: 6px 0; margin-top: 10px; border-top: 1px solid rgba(255,255,255,.2);
}
.scenario:not(.recommended) .tier-row { border-top-color: var(--border); color: var(--text-muted); }
.scenario:not(.recommended) .tier-row strong { color: var(--text); }

/* ---------- Copy / explanation ---------- */
.copy { max-width: 820px; margin: 40px auto 0; font-size: 1rem; }
.copy h2 { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em; margin: 28px 0 10px; }
.copy h3 { font-size: 1.08rem; font-weight: 700; margin: 16px 0 6px; }
.copy p { margin: 0 0 10px; color: var(--text); }
.copy ul { margin: 0 0 14px; padding-left: 20px; }
.copy li { margin: 4px 0; }
.copy .callout {
  background: var(--primary-soft); border-left: 3px solid var(--primary);
  padding: 12px 14px; border-radius: 8px; margin: 14px 0; font-size: 0.94rem;
}

/* ---------- FAQ ---------- */
.faq { max-width: 820px; margin: 24px auto 0; }
.faq h2 { font-size: 1.45rem; font-weight: 700; margin: 24px 0 14px; }
.faq details {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 8px;
}
.faq summary { font-weight: 600; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; font-weight: 400; color: var(--text-muted); transition: transform .15s; }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { margin: 8px 0 4px; color: var(--text); font-size: 0.94rem; }

/* ---------- Related / footer ---------- */
section.related { max-width: 1100px; margin: 48px auto 0; padding: 0 20px; }
section.related h2 { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 14px; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.related-card {
  display: block; padding: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.related-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--primary); color: var(--text); text-decoration: none; }
.related-card h3 { margin: 0 0 6px; font-size: 1.02rem; color: var(--primary-dark); }
.related-card p { margin: 0; font-size: 0.88rem; color: var(--text-muted); }

footer.site-footer {
  max-width: 1100px; margin: 56px auto 0; padding: 24px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  font-size: 0.85rem; color: var(--text-muted);
}
footer.site-footer a { color: var(--text-muted); margin: 0 8px; }
footer.site-footer a:hover { color: var(--primary); }

/* ---------- Mobile tweaks ---------- */
@media (max-width: 640px) {
  .page { padding: 16px 16px 32px; }
  .brand-sub { display: none; }
  nav.site-nav a { padding: 6px 10px; font-size: 0.85rem; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .stat .stat-val { font-size: 0.86rem; }
}
