/* === Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy: #1a3a5c;
  --navy-light: #2c5f8a;
  --gold: #d4af37;
  --gold-light: #e8d48b;
  --blue-pale: #d6e8f7;
  --row-alt: #f0f4f8;
  --link: #1558a3;
  --gray: #555;
  --gray-light: #888;
  --bg: #fafbfc;
  --white: #fff;
  --text: #222;
  --border: #ddd;
  --radius: 6px;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === Header === */
.site-header {
  background: var(--navy);
  color: var(--white);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.site-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
  white-space: nowrap;
}
.site-logo a { color: inherit; }
.site-logo a:hover { text-decoration: none; }

nav { display: flex; gap: 0.25rem; }
nav a {
  color: var(--blue-pale);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  transition: background 0.15s;
}
nav a:hover, nav a.active {
  background: rgba(255,255,255,0.1);
  color: var(--white);
  text-decoration: none;
}

/* Mobile hamburger */
.nav-toggle { display: none; background: none; border: none; color: var(--gold); font-size: 1.5rem; cursor: pointer; }
@media (max-width: 700px) {
  .nav-toggle { display: block; }
  nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--navy);
    padding: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  }
  nav.open { display: flex; }
  nav a { padding: 0.7rem 1rem; }
}

/* === Main content === */
main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  width: 100%;
}

/* === Hero section (index.html) === */
.hero {
  text-align: center;
  padding: 2rem 1rem 1rem;
}
.hero h1 {
  font-size: 2rem;
  color: var(--navy);
  margin-bottom: 0.3rem;
}
.hero .subtitle {
  font-size: 1.1rem;
  color: var(--gray);
}
.hero-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.state-select {
  padding: 0.45rem 0.75rem;
  border: 2px solid var(--navy);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--navy);
  background: var(--white);
  cursor: pointer;
  outline: none;
  min-width: 260px;
}
.state-select:focus { border-color: var(--gold); }
.state-select option { color: var(--text); }

/* === Map === */
.map-container {
  max-width: 960px;
  margin: 1.5rem auto;
  position: relative;
}
.map-container svg {
  width: 100%;
  height: auto;
  display: block;
}
.map-container svg path {
  stroke: var(--white);
  stroke-width: 1;
  cursor: pointer;
  transition: opacity 0.15s;
}
.map-container svg path:hover {
  opacity: 0.8;
  stroke: var(--gold);
  stroke-width: 2;
}

/* Map tooltip */
.map-tooltip {
  position: fixed;
  background: var(--navy);
  color: var(--white);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 200;
  display: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  white-space: nowrap;
}

/* State panel (sidebar / modal) */
.state-panel {
  display: none;
  position: fixed;
  top: 56px;
  right: 0;
  width: 420px;
  max-width: 90vw;
  height: calc(100vh - 56px);
  background: var(--white);
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  z-index: 150;
  overflow-y: auto;
  padding: 1.5rem;
}
.state-panel.open { display: block; }
.state-panel .close-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray);
  line-height: 1;
}
.state-panel h2 {
  color: var(--navy);
  margin-bottom: 0.25rem;
  padding-right: 2rem;
}
.state-panel .state-stats {
  color: var(--gray);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.state-panel .court-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.state-panel .court-item:last-child { border-bottom: none; }
.court-num {
  display: inline-block;
  background: var(--navy);
  color: var(--white);
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin-right: 0.4rem;
  min-width: 1.8rem;
  text-align: center;
}
.court-name { font-weight: 600; }
.court-county { color: var(--gray); font-size: 0.85rem; }
.court-url { font-size: 0.8rem; word-break: break-all; }

/* Map legend */
.map-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--gray);
}
.legend-bar {
  width: 200px;
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(to right, #d6e8f7, #1a3a5c);
}

/* === Tables === */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table thead { position: sticky; top: 56px; z-index: 10; }
.data-table th {
  background: var(--navy-light);
  color: var(--white);
  padding: 0.5rem 0.6rem;
  text-align: left;
  font-weight: 600;
}
.data-table td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.data-table tr:nth-child(even) td { background: var(--row-alt); }
.data-table .url-cell {
  word-break: break-all;
  font-size: 0.8rem;
  max-width: 300px;
}
.state-group-header {
  background: var(--blue-pale) !important;
  font-weight: 700;
  font-size: 1rem;
  color: var(--navy);
  padding: 0.6rem !important;
}

/* === Search === */
.search-box {
  max-width: 600px;
  margin: 1.5rem auto;
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
}
.search-box input:focus { border-color: var(--navy-light); }
.search-icon {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-light);
  font-size: 1.1rem;
}
.search-count {
  text-align: center;
  color: var(--gray);
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

/* === Trump Cases === */
.case-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.case-card h2 {
  color: var(--navy);
  margin-bottom: 0.75rem;
  font-size: 1.3rem;
}
.case-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  background: var(--row-alt);
  padding: 0.75rem;
  border-radius: var(--radius);
  border-left: 4px solid var(--navy-light);
}
.case-info dt { font-weight: 600; white-space: nowrap; }
.case-info dd { color: var(--gray); }
.case-body p { margin-bottom: 0.75rem; }

.summary-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}
.summary-table th {
  background: var(--navy-light);
  color: var(--white);
  padding: 0.6rem 0.8rem;
  text-align: left;
}
.summary-table td {
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid var(--border);
}
.summary-table tr:nth-child(even) td { background: var(--row-alt); }

/* === Page title === */
.page-title {
  color: var(--navy);
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
}
.page-subtitle {
  color: var(--gray);
  margin-bottom: 1.5rem;
}

/* === Footer === */
.site-footer {
  background: var(--navy);
  color: var(--blue-pale);
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.85rem;
  margin-top: 2rem;
}
.site-footer a { color: var(--gold); }
.site-footer .footer-book { margin-bottom: 0.5rem; }

/* === Ad placeholder === */
.ad-placeholder {
  background: var(--row-alt);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  color: var(--gray-light);
  font-size: 0.85rem;
  margin: 1.5rem 0;
}

/* === Paywall === */
.paywall-link {
  color: var(--gray-light) !important;
  font-size: 0.8rem;
  text-decoration: none;
}
.paywall-link:hover {
  color: var(--navy) !important;
  text-decoration: underline;
}
.paywall-banner {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: var(--white);
  border-radius: var(--radius);
  padding: 0.75rem 1.2rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.paywall-banner a {
  color: var(--gold);
  font-weight: 600;
  white-space: nowrap;
}

/* === Responsive === */
@media (max-width: 600px) {
  .hero h1 { font-size: 1.5rem; }
  .state-panel { width: 100vw; max-width: 100vw; }
  .data-table { font-size: 0.8rem; }
  .data-table th, .data-table td { padding: 0.3rem 0.4rem; }
  .case-info { grid-template-columns: 1fr; }
}
