/* ============================================
   Politics1.com - Optimized & Mobile-Enhanced CSS
   ============================================ */

/* === CSS Variables === */
:root{
  --bg: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --card: #f8fafc;
  --border: #e2e8f0;
  --brand-red: #df0000;
  --brand-blue: #00aef0;
  --shadow: 0 10px 24px rgba(2,6,23,.08);
  --radius: 18px;
  --max: 1160px;
  
  /* Header theme */
  --header-bg: #0B1E3B;
  --header-text: #FFFFFF;
  --header-muted: rgba(255,255,255,.78);
  --header-hover: rgba(255,255,255,.10);
}

/* === Base Styles === */
*{ box-sizing: border-box; }

html, body{ height: 100%; }

body{
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 10% 0%, rgba(0,174,240,.14), transparent 60%),
    radial-gradient(900px 520px at 90% 0%, rgba(223,0,0,.10), transparent 60%),
    var(--bg);
  line-height: 1.4;
  padding-top: 74px;
}

a{ 
  color: inherit; 
  text-decoration: none; 
}

a:hover{ text-decoration: underline; }

/* Improved focus states for accessibility */
a:focus-visible, 
button:focus-visible,
summary:focus-visible{
  outline: 2px solid var(--brand-blue);
  outline-offset: 2px;
  border-radius: 4px;
}

.wrap{ 
  max-width: var(--max); 
  margin: 0 auto; 
  padding: 16px; 
}

/* === Header === */
header,
.siteHeader{
  position: fixed; 
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--header-bg) !important;
  border-bottom: 1px solid rgba(255,255,255,.10);
}

/* Remove extra padding from header wrap */
.siteHeader .wrap{ 
  padding-top: 8px; 
  padding-bottom: 8px; 
}

.topbar{
  display: flex; 
  align-items: center; 
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  position: relative;
}

.brand{
  display: flex; 
  align-items: center; 
  gap: 12px;
  min-width: 220px;
}

.brand img{ 
  height: 44px; 
  width: auto; 
  display: block; 
}

.tag{
  font-size: 12px;
  color: var(--header-muted);
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.10);
  padding: 6px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Hide inline nav (using hamburger menu instead) */
.topbar > nav[aria-label="Primary"]:not(.menuPanel){
  display: none;
}

/* === Hamburger Menu === */
.menuButton{
  appearance: none;
  border: 1px solid rgba(255,255,255,.20);
  background: rgba(0,0,0,.12);
  color: #fff;
  border-radius: 12px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.menuButton:hover{
  background: rgba(255,255,255,.10);
}

.menuIcon{
  width: 18px;
  height: 12px;
  position: relative;
  display: inline-block;
  border-top: 2px solid rgba(255,255,255,.92);
}

.menuIcon::before,
.menuIcon::after{
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  border-top: 2px solid rgba(255,255,255,.92);
}

.menuIcon::before{ top: 5px; }
.menuIcon::after{ top: 10px; }

.menuPanel{
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(360px, calc(100vw - 32px));
  background: #ffffff;
  border: 1px solid rgba(2,6,23,.10);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(2,6,23,.22);
  overflow: hidden;
  transform: translateY(-6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  will-change: opacity, transform;
  z-index: 50;
}

.menuPanel.isOpen{
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.menuPanelInner{
  padding: 14px;
}

.menuTitle{
  font-size: 12px;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: #475569;
  margin-bottom: 8px;
}

.menuLinks a{
  display: block;
  padding: 12px;
  border-radius: 12px;
  color: #0f172a;
  text-decoration: none;
  font-weight: 650;
  line-height: 1.1;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.menuLinks a:hover{
  background: #f1f5f9;
}

.menuBackdrop{
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,.35);
  z-index: 40;
}

html.menuOpen, 
html.menuOpen body{
  overflow: hidden;
}

/* === Hero Section === */
.hero{
  padding: 22px 0 10px;
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 18px;
  align-items: start;
}

.subsectionNote {
  margin: 12px 0 0;
  padding: 0;
  font-size: 1rem;
  line-height: 1.35;
}

.panel{
  background: rgba(255,255,255,.78);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

h1{
  margin: 0 0 10px;
  font-size: clamp(26px, 3vw, 40px);
  letter-spacing: -0.02em;
}

.lead{ 
  color: var(--muted); 
  font-size: 16px; 
  margin: 0 0 14px; 
}

/* === Buttons === */
.ctaRow{
  display: flex; 
  flex-wrap: wrap; 
  gap: 10px;
  margin-top: 10px;
}

.btn{
  display: inline-flex; 
  align-items: center; 
  justify-content: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
  font-weight: 650;
  font-size: 14px;
  min-height: 42px;
}

.btn.primary{
  border-color: rgba(0,174,240,.35);
  box-shadow: 0 10px 18px rgba(0,174,240,.12);
}

/* === Sections === */
.sectionTitle{
  margin: 22px 0 10px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .10em;
}

/* === Grid Layouts === */
.grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.grid2{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.sectionTitle {
  scroll-margin-top: 120px;
}

.ad-slot:empty {
  display: none !important;
}


/* === Cards === */
.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 6px 16px rgba(2,6,23,.05);
  min-height: 112px;
}

.card h2{ 
  margin: 0 0 10px; 
  font-size: 18px; 
}

.card h3{ 
  margin: 0 0 6px; 
  font-size: 16px; 
}

.card p{ 
  margin: 0; 
  color: var(--muted); 
  font-size: 13px; 
}

/* === Utility Classes === */
.small, .muted{
  color: var(--muted);
  font-size: 13px;
}

.hideMobile{ display: block; }
.showMobile{ display: none; }

/* === Ad Slots === */
.adSlot{
  margin-top: 14px;
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
}

.wideAd{
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255,255,255,.75);
  margin-top: 12px;
}

/* === Footer === */
.footer, .siteFooter{
  margin-top: 26px;
  border-top: 1px solid var(--border);
  padding: 18px 0 30px;
  color: var(--muted);
  font-size: 13px;
}

.footerGrid{
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
  align-items: start;
}

.footerLinks, .resourceLinks{
  display: flex; 
  flex-wrap: wrap; 
  gap: 10px 14px;
}

.resourceLinks a{
  color: rgba(15,23,42,.78);
  text-decoration: none;
  font-weight: 650;
}

.resourceLinks a:hover{ 
  text-decoration: underline; 
}

/* === State Pages === */
.siteHeader .wrap{ 
  padding-top: 10px; 
  padding-bottom: 10px; 
}

.stateLayout{ 
  padding-top: 16px; 
  padding-bottom: 28px; 
}

.stateHero{
  padding: 0;
  margin: 0 0 12px;
  display: block;
}

.heroCard{
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(226,232,240,.95);
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(2,6,23,.08);
  padding: 18px;
  width: 100%;
  max-width: none;
  margin: 0;
}

.stateKicker{
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .10em;
  color: rgba(15,23,42,.68);
  margin-bottom: 8px;
}

.stateTitle{
  margin: 0 0 8px;
  font-size: clamp(28px, 3.5vw, 44px);
  letter-spacing: -0.02em;
}

.stateLead{ 
  margin: 0 0 12px; 
  color: #475569; 
  font-size: 16px; 
}

.heroMeta{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}

.badge{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(2,6,23,.12);
  background: rgba(2,6,23,.03);
  font-size: 12px;
  color: rgba(15,23,42,.78);
}

.ghostLink{
  color: rgba(15,23,42,.72);
  font-weight: 650;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
}

.ghostLink:hover{ 
  background: rgba(2,6,23,.04); 
}

.toc{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.toc a{
  font-size: 13px;
  font-weight: 650;
  color: rgba(15,23,42,.78);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(2,6,23,.10);
  background: rgba(255,255,255,.65);
}

.toc a:hover{ 
  background: rgba(2,6,23,.04); 
}

.tocWide a{ 
  margin-bottom: 6px; 
}

.rightRail{
  display: grid;
  gap: 12px;
}

.railCard{
  background: #ffffff;
  border: 1px solid rgba(226,232,240,.95);
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(2,6,23,.08);
  padding: 14px;
}

.railBody{
  font-size: 14px;
  line-height: 1.5;
}

.railBody p{
  margin: 0;
}

.railTitle{
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .10em;
  color: rgba(15,23,42,.68);
  margin-bottom: 8px;
}

.stateQuick{ 
  margin-top: 14px; 
}

.chipRow{ 
  display: flex; 
  flex-wrap: wrap; 
  gap: 8px; 
  margin-top: 10px; 
}

.chip{
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(2,6,23,.12);
  background: rgba(2,6,23,.03);
  font-size: 12px;
  color: rgba(15,23,42,.78);
}

.stateDirectory{ 
  margin-top: 16px; 
}

.sectionHeader h2{ 
  margin: 0 0 6px; 
}

.sectionHeader p{ 
  margin: 0 0 12px; 
}

.stateResources{ 
  margin-top: 16px; 
}

/* === Legacy Content Support === */
.legacyCard{
  background: #ffffff;
  border: 1px solid rgba(226,232,240,.95);
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(2,6,23,.08);
  padding: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.legacyCard table{ 
  max-width: 100%; 
}

.legacyCard img{ 
  max-width: 100%; 
  height: auto; 
}

.legacyCard td, 
.legacyCard th{ 
  max-width: 100%; 
}

.legacyCard font, 
.legacyCard center{ 
  font-family: inherit;
}

.legacyCard a{ 
  color: #0b5bd3; 
}

.legacyCard a:visited{ 
  color: #6b21a8; 
}

/* === Accordions === */
.anchorTarget{
  scroll-margin-top: 90px;
}

details.accordion{
  border: 1px solid rgba(226,232,240,.95);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(2,6,23,.08);
  margin: 12px 0;
  overflow: hidden;
}

details.accordion > summary{
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}

details.accordion > summary::-webkit-details-marker{ 
  display: none; 
}

details.accordion > summary::after{
  content: "▾";
  margin-left: auto;
  font-size: 14px;
  color: rgba(15,23,42,.65);
  transition: transform .18s ease;
  will-change: transform;
}

details.accordion[open] > summary::after{
  transform: rotate(180deg);
}

.accTitle{
  font-weight: 800;
  color: rgba(15,23,42,.92);
}

.accBody{
  border-top: 1px solid rgba(226,232,240,.95);
  padding: 12px 14px;
}

/* === State Links Grid === */
.stateLinksGrid{
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  max-width: 980px;
  margin: 0 auto 16px;
}

.stateLinksGrid .stateLink{
  display: block;
  text-align: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  font-weight: 700;
  text-decoration: none;
  line-height: 1.2;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stateLinksGrid .stateLink:hover{
  text-decoration: underline;
}

.stateLinksGrid .stateLink:focus-visible{
  outline: 3px solid currentColor;
  outline-offset: 2px;
}

/* === Responsive Image Maps === */
img[usemap]{
  max-width: 100%;
  height: auto;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Tablet & Medium Screens (980px and below) */
@media (max-width: 980px){
  .hero{ 
    grid-template-columns: 1fr; 
  }
  
  .grid{ 
    grid-template-columns: repeat(2, 1fr); 
  }
  
  .grid2{ 
    grid-template-columns: 1fr; 
  }
  
  .brand{ 
    min-width: unset; 
  }
  
  .stateLinksGrid{ 
    grid-template-columns: repeat(4, minmax(0, 1fr)); 
  }
}

/* Tablet Portrait (820px and below) */
@media (max-width: 820px){
  .stateLinksGrid{ 
    grid-template-columns: repeat(3, minmax(0, 1fr)); 
  }
}

/* Mobile & Small Tablets (600px and below) */
@media (max-width: 600px){
  /* Layout adjustments */
  .wrap{ 
    padding: 12px; 
  }
  
  .grid{ 
    grid-template-columns: 1fr; 
  }
  
  .footerGrid{ 
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  /* Header adjustments */
  .tag{ 
    display: none; 
  }
  
  /* Typography */
  body{ 
    font-size: 15px; 
  }
  
  .lead{ 
    font-size: 15px; 
  }
  
  .card p{ 
    font-size: 12px; 
  }
  
  /* Spacing */
  .panel, .heroCard{ 
    padding: 14px; 
  }
  
  /* Buttons */
  .ctaRow{ 
    gap: 8px; 
  }
  
  .btn{ 
    font-size: 13px; 
    padding: 9px 11px;
    min-height: 40px;
  }
  
  /* Touch targets */
  .toc a{ 
    padding: 10px 12px; 
  }
  
  /* Accordions */
  details.accordion > summary{ 
    padding: 12px 14px;
    font-size: 15px;
  }
  
  .accBody{ 
    padding: 10px 12px; 
  }
  
  /* Tables in legacy content */
  .legacyCard table{
    font-size: 12px;
  }
  
  .legacyCard td, 
  .legacyCard th{
    padding: 6px 8px;
  }
  
  /* Shadows (lighter for performance) */
  .card, 
  .heroCard, 
  .railCard, 
  .legacyCard,
  details.accordion{
    box-shadow: 0 4px 12px rgba(2,6,23,.06);
  }
  
  /* Visibility toggles */
  .hideMobile{ 
    display: none; 
  }
  
  .showMobile{ 
    display: block; 
  }
}

/* Small Phones (560px and below) */
@media (max-width: 560px){
  .stateLinksGrid{ 
    grid-template-columns: repeat(2, minmax(0, 1fr)); 
  }
}

/* Very Small Screens (360px and below) */
@media (max-width: 360px){
  .stateLinksGrid{ 
    grid-template-columns: 1fr; 
  }
}

/* Extra Small Devices (340px and below) */
@media (max-width: 340px){
  .brand img{ 
    height: 38px; 
  }
  
  h1{ 
    font-size: 24px; 
  }
  
  .menuButton{ 
    width: 40px; 
    height: 40px; 
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce){
  *, 
  *::before, 
  *::after{
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* === Gap Fixes: collapse empty legacy ad/anchor/paragraph space === */
.ad-slot,
.ad-slot:empty,
.adsbygoogle:empty,
ins.adsbygoogle[data-ad-status="unfilled"]{
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.anchorTarget:empty{
  display: block;
  height: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.legacyCard p:empty,
.legacyCard center:empty{
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.legacyCard p{
  margin-top: 0;
  margin-bottom: .45rem;
}

.legacyCard p:last-child{
  margin-bottom: 0;
}

.sectionTitle + .legacyCard,
.sectionTitle + .accBody{
  margin-top: 0;
}
