/* ── Design Tokens ────────────────────────────────────── */
:root {
  --brand-900: #0B1F3B;
  --brand-700: #12365F;
  --brand-600: #155E75;
  --accent-500: #F59E0B;

  --bg: #F7F8FB;
  --surface: #FFFFFF;
  --text: #0F172A;
  --muted: #475569;
  --border: #E2E8F0;

  --success: #16A34A;
  --danger: #DC2626;
  --warning: #D97706;

  --radius: 14px;
  --shadow: 0 10px 30px rgba(2,6,23,.08);
  --shadow-sm: 0 4px 14px rgba(2,6,23,.08);
  --ring: 0 0 0 3px rgba(21,94,117,.18);
}

/* ── Reset & Base ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
.container { max-width: 1040px; margin: 0 auto; padding: 0 24px; }

/* ── Typography ──────────────────────────────────────── */
h1 { font-size: 2rem; line-height: 1.15; margin: .2rem 0 1rem; color: var(--text); }
h2 { font-size: 1.35rem; margin: 1.5rem 0 .75rem; color: var(--text); }
h3 { font-size: 1.15rem; font-weight: 600; margin: 1.25rem 0 .5rem; color: var(--text); }
h4 { font-size: 1rem; font-weight: 600; margin: 1rem 0 .5rem; color: var(--text); }
p { margin-bottom: 1rem; }
ul, ol { margin: 0 0 1rem 1.25rem; }
.small { font-size: .92rem; color: var(--muted); }
.kicker { color: rgba(255,255,255,.85); font-size: .95rem; }
code { background: #F1F5F9; padding: 2px 6px; border-radius: 4px; font-size: .9em; }

/* ── Header / Nav ────────────────────────────────────── */
.site-header {
  background: linear-gradient(180deg, var(--brand-900), var(--brand-700));
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.12);
  position: sticky; top: 0; z-index: 100;
}
.site-header a { color: #fff; text-decoration: none; }
.nav {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 1040px; margin: 0 auto;
  padding: 16px 24px;
}
.brand { font-weight: 800; font-size: 1.15rem; letter-spacing: .2px; }
.brand:hover { text-decoration: none; }
.navlinks { list-style: none; display: flex; gap: 20px; opacity: .95; }
.navlinks a { font-size: .925rem; font-weight: 500; }
.navlinks a:hover { text-decoration: none; opacity: .8; }
.nav-toggle {
  display: none; background: none; border: none; cursor: pointer;
  flex-direction: column; gap: 5px; padding: 4px;
}
.nav-toggle span { display: block; width: 22px; height: 2px; background: #fff; border-radius: 2px; }

@media (max-width: 700px) {
  .nav-toggle { display: flex; }
  .navlinks {
    display: none; flex-direction: column; position: absolute;
    top: 56px; left: 0; right: 0;
    background: var(--brand-700); padding: 16px 24px; gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,.12);
  }
  .navlinks.open { display: flex; }
}

/* ── Main content ────────────────────────────────────── */
main { min-height: 60vh; padding: 32px 24px; max-width: 1040px; margin: 0 auto; }

/* ── Cards ───────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, transform .15s;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card.pad { padding: 20px; }
a.card { color: var(--text); display: block; }
a.card:hover { text-decoration: none; }
.card h3 { margin-top: 0; color: var(--brand-600); }
.card p { color: var(--muted); font-size: .93rem; }
.card-link { font-weight: 700; font-size: .93rem; color: var(--brand-600); display: inline-flex; align-items: center; gap: 4px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin: 1.5rem 0; }
.stack { display: grid; gap: 14px; }

/* ── Hero Banner ─────────────────────────────────────── */
.hero-banner {
  background: linear-gradient(135deg, var(--brand-900) 0%, var(--brand-700) 100%);
  color: #fff; text-align: center;
  padding: 3.5rem 24px 3rem;
  margin: -32px -24px 2rem;
  border-radius: 0 0 var(--radius) var(--radius);
}
.hero-banner h1 { color: #fff; font-size: 2.3rem; margin-bottom: .75rem; }
.hero-banner .subtitle { color: rgba(255,255,255,.85); font-size: 1.1rem; max-width: 600px; margin: 0 auto; }

/* ── Forms ────────────────────────────────────────────── */
.form-card { margin: 1.5rem 0; }
.grid { display: grid; gap: 14px; }
@media (min-width: 700px) {
  .two-col { grid-template-columns: 1fr 1fr; }
  .three-col { grid-template-columns: 1fr 1fr 1fr; }
}
.form-group { display: flex; flex-direction: column; }
.form-group label { font-weight: 650; font-size: .92rem; margin-bottom: 4px; color: var(--text); }
.form-group input, .form-group select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 12px;
  background: #fff; color: var(--text); font-size: .95rem;
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus, .form-group select:focus {
  outline: none; border-color: rgba(21,94,117,.55); box-shadow: var(--ring);
}
.form-group-full { grid-column: 1 / -1; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: .92rem; font-weight: 500; }
.form-check input[type="checkbox"] { width: 1rem; height: 1rem; accent-color: var(--brand-600); }
.help { font-size: .85rem; color: var(--muted); margin-top: 6px; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 11px 18px; border-radius: 12px;
  border: 1px solid transparent; font-weight: 700; font-size: .95rem;
  cursor: pointer; transition: filter .15s, background .15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand-600); color: #fff; }
.btn-primary:hover { filter: brightness(.92); }
.btn-accent { background: var(--accent-500); color: #1f2937; }
.btn-accent:hover { filter: brightness(.92); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: #F1F5F9; }
.btn-full { width: 100%; grid-column: 1 / -1; margin-top: 6px; }

/* ── Results Panel ───────────────────────────────────── */
.results-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 6px solid var(--brand-600);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px; margin: 1.5rem 0;
}
.results-panel h3 { margin-top: 0; color: var(--brand-600); }
.result-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.result-row:last-child { border-bottom: none; }
.result-label { color: var(--muted); font-size: .93rem; }
.result-value { font-weight: 700; color: var(--text); font-size: 1rem; }
.result-value.highlight { font-size: 1.5rem; font-weight: 850; color: var(--brand-600); }
.results-comparison {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 6px solid var(--accent-500);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px; margin: 1rem 0;
}
.results-comparison h3 { margin-top: 0; color: var(--warning); }

/* ── Affiliate CTA / Disclosure ──────────────────────── */
.cta-box {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius);
  padding: 20px; margin: 1.5rem 0; text-align: center;
}
.cta-box h3 { color: #92400E; margin-top: 0; }
.cta-box p { color: var(--muted); margin-bottom: 1rem; }
.cta-box .btn { margin-bottom: .5rem; }
.cta-box small { display: block; margin-top: 10px; color: #92400E; font-size: .82rem; }
.cta-box small a { color: #92400E; }

/* ── Alerts / Notices ────────────────────────────────── */
.notice {
  background: #EFF6FF; border: 1px solid #BFDBFE; color: #1E3A8A;
  padding: 12px 14px; border-radius: 12px; margin: 1rem 0;
}

/* ── Content Sections ────────────────────────────────── */
.calc-section { margin-bottom: 2.5rem; }
.content-section { margin: 2.5rem 0; }
.content-section h2 { border-bottom: 2px solid var(--border); padding-bottom: .5rem; }
.example-box {
  background: var(--surface); border-left: 4px solid var(--brand-600);
  border-radius: 0 var(--radius) var(--radius) 0;
  box-shadow: var(--shadow-sm);
  padding: 16px 20px; margin: 1rem 0;
}
.example-box h4 { color: var(--brand-600); margin-top: 0; }

/* ── FAQ Accordion ───────────────────────────────────── */
.faq-section { margin: 2.5rem 0; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item summary {
  padding: 14px 0; font-weight: 600; cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
  color: var(--text); font-size: .95rem;
}
.faq-item summary::after { content: "+"; font-size: 1.25rem; color: var(--muted); transition: transform .2s; }
.faq-item[open] summary::after { content: "\2212"; }
.faq-item .faq-answer { padding: 0 0 14px; color: var(--muted); font-size: .93rem; line-height: 1.7; }

/* ── Page Content (legal, about, etc.) ───────────────── */
.page-content { max-width: 720px; }
.page-content h1 { margin-bottom: 1.5rem; }
.page-content h2 { font-size: 1.3rem; margin-top: 2rem; }
.page-content p, .page-content li { color: var(--muted); }

/* ── Tables ──────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; overflow: hidden; border-radius: 12px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
th { background: #F1F5F9; font-size: .9rem; color: #334155; }

/* ── Footer ──────────────────────────────────────────── */
.site-footer {
  background: linear-gradient(180deg, var(--brand-900), #081529);
  color: #94a3b8; padding: 3rem 0 1.5rem; margin-top: 4rem;
}
.footer-container {
  max-width: 1040px; margin: 0 auto; padding: 0 24px;
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 2rem;
}
@media (max-width: 700px) { .footer-container { grid-template-columns: 1fr 1fr; gap: 1.5rem; } }
.footer-brand a { color: #fff; font-weight: 800; font-size: 1.1rem; }
.footer-brand a:hover { text-decoration: none; }
.footer-brand p { font-size: .875rem; margin-top: .5rem; color: #64748b; }
.footer-links h4 {
  color: rgba(255,255,255,.7); font-size: .8rem;
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: .75rem;
}
.footer-links ul { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: .4rem; }
.footer-links a { color: #94a3b8; font-size: .875rem; }
.footer-links a:hover { color: #e2e8f0; text-decoration: none; }
.footer-bottom {
  max-width: 1040px; margin: 2rem auto 0; padding: 1.5rem 24px 0;
  border-top: 1px solid rgba(255,255,255,.08); text-align: center;
}
.footer-bottom p { font-size: .8rem; color: #64748b; margin: 0; }

/* ── HTMX Loading ────────────────────────────────────── */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-flex; }
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(15,23,42,.25);
  border-top-color: rgba(15,23,42,.8);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utilities ───────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.validation-error { color: var(--danger); font-size: .85rem; margin-top: 4px; }
.text-center { text-align: center; }
