/* =============================================================
   representatives-compare.com — style.css
   Version: 20260414a  (bump CSS_VERSION in includes/head.php on edit)
   Mobile-first, system fonts, no external deps.
   ============================================================= */

/* ---------- 1. Tokens ---------------------------------------- */
:root {
  /* Palette — neutral/institutional, trust-first */
  --c-bg:          #ffffff;
  --c-bg-alt:      #f6f8fb;
  --c-bg-accent:   #eef3fb;
  --c-border:      #e2e8ef;
  --c-text:        #1a2332;
  --c-text-muted:  #556070;
  --c-link:        #0b4fb3;
  --c-link-hover:  #083a85;
  --c-primary:     #0b4fb3;
  --c-primary-dk:  #083a85;
  --c-cta:         #c44a1a;          /* CTA accent, warm, high-contrast on white */
  --c-cta-dk:      #9a3810;
  --c-accent:      #0f7a5a;          /* positive / featured */
  --c-warn-bg:     #fff6e5;
  --c-warn-bd:     #ffcf7a;
  --c-shadow:      0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
  --c-shadow-lg:   0 10px 25px rgba(16,24,40,.08), 0 4px 10px rgba(16,24,40,.04);

  /* Typography */
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-heading: var(--f-body);
  --fs-base: 17px;
  --lh-base: 1.6;

  /* Spacing scale (4px base) */
  --s-1: .25rem;  --s-2: .5rem;   --s-3: .75rem;  --s-4: 1rem;
  --s-5: 1.5rem;  --s-6: 2rem;    --s-7: 3rem;    --s-8: 4rem;

  /* Layout */
  --maxw: 72rem;         /* ~1152px */
  --maxw-prose: 44rem;   /* article body */
  --radius: 10px;
  --radius-sm: 6px;
}

/* ---------- 2. Reset / base ---------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font: var(--fs-base)/var(--lh-base) var(--f-body);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, canvas { max-width: 100%; height: auto; display: block; }
a {
  color: var(--c-link);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover, a:focus { color: var(--c-link-hover); }
:focus-visible { outline: 3px solid #ffb703; outline-offset: 2px; border-radius: 3px; }

h1, h2, h3, h4 {
  font-family: var(--f-heading);
  line-height: 1.2;
  margin: 0 0 var(--s-4);
  color: var(--c-text);
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 700; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); font-weight: 700; margin-top: var(--s-7); }
h3 { font-size: 1.2rem; font-weight: 600; margin-top: var(--s-5); }
h4 { font-size: 1.05rem; font-weight: 600; margin-top: var(--s-4); }
p { margin: 0 0 var(--s-4); }
ul, ol { margin: 0 0 var(--s-4); padding-left: 1.25rem; }
li + li { margin-top: var(--s-1); }
strong { font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--c-border); margin: var(--s-6) 0; }

/* Skip-link */
.skip-link {
  position: absolute; left: -9999px; top: 0; background: #000; color:#fff;
  padding: var(--s-2) var(--s-3); z-index: 1000;
}
.skip-link:focus { left: var(--s-3); top: var(--s-3); }

/* ---------- 3. Layout primitives ----------------------------- */
.site-header, .breadcrumb, main, .site-footer, .cookie-banner .cookie-inner {
  padding-left: var(--s-5);
  padding-right: var(--s-5);
}
main { max-width: var(--maxw); margin: 0 auto; padding-top: var(--s-5); padding-bottom: var(--s-7); }
article, .meta-page { max-width: var(--maxw-prose); margin: 0 auto; }
.directory-list, .pillar-grid, .lanes, .footer-grid, .rep-cards { list-style: none; padding: 0; }

/* ---------- 4. Header / nav ---------------------------------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-4);
  max-width: var(--maxw); margin: 0 auto;
  padding-top: var(--s-4); padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--c-border);
}
.site-header .logo {
  font-weight: 700; text-decoration: none; color: var(--c-text);
  font-size: 1.05rem;
}
.primary-nav ul {
  display: flex; flex-wrap: wrap; gap: var(--s-4);
  margin: 0; padding: 0; list-style: none;
}
.primary-nav a {
  text-decoration: none; color: var(--c-text-muted); font-weight: 500;
  padding: var(--s-2) 0; font-size: .95rem;
}
.primary-nav a:hover { color: var(--c-link); }
@media (max-width: 720px) {
  .site-header { flex-direction: column; align-items: flex-start; }
  .primary-nav ul { gap: var(--s-3); }
}

/* Breadcrumb */
.breadcrumb {
  max-width: var(--maxw); margin: 0 auto;
  padding-top: var(--s-4); padding-bottom: 0;
  font-size: .9rem; color: var(--c-text-muted);
}
.breadcrumb ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--s-2); }
.breadcrumb li + li::before { content: "›"; margin-right: var(--s-2); color: var(--c-text-muted); }
.breadcrumb a { color: var(--c-text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--c-link); text-decoration: underline; }
.breadcrumb [aria-current="page"] { color: var(--c-text); }

/* ---------- 5. Hero (all variants) --------------------------- */
.hero {
  display: grid; gap: var(--s-6);
  grid-template-columns: 1fr;
  align-items: center;
  padding: var(--s-7) 0 var(--s-6);
  border-bottom: 1px solid var(--c-border);
  margin-bottom: var(--s-6);
}
@media (min-width: 860px) {
  .hero { grid-template-columns: 1.1fr .9fr; padding-top: var(--s-8); }
  .hero--meta, .hero--contact { grid-template-columns: 1fr; }
}
.hero-lede {
  font-size: 1.1rem; color: var(--c-text-muted);
  max-width: 38rem;
}
.hero-actions {
  list-style: none; padding: 0; margin: var(--s-5) 0 0;
  display: flex; flex-wrap: wrap; gap: var(--s-3);
}
.hero-visual { min-height: 200px; }
.hero-visual svg, .hero-visual img { width: 100%; height: auto; max-height: 360px; }
.hero--meta, .hero--contact { padding: var(--s-6) 0; }

/* ---------- 6. Buttons --------------------------------------- */
.btn {
  display: inline-block;
  font-weight: 600;
  padding: .75rem 1.25rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: 1.5px solid transparent;
  cursor: pointer;
  font-size: .97rem;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .05s ease;
  line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--c-primary); color: #fff; border-color: var(--c-primary);
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--c-primary-dk); border-color: var(--c-primary-dk); color:#fff;
}
.btn-ghost {
  background: transparent; color: var(--c-primary); border-color: var(--c-primary);
}
.btn-ghost:hover, .btn-ghost:focus {
  background: var(--c-bg-accent); color: var(--c-primary-dk);
}
.btn-cta {
  background: var(--c-cta); color: #fff; border-color: var(--c-cta);
  padding: .9rem 1.6rem; font-size: 1.05rem;
  box-shadow: var(--c-shadow);
}
.btn-cta:hover, .btn-cta:focus {
  background: var(--c-cta-dk); border-color: var(--c-cta-dk); color:#fff;
}
.btn-link { color: var(--c-link); text-decoration: underline; }

/* ---------- 7. TOC / takeaways / faq / related --------------- */
.toc {
  background: var(--c-bg-alt);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: var(--s-4) var(--s-5);
  margin: var(--s-5) 0 var(--s-6);
  font-size: .95rem;
}
.toc h2 { margin: 0 0 var(--s-2); font-size: 1rem; text-transform: uppercase; letter-spacing: .05em; color: var(--c-text-muted); }
.toc ol { margin: 0; padding-left: 1.25rem; }

.takeaways {
  background: var(--c-bg-accent);
  border-left: 4px solid var(--c-primary);
  padding: var(--s-4) var(--s-5);
  border-radius: var(--radius-sm);
  margin: var(--s-6) 0;
}
.takeaways h2 { margin-top: 0; }
.takeaways ul { margin-bottom: 0; }

.faq details {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-2);
  background: var(--c-bg);
}
.faq summary {
  cursor: pointer; font-weight: 600; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+ "; color: var(--c-primary); font-weight: 700; }
.faq details[open] summary::before { content: "− "; }
.faq details[open] { background: var(--c-bg-alt); }

.related {
  margin-top: var(--s-7);
  padding-top: var(--s-5);
  border-top: 1px solid var(--c-border);
}
.related ul { list-style: none; padding: 0; display: grid; gap: var(--s-2); grid-template-columns: 1fr; }
@media (min-width: 640px) { .related ul { grid-template-columns: 1fr 1fr; } }
.related a {
  display: block; padding: var(--s-3) var(--s-4);
  border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  text-decoration: none; color: var(--c-text); background: var(--c-bg);
}
.related a:hover { border-color: var(--c-primary); background: var(--c-bg-alt); color: var(--c-link); }

/* ---------- 8. Verdict / decision boxes ---------------------- */
.verdict-box {
  background: var(--c-warn-bg);
  border: 1px solid var(--c-warn-bd);
  border-radius: var(--radius);
  padding: var(--s-5);
  margin: var(--s-6) 0;
}
.verdict-box .verdict { font-size: 1.15rem; margin: 0; }

.decision-test {
  background: var(--c-bg-alt);
  border-radius: var(--radius);
  padding: var(--s-6);
  margin: var(--s-6) 0;
}
.decision-test ol { counter-reset: d; list-style: none; padding: 0; }
.decision-test ol li {
  counter-increment: d;
  padding-left: 2.5rem; position: relative; margin-bottom: var(--s-3);
}
.decision-test ol li::before {
  content: counter(d);
  position: absolute; left: 0; top: 0;
  width: 1.75rem; height: 1.75rem; border-radius: 50%;
  background: var(--c-primary); color:#fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem;
}

/* ---------- 9. Charts / figures ------------------------------ */
.chart {
  margin: var(--s-6) 0;
  padding: var(--s-4);
  background: var(--c-bg-alt);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}
.chart canvas { max-width: 100%; height: auto !important; }
.chart figcaption { font-size: .9rem; color: var(--c-text-muted); margin-top: var(--s-3); }
.chart details { margin-top: var(--s-3); font-size: .9rem; }
.chart details summary { cursor: pointer; color: var(--c-link); }
.chart table { width: 100%; border-collapse: collapse; margin-top: var(--s-2); font-size: .9rem; }
.chart th, .chart td { padding: var(--s-2); border: 1px solid var(--c-border); text-align: left; }
.chart th { background: var(--c-bg); }

/* ---------- 10. Aside: representatives list ------------------ */
.representatives-list {
  margin: var(--s-7) 0;
  padding: var(--s-5);
  background: linear-gradient(180deg, var(--c-bg-accent), var(--c-bg));
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}
.representatives-list > h2 { margin-top: 0; }
.representatives-list .aside-intro { color: var(--c-text-muted); font-size: .95rem; }
.rep-cards {
  display: grid; gap: var(--s-4);
  grid-template-columns: 1fr;
  margin: var(--s-4) 0;
}
@media (min-width: 720px) {
  .rep-cards { grid-template-columns: repeat(3, 1fr); }
}
.rep-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: var(--s-5);
  box-shadow: var(--c-shadow);
  display: flex; flex-direction: column; gap: var(--s-2);
}
.rep-card--featured { border-color: var(--c-accent); }
.rep-card h3 { margin: var(--s-2) 0 0; font-size: 1.1rem; }
.rep-rank {
  position: absolute; top: -10px; left: var(--s-4);
  background: var(--c-accent); color: #fff;
  font-weight: 700; font-size: .85rem;
  padding: .15rem .6rem; border-radius: 999px;
}
.rep-positioning { color: var(--c-text); font-size: .95rem; margin: 0; }
.rep-meta { list-style: none; padding: 0; margin: var(--s-2) 0; font-size: .88rem; color: var(--c-text-muted); }
.rep-meta li { margin: 0; padding: .15rem 0; }
.rep-card .btn { margin-top: auto; }
.aside-footnote { margin: var(--s-3) 0 0; font-size: .95rem; }

/* ---------- 11. Aside: partner CTA (bottom) ------------------ */
.partner-cta {
  margin: var(--s-7) 0 0;
  background: linear-gradient(135deg, #0b2b4f 0%, #0b4fb3 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: var(--s-6);
  text-align: center;
  box-shadow: var(--c-shadow-lg);
}
.partner-cta h2 { color: #fff; margin-top: 0; }
.partner-cta p { color: #d9e4f5; max-width: 40rem; margin-left: auto; margin-right: auto; }
.partner-cta .btn-cta { margin-top: var(--s-3); }
.partner-cta .cta-note { font-size: .85rem; color: #b7c6e0; margin-top: var(--s-3); }
.partner-cta .cta-note a { color: #fff; }

/* ---------- 12. Directory ------------------------------------ */
.directory-filters form {
  display: grid; gap: var(--s-3);
  grid-template-columns: 1fr;
  background: var(--c-bg-alt); padding: var(--s-4); border-radius: var(--radius);
  margin-bottom: var(--s-5);
}
@media (min-width: 720px) { .directory-filters form { grid-template-columns: repeat(3, 1fr); } }
.directory-filters label { display: flex; flex-direction: column; gap: var(--s-1); font-size: .9rem; color: var(--c-text-muted); }
.directory-filters select, .directory-filters input {
  padding: .55rem .75rem; border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); font: inherit; background: #fff;
}

.directory-list { display: grid; gap: var(--s-4); grid-template-columns: 1fr; }
@media (min-width: 720px) { .directory-list { grid-template-columns: 1fr 1fr; } }
.directory-entry {
  background: #fff; border: 1px solid var(--c-border);
  border-radius: var(--radius); padding: var(--s-4) var(--s-5);
}
.directory-entry.is-featured { border-color: var(--c-accent); background: #f6fbf8; }
.directory-entry h3 { margin-top: 0; display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.badge {
  display: inline-block; background: var(--c-accent); color: #fff;
  font-size: .75rem; font-weight: 600; padding: .15rem .5rem; border-radius: 999px;
  text-transform: uppercase; letter-spacing: .03em;
}

/* ---------- 13. Home lanes / pillar grid --------------------- */
.lanes, .pillar-grid {
  display: grid; gap: var(--s-4);
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .lanes { grid-template-columns: repeat(4, 1fr); }
  .pillar-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .pillar-grid { grid-template-columns: repeat(3, 1fr); }
}
.lanes a, .pillar-grid a {
  display: block;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: var(--s-4) var(--s-5);
  text-decoration: none;
  color: var(--c-text);
  font-weight: 500;
  box-shadow: var(--c-shadow);
  transition: border-color .15s ease, transform .1s ease;
}
.lanes a:hover, .pillar-grid a:hover {
  border-color: var(--c-primary); color: var(--c-link);
  transform: translateY(-2px);
}
.lanes a strong { display: block; color: var(--c-primary); margin-bottom: var(--s-1); }

/* ---------- 14. Tool widget ---------------------------------- */
.tool-widget {
  background: var(--c-bg-alt);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: var(--s-5);
  margin: var(--s-5) 0;
}
.tool-widget form { display: grid; gap: var(--s-4); grid-template-columns: 1fr; }
@media (min-width: 720px) { .tool-widget form { grid-template-columns: 1fr 1fr; } }
.tool-widget label { display: flex; flex-direction: column; gap: var(--s-1); font-weight: 500; }
.tool-widget input, .tool-widget select, .tool-widget textarea {
  padding: .6rem .8rem; border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); font: inherit; background: #fff;
}
.tool-widget output {
  display: block; margin-top: var(--s-4); padding: var(--s-4);
  background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius-sm);
  min-height: 3rem;
}
.tool-disclaimer { font-size: .85rem; color: var(--c-text-muted); margin-top: var(--s-3); }

/* ---------- 15. Contact form --------------------------------- */
#contact-form form { display: grid; gap: var(--s-4); max-width: 40rem; }
#contact-form label { display: flex; flex-direction: column; gap: var(--s-1); font-weight: 500; }
#contact-form input, #contact-form select, #contact-form textarea {
  padding: .65rem .8rem; border: 1px solid var(--c-border);
  border-radius: var(--radius-sm); font: inherit; background: #fff;
}
#contact-form textarea { min-height: 9rem; resize: vertical; }
.privacy-note { font-size: .85rem; color: var(--c-text-muted); }

/* ---------- 16. Footer --------------------------------------- */
.site-footer {
  max-width: var(--maxw); margin: var(--s-8) auto 0;
  border-top: 1px solid var(--c-border);
  padding-top: var(--s-6); padding-bottom: var(--s-6);
  color: var(--c-text-muted);
  font-size: .92rem;
}
.footer-grid {
  display: grid; gap: var(--s-5);
  grid-template-columns: 1fr;
}
@media (min-width: 720px)  { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .footer-grid { grid-template-columns: repeat(4, 1fr); } }
.footer-grid h2 {
  font-size: .85rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--c-text); margin: 0 0 var(--s-3);
}
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin: var(--s-1) 0; }
.footer-grid a { color: var(--c-text-muted); text-decoration: none; }
.footer-grid a:hover { color: var(--c-link); text-decoration: underline; }
.footer-note {
  margin-top: var(--s-6); padding-top: var(--s-4);
  border-top: 1px solid var(--c-border);
  font-size: .85rem;
}
.footer-copy { font-size: .85rem; margin: var(--s-2) 0 0; }

/* ---------- 17. Cookie banner -------------------------------- */
.cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #111a2b; color: #fff; z-index: 100;
  box-shadow: 0 -4px 20px rgba(0,0,0,.2);
}
.cookie-banner[hidden] { display: none !important; }
.cookie-banner .cookie-inner {
  max-width: var(--maxw); margin: 0 auto;
  padding-top: var(--s-4); padding-bottom: var(--s-4);
  display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: center; justify-content: space-between;
}
.cookie-banner p { margin: 0; max-width: 44rem; font-size: .95rem; color: #dbe2ee; }
.cookie-banner .cookie-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.cookie-banner .btn-ghost { color: #fff; border-color: #fff; }
.cookie-banner .btn-ghost:hover { background: rgba(255,255,255,.1); color:#fff; }
.cookie-banner .btn-link { color: #fff; }

/* ---------- 18. Utilities ------------------------------------ */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- 19. Print ---------------------------------------- */
@media print {
  .site-header, .primary-nav, .breadcrumb,
  .cookie-banner, .partner-cta, .representatives-list,
  .hero-actions, .btn { display: none !important; }
  main { max-width: none; padding: 0; }
  a { color: #000; text-decoration: underline; }
}

/* ---------- 20. Reduced motion ------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0ms !important; transition-duration: 0ms !important; scroll-behavior: auto !important; }
}
