/* My Best Mortgage Rates — shared design system.
   Warm, approachable mortgage landing pages. Default palette below is the Nestwise
   Every brand colour is a CSS variable so an affiliate's palette (fetched by
   ?partner key) can re-skin the whole page at runtime. Defaults below are the
   Oscar accent palette used when there is no partner / the fetch fails. */
:root {
  /* Affiliate-overridable brand colours (set by mbmr.js from partner branding). */
  --brand: #e0603c;          /* primary  — warm coral: buttons, key accents */
  --brand-2: #2a2420;        /* secondary — warm charcoal: headings          */
  --brand-3: #b96b2e;        /* tertiary — amber: links, highlights          */
  --on-brand: #ffffff;       /* text that sits on --brand (derived in JS)   */
  --brand-soft: #fbebe3;     /* soft tint of --brand (derived in JS)        */
  --brand-ring: rgba(224, 96, 60, 0.28);

  /* Fixed warm neutral surface (stays light regardless of affiliate). */
  --bg: #faf6f1;
  --surface: #ffffff;
  --ink: #211d1a;
  --ink-2: #6b6157;
  --line: #ece3d8;
  --shadow: 0 10px 30px rgba(14, 23, 38, 0.08);
  --shadow-lg: 0 24px 60px rgba(14, 23, 38, 0.14);
  --radius: 18px;
  --container: min(1140px, 92vw);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, Segoe UI, sans-serif;
  --font-head: "Sora", var(--font);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
.container { width: var(--container); margin: 0 auto; }
.eyebrow {
  display: inline-block; font-weight: 700; font-size: 0.74rem; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--brand-3);
}
h1, h2, h3 { font-family: var(--font-head); line-height: 1.08; color: var(--brand-2); margin: 0 0 0.5em; }
h1 { font-size: clamp(2.1rem, 5vw, 3.5rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); letter-spacing: -0.01em; }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1rem; }
.muted { color: var(--ink-2); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-weight: 700; font-size: 1rem; padding: 0.85rem 1.5rem; border-radius: 999px;
  border: 1px solid transparent; cursor: pointer; transition: transform 0.12s, box-shadow 0.2s, opacity 0.2s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--brand); color: var(--on-brand); box-shadow: 0 8px 20px var(--brand-ring); }
.btn-primary:hover { box-shadow: 0 12px 28px var(--brand-ring); }
.btn-ghost { background: transparent; color: var(--brand-2); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-lg { padding: 1rem 1.9rem; font-size: 1.06rem; }

/* Header — co-brand lockup */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 0; }
.cobrand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; }
.cobrand:hover { text-decoration: none; }
.cobrand .divider { width: 1px; height: 30px; background: var(--line); }
.cobrand .partner-name { font-weight: 700; color: var(--brand-2); font-size: 0.98rem; }
/* Affiliate logo shown alongside the My Best Mortgage Rates lockup (header + footer). */
.cobrand .cobrand-affiliate { height: 44px; width: auto; max-width: 200px; object-fit: contain; display: block; }
.footer-wrap .cobrand .cobrand-affiliate { height: 30px; max-width: 150px; }
@media (max-width: 560px) { .cobrand .cobrand-affiliate { height: 36px; max-width: 150px; } }

/* Brand lockup: mark + wordmark (inline SVG re-themes with affiliate colours). */
.mbmr-lockup { display: flex; align-items: center; gap: 0.62rem; }
.mbmr-mark { flex: 0 0 auto; display: block; border-radius: 12px; box-shadow: 0 6px 16px var(--brand-ring); }
.mbmr-wm { display: flex; flex-direction: column; line-height: 1.05; }
.mbmr-wm .wm1 { font-family: var(--font-head); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--brand-3); }
.mbmr-wm .wm2 { font-family: var(--font-head); font-size: 1.16rem; font-weight: 700; letter-spacing: -0.015em; color: var(--brand-2); }
.footer-wrap .mbmr-mark { width: 34px; height: 34px; }
.header-cta { display: flex; align-items: center; gap: 0.9rem; }
.header-phone { font-weight: 700; color: var(--brand-2); white-space: nowrap; }
@media (max-width: 640px) { .header-phone { display: none; } }

/* Hero */
.hero { position: relative; overflow: hidden; padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(2rem, 5vw, 3.5rem); }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(60% 80% at 85% -10%, var(--brand-soft), transparent 60%),
    radial-gradient(50% 60% at 0% 0%, rgba(0, 160, 91, 0.08), transparent 55%);
}
.hero-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; }
/* Stack below 1200px: the embedded funnel's internal two-column layout has a large
   min-width, so in the 940-1200 range a side-by-side grid crushes the copy column
   (~284px). Stacking gives the form the full container width instead. */
@media (max-width: 1200px) { .hero-grid { grid-template-columns: 1fr; } }
.hero-copy h1 span { color: var(--brand); }
.hero-copy .lead { font-size: 1.16rem; color: var(--ink-2); max-width: 34ch; }
.hero-cta { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-top: 1.5rem; }
.trust-row { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-top: 2rem; }
.trust-row .stat .n { font-family: var(--font-head); font-size: 1.7rem; color: var(--brand-2); font-weight: 700; }
.trust-row .stat .l { font-size: 0.82rem; color: var(--ink-2); }
.hero-checks { list-style: none; padding: 0; margin: 1.1rem 0 0; display: grid; gap: 0.6rem; max-width: 40ch; }
.hero-checks li { display: flex; gap: 0.6rem; align-items: flex-start; }
.hero-checks li svg { width: 20px; height: 20px; color: var(--brand-3); flex: 0 0 auto; margin-top: 2px; }
.funnel-fallback { padding: 2rem 1.2rem; text-align: center; }

/* The embedded funnel card */
.funnel-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.funnel-card .fc-head {
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 0.6rem; background: var(--brand-soft);
}
.funnel-card .fc-head .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand-3); box-shadow: 0 0 0 4px rgba(0, 160, 91, 0.15); }
.funnel-card .fc-head .t { font-weight: 700; color: var(--brand-2); font-size: 0.92rem; }
.funnel-card .fc-body { padding: 0.35rem; }
.funnel-mount { min-height: 420px; }

/* Sections */
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.section-head { max-width: 640px; margin: 0 auto 2rem; text-align: center; }
.section-head.left { margin-left: 0; text-align: left; }
.grid { display: grid; gap: 1.1rem; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 860px) { .cols-3, .cols-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .cols-3, .cols-4 { grid-template-columns: 1fr; } }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem; box-shadow: var(--shadow); transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}
.card .ico {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); margin-bottom: 0.9rem;
}
.card .ico svg { width: 22px; height: 22px; }
.card h3 { margin-bottom: 0.3rem; }
.card p { margin: 0; color: var(--ink-2); font-size: 0.95rem; }

/* Funnel picker cards (hub) */
a.pick {
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
}
a.pick:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--brand); text-decoration: none; }
a.pick .arrow { margin-top: auto; padding-top: 1rem; font-weight: 700; color: var(--brand); display: inline-flex; align-items: center; gap: 0.35rem; }

/* Trust strip / logos / band */
.band { background: var(--brand-2); color: #fff; }
.band h2 { color: #fff; }
.band .muted, .band p { color: rgba(255, 255, 255, 0.8); }
.band .stat .n { color: #fff; }
.band .stat .l { color: rgba(255, 255, 255, 0.72); }

/* Steps */
.steps { counter-reset: step; }
.step { display: flex; gap: 1rem; align-items: flex-start; }
.step .num {
  counter-increment: step; flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%;
  background: var(--brand); color: var(--on-brand); font-weight: 700; display: grid; place-items: center;
}
.step .num::before { content: counter(step); }

/* FAQ */
.faq details {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 0.9rem 1.15rem; margin-bottom: 0.7rem;
}
.faq summary { font-weight: 700; color: var(--brand-2); cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; color: var(--brand); font-weight: 700; }
.faq details[open] summary::after { content: "\2013"; }
.faq details p { margin: 0.7rem 0 0; color: var(--ink-2); }

/* "Brokered by Cannect" partner card (injected before the footer on every page) */
.cannect-card {
  display: grid; grid-template-columns: auto 1fr; gap: 1.4rem; align-items: start;
  background: linear-gradient(135deg, var(--brand-soft), var(--surface));
  border: 1px solid var(--line); border-left: 4px solid var(--brand);
  border-radius: var(--radius); padding: clamp(1.4rem, 3vw, 2.2rem); box-shadow: var(--shadow);
}
.cannect-card .badge {
  flex: 0 0 auto; width: 60px; height: 60px; border-radius: 16px; display: grid; place-items: center;
  background: var(--brand); color: var(--on-brand); box-shadow: 0 8px 20px var(--brand-ring);
}
.cannect-card .badge svg { width: 30px; height: 30px; }
.cannect-card h2 { font-size: clamp(1.3rem, 2.4vw, 1.75rem); margin-bottom: 0.4rem; }
.cannect-card p { color: var(--ink-2); margin: 0 0 1rem; max-width: 68ch; }
.cannect-points { display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; }
.cannect-points span { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 600; color: var(--brand-2); font-size: 0.92rem; }
.cannect-points span svg { width: 18px; height: 18px; color: var(--brand-3); flex: 0 0 auto; }
.cannect-contact { display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.cannect-contact a { display: inline-flex; align-items: center; gap: 0.45rem; font-weight: 700; color: var(--brand); text-decoration: none; }
.cannect-contact a:hover { text-decoration: underline; }
.cannect-contact a svg { width: 18px; height: 18px; flex: 0 0 auto; }
.cannect-contact a.cannect-visit { margin-left: auto; padding: 0.45rem 1rem; border-radius: 999px; background: var(--brand); color: var(--on-brand); box-shadow: 0 6px 16px var(--brand-ring); }
.cannect-contact a.cannect-visit:hover { text-decoration: none; opacity: 0.92; }
@media (max-width: 560px) { .cannect-card { grid-template-columns: 1fr; } .cannect-contact a.cannect-visit { margin-left: 0; } }

/* Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 2rem; background: var(--surface); }
.footer-wrap { padding: 2.2rem 0; display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.5rem; }
@media (max-width: 720px) { .footer-wrap { grid-template-columns: 1fr; } }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; }
.footer-links a { color: var(--ink-2); font-size: 0.92rem; }
.legal { font-size: 0.78rem; color: var(--ink-2); border-top: 1px solid var(--line); padding: 1rem 0 1.6rem; }

/* Utilities */
.center { text-align: center; }
.mt-2 { margin-top: 0.7rem; } .mt-3 { margin-top: 1.1rem; } .mt-4 { margin-top: 1.6rem; }
.hide { display: none !important; }

/* Page fade — hides the affiliate brand-swap flicker on load and cross-fades
   between page changes. Set on <html> by an inline head script; removed by
   mbmr.js/calc.js once branding is applied (or a 1.2s safety timeout). */
html.mbmr-fade body { opacity: 0; }
body { opacity: 1; transition: opacity 0.28s ease; }
@media (prefers-reduced-motion: reduce) { body { transition: none; } html.mbmr-fade body { opacity: 1; } }
