/* ─── RESET & TOKENS ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:         #0e1b2e;
  --navy-mid:     #142339;
  --navy-light:   #1e3254;
  --gold:         #c9922a;
  --gold-light:   #e8a83a;
  --gold-pale:    #f5e9d0;
  --cream:        #f7f4ef;
  --text-primary: #1a1a2e;
  --text-muted:   #6b7280;
  --border:       #e5e7eb;
  --card-bg:      #ffffff;
  --surface:      #f7f4ef;
  --shadow:       0 2px 12px rgba(0,0,0,0.07);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.10);
  --radius:       12px;
  --radius-sm:    8px;
  --font-display: 'Cabinet Grotesk', 'Segoe UI', sans-serif;
  --font-body:    'Satoshi', 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
  --navy:         #0a1628;
  --navy-mid:     #0f1f3d;
  --navy-light:   #1a2f52;
  --cream:        #0e1b2e;
  --text-primary: #f0ece4;
  --text-muted:   #9ca3af;
  --border:       #1e3254;
  --card-bg:      #0f1f3d;
  --surface:      #0a1628;
  --gold-pale:    #2a1e07;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--text-primary);
  line-height: 1.65;
  transition: background 0.3s, color 0.3s;
}

/* ─── NAVBAR ─── */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: var(--navy);
  box-shadow: 0 2px 16px rgba(0,0,0,0.25);
}
.navbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  height: 60px; display: flex; align-items: center; gap: 24px;
}
.navbar-gold-bar { height: 3px; background: linear-gradient(90deg, var(--gold), var(--gold-light)); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; flex-shrink: 0; }
.brand-icon { width: 32px; height: 32px; color: var(--gold); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; color: #fff; letter-spacing: -0.01em; }
.brand-sub  { font-size: 0.68rem; color: rgba(255,255,255,0.55); }
.nav-center { flex: 1; display: flex; justify-content: center; }
.portal-link { font-size: 0.875rem; font-weight: 500; color: rgba(255,255,255,0.75); text-decoration: none; transition: color 0.2s; }
.portal-link:hover { color: var(--gold-light); }
.theme-toggle {
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px; padding: 6px 8px; color: rgba(255,255,255,0.8);
  cursor: pointer; display: flex; align-items: center; flex-shrink: 0; transition: background 0.2s;
}
.theme-toggle:hover { background: rgba(255,255,255,0.18); color: #fff; }

/* ─── HERO ─── */
.hero {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-mid) 55%, var(--navy-light) 100%);
  padding: 64px 24px 56px;
}
.hero-inner { max-width: 860px; margin: 0 auto; }
.badge {
  display: inline-block;
  background: rgba(201,146,42,0.18); border: 1px solid rgba(201,146,42,0.4);
  color: var(--gold-light); font-family: var(--font-display); font-size: 0.72rem;
  font-weight: 700; letter-spacing: 0.12em; padding: 5px 14px; border-radius: 100px; margin-bottom: 20px;
}
.hero-title {
  font-family: var(--font-display); font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 800; color: #fff; letter-spacing: -0.03em; margin-bottom: 20px;
}
.hero-desc { font-size: 1.05rem; color: rgba(255,255,255,0.72); max-width: 680px; margin-bottom: 40px; line-height: 1.7; }
.hero-stats { display: flex; align-items: center; flex-wrap: wrap; gap: 0; }
.stat { padding: 0 32px 0 0; }
.stat-num { display: block; font-family: var(--font-display); font-size: 1.9rem; font-weight: 800; color: var(--gold-light); line-height: 1; margin-bottom: 4px; }
.stat-label { display: block; font-size: 0.67rem; font-weight: 600; letter-spacing: 0.1em; color: rgba(255,255,255,0.45); }
.stat-divider { width: 1px; height: 38px; background: rgba(255,255,255,0.15); margin-right: 32px; }

/* ─── MAIN ─── */
.main-content { padding: 40px 24px 0; }
.container { max-width: 1100px; margin: 0 auto; }

/* ─── INTRO GRID ─── */
.intro-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-bottom: 48px;
}
.intro-card {
  display: flex; align-items: flex-start; gap: 16px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 24px;
  box-shadow: var(--shadow);
}
.intro-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.intro-icon.dp { background: rgba(201,146,42,0.12); color: var(--gold); }
.intro-icon.cc { background: rgba(59,130,246,0.12); color: #2563eb; }
[data-theme="dark"] .intro-icon.cc { color: #60a5fa; }
.intro-label {
  font-family: var(--font-display); font-size: 1rem; font-weight: 700;
  color: var(--text-primary); margin-bottom: 6px;
}
.intro-text { font-size: 0.9rem; color: var(--text-muted); line-height: 1.7; }
.intro-text strong { color: var(--text-primary); }

/* ─── CONTENT SECTION ─── */
.content-section {
  margin-bottom: 56px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* ─── SECTION HEADER ─── */
.section-header {
  display: flex; align-items: flex-start; gap: 20px;
  padding: 28px 32px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.section-num {
  font-family: var(--font-display); font-size: 2.2rem; font-weight: 800;
  color: var(--gold); opacity: 0.35; line-height: 1; flex-shrink: 0;
  margin-top: -4px;
}
.section-title {
  font-family: var(--font-display); font-size: clamp(1.3rem, 2.5vw, 1.7rem);
  font-weight: 800; color: var(--text-primary); letter-spacing: -0.025em; margin-bottom: 5px;
}
.section-sub { font-size: 0.875rem; color: var(--text-muted); line-height: 1.55; }

/* ─── FACT GRID (Section 1) ─── */
.fact-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  padding: 24px 32px 0;
}
.fact-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
}
.fact-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(201,146,42,0.12); color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.fact-label {
  font-family: var(--font-display); font-size: 0.85rem; font-weight: 700;
  color: var(--text-primary); margin-bottom: 7px;
}
.fact-text { font-size: 0.85rem; color: var(--text-muted); line-height: 1.65; }

/* ─── EXAMPLE BOX ─── */
.example-box {
  margin: 20px 32px 0;
  background: var(--gold-pale); border: 1px solid rgba(201,146,42,0.3);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm); padding: 14px 18px;
  font-size: 0.875rem; color: var(--text-primary); line-height: 1.65;
}
.example-label {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-display); font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--gold); margin-bottom: 8px;
}
.example-box strong { font-weight: 600; }

/* ─── DATA TABLE ─── */
.table-wrap { padding: 20px 32px 28px; overflow-x: auto; }
.data-table {
  width: 100%; border-collapse: collapse; font-size: 0.875rem;
}
.data-table th {
  font-family: var(--font-display); font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); padding: 10px 14px 12px; border-bottom: 2px solid var(--border);
  text-align: left; white-space: nowrap;
}
.data-table td {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  color: var(--text-primary); vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(201,146,42,0.04); }
.data-table td strong { font-weight: 600; }
.highlight-cell { color: var(--gold); font-family: var(--font-display); font-weight: 700; }

/* ─── AZ CALLOUT ─── */
.az-callout {
  display: flex; align-items: flex-start; gap: 12px;
  margin: 24px 32px 0;
  background: rgba(59,130,246,0.06); border: 1px solid rgba(59,130,246,0.2);
  border-left: 3px solid #3b82f6;
  border-radius: var(--radius-sm); padding: 14px 18px;
  font-size: 0.875rem; color: var(--text-primary); line-height: 1.65;
}
.az-callout svg { color: #3b82f6; margin-top: 1px; }
.az-callout strong { font-weight: 600; }
[data-theme="dark"] .az-callout { background: rgba(59,130,246,0.08); border-color: rgba(59,130,246,0.25); }

/* ─── CLOSING COSTS GRID ─── */
.closing-costs-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
  padding: 20px 32px 28px;
}
.cost-category {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.cost-cat-header {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: 0.82rem; font-weight: 700;
  padding: 10px 16px; letter-spacing: 0.01em;
}
.cost-cat-header.lender  { background: rgba(201,146,42,0.12); color: #92680d; }
.cost-cat-header.title   { background: rgba(59,130,246,0.1);  color: #1d4ed8; }
.cost-cat-header.govt    { background: rgba(139,92,246,0.1);  color: #6d28d9; }
.cost-cat-header.prepaid { background: rgba(34,197,94,0.1);   color: #15803d; }
[data-theme="dark"] .cost-cat-header.lender  { color: var(--gold-light); }
[data-theme="dark"] .cost-cat-header.title   { color: #60a5fa; }
[data-theme="dark"] .cost-cat-header.govt    { color: #a78bfa; }
[data-theme="dark"] .cost-cat-header.prepaid { color: #4ade80; }

.cost-list { list-style: none; padding: 10px 0; }
.cost-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 16px; font-size: 0.84rem; color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}
.cost-list li:last-child { border-bottom: none; }
.cost-name { color: var(--text-primary); }
.cost-range { font-weight: 600; color: var(--text-muted); white-space: nowrap; margin-left: 8px; font-size: 0.8rem; }

/* ─── FORMULA BLOCK ─── */
.formula-block { padding: 24px 32px 0; }
.formula-row {
  display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap;
}
.formula-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  flex: 1; min-width: 160px;
}
.formula-item.result {
  background: var(--navy); border-color: var(--navy);
}
.formula-sign {
  font-family: var(--font-display); font-size: 1.6rem; font-weight: 800;
  flex-shrink: 0; line-height: 1;
}
.formula-item.add  .formula-sign { color: #22c55e; }
.formula-item.sub  .formula-sign { color: #f59e0b; }
.formula-item.result .formula-sign { color: var(--gold); }

.formula-label {
  font-family: var(--font-display); font-size: 0.85rem; font-weight: 700;
  color: var(--text-primary); line-height: 1.3; margin-bottom: 3px;
}
.formula-item.result .formula-label { color: #fff; }
.formula-example { font-size: 0.76rem; color: var(--text-muted); line-height: 1.4; }
.formula-item.result .formula-example { color: rgba(255,255,255,0.6); }

/* ─── INFO NOTE ─── */
.info-note {
  display: flex; align-items: flex-start; gap: 12px;
  margin: 20px 32px 28px;
  background: var(--gold-pale); border: 1px solid rgba(201,146,42,0.3);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-sm); padding: 14px 18px;
  font-size: 0.875rem; color: var(--text-primary); line-height: 1.65;
}
.info-note svg { color: var(--gold); margin-top: 1px; }
.info-note strong { font-weight: 600; }

/* ─── ASSIST GRID ─── */
.assist-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  padding: 24px 32px 0;
}
.assist-card {
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border);
}
.assist-card.homeplus { border-top: 3px solid var(--gold); }
.assist-card.homeinfive { border-top: 3px solid #3b82f6; }

.assist-card-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
  padding: 16px 20px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.assist-name {
  font-family: var(--font-display); font-size: 1rem; font-weight: 800;
  color: var(--text-primary);
}
.assist-badge {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 3px 10px; border-radius: 100px;
}
.assist-badge.statewide {
  background: rgba(201,146,42,0.15); color: var(--gold);
  border: 1px solid rgba(201,146,42,0.3);
}
.assist-badge.county {
  background: rgba(59,130,246,0.12); color: #2563eb;
  border: 1px solid rgba(59,130,246,0.25);
}
[data-theme="dark"] .assist-badge.county { color: #60a5fa; }

.assist-desc { font-size: 0.875rem; color: var(--text-muted); line-height: 1.7; padding: 14px 20px 10px; }
.assist-list {
  list-style: none; padding: 0 20px 16px; display: flex; flex-direction: column; gap: 6px;
}
.assist-list li {
  font-size: 0.84rem; color: var(--text-primary); padding-left: 16px; position: relative; line-height: 1.5;
}
.assist-list li::before {
  content: '→'; position: absolute; left: 0; color: var(--gold); font-weight: 700;
}
.assist-list strong { font-weight: 600; }

/* ─── FTP CALLOUT ─── */
.ftp-callout {
  display: flex; align-items: flex-start; gap: 14px;
  margin: 20px 32px 28px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  border-radius: var(--radius); padding: 20px 24px;
}
.ftp-callout svg { color: var(--gold); flex-shrink: 0; margin-top: 2px; }
.ftp-callout p { font-size: 0.925rem; color: rgba(255,255,255,0.85); line-height: 1.7; font-style: italic; }
.ftp-callout strong { color: #fff; font-style: normal; }

/* ─── CHECKLIST GRID ─── */
.checklist-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px;
  padding: 24px 32px 28px;
}
.checklist-item {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
}
.check-circle {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--gold); color: var(--navy);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.check-title {
  font-family: var(--font-display); font-size: 0.9rem; font-weight: 700;
  color: var(--text-primary); margin-bottom: 6px;
}
.check-content p { font-size: 0.83rem; color: var(--text-muted); line-height: 1.65; }

/* ─── CTA ─── */
.cta-section { padding: 0 24px 64px; }
.cta-box {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  border-radius: 16px; padding: 48px 40px; text-align: center;
  max-width: 760px; margin: 0 auto; box-shadow: var(--shadow-lg);
}
.cta-icon { font-size: 2.5rem; margin-bottom: 16px; }
.cta-box h2 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; color: #fff; letter-spacing: -0.02em; margin-bottom: 12px; }
.cta-box p { color: rgba(255,255,255,0.7); font-size: 0.95rem; line-height: 1.7; margin-bottom: 28px; max-width: 520px; margin-left: auto; margin-right: auto; }
.cta-links { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.cta-btn {
  display: inline-block; background: var(--gold); color: var(--navy);
  font-family: var(--font-display); font-size: 0.9rem; font-weight: 700;
  padding: 13px 24px; border-radius: 8px; text-decoration: none; transition: background 0.2s, transform 0.15s;
}
.cta-btn:hover { background: var(--gold-light); transform: translateY(-2px); }
.cta-btn-outline {
  display: inline-block; background: transparent; color: rgba(255,255,255,0.85);
  font-family: var(--font-display); font-size: 0.9rem; font-weight: 600;
  padding: 13px 24px; border-radius: 8px; text-decoration: none;
  border: 1px solid rgba(255,255,255,0.25); transition: background 0.2s, border-color 0.2s;
}
.cta-btn-outline:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.5); }

/* ─── FOOTER ─── */
.footer { background: var(--navy); border-top: 1px solid rgba(255,255,255,0.07); padding: 20px 24px; }
.footer-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px; font-size: 0.76rem; color: rgba(255,255,255,0.35);
}
.footer-inner a { color: rgba(255,255,255,0.35); text-decoration: none; transition: color 0.2s; }
.footer-inner a:hover { color: var(--gold); }

/* ─── RESPONSIVE ─── */
@media (max-width: 960px) {
  .closing-costs-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .hero { padding: 48px 20px 44px; }
  .hero-stats { flex-direction: column; gap: 14px; }
  .stat-divider { display: none; }
  .stat { padding: 0; }
  .main-content { padding: 28px 20px 0; }
  .cta-section { padding: 0 20px 48px; }

  .intro-grid { grid-template-columns: 1fr; }
  .fact-grid { grid-template-columns: 1fr; }
  .closing-costs-grid { grid-template-columns: 1fr; }
  .assist-grid { grid-template-columns: 1fr; }
  .checklist-grid { grid-template-columns: 1fr; }

  .section-header { padding: 22px 22px 18px; }
  .fact-grid, .table-wrap { padding-left: 22px; padding-right: 22px; }
  .example-box { margin-left: 22px; margin-right: 22px; }
  .az-callout { margin-left: 22px; margin-right: 22px; }
  .closing-costs-grid { padding: 16px 22px 22px; }
  .formula-block { padding: 20px 22px 0; }
  .info-note { margin: 16px 22px 22px; }
  .assist-grid { padding: 18px 22px 0; }
  .ftp-callout { margin: 16px 22px 22px; }
  .checklist-grid { padding: 18px 22px 22px; }

  .formula-row { flex-direction: column; }
  .formula-item { min-width: 0; }

  .cta-box { padding: 36px 24px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
  .navbar-inner { padding: 0 16px; }
  .brand-sub { display: none; }
}

@media (max-width: 480px) {
  .main-content { padding-left: 16px; padding-right: 16px; }
  .cta-section { padding-left: 16px; padding-right: 16px; }
  .section-header { padding: 18px 18px 14px; }
  .fact-grid, .table-wrap { padding-left: 18px; padding-right: 18px; }
  .example-box { margin-left: 18px; margin-right: 18px; }
  .az-callout { margin-left: 18px; margin-right: 18px; }
  .closing-costs-grid { padding: 14px 18px 18px; }
  .formula-block { padding: 16px 18px 0; }
  .info-note { margin: 14px 18px 18px; }
  .assist-grid { padding: 14px 18px 0; }
  .ftp-callout { margin: 14px 18px 18px; }
  .checklist-grid { padding: 14px 18px 18px; }
  .section-title { font-size: 1.25rem; }
  .cta-links { flex-direction: column; align-items: center; }
}
