/* Community Health Commons — design system
   Civic-health look: warm paper, deep teal, terracotta accent.
   All text/background pairs meet WCAG AA. */

:root {
  --paper: #faf7f2;
  --paper-raised: #ffffff;
  --paper-sunken: #f1ece3;
  --ink: #21302e;
  --ink-soft: #4c5f5c;
  --teal: #0e5a57;
  --teal-deep: #0a4341;
  --teal-wash: #e3efee;
  --terracotta: #b44a26;
  --terracotta-wash: #f7e6de;
  --gold-wash: #f5ecd7;
  --gold-ink: #6d5514;
  --line: #ddd5c8;
  --ok: #2e6b40;
  --ok-wash: #e2efe5;
  --radius: 10px;
  --max: 1080px;
  font-size: 17px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Public Sans", -apple-system, "Segoe UI", sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: "Source Serif 4", Georgia, serif;
  color: var(--teal-deep);
  line-height: 1.2;
  margin: 0 0 .5em;
}
h1 { font-size: 2.3rem; font-weight: 700; }
h2 { font-size: 1.6rem; margin-top: 1.8em; }
h3 { font-size: 1.2rem; margin-top: 1.4em; }

a { color: var(--teal); text-underline-offset: 3px; }
a:hover { color: var(--terracotta); }

p { margin: 0 0 1em; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--teal-deep); color: #fff; padding: .6rem 1rem; z-index: 100;
}
.skip-link:focus { left: 0; }

/* Header */
header.site {
  background: var(--teal-deep);
  color: #fff;
  border-bottom: 4px solid var(--terracotta);
}
header.site .bar {
  max-width: var(--max); margin: 0 auto; padding: .9rem 1.2rem;
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
}
.wordmark {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.25rem; font-weight: 700; color: #fff; text-decoration: none;
  display: flex; align-items: center; gap: .6rem;
}
.wordmark:hover { color: #fff; }
.wordmark .mark {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--terracotta);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: "Public Sans", sans-serif; font-size: .9rem; font-weight: 700;
}
.wordmark .city { font-family: "Public Sans", sans-serif; font-size: .75rem; font-weight: 400; opacity: .85; display: block; letter-spacing: .06em; text-transform: uppercase; }
nav.site { margin-left: auto; display: flex; gap: .2rem; flex-wrap: wrap; }
nav.site a {
  color: #e8f1f0; text-decoration: none; padding: .45rem .8rem; border-radius: 6px;
  font-size: .95rem;
}
nav.site a:hover { background: rgba(255,255,255,.12); color: #fff; }
nav.site a[aria-current="page"] { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }

/* Layout */
main { max-width: var(--max); margin: 0 auto; padding: 2.2rem 1.2rem 4rem; }
.measure { max-width: 46rem; }

.hero { padding: 3rem 0 1rem; }
.hero .kicker {
  color: var(--terracotta); font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; font-size: .8rem; margin-bottom: .8rem;
}
.hero p.lede { font-size: 1.25rem; color: var(--ink-soft); max-width: 40rem; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.1rem; margin: 1.5rem 0; padding: 0; list-style: none; }
.card {
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
  display: flex; flex-direction: column; gap: .3rem;
}
.card h3 { margin-top: 0; }
.card .meta { font-size: .85rem; color: var(--ink-soft); }
.card a.cover { color: inherit; text-decoration: none; }
.card a.cover:hover h3 { color: var(--terracotta); }

/* Pills & badges */
.pill {
  display: inline-block; font-size: .75rem; font-weight: 600;
  padding: .15rem .6rem; border-radius: 999px; letter-spacing: .02em;
  background: var(--teal-wash); color: var(--teal-deep);
}
.pill.warn { background: var(--gold-wash); color: var(--gold-ink); }
.pill.ok { background: var(--ok-wash); color: var(--ok); }
.pill.cat { background: var(--terracotta-wash); color: var(--terracotta); }

/* Buttons */
.btn {
  display: inline-block; background: var(--teal); color: #fff; text-decoration: none;
  padding: .65rem 1.3rem; border-radius: 8px; font-weight: 600; border: none;
  font-size: 1rem; cursor: pointer;
}
.btn:hover { background: var(--teal-deep); color: #fff; }
.btn.ghost { background: transparent; color: var(--teal); border: 1.5px solid var(--teal); }
.btn.ghost:hover { background: var(--teal-wash); color: var(--teal-deep); }

/* Notices */
.notice {
  background: var(--gold-wash); border-left: 4px solid var(--gold-ink);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: .9rem 1.2rem; margin: 1.4rem 0; font-size: .95rem;
}
.notice.teal { background: var(--teal-wash); border-left-color: var(--teal); }

/* Review provenance box (library articles) */
.provenance {
  background: var(--paper-sunken); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.2rem; margin: 1.4rem 0; font-size: .88rem; color: var(--ink-soft);
}
.provenance dt { font-weight: 700; color: var(--ink); float: left; clear: left; margin-right: .5rem; }
.provenance dd { margin: 0 0 .2rem; }

/* Stats (dashboard) */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.1rem; margin: 1.6rem 0; }
.stat {
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
}
.stat .num { font-family: "Source Serif 4", Georgia, serif; font-size: 2.4rem; font-weight: 700; color: var(--teal-deep); line-height: 1; }
.stat .label { font-size: .85rem; color: var(--ink-soft); margin-top: .4rem; }

/* Map */
#map { height: 62vh; min-height: 420px; border-radius: var(--radius); border: 1px solid var(--line); }
.map-filters { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0; }
.map-filters button {
  font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer;
  padding: .35rem .85rem; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--paper-raised); color: var(--ink-soft);
}
.map-filters button[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: #fff; }
.resource-list { list-style: none; padding: 0; }
.resource-list li { border-bottom: 1px solid var(--line); padding: 1rem 0; }
.leaflet-popup-content { font-family: "Public Sans", sans-serif; font-size: .9rem; line-height: 1.5; }
.leaflet-popup-content h3 { font-size: 1rem; margin: 0 0 .3rem; }

/* Article body */
article.library-article ul { padding-left: 1.3rem; }
article.library-article li { margin-bottom: .45rem; }
article.library-article .sources { font-size: .88rem; color: var(--ink-soft); border-top: 1px solid var(--line); margin-top: 2rem; padding-top: 1rem; }

/* Tables */
table { border-collapse: collapse; width: 100%; margin: 1.2rem 0; font-size: .95rem; }
th, td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--teal-deep); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }

/* Footer */
footer.site {
  background: var(--teal-deep); color: #cfe0df; margin-top: 3rem;
  border-top: 4px solid var(--terracotta);
}
footer.site .inner { max-width: var(--max); margin: 0 auto; padding: 2rem 1.2rem; font-size: .88rem; }
footer.site a { color: #fff; }
footer.site .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; }

@media (max-width: 640px) {
  :root { font-size: 16px; }
  h1 { font-size: 1.8rem; }
  .hero { padding: 1.6rem 0 .5rem; }
}

/* Narration player */
.listen {
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .8rem 1.1rem; margin: 1.2rem 0; max-width: 34rem;
}
.listen-label {
  font-size: .8rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--terracotta); margin-bottom: .45rem;
}
.listen audio { width: 100%; height: 36px; }
