/* ==========================================================================
   MyCarFi — site styles. Design tokens in :root; everything else uses them.
   ========================================================================== */

:root {
  --navy:        #0f2440;
  --navy-deep:   #091830;
  --ink:         #1a2433;
  --muted:       #5b6878;
  --line:        #e3e8ef;
  --paper:       #ffffff;
  --paper-tint:  #f4f7fb;
  --green:       #1f9d55;
  --green-dark:  #177a42;
  --green-tint:  #e8f6ee;
  --amber:       #d98b0b;
  --amber-tint:  #fdf4e3;
  --error:       #c11a1a;

  --font-head: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --radius:     10px;
  --radius-lg:  16px;
  --page-max:   1120px;
  --article-max: 720px;
  --gutter:     16px;
  --shadow-card: 0 1px 2px rgba(15, 36, 64, 0.06), 0 8px 24px rgba(15, 36, 64, 0.06);
}

*, *::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: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--navy); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--green-dark); }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.2;
  color: var(--navy);
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2rem, 4.5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3vw, 1.9rem); margin-top: 1.8em; }
h3 { font-size: 1.25rem; margin-top: 1.5em; }
p  { margin: 0 0 1.1em; }

.wrap { max-width: var(--page-max); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: var(--article-max); margin: 0 auto; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.eyebrow {
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--green-dark); margin-bottom: 0.75rem;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Buttons ---------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 1rem/1 var(--font-body);
  padding: 14px 22px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dark); color: #fff; }
.btn-outline { background: transparent; color: #fff; border-color: rgba(255,255,255,0.4); }
.btn-outline:hover { border-color: #fff; color: #fff; }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--navy); }
.btn-block { width: 100%; }

/* Header ----------------------------------------------------------------- */
.site-header {
  background: var(--navy);
  color: #fff;
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-head); font-weight: 700; font-size: 1.4rem;
  color: #fff; text-decoration: none; letter-spacing: -0.01em;
}
.logo-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--green);
  display: inline-grid; place-items: center; color: #fff; font-family: var(--font-body); font-size: 0.9rem; font-weight: 700;
}
.nav { display: flex; gap: 4px; align-items: center; }
.nav a {
  color: rgba(255,255,255,0.85); text-decoration: none; font-size: 0.95rem; font-weight: 500;
  padding: 8px 12px; border-radius: 8px;
}
.nav a:hover, .nav a[aria-current="page"] { color: #fff; background: rgba(255,255,255,0.1); }
.nav .btn { padding: 10px 16px; font-size: 0.9rem; margin-left: 8px; }
.nav-toggle {
  display: none; background: none; border: 1px solid rgba(255,255,255,0.3); color: #fff;
  border-radius: 8px; padding: 8px 10px; font: inherit; cursor: pointer;
}

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 64px;
    background: var(--navy-deep); flex-direction: column; align-items: stretch;
    padding: 12px var(--gutter) 20px; border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 12px; }
  .nav .btn { margin: 8px 0 0; }
}

/* Hero ------------------------------------------------------------------- */
.hero { background: var(--navy); color: #fff; padding: 64px 0 72px; }
.hero h1 { color: #fff; max-width: 14ch; margin-bottom: 0.4em; }
.hero p.lead { font-size: 1.2rem; color: rgba(255,255,255,0.85); max-width: 52ch; margin-bottom: 1.6em; }
.hero .actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn-primary { padding: 16px 26px; font-size: 1.05rem; }
@media (max-width: 600px) { .hero { padding: 44px 0 52px; } }

/* Stat cards ------------------------------------------------------------- */
.stats { margin-top: -36px; position: relative; z-index: 2; }
.stat-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.stat-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 22px 24px; box-shadow: var(--shadow-card);
}
.stat-card .value { font-family: var(--font-head); font-size: 2.2rem; font-weight: 700; color: var(--green-dark); line-height: 1; }
.stat-card .label { margin-top: 8px; font-weight: 500; }
.stat-card .source { margin-top: 4px; font-size: 0.8rem; color: var(--muted); }

/* Sections / cluster tiles ---------------------------------------------- */
.section { padding: 64px 0; }
.section-tint { background: var(--paper-tint); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.section-head h2 { margin: 0; }

.tile-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.tile {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 24px; text-decoration: none; color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tile:hover { border-color: var(--navy); box-shadow: var(--shadow-card); color: inherit; }
.tile .icon {
  width: 40px; height: 40px; border-radius: 10px; background: var(--green-tint); color: var(--green-dark);
  display: grid; place-items: center;
}
.tile .icon svg { width: 22px; height: 22px; }
.tile h3 { margin: 4px 0 0; font-size: 1.2rem; }
.tile p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.tile .count { font-size: 0.85rem; color: var(--green-dark); font-weight: 600; margin-top: auto; }

/* Article lists ---------------------------------------------------------- */
.article-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.article-list li {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; background: var(--paper);
}
.article-list a { text-decoration: none; font-family: var(--font-head); font-weight: 600; font-size: 1.15rem; }
.article-list a:hover { text-decoration: underline; }
.article-list p { margin: 6px 0 0; color: var(--muted); font-size: 0.95rem; }
.article-list .meta { margin-top: 8px; font-size: 0.8rem; color: var(--muted); }
.badge {
  display: inline-block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; background: var(--green-tint); color: var(--green-dark); margin-right: 8px; vertical-align: middle;
}

/* Trust strip ------------------------------------------------------------ */
.trust { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.trust h3 { font-size: 1.05rem; margin: 0 0 6px; }
.trust p { margin: 0; color: var(--muted); font-size: 0.95rem; }

/* Page header (hubs, static pages) -------------------------------------- */
.page-head { background: var(--paper-tint); border-bottom: 1px solid var(--line); padding: 48px 0 40px; }
.page-head h1 { margin-bottom: 0.3em; }
.page-head p.lead { font-size: 1.15rem; color: var(--muted); max-width: 60ch; margin: 0; }
.breadcrumbs { font-size: 0.85rem; color: var(--muted); margin-bottom: 14px; }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; color: var(--line); }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--navy); }

/* Article layout --------------------------------------------------------- */
.article-head { padding: 48px 0 32px; }
.article-head h1 { max-width: 22ch; }
.article-head .dek { font-size: 1.2rem; color: var(--muted); max-width: 60ch; }
.byline { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.875rem; color: var(--muted); margin-top: 18px; }
.byline strong { color: var(--ink); font-weight: 600; }

.article-layout { display: grid; grid-template-columns: minmax(0, var(--article-max)) 260px; gap: 56px; justify-content: center; align-items: start; }
@media (max-width: 1000px) { .article-layout { grid-template-columns: minmax(0, 1fr); } .toc { display: none; } }

.toc { position: sticky; top: 88px; font-size: 0.9rem; border-left: 2px solid var(--line); padding-left: 16px; }
.toc h2 { font: 600 0.8rem/1 var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0 0 8px; }
.toc a { color: var(--muted); text-decoration: none; display: block; line-height: 1.35; }
.toc a:hover, .toc a.is-active { color: var(--navy); font-weight: 500; }

.prose { font-size: 1.0625rem; }
.prose > :first-child { margin-top: 0; }
.prose h2 { scroll-margin-top: 90px; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.prose li { margin-bottom: 0.4em; }
.prose strong { color: var(--navy); }
.prose blockquote { margin: 1.5em 0; padding: 0.2em 0 0.2em 1.2em; border-left: 3px solid var(--green); color: var(--muted); font-style: italic; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: 0.95rem; }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-weight: 600; color: var(--navy); background: var(--paper-tint); }
.prose .table-wrap { overflow-x: auto; }

.takeaways {
  background: var(--paper-tint); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 22px 24px; margin: 0 0 36px;
}
.takeaways h2 { font: 600 0.8rem/1 var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--green-dark); margin: 0 0 12px; }
.takeaways ul { margin: 0; padding-left: 1.2em; }
.takeaways li { margin-bottom: 0.5em; }
.takeaways li:last-child { margin-bottom: 0; }

.callout { border-radius: var(--radius); padding: 18px 20px; margin: 1.6em 0; border: 1px solid; }
.callout p:last-child { margin-bottom: 0; }
.callout-warn { background: var(--amber-tint); border-color: #f1d9a7; }
.callout-warn strong { color: #8a5a06; }
.callout-tip { background: var(--green-tint); border-color: #bfe3cd; }

.sources { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); font-size: 0.9rem; }
.sources h2 { font-size: 1.1rem; margin: 0 0 12px; }
.sources ol { padding-left: 1.3em; margin: 0; color: var(--muted); }
.sources li { margin-bottom: 6px; overflow-wrap: anywhere; }

.related { margin-top: 56px; }
.related h2 { font-size: 1.4rem; }

.notice {
  background: var(--amber-tint); border: 1px solid #f1d9a7; color: #8a5a06;
  padding: 12px 16px; border-radius: var(--radius); font-size: 0.9rem; margin-bottom: 24px;
}

/* Opt-in form ------------------------------------------------------------ */
.optin {
  background: var(--navy); color: #fff; border-radius: var(--radius-lg);
  padding: 32px 28px; margin: 2.5em 0;
}
.optin.optin-inline { margin: 2.5em 0; }
.optin.optin-page { margin: 0; }
.optin h2, .optin h3 { color: #fff; margin: 0 0 6px; font-size: 1.5rem; }
.optin .copy { color: rgba(255,255,255,0.8); margin: 0 0 20px; font-size: 1rem; }
.optin form { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.optin .field { display: flex; flex-direction: column; gap: 6px; }
.optin .field.full { grid-column: 1 / -1; }
.optin label { font-size: 0.82rem; font-weight: 500; color: rgba(255,255,255,0.85); }
.optin input {
  font: inherit; font-size: 1rem; padding: 13px 14px; border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.18); background: rgba(255,255,255,0.06); color: #fff;
  outline: none; width: 100%;
}
.optin input::placeholder { color: rgba(255,255,255,0.4); }
.optin input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(31,157,85,0.35); background: rgba(255,255,255,0.1); }
.optin input[aria-invalid="true"] { border-color: #ff8a8a; }
.optin .error { font-size: 0.8rem; color: #ffb3b3; min-height: 0; }
.optin .error:empty { display: none; }
.optin .submit { grid-column: 1 / -1; margin-top: 4px; }
.optin .btn-primary { padding: 16px 22px; font-size: 1.05rem; }
.optin .disclosure {
  grid-column: 1 / -1; font-size: 0.875rem; line-height: 1.5; color: rgba(255,255,255,0.85); margin: 4px 0 0;
}
.optin .disclosure a { color: rgba(255,255,255,0.85); }
.optin .field-hint { font-size: 0.875rem; color: rgba(255,255,255,0.8); }
.optin .contact-choices { grid-column: 1 / -1; min-width: 0; margin: 8px 0 0; padding: 16px; border: 1px solid rgba(255,255,255,0.3); border-radius: var(--radius); }
.optin .contact-choices legend { font-size: 1rem; font-weight: 600; padding: 0 6px; }
.optin .consent-label { display: grid; grid-template-columns: 1.25rem minmax(0,1fr); gap: 12px; align-items: start; font-size: 0.875rem; line-height: 1.6; color: #fff; cursor: pointer; }
.optin .consent-label + .consent-label { margin-top: 20px; }
.optin .consent-label strong, .optin .sms-disclosure, .optin .call-disclosure { display: block; }
.optin .consent-label input[type="checkbox"] { appearance: auto; width: 1.25rem; height: 1.25rem; padding: 0; margin: 4px 0 0; accent-color: var(--green); }
.optin .consent-label a { color: #fff; text-decoration: underline; }
.optin .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.optin .form-status { grid-column: 1 / -1; font-size: 0.9rem; color: #ffb3b3; }
.optin .form-status:empty { display: none; }
@media (max-width: 560px) {
  .optin { padding: 26px 20px; }
  .optin form { grid-template-columns: 1fr; }
}

/* Thank-you -------------------------------------------------------------- */
.thanks { text-align: center; padding: 72px 0; }
.thanks .check {
  width: 64px; height: 64px; border-radius: 50%; background: var(--green-tint); color: var(--green-dark);
  display: grid; place-items: center; margin: 0 auto 20px;
}
.thanks .check svg { width: 32px; height: 32px; }

/* Footer ----------------------------------------------------------------- */
.site-footer { background: var(--navy-deep); color: rgba(255,255,255,0.75); padding: 48px 0 32px; margin-top: 72px; font-size: 0.9rem; }
.footer-grid { display: grid; gap: 32px; grid-template-columns: 2fr 1fr 1fr 1fr; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 500px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h4 { font: 600 0.8rem/1 var(--font-body); letter-spacing: 0.08em; text-transform: uppercase; color: #fff; margin: 0 0 14px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-footer a { color: rgba(255,255,255,0.75); text-decoration: none; }
.site-footer a:hover { color: #fff; }
.site-footer .logo { font-size: 1.3rem; margin-bottom: 12px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); margin-top: 36px; padding-top: 20px; font-size: 0.8rem; color: rgba(255,255,255,0.5); }
.footer-bottom p { margin: 0 0 6px; }
