/* ── Design tokens ── */
:root {
  --bg: #fafaf7;
  --fg: #1a1a1a;
  --muted: #777;
  --rule: #e2e2dc;
  --rowhover: #f3f3ee;
  --accent: #2c5282;
  --accent-soft: #ebf4ff;

  /* Importance tiers — urgency scale */
  --color-high: #c0392b;
  --color-medium: #e67e22;
  --color-low: #aaa;

  --max-w: 740px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.55;
}

a { color: var(--accent); }

/* ── Site chrome ── */
.site-header {
  border-bottom: 2px solid var(--fg);
  padding: 11px 0;
}
.site-header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: baseline;
  gap: 20px;
  flex-wrap: wrap;
}
.site-wordmark {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--fg);
}
.site-nav { display: flex; flex-wrap: wrap; }
.site-nav a {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  margin-right: 14px;
}
.site-nav a:hover { color: var(--fg); }

/* ── Back link ── */
.back {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
}
.back:hover { color: var(--fg); }

/* ── Peak badge & score dot (shared tier classes) ── */
.peak-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.04em;
  color: #fff;
}
.peak-badge.s-high,   .score-dot.s-high   { background: var(--color-high); }
.peak-badge.s-medium, .score-dot.s-medium { background: var(--color-medium); }
.peak-badge.s-low,    .score-dot.s-low    { background: var(--color-low); }

.score-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* ── Episode header ── */
.episode-header {
  border-bottom: 1px solid var(--rule);
  padding: 32px 0 24px;
  background: #fff;
}
.episode-header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}
.episode-muni {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.episode-title {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.episode-meta {
  display: flex;
  gap: 14px;
  font-size: 13px;
  color: var(--muted);
  align-items: center;
  flex-wrap: wrap;
}
.episode-meta a { color: var(--muted); text-decoration: none; font-size: 13px; }
.episode-meta a:hover { color: var(--fg); }

/* ── Audio player bar ── */
.audio-bar {
  margin-top: 16px;
  padding: 10px 14px;
  background: #f4f4f0;
  border: 1px solid var(--rule);
  border-radius: 6px;
}
.audio-bar audio {
  display: block;
  width: 100%;
}

/* ── Episode body ── */
.episode-body {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* Intro / outro */
.intro-segment {
  padding: 28px 0 20px;
  border-bottom: 1px solid var(--rule);
}
.intro-segment p {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #333;
  font-style: italic;
}
.intro-segment p + p { margin-top: 10px; }

/* Item card */
.item-card {
  padding: 22px 0;
  border-bottom: 1px solid #eee;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0 18px;
}
.item-card:target {
  background: #fffbf0;
  margin: 0 -24px;
  padding: 22px 24px;
}
.score-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 3px;
}
.score-line {
  width: 1px;
  flex: 1;
  background: #e8e8e4;
  margin-top: 8px;
  min-height: 12px;
}
.item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.item-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.item-link {
  font-size: 11px;
  color: #bbb;
  text-decoration: none;
  white-space: nowrap;
  margin-top: 3px;
  flex-shrink: 0;
  font-family: monospace;
}
.item-link:hover { color: var(--muted); }
.item-body {
  font-size: 0.9rem;
  line-height: 1.65;
  color: #444;
}
.item-body p + p { margin-top: 8px; }

/* Rollup card */
.rollup-card {
  padding: 18px 20px;
  background: #f4f4f0;
  border: 1px solid var(--rule);
  border-radius: 6px;
  margin: 20px 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.6;
}
.rollup-card p + p { margin-top: 6px; }

/* ── Municipality listing ── */
.listing-header {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px 24px 0;
}
.listing-body {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 16px 24px 80px;
}
.listing-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.listing-desc {
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.55;
}
.listing-stats {
  display: flex;
  gap: 20px;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.listing-stats strong { color: var(--fg); }

/* RSS feed row */
.feed-row {
  margin-bottom: 20px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.feed-tag {
  display: inline-block;
  background: var(--color-medium);
  color: white;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.copyable {
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.82rem;
  user-select: all;
  color: var(--accent);
}
.copy-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.copy-btn:hover { background: #224b75; }
.copy-btn.copied { background: #27ae60; }

/* Episode table */
.episode-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}
.episode-table thead th {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 2px solid var(--rule);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.episode-table thead th.r { text-align: right; }
.episode-table tbody td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
  font-size: 0.9rem;
}
.episode-table tbody td.r { text-align: right; }
.episode-table tbody td.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--muted);
}
.episode-table tbody tr:hover { background: var(--rowhover); }
.episode-table tbody td a {
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
}
.episode-table tbody td a:hover { color: var(--accent); }
.episode-table .read-link {
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.episode-table .read-link:hover { color: var(--accent); }

/* ── Parent / home page ── */
.home-header {
  max-width: 980px;
  margin: 0 auto;
  padding: 40px 24px 0;
}
.home-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}
.home-subtitle {
  font-size: 0.95rem;
  color: var(--muted);
  max-width: 580px;
  line-height: 1.6;
  margin-bottom: 32px;
}
.muni-grid {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 24px 80px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 16px;
}
.muni-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 20px 22px;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
}
.muni-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 12px rgba(44,82,130,0.09);
}
.muni-card:hover .muni-card-name { text-decoration: underline; }
.muni-card-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.muni-card-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.muni-card-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 8px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.muni-card-meta strong { color: var(--fg); }
.muni-card-desc {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 12px;
}
.muni-card-feed {
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.muni-card-feed a { color: var(--accent); text-decoration: none; }
.muni-card-feed a:hover { text-decoration: underline; }

/* ── Footer ── */
.footer {
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
  padding: 24px;
}
.footer a { color: var(--accent); }

/* ── Responsive ── */
@media (max-width: 600px) {
  .item-card {
    grid-template-columns: 1fr;
  }
  .score-column {
    display: none;
  }
  /* Inline score badge on mobile via data attribute */
  .item-card.s-high .item-title::before,
  .item-card.s-medium .item-title::before,
  .item-card.s-low .item-title::before {
    content: attr(data-score-label);
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    padding: 1px 5px;
    border-radius: 10px;
    margin-right: 6px;
    vertical-align: middle;
  }
  .item-card.s-high .item-title::before   { background: var(--color-high); }
  .item-card.s-medium .item-title::before { background: var(--color-medium); }
  .item-card.s-low .item-title::before    { background: var(--color-low); }

  .episode-title { font-size: 1.3rem; }
  .home-title    { font-size: 1.5rem; }
  .muni-grid     { grid-template-columns: 1fr; }
}
