/* City Health Evidence — v0.1 styles.
   Palette per the build brief: dark navy header, light grey background,
   white content, subtle borders, light blue tags. */

:root {
  --navy: #0B1F33;
  --navy-soft: #14507e;
  --grey-bg: #F5F7FA;
  --white: #FFFFFF;
  --border: #D9E2EC;
  --border-strong: #b9cbdd;
  --tag-blue: #E8F1FB;
  --text: #1c2b3a;
  --muted: #5a6b7c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--grey-bg);
  color: var(--text);
  line-height: 1.55;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--navy-soft);
  outline-offset: 2px;
  border-radius: 3px;
}

/* Header */
.site-header {
  background: var(--navy);
  color: var(--white);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.brand {
  color: var(--white);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15rem;
  white-space: nowrap;
}

.beta-tag {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 3px;
  padding: 0.15rem 0.4rem;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.brand-descriptor {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: #cfdcea;
  letter-spacing: 0.01em;
  margin-top: 0.1rem;
}

.nav-toggle { display: none; }

.site-nav {
  display: flex;
  gap: 0.25rem;
}

.site-nav a {
  color: #cfdcea;
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.4rem 0.55rem;
  border-radius: 4px;
  white-space: nowrap;
}

.site-nav a:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
}

.site-nav a.active {
  color: var(--white);
  font-weight: 600;
}

/* Main content */
main.container { padding-top: 1.75rem; padding-bottom: 3rem; }

h1 { color: var(--navy); margin: 0.5rem 0 0.9rem; font-size: 2rem; letter-spacing: -0.01em; }
h2 { color: var(--navy); font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }

a { color: var(--navy-soft); }

.lead { font-size: 1.2rem; max-width: 44rem; margin-top: 0; }

.buttons { margin: 1.5rem 0; display: flex; gap: 0.75rem; flex-wrap: wrap; }

.button {
  display: inline-block;
  background: var(--navy);
  color: var(--white);
  text-decoration: none;
  border: 1px solid var(--navy);
  padding: 0.6rem 1.2rem;
  border-radius: 5px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}

.button:hover { background: #16324e; }

.button.secondary {
  background: var(--white);
  color: var(--navy);
  border: 1px solid var(--border);
}

.button.secondary:hover { border-color: var(--border-strong); background: var(--white); }

.panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.25rem;
}

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

/* Search form */
.search-form { display: grid; gap: 0.85rem; }

.search-row { display: flex; gap: 0.6rem; }

.search-row input[type="search"] {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 1rem;
}

.search-row input[type="search"]:focus { border-color: var(--navy-soft); }

.search-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.clear-link { font-size: 0.9rem; color: var(--muted); }
.clear-link:hover { color: var(--navy-soft); }

.filter-toggle { display: none; }

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.7rem;
}

.filter-grid label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.filter-grid select {
  width: 100%;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--white);
  font-size: 0.9rem;
  color: var(--text);
}

/* Results */
#result-count {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--navy);
  margin: 1.4rem 0 0.75rem;
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem 1.3rem;
  margin-bottom: 0.9rem;
  transition: border-color 0.15s ease;
}

.card:hover { border-color: var(--border-strong); }

.card h3 { margin: 0 0 0.3rem; font-size: 1.12rem; line-height: 1.35; }
.card h3 a { color: var(--navy); text-decoration: none; }
.card h3 a:hover { color: var(--navy-soft); text-decoration: underline; }

.card .location { color: var(--muted); font-size: 0.88rem; margin: 0 0 0.55rem; }
.card .description { margin: 0.45rem 0 0.75rem; color: #33475b; }

.card-actions { margin: 0.7rem 0 0.1rem; }
.button-small { padding: 0.35rem 0.8rem; font-size: 0.85rem; }
.map-note { font-size: 0.85rem; max-width: 52rem; }

.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.4rem 0 0.1rem; }

.tag {
  background: var(--tag-blue);
  color: var(--navy);
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.18rem 0.55rem;
  white-space: nowrap;
}

.tag--status {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  font-weight: 400;
}

/* Pagination */
.pagination {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  margin: 1.75rem 0 0.5rem;
}

.pagination a {
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  color: var(--navy);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.5rem 1rem;
}

.pagination a:hover { border-color: var(--border-strong); }

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

/* Map */
#map {
  height: 430px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 1.1rem 0 0.25rem;
  background: var(--white);
}

.map-popup { font-size: 0.92rem; line-height: 1.5; }
.map-popup p { margin: 0.5rem 0 0; }
.map-error { padding: 1rem; color: var(--muted); }

/* Case detail */
.crumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 0; }
.case-location { color: var(--muted); margin-top: 0; font-size: 1.02rem; }

.case-detail section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem 1.3rem;
  margin-bottom: 1rem;
}

.case-detail section h2 { margin-top: 0; }

.note {
  background: #fff8e6;
  border: 1px solid #e6d9a8;
  border-radius: 5px;
  padding: 0.6rem 0.9rem;
  margin: 0.75rem 0;
}

.citation {
  background: var(--bg-soft, #f4f7fa);
  border-left: 3px solid var(--navy);
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.6rem 1.5rem; }
.fact dt { font-size: 0.78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.fact dd { margin: 0.1rem 0 0; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 2.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer p { margin: 0.35rem 0; max-width: 52rem; }
.footer-links { margin-top: 0.75rem; }

/* Small screens */
@media (max-width: 719px) {
  /* Compact single-row header: brand left, menu button right. The nav
     opens as a full-width panel of comfortable link rows beneath it. */
  .header-inner {
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
    gap: 0.5rem;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: var(--white);
    padding: 0.45rem 0.55rem;
    cursor: pointer;
  }

  .site-nav { display: none; }

  .site-header.nav-open .site-nav {
    display: flex;
    flex-direction: column;
    width: 100%;
    order: 3;
    padding: 0.25rem 0 0.6rem;
    gap: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    margin-top: 0.25rem;
  }

  .site-header.nav-open .site-nav a {
    font-size: 1rem;
    padding: 0.8rem 0.35rem;
    border-radius: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  }

  .site-header.nav-open .site-nav a:last-child { border-bottom: none; }

  .brand-descriptor { font-size: 0.66rem; }

  h1 { font-size: 1.6rem; }
  .lead { font-size: 1.08rem; }
  .panel { padding: 1.1rem 1rem; }

  /* Filters collapse behind a toggle so results stay close to the top.
     JavaScript opens them automatically when a filter is active. */
  .filter-toggle { display: inline-block; }
  .filter-grid { display: none; }
  .filter-grid.open { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .filter-grid.open select { font-size: 16px; } /* prevents iOS zoom-on-focus */

  .buttons .button { flex: 1; text-align: center; }

  #map { height: 300px; }

  .card { padding: 0.95rem 1rem; }
  .tag { font-size: 0.76rem; }
}
