/* ============================================================
   Mark Norman – Better Mortgage Solutions
   Site-wide design system for mark-norman.ca.
   Funnel palette (navy + gold), Inter, flat/spacious/premium:
   white space does the work, gold is a restrained accent.
   Funnels keep their own stylesheet (assets/funnel.css).
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --navy: #173a70;
  --navy-2: #224c8f;
  --ink: #0f2748;
  --gold: #d8b56a;
  --gold-2: #ecd39b;
  --gold-deep: #8a6a24; /* AA on white (5.04:1) and paper (4.70:1) */
  --white: #ffffff;
  --paper: #f6f7f9;
  --border: #dcdfe6;
  --hairline: #e6e9ef;
  --text: #333b49;
  --muted: #5f6672;
  --shadow: 0 18px 50px rgba(15, 39, 72, 0.12);
  --shadow-sm: 0 6px 18px rgba(15, 39, 72, 0.08);
  --radius: 16px;
  --radius-sm: 10px;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, Helvetica, sans-serif;
  --container: 1120px;
  --gutter: clamp(18px, 4vw, 32px);
  --section-pad: clamp(48px, 8vw, 96px);
}

/* Breakpoint scale (mobile-first, min-width unless noted):
   600px  card grid 1→2 cols; trust-strip dividers appear
   720px  bottom CTA bar hidden at/above this (max-width: 719.98px)
   800px  footer stacks → 3 columns
   860px  hero + statement band split into 2 columns
   960px  desktop nav (drawer below); card grid → 4 cols */

/* Self-hosted Inter (variable) — no external font/CDN requests */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/site/fonts/inter.woff2') format('woff2');
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  color: var(--navy);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.1rem, 1.45rem + 3vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.55rem, 1.2rem + 1.8vw, 2.3rem); }
h3 { font-size: 1.15rem; letter-spacing: -0.01em; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--navy-2); text-underline-offset: 3px; }

ul, ol { margin: 0 0 1em; padding-left: 1.2em; }

button { font-family: inherit; }

/* Accessible focus */
:focus-visible {
  outline: 3px solid var(--navy-2);
  outline-offset: 2px;
  border-radius: 3px;
}
.band :focus-visible,
.trust-strip :focus-visible,
.site-footer :focus-visible { outline-color: var(--gold); }

/* ---------- Layout helpers ---------- */
.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-pad); }
.section--paper { background: var(--paper); }

.section-head { max-width: 760px; margin-bottom: clamp(28px, 4vw, 48px); }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head.center .lead { margin-inline: auto; }

.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--navy-2);
}
/* Gold accent: deep gold on light backgrounds (AA-compliant),
   bright gold on navy/ink components via the scoped overrides below. */
.accent { color: var(--gold-deep); }
.band .accent,
.trust-strip .accent,
.site-footer .accent { color: var(--gold); }

.lead {
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.2rem);
  line-height: 1.65;
  color: var(--text);
  max-width: 56ch;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- Buttons ---------- */
.btn-gold, .btn-navy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 26px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover { background: #cfa851; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-gold:active { transform: none; }
.btn-navy { background: var(--navy); color: var(--white); }
.btn-navy:hover { background: var(--navy-2); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-navy:active { transform: none; }
.btn-sm { padding: 10px 18px; font-size: 12.5px; }

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--navy);
  text-decoration: none;
}
.btn-link::after {
  content: "\2192"; /* → */
  color: var(--gold-deep); /* AA on white/paper; bright gold on dark below */
  font-size: 1.1em;
  transition: transform 0.15s ease;
}
.band .btn-link::after,
.trust-strip .btn-link::after,
.site-footer .btn-link::after { color: var(--gold); }
.btn-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.btn-link:hover::after { transform: translateX(3px); }
/* on navy bands the link itself goes white */
.band .btn-link { color: var(--white); }
/* buttons keep their identity inside bands (.band a would otherwise
   recolor them): gold stays ink-on-gold; navy becomes a white-outlined
   ghost button (a navy fill would vanish against the navy band) */
.band .btn-gold { color: var(--ink); }
.band .btn-navy {
  color: var(--white);
  background: transparent;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.9);
}
.band .btn-navy:hover { background: rgba(255, 255, 255, 0.12); }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--navy);
  color: var(--white);
  font-weight: 700;
  font-size: 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--white);
  border-bottom: 1px solid var(--hairline);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 64px;
  position: relative; /* anchors the mobile drawer */
}
.header-logo { display: inline-flex; flex: 0 0 auto; }
.header-logo img { width: 150px; }

.site-nav a {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--navy-2); }
.site-nav a[aria-current="page"] {
  color: var(--navy);
  box-shadow: inset 0 -2px 0 var(--gold);
}
.site-nav .btn-gold { color: var(--ink); }
.site-nav .btn-gold:hover { color: var(--ink); }

/* hamburger */
.nav-toggle {
  display: none;
  margin-left: auto;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; height: 44px;
  padding: 10px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.nav-toggle .nav-bar {
  display: block;
  width: 22px; height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] .nav-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* desktop nav */
@media (min-width: 960px) {
  .header-inner { min-height: 72px; }
  .header-logo img { width: 168px; }
  .site-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 26px;
  }
  .site-nav .btn-gold { margin-left: 6px; }
}

/* mobile drawer */
@media (max-width: 959.98px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;  /* .container has no border, so this is the full viewport width */
    right: 0;
    display: flex;
    flex-direction: column;
    padding: 6px var(--gutter) 20px;
    background: var(--white);
    border-bottom: 1px solid var(--hairline);
    box-shadow: var(--shadow-sm);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  }
  .site-nav.is-open { opacity: 1; visibility: visible; transform: none; }
  .site-nav a {
    padding: 13px 2px;
    font-size: 16px;
    border-bottom: 1px solid var(--hairline);
  }
  .site-nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--gold); }
  .site-nav .btn-gold {
    margin-top: 16px;
    padding: 14px 26px;
    font-size: 14px;
    border-bottom: none;
    justify-content: center;
  }
}

/* ---------- Trust strip (navy) ---------- */
.trust-strip { background: var(--navy); color: #eef1f7; }
.trust-strip .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  padding-block: 9px;
}
.trust-strip span {
  display: inline-flex;
  align-items: center;
  padding: 2px 16px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}
.trust-strip span + span { border-left: 1px solid rgba(255, 255, 255, 0.25); }
.trust-strip svg { width: 13px; height: 13px; margin-right: 7px; color: var(--gold); flex: 0 0 auto; }
/* stacked items on small screens: no dividers */
@media (max-width: 599.98px) {
  .trust-strip span + span { border-left: none; }
  .trust-strip span { padding-inline: 8px; }
}

/* ---------- Hero (split: text left / portrait right) ----------
   Structure: .hero > .container > .hero-grid > (.hero-copy + .hero-media > img) */
.hero { padding-block: var(--section-pad); }
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
}
.hero-copy .lead { margin-top: 18px; }
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  margin-top: 28px;
}
.hero-media img {
  width: 100%;
  border-radius: var(--radius);
  object-fit: cover;
}
@media (min-width: 860px) {
  .hero-grid { grid-template-columns: 1.05fr 0.95fr; }
}

/* ---------- Card grid (intent cards: 4 → 2 → 1) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 600px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) {
  .card-grid { grid-template-columns: repeat(4, 1fr); }
  .card-grid--cols-2 { grid-template-columns: repeat(2, 1fr); }
  .card-grid--cols-3 { grid-template-columns: repeat(3, 1fr); }
}

.intent-card {
  position: relative; /* anchors the .card-link whole-card overlay */
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: clamp(20px, 3vw, 28px);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.intent-card:hover { border-color: var(--navy-2); box-shadow: var(--shadow-sm); }
.intent-card > svg { width: 38px; height: 38px; color: var(--gold); margin-bottom: 6px; }
.intent-card h3 { margin-bottom: 0; }
.intent-card p { font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.intent-card .btn-link { margin-top: auto; padding-top: 8px; }
/* whole-card click affordance when the card's link carries .card-link */
.intent-card .card-link::before { content: ""; position: absolute; inset: 0; }
/* secondary in-card link (e.g. an alternate CTA below the main .card-link):
   position + z-index lift it above the .card-link::before whole-card overlay
   so it stays independently clickable instead of being swallowed by it. */
.intent-card .card-link-secondary { position: relative; z-index: 1; margin: 0; font-size: 13px; }

/* ---------- Navy statement band ----------
   Structure: .band > .container > .band-grid > (text div + .band-media > img) */
.band {
  background: var(--navy);
  color: var(--white);
  padding-block: var(--section-pad);
}
.band--ink { background: var(--ink); }
.band h2, .band h3 { color: var(--white); }
.band h2 { font-size: clamp(1.7rem, 1.25rem + 2.2vw, 2.6rem); }
.band p { color: rgba(255, 255, 255, 0.85); }
.band .eyebrow { color: var(--gold-2); }
.band a { color: var(--white); }

.band-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
}
.band-media img {
  width: 100%;
  border-radius: var(--radius);
  object-fit: cover;
}
@media (min-width: 860px) {
  .band-grid { grid-template-columns: 1.1fr 0.9fr; }
}

/* slim conversation bar: statement left, button right */
.band--slim { padding-block: clamp(26px, 4vw, 40px); }
.band-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 28px;
}
.band-row h2, .band-row p { margin: 0; }

/* ---------- Action rows & centering utilities ---------- */
/* canonical CTA wrapper inside bands / closing sections */
.band-actions {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.section-head.center .band-actions { justify-content: center; }
/* CCA seal images (landing + about) */
.award-seal { margin: 0 auto 20px; }
.chip-row--center { justify-content: center; }
.tag-row--center { justify-content: center; }
.hero-actions.center { justify-content: center; }
/* compact section (e.g. the Learn filter bar) */
.section--slim { padding-block: clamp(20px, 3vw, 32px); }
/* lead paragraph directly after an icon list gets breathing room */
.icon-list + .lead { margin-top: 24px; }

/* ---------- Icon list rows ---------- */
.icon-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}
.icon-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 16px;
  color: var(--text);
}
.icon-list li strong { color: var(--ink); }
.icon-list svg {
  width: 22px; height: 22px;
  flex: 0 0 auto;
  margin-top: 2px;
  color: var(--gold);
}
.band .icon-list li { color: rgba(255, 255, 255, 0.88); }
.band .icon-list li strong { color: var(--white); }

/* ---------- Icon chip grid (thin gold line icons + tiny labels) ---------- */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 22px 30px;
}
.chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  width: 96px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}
.chip svg { width: 30px; height: 30px; color: var(--gold); }
.band .chip { color: rgba(255, 255, 255, 0.92); }
@media (max-width: 599.98px) {
  .chip-row { gap: 18px 14px; justify-content: center; }
  .chip { width: 88px; }
}

/* ---------- Lender logo row (uniform, monochrome) ---------- */
.logo-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 22px 44px;
}
.logo-row img {
  height: 28px;
  width: auto;
  filter: grayscale(1);
  opacity: 0.72;
}
.logo-row .logo-more { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
/* Text wordmark fallback while official lender logo files are pending (site/img/lenders is empty; roster draft — spec §9) */
.logo-row .logo-word {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--muted); /* #5f6672 on white ≈ 5.5:1 — AA; no opacity (it dropped this below 4.5:1) */
  white-space: nowrap;
}

/* ---------- Review cards ----------
   Structure: .review-card > (blockquote + cite); gold quote mark is ::before */
.review-card {
  display: flex;
  flex-direction: column;
  padding: clamp(22px, 3vw, 28px);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.review-card::before {
  content: "\201C";
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 44px;
  line-height: 1;
  color: var(--gold);
}
.review-card blockquote {
  margin: 6px 0 16px;
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--text);
}
.review-card cite {
  margin-top: auto;
  font-style: normal;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
}

/* ---------- Article cards (Learn) ----------
   Structure: .article-card > (img + .article-body > (h3 + p + .btn-link)).
   The .article-body wrapper is REQUIRED — it provides the padding and the
   flex column that pins .btn-link to the card bottom. */
.article-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}
.article-card:hover { border-color: var(--navy-2); box-shadow: var(--shadow-sm); }
.article-card > img { aspect-ratio: 16 / 10; object-fit: cover; width: 100%; }
.article-card .article-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 8px;
  padding: 18px 20px 20px;
}
.article-card h3 { font-size: 1.05rem; margin-bottom: 0; }
.article-card p { font-size: 14px; line-height: 1.55; color: var(--muted); }
.article-card .btn-link { margin-top: auto; padding-top: 6px; font-size: 12px; }
.article-card .card-link::before { content: ""; position: absolute; inset: 0; }
.article-card[hidden] { display: none; }
[data-empty-msg] { margin-inline: auto; text-align: center; }
[data-empty-msg][hidden] { display: none; }

/* category chips / filter tags */
.tag-row { display: flex; flex-wrap: wrap; gap: 10px; }
.tag {
  display: inline-flex;
  align-items: center;
  padding: 7px 15px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--white);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.tag:hover { border-color: var(--navy-2); }
.tag.is-active, .tag[aria-pressed="true"] {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

/* ---------- Article body (Learn detail pages) ---------- */
.prose { max-width: 68ch; }
.prose h2 { margin-top: 1.6em; }
.prose h3 { margin-top: 1.4em; }
.prose p, .prose li { font-size: 16.5px; line-height: 1.7; }
.prose img { border-radius: var(--radius); margin-block: 1.5em; }
.prose blockquote {
  margin: 1.5em 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--gold);
  color: var(--ink);
  font-weight: 500;
}
.prose .byline { color: var(--muted); font-size: 14px; font-weight: 600; letter-spacing: 0.02em; margin-top: -0.4em; }

/* ---------- Calendar embed ---------- */
.calendar-embed { width: 100%; }
.calendar-embed iframe {
  width: 100%;
  min-height: 680px;
  border: none;
  display: block;
}

/* ---------- Footer (ink) ---------- */
.site-footer {
  background: var(--ink);
  color: rgba(255, 255, 255, 0.78);
  padding-block: clamp(44px, 6vw, 64px) 28px;
  font-size: 14.5px;
  line-height: 1.7;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 36px;
}
@media (min-width: 800px) {
  .footer-grid { grid-template-columns: 1.2fr 1fr 1fr; gap: 48px; }
}
.footer-heading {
  margin-bottom: 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-2);
}
.site-footer p { margin-bottom: 6px; }
.site-footer a { color: var(--white); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-underline-offset: 3px; }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-brand .premiere-logo { width: 150px; }
.footer-bottom {
  margin-top: clamp(32px, 5vw, 48px);
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}
.footer-bottom .small-print {
  font-size: 12.5px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.62);
  max-width: 72ch;
}

/* ---------- Mobile bottom CTA bar (<720px only) ---------- */
.bottom-cta { display: none; }
@media (max-width: 719.98px) {
  .bottom-cta {
    display: block;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 40;
    padding: 10px var(--gutter);
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--hairline);
  }
  .bottom-cta .btn-gold { display: flex; width: 100%; }
  /* keep page content and footer clear of the fixed bar */
  body { padding-bottom: calc(74px + env(safe-area-inset-bottom)); }
  html { scroll-padding-bottom: 90px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition: none !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
