:root {
  --bg: #eef2ef;
  --ink: #15202b;
  --panel: #ffffff;
  --accent: #0e7c66;
  --accent-2: #c95d2a;
  --line: #d2ddda;
  --muted: #55636f;
  --hero-a: #daf1e7;
  --hero-b: #f7f1df;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 5%, var(--hero-b) 0%, transparent 28%),
    radial-gradient(circle at 92% 0%, var(--hero-a) 0%, transparent 24%),
    var(--bg);
  color: var(--ink);
  font-family: 'Bricolage Grotesque', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

.hero {
  position: relative;
}

.kicker {
  margin: 0;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0.4rem 0;
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  line-height: 1.05;
}

.lede {
  margin: 0;
  max-width: 68ch;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-meta {
  margin-top: 0.65rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9rem;
  color: #30424e;
}

.top-band {
  background: rgb(255 255 255 / 72%);
  backdrop-filter: blur(8px);
}

.brand-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid #c8d7d3;
  background: #f3faf6;
  color: #0d5b48;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
}

.brand-chip:hover,
.brand-chip:focus {
  color: #0d5b48;
  text-decoration: none;
}

.top-offset {
  top: 1rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 12px 28px rgb(21 32 43 / 7%);
}

.controls label {
  display: block;
  margin: 0.7rem 0 0.2rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.form-control,
.form-select,
.btn {
  min-height: 44px;
}

.form-control[type='search'] {
  border-color: #c6d6d2;
  background: #fbfdfc;
}

.form-control[type='search']:focus {
  border-color: #0e7c66;
  box-shadow: 0 0 0 0.2rem rgb(14 124 102 / 18%);
}

.btn-primary {
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-bg: #0b6854;
  --bs-btn-hover-border-color: #0b6854;
  --bs-btn-active-bg: #095441;
  --bs-btn-active-border-color: #095441;
  --bs-btn-focus-shadow-rgb: 14, 124, 102;
  font-weight: 700;
}

.map {
  width: 100%;
  min-height: 560px;
  border-radius: 12px;
  border: 1px solid #d4dfdc;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.7rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 0.35rem;
}

.dot.offender {
  background: var(--accent-2);
}

.dot.school {
  background: var(--accent);
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.county-list,
.result-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.55rem;
}

.state-county-list {
  max-height: min(68vh, 680px);
  overflow: auto;
  padding-right: 0.15rem;
  -webkit-overflow-scrolling: touch;
}

.county-list a {
  color: inherit;
  text-decoration: none;
}

.county-item,
.result-item {
  border: 1px solid #d9e4e1;
  border-radius: 12px;
  padding: 0.75rem;
  background: #fff;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.county-item:hover,
.county-item:focus-within {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgb(21 32 43 / 9%);
}

.result-item h3,
.county-item h3 {
  margin: 0;
  font-size: 1rem;
}

.result-item p,
.county-item p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.offender-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 940px;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}

.offender-table th,
.offender-table td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.45rem;
  font-size: 0.9rem;
}

.offender-table th {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: #edf3f1;
  position: sticky;
  top: 0;
  z-index: 1;
}

.offender-table tbody tr:nth-child(even) {
  background: #fbfdfc;
}

.offender-photo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink);
}

.offender-photo {
  width: 56px;
  height: 70px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #f0ece4;
}

.offender-photo-fallback {
  display: none;
  font-size: 0.8rem;
}

.popup-photo {
  width: 92px;
  height: 116px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #f0ece4;
}

.map-label {
  background: rgb(255 255 255 / 92%);
  border: 1px solid rgb(21 32 43 / 12%);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgb(21 32 43 / 10%);
  color: var(--ink);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  line-height: 1.1;
  padding: 0.24rem 0.45rem;
  white-space: nowrap;
}

.map-label::before {
  display: none;
}

.map-label-school {
  color: #0b6854;
  font-weight: 600;
}

.map-label-offender {
  color: #8f3c18;
}

.name-last {
  display: inline;
}

.name-first {
  display: block;
  margin-top: 0.02rem;
}

.mobile-view-toggle .btn {
  font-weight: 700;
}

.mobile-view-toggle .btn.is-active {
  background: #15202b;
  border-color: #15202b;
  color: #fff;
}

.is-hidden {
  display: none;
}

.back-link {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--ink);
}

@media (min-width: 992px) {
  .split-layout > .col-lg-4,
  .split-layout > .col-lg-8 {
    display: flex;
  }

  .split-layout > .col-lg-4 > .panel,
  .split-layout > .col-lg-8 > .panel {
    width: 100%;
  }

  .split-layout > .col-lg-4 .controls .card-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
  }

  .split-layout > .col-lg-4 .state-county-list {
    flex: 1;
    min-height: 0;
    max-height: min(68vh, 680px);
    overflow: auto;
  }
}

@media (max-width: 980px) {
  .county-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .state-county-list {
    max-height: none;
    overflow: visible;
  }

  .map {
    min-height: 380px;
  }
}

@media (max-width: 768px) {
  .hero {
    padding-top: 1.1rem;
    padding-bottom: 0.5rem;
  }

  h1 {
    font-size: clamp(1.55rem, 7vw, 2.2rem);
    line-height: 1.12;
  }

  .lede {
    font-size: 0.98rem;
  }

  .panel {
    border-radius: 14px;
    box-shadow: 0 8px 20px rgb(21 32 43 / 7%);
  }

  .legend {
    gap: 0.65rem;
    font-size: 0.82rem;
  }

  .offender-table {
    min-width: 620px;
    font-size: 0.84rem;
  }

  .offender-table th,
  .offender-table td {
    padding: 0.48rem 0.4rem;
    font-size: 0.82rem;
  }

  /* Keep high-signal columns on phones. */
  .offender-table th:nth-child(3),
  .offender-table td:nth-child(3),
  .offender-table th:nth-child(5),
  .offender-table td:nth-child(5),
  .offender-table th:nth-child(6),
  .offender-table td:nth-child(6) {
    display: none;
  }

  .offender-photo {
    width: 44px;
    height: 56px;
  }

  .popup-photo {
    width: 76px;
    height: 96px;
  }

  .map-label {
    font-size: 0.64rem;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-view-hidden {
    display: none;
  }
}

@media (max-width: 640px) {
  .hero-meta {
    font-size: 0.82rem;
  }

  .county-list {
    grid-template-columns: 1fr;
  }

  .map {
    min-height: 300px;
  }

  .offender-table {
    min-width: 540px;
  }
}
