/* =============================================================
   Buy Before You Sell — Cornerstone First Mortgage
   Design system: minimal, editorial, Arizona-warm.
   No purple gradients. No Inter/Roboto. No generic tech blue-on-white.
   ============================================================= */

:root {
  /* Core palette — desert-warm over brand navy */
  --navy:        #002e5e;   /* brand primary (matches logo) */
  --navy-700:    #072147;
  --navy-50:     #eef2f8;

  --ink:         #1f2430;   /* body text on light */
  --ink-soft:    #52586a;   /* secondary text */
  --rule:        #e6e2db;   /* hairlines */

  --cream:       #f7f3ec;   /* page surfaces (warm, not gray) */
  --sand:        #efe7d9;   /* secondary surface */
  --paper:       #ffffff;

  --clay:        #b5532a;   /* terracotta accent — desert clay */
  --clay-700:    #933f1f;
  --gold:        #c9a24a;   /* muted saguaro gold */
  --sage:        #7a8a6b;   /* desert sage — success tone */

  /* Type scale (modular, ~1.250 minor third at mobile, ~1.333 at desktop) */
  --font-display: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body:    "Libre Franklin", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --step--1: clamp(0.82rem, 0.80rem + 0.1vw, 0.88rem);
  --step-0:  clamp(1.00rem, 0.96rem + 0.2vw, 1.08rem);
  --step-1:  clamp(1.20rem, 1.12rem + 0.4vw, 1.35rem);
  --step-2:  clamp(1.45rem, 1.30rem + 0.7vw, 1.70rem);
  --step-3:  clamp(1.80rem, 1.55rem + 1.3vw, 2.30rem);
  --step-4:  clamp(2.20rem, 1.80rem + 2.0vw, 3.10rem);
  --step-5:  clamp(2.80rem, 2.20rem + 3.0vw, 4.20rem);

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
  --space-6: 4.5rem;
  --space-7: 6rem;

  --max: 1180px;
  --radius: 6px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(12, 22, 45, 0.06);
  --shadow: 0 8px 24px rgba(12, 22, 45, 0.08);
}

/* -------- Reset & base -------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: "ss01", "kern";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: var(--navy); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--clay); }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--navy);
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-weight: 500;
  margin: 0 0 var(--space-3);
  font-variation-settings: "opsz" 36;
}
h1 { font-size: var(--step-5); font-weight: 500; }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }
p  { margin: 0 0 var(--space-3); max-width: 62ch; }
p.lede { font-size: var(--step-1); color: var(--ink-soft); max-width: 52ch; }
small, .micro { font-size: var(--step--1); color: var(--ink-soft); }
hr { border: 0; border-top: 1px solid var(--rule); margin: var(--space-5) 0; }
ul, ol { padding-left: 1.1em; }
li { margin-bottom: 0.35rem; }
code, pre { font-family: "SF Mono", ui-monospace, Menlo, monospace; }
::selection { background: var(--gold); color: var(--navy-700); }

/* -------- Skip link & accessibility -------- */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--navy); color: #fff; padding: 0.6rem 1rem;
  z-index: 1000; border-radius: 0 0 6px 0;
}
.skip-link:focus { left: 0; }
:focus-visible { outline: 2px solid var(--clay); outline-offset: 2px; }

/* -------- Layout primitives -------- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--space-3); }
.section { padding: var(--space-6) 0; }
.section--tight { padding: var(--space-5) 0; }
.section--cream { background: var(--cream); }
.section--sand  { background: var(--sand); }
.section--navy  { background: var(--navy); color: #e9ecf1; }
.section--navy h1, .section--navy h2, .section--navy h3 { color: #fff; }
.section--navy p { color: #c6cbd6; }
.section--navy a { color: #fff; text-decoration-color: var(--gold); }

.grid { display: grid; gap: var(--space-3); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

/* Eyebrow label */
.eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--clay);
  margin-bottom: var(--space-2);
}

/* -------- Top bar & nav -------- */
.topbar {
  background: var(--navy-700);
  color: #cfd6e3;
  font-size: var(--step--1);
  padding: 0.4rem 0;
}
.topbar .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.topbar a { color: #fff; text-decoration: none; }
.topbar a:hover { color: var(--gold); }

.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.nav__inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 0; gap: 1rem;
}
.nav__logo { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.nav__logo img { height: 34px; width: auto; }
.nav__logo-text { font-family: var(--font-display); color: var(--navy); font-size: 1.05rem; font-weight: 500; }
.nav__logo-text small { display: block; font-family: var(--font-body); font-size: 0.72rem; color: var(--ink-soft); letter-spacing: 0.12em; text-transform: uppercase; font-weight: 500; }
.nav__links { display: flex; gap: 1.5rem; list-style: none; margin: 0; padding: 0; align-items: center; }
.nav__links a {
  color: var(--navy); text-decoration: none;
  font-size: 0.95rem; font-weight: 500; padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
.nav__links a:hover, .nav__links a[aria-current="page"] {
  color: var(--clay); border-bottom-color: var(--clay);
}
.nav__toggle {
  display: none; background: none; border: 1px solid var(--rule);
  border-radius: 4px; padding: 0.45rem 0.7rem; font-size: 1rem; cursor: pointer;
}

@media (max-width: 860px) {
  .nav__links { display: none; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: #fff; padding: 1rem 1.2rem; border-bottom: 1px solid var(--rule); gap: 0.8rem; }
  .nav__links.is-open { display: flex; }
  .nav__toggle { display: inline-block; }
  .nav__inner { position: relative; }
}

/* -------- Buttons -------- */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600; font-size: 0.98rem;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  border: 1px solid transparent;
  cursor: pointer;
  letter-spacing: 0.02em;
  min-height: 44px;
  line-height: 1.2;
}
.btn--primary { background: var(--clay); color: #fff; }
.btn--primary:hover { background: var(--clay-700); color: #fff; transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn--ghost:hover { background: var(--navy); color: #fff; }
.btn--on-navy { background: var(--gold); color: var(--navy-700); border-color: var(--gold); }
.btn--on-navy:hover { background: #e0bd66; color: var(--navy-700); }

/* Apply Now — highest-pop CTA: bright orange, navy text, subtle glow */
.btn--apply {
  background: #ea5a1a;
  color: #002e5e;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 14px rgba(234, 90, 26, 0.28);
}
.btn--apply:hover {
  background: #ff6e2e;
  color: #002e5e;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(234, 90, 26, 0.42);
}
.btn + .btn { margin-left: 0.6rem; }

/* -------- Hero -------- */
.hero {
  position: relative;
  background: var(--cream);
  overflow: hidden;
  padding: var(--space-7) 0 var(--space-6);
}
.hero::after { /* subtle horizon line */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px; background: var(--rule);
}
.hero__grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: var(--space-5); align-items: center; }
.hero__stats { display: flex; flex-wrap: wrap; gap: var(--space-4); margin: var(--space-4) 0; }
.hero__stat { min-width: 120px; }
.hero__stat .num { font-family: var(--font-display); font-size: var(--step-3); color: var(--clay); display: block; line-height: 1; }
.hero__stat .lbl { font-size: var(--step--1); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.hero__visual {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: linear-gradient(180deg, #c9a24a22 0%, #b5532a22 100%), var(--sand);
  box-shadow: var(--shadow);
}
.hero__visual img { width: 100%; height: 100%; object-fit: cover; image-rendering: auto; filter: saturate(0.95); }
@media (max-width: 820px) {
  .hero__grid { grid-template-columns: 1fr; }
}

/* -------- Cards -------- */
.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--gold); box-shadow: var(--shadow-sm); }
.card__tag { font-size: var(--step--1); letter-spacing: 0.1em; text-transform: uppercase; color: var(--clay); font-weight: 600; }
.card h3 { margin-top: 0.4rem; }
.card p { color: var(--ink-soft); }
.card__link { display: inline-block; margin-top: var(--space-2); color: var(--navy); font-weight: 600; }

/* Product card (more visual) */
.product {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.product__header {
  background: var(--navy);
  color: #fff;
  padding: var(--space-4);
}
.product__header h3 { color: #fff; margin: 0 0 0.4rem; }
.product__price { font-family: var(--font-display); font-size: var(--step-3); color: var(--gold); }
.product__price small { font-family: var(--font-body); font-size: 0.85rem; color: #cfd6e3; font-weight: 400; }
.product__body { padding: var(--space-4); }
.product__features { list-style: none; padding: 0; margin: 0 0 var(--space-3); }
.product__features li {
  padding: 0.6rem 0; border-bottom: 1px solid var(--rule);
  display: flex; gap: 0.6rem; align-items: flex-start;
}
.product__features li:last-child { border-bottom: none; }
.product__features li::before {
  content: "✓"; color: var(--sage); font-weight: 700; flex-shrink: 0;
}

/* -------- Tables -------- */
table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--rule);
  font-size: 0.96rem;
}
table.data th, table.data td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--rule);
}
table.data thead th {
  background: var(--navy); color: #fff;
  font-family: var(--font-body); font-weight: 600;
  letter-spacing: 0.03em;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:nth-child(even) td { background: var(--cream); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.good { color: var(--sage); font-weight: 600; }
table.data td.bad  { color: var(--clay); font-weight: 600; }

/* -------- Steps -------- */
.steps { counter-reset: step; display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.step {
  padding: var(--space-3);
  border-left: 3px solid var(--gold);
  background: var(--paper);
}
.step__num {
  font-family: var(--font-display);
  font-size: var(--step-3); color: var(--clay);
  display: block; line-height: 1;
}
.step h3 { margin-top: 0.3rem; font-size: var(--step-1); }
.step p { color: var(--ink-soft); margin-bottom: 0; }

/* -------- FAQ (details/summary) -------- */
.faq { display: grid; gap: 0.6rem; }
.faq details {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
}
.faq details[open] { border-color: var(--gold); }
.faq summary {
  cursor: pointer; font-weight: 600; font-size: 1.05rem;
  color: var(--navy); list-style: none;
  display: flex; justify-content: space-between; gap: 1rem;
}
.faq summary::after { content: "+"; font-size: 1.4rem; color: var(--clay); line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq summary::-webkit-details-marker { display: none; }
.faq details > *:not(summary) { margin-top: 0.7rem; color: var(--ink-soft); }

/* -------- Callouts -------- */
.callout {
  border-left: 4px solid var(--clay);
  background: var(--sand);
  padding: var(--space-3) var(--space-4);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: var(--space-4) 0;
}
.callout p:last-child { margin-bottom: 0; }

/* -------- Forms -------- */
.form { display: grid; gap: var(--space-3); max-width: 640px; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
@media (max-width: 640px) { .form__row { grid-template-columns: 1fr; } }
.form label {
  font-size: 0.88rem; font-weight: 600; color: var(--navy); display: block;
  margin-bottom: 0.3rem; letter-spacing: 0.02em;
}
.form input, .form select, .form textarea {
  width: 100%;
  font-family: var(--font-body); font-size: 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  transition: border-color 0.15s ease;
}
.form textarea { min-height: 120px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none; border-color: var(--clay);
}
.form__consent { font-size: 0.82rem; color: var(--ink-soft); }
.form__success {
  display: none;
  padding: 1rem; border-radius: var(--radius);
  background: #e7efe4; color: #2f4b27; border: 1px solid #bfd1b7;
}
.form__success.is-show { display: block; }

/* -------- Blog list -------- */
.blog-list { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.blog-card { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; transition: transform 0.2s ease, border-color 0.2s ease; }
.blog-card:hover { transform: translateY(-3px); border-color: var(--gold); }
.blog-card img { aspect-ratio: 16 / 10; object-fit: cover; width: 100%; }
.blog-card__body { padding: var(--space-3); display: flex; flex-direction: column; gap: 0.6rem; flex-grow: 1; }
.blog-card__meta { font-size: 0.82rem; color: var(--ink-soft); letter-spacing: 0.05em; }
.blog-card__cat { color: var(--clay); text-transform: uppercase; font-weight: 700; font-size: 0.72rem; letter-spacing: 0.12em; }
.blog-card h3 { font-size: var(--step-1); margin: 0; }
.blog-card h3 a { color: var(--navy); text-decoration: none; }
.blog-card h3 a:hover { color: var(--clay); }
.blog-card p { color: var(--ink-soft); margin: 0; flex-grow: 1; }
.blog-card__more { color: var(--clay); font-weight: 600; text-decoration: none; margin-top: auto; }

/* -------- Article / long-form -------- */
.article { max-width: 720px; margin: 0 auto; }
.article h1 { font-size: var(--step-4); }
.article h2 { font-size: var(--step-2); margin-top: var(--space-5); }
.article h3 { font-size: var(--step-1); margin-top: var(--space-3); }
.article p, .article li { font-size: 1.05rem; }
.article img { border-radius: var(--radius-lg); margin: var(--space-4) 0; }
.article ul, .article ol { margin-bottom: var(--space-3); }
.article .meta { color: var(--ink-soft); font-size: 0.9rem; letter-spacing: 0.03em; margin-bottom: var(--space-3); }
.article blockquote { border-left: 3px solid var(--gold); padding: 0.2rem 0 0.2rem 1.2rem; margin: var(--space-3) 0; color: var(--ink-soft); font-style: italic; }
.toc { background: var(--cream); border-radius: var(--radius); padding: var(--space-3); margin-bottom: var(--space-4); }
.toc h2 { margin: 0 0 0.6rem; font-size: var(--step-1); }
.toc ol { margin: 0; padding-left: 1.2em; }

/* -------- Breadcrumbs -------- */
.crumbs { font-size: 0.85rem; color: var(--ink-soft); margin: 0 0 var(--space-3); }
.crumbs a { color: var(--ink-soft); text-decoration: none; }
.crumbs a:hover { color: var(--clay); }
.crumbs [aria-current="page"] { color: var(--navy); }
.crumbs span { margin: 0 0.4rem; color: var(--rule); }

/* -------- Badges / trust -------- */
.trust-row { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-5); align-items: center; color: var(--ink-soft); font-size: 0.92rem; }
.trust-row strong { color: var(--navy); }

/* -------- Reviews widget (experience.com) -------- */
.reviews-widget { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: var(--space-4); }
.reviews-widget__frame { max-width: 960px; margin: 0 auto; }

/* -------- Testimonial -------- */
.quote {
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-lg);
  padding: var(--space-4); position: relative;
}
.quote::before {
  content: "\201C"; font-family: var(--font-display); font-size: 4rem; color: var(--gold);
  position: absolute; top: 0.4rem; left: 1rem; line-height: 1; opacity: 0.5;
}
.quote p { font-size: 1.05rem; font-style: italic; color: var(--ink); }
.quote__who { font-size: 0.9rem; color: var(--ink-soft); margin-top: var(--space-2); }
.quote__who strong { color: var(--navy); font-style: normal; }

/* -------- Footer -------- */
.footer {
  background: var(--navy);
  color: #c6cbd6;
  padding: var(--space-6) 0 var(--space-3);
  font-size: 0.95rem;
}
.footer a { color: #fff; text-decoration: none; }
.footer a:hover { color: var(--gold); }
.footer__grid { display: grid; gap: var(--space-4); grid-template-columns: 1.4fr 1fr 1fr 1fr; }
@media (max-width: 820px) { .footer__grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer__grid { grid-template-columns: 1fr; } }
.footer h4 { color: #fff; font-family: var(--font-body); font-size: 0.82rem; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; margin-bottom: var(--space-2); }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin-bottom: 0.45rem; }
.footer__logo img { height: 38px; filter: brightness(0) invert(1); margin-bottom: 0.8rem; }
.footer__disclaimer {
  border-top: 1px solid rgba(255,255,255,0.12);
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  font-size: 0.8rem; color: #9aa3b5; line-height: 1.55;
}
.footer__eho { display: inline-flex; align-items: center; gap: 0.7rem; font-size: 0.85rem; margin-bottom: 0.6rem; }
.footer__eho img { width: 56px; height: 59px; display: inline-block; }
.footer__eho svg { width: auto; height: 48px; filter: brightness(0) invert(1); }

/* -------- Utilities -------- */
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mb-0 { margin-bottom: 0; }
.flex-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.measure { max-width: 62ch; }
.hide-sm { }
@media (max-width: 640px) { .hide-sm { display: none; } }

/* -------- Print -------- */
@media print {
  .nav, .footer, .topbar, .btn { display: none !important; }
  body { color: #000; background: #fff; }
  a { color: #000; text-decoration: underline; }
}
