/* ==========================================================================
   Base — reset, editorial typography, layout primitives, masthead, footer
   ========================================================================== */

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

/* The `hidden` attribute means hidden, and it has to beat any class on the same
   element. The browser's own rule is `[hidden] { display: none }`, which any
   class setting `display` outranks on specificity — so an element written as
   `<div class="banner" hidden>` renders as an empty bar, and one written as
   `<div class="ticker" hidden>` never goes away when dismissed. Both of those
   happened here. This is the case `!important` exists for: there is no state
   in which markup says hidden and the element should be on screen. */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

/* Headings are Archivo, set heavy and NARROW. The width axis is where this
   type gets its character — at 84% the letters compress and a headline reads
   as a stacked block rather than a line of text, which is the whole point of
   the display face. font-stretch is the standard property that drives the
   axis; font-variation-settings is the fallback for engines that only expose
   it through the low-level API. */
h1,
h2,
h3,
h4 {
  margin: 0 0 var(--space-3);
  font-family: var(--font-display);
  font-weight: var(--weight-black);
  font-stretch: var(--width-display);
  font-variation-settings: "wdth" 84;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 {
  font-size: var(--text-3xl);
  letter-spacing: var(--tracking-tighter);
}
h2 {
  font-size: var(--text-2xl);
}
/* Compression is for display sizes only. At h3 and below the narrow cut costs
   more legibility than it buys character, so these go back to normal width. */
h3 {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  font-stretch: var(--width-normal);
  font-variation-settings: "wdth" 100;
  line-height: var(--leading-snug);
  letter-spacing: -0.008em;
}
h4 {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  font-stretch: var(--width-normal);
  font-variation-settings: "wdth" 100;
  line-height: var(--leading-snug);
  letter-spacing: 0;
}

/* Long-form prose keeps the serif — that is where the reading happens. */
.prose p,
.prose li,
.detail__body,
.report-card__body {
  font-family: var(--font-serif);
}

/* Anything that is a number, a code or a timestamp is monospace, with lining
   tabular figures so columns of digits line up. */
.stat__value,
.chart__value,
.watch-card__count,
.ticker__count,
.news-item__meta time,
code,
kbd,
samp {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

p {
  margin: 0 0 var(--space-4);
  text-wrap: pretty;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

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

ul,
ol {
  margin: 0 0 var(--space-4);
  padding-left: var(--space-5);
}

li + li {
  margin-top: var(--space-2);
}

strong,
b {
  font-weight: var(--weight-bold);
}

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-sunken);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.35em;
}

hr {
  border: 0;
  border-top: var(--rule-width) solid var(--rule);
  margin: var(--space-6) 0;
}

blockquote {
  margin: var(--space-5) 0;
  padding-left: var(--space-5);
  border-left: var(--rule-heavy) solid var(--text);
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
}

/* ---- Editorial furniture, all set in the sans ---------------------------- */

/* A kicker is the small line above a headline. Uppercase, tracked out, with a
   short rule after it — the most recognisable piece of newspaper furniture. */
.kicker {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0 0 var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-kicker);
  text-transform: uppercase;
  color: var(--text);
}

.kicker::after {
  content: "";
  flex: 1;
  height: var(--rule-width);
  background: var(--rule);
}

.kicker--accent {
  color: var(--status-reported);
}

.kicker--plain::after {
  display: none;
}

.lead {
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  color: var(--text-muted);
}

/* Drop cap on the opening paragraph of a long read. Serif, four lines deep. */
.dropcap::first-letter {
  float: left;
  font-size: 3.6em;
  line-height: 0.78;
  font-weight: var(--weight-bold);
  padding: 0.06em 0.09em 0 0;
  color: var(--text);
}

.muted {
  color: var(--text-muted);
}

.small {
  font-size: var(--text-sm);
}

.tiny {
  font-size: var(--text-xs);
}

.sans {
  font-family: var(--font-sans);
}

.nowrap {
  white-space: nowrap;
}

.numeric {
  font-variant-numeric: tabular-nums;
}

/* A dateline — sans, small, muted, sits under a headline. */
.dateline {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
  color: var(--text-subtle);
}

/* --------------------------------------------------------------------------
   Accessibility
   -------------------------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 2000;
  padding: var(--space-2) var(--space-4);
  background: var(--bg-ink);
  color: var(--text-on-ink);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  transform: translateY(-250%);
  transition: transform var(--duration-fast) var(--ease-out);
}

.skip-link:focus {
  transform: translateY(0);
  color: var(--text-on-ink);
}

/* --------------------------------------------------------------------------
   Layout primitives
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

@media (min-width: 768px) {
  .container {
    padding-inline: var(--space-6);
  }
}

.container-wide {
  max-width: var(--container-wide);
}

.container-narrow {
  max-width: var(--container-narrow);
}

.section {
  padding-block: var(--space-7);
}

@media (min-width: 900px) {
  .section {
    padding-block: var(--space-8);
  }
}

/* Sections are separated by hairline rules rather than cards on a grey field.
   This is the single biggest change from the old dashboard look. */
.section--ruled {
  border-top: var(--rule-width) solid var(--rule);
}

.section--tinted {
  background: var(--bg-sunken);
  border-block: var(--rule-width) solid var(--rule);
}

.stack > * + * {
  margin-top: var(--space-4);
}

.stack-sm > * + * {
  margin-top: var(--space-2);
}

.stack-lg > * + * {
  margin-top: var(--space-6);
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}

.row-between {
  justify-content: space-between;
}

.grid {
  display: grid;
  gap: var(--space-5);
}

.grid-2 {
  grid-template-columns: 1fr;
}
.grid-3 {
  grid-template-columns: 1fr;
}
.grid-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 900px) {
  .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Broadsheet columns — used for the concern cards and long report lists on
   wide screens only. `break-inside` keeps a card from splitting across a
   column boundary. */
.columns {
  column-gap: var(--space-6);
  column-rule: var(--rule-width) solid var(--rule);
}

@media (min-width: 1100px) {
  .columns--2 {
    column-count: 2;
  }
  .columns--3 {
    column-count: 3;
  }
}

.columns > * {
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
}

main {
  flex: 1 0 auto;
}

/* Page header — the standing head on inner pages. */
.page-header {
  padding-block: var(--space-6) var(--space-5);
  border-bottom: var(--rule-heavy) solid var(--text);
  margin-bottom: var(--space-6);
}

.page-header p {
  max-width: 62ch;
}

.prose {
  max-width: 68ch;
}

.prose h2 {
  margin-top: var(--space-7);
  padding-top: var(--space-4);
  border-top: var(--rule-width) solid var(--rule);
}

.prose h3 {
  margin-top: var(--space-5);
}

.prose > *:first-child {
  margin-top: 0;
}

/* --------------------------------------------------------------------------
   Masthead
   -------------------------------------------------------------------------- */

/* The masthead is part of the instrument panel, not a separate light bar
   sitting on top of it. Dark everywhere, with a hairline that glows faintly —
   the same edge you get on a rack-mounted display. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 900;
  background: var(--bg-ink);
  color: var(--text-on-ink);
  border-bottom: var(--border-width) solid var(--border-on-ink);
  transition: box-shadow var(--duration-base) var(--ease-out),
              background var(--duration-base) var(--ease-out);
}

.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(0, 184, 189, 0.5) 22%,
    rgba(255, 107, 61, 0.5) 62%,
    transparent
  );
  pointer-events: none;
}

/* Applied by layout.js once the page scrolls, so the bar only gains weight
   when it is actually floating over content. */
.site-header.is-stuck {
  box-shadow: 0 8px 28px rgba(10, 15, 28, 0.45);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: var(--header-height);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text-on-ink);
  text-decoration: none;
  flex-shrink: 0;
}

.brand:hover {
  color: var(--text-on-ink);
}

/* The county silhouette, generated from the county's own district boundaries
   by scripts/build-county-svg.py. */
.brand__mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  color: var(--teal-bright);
  transition: transform var(--duration-base) var(--ease-spring),
              color var(--duration-base) var(--ease-out);
  filter: drop-shadow(0 0 10px rgba(0, 184, 189, 0.35));
}

.brand:hover .brand__mark {
  color: var(--signal-bright);
  filter: drop-shadow(0 0 12px rgba(255, 107, 61, 0.45));
}

.brand__mark svg {
  width: 100%;
  height: 100%;
}

.brand:hover .brand__mark {
  transform: rotate(-6deg) scale(1.08);
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 88%;
  font-variation-settings: "wdth" 88;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  line-height: 1.1;
  display: none;
}

.brand__name--short {
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 88%;
  font-variation-settings: "wdth" 88;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
}

@media (min-width: 560px) {
  .brand__name {
    display: block;
  }
  .brand__name--short {
    display: none;
  }
}

.nav-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: none;
  border: var(--border-width) solid var(--border-on-ink);
  color: var(--text-on-ink);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-kicker);
  text-transform: uppercase;
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  min-height: 40px;
  border-radius: var(--radius-md);
}

@media (min-width: 960px) {
  .nav-toggle {
    display: none;
  }
}

.site-nav {
  display: none;
  margin-left: auto;
}

.site-nav.is-open {
  display: block;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-ink);
  border-bottom: var(--border-width) solid var(--border-on-ink);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3) var(--space-4);
  animation: nav-drop var(--duration-base) var(--ease-out) both;
}

@keyframes nav-drop {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

.site-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.site-nav__list li + li {
  margin-top: 0;
  border-top: var(--border-width) solid var(--border-on-ink);
}

.site-nav__link {
  display: block;
  position: relative;
  padding: var(--space-3);
  color: var(--text-on-ink-muted);
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.site-nav__link:hover {
  color: var(--text-on-ink);
}

.site-nav__link[aria-current="page"] {
  font-weight: var(--weight-bold);
  color: var(--text-on-ink);
}

@media (min-width: 960px) {
  .site-nav {
    display: block;
  }

  .site-nav.is-open {
    position: static;
    border: 0;
    box-shadow: none;
    padding: 0;
    animation: none;
  }

  .site-nav__list {
    flex-direction: row;
    align-items: center;
    gap: var(--space-1);
  }

  .site-nav__list li + li {
    border-top: 0;
  }

  .site-nav__link {
    padding: var(--space-2) var(--space-3);
  }

  /* An underline that wipes in from the left on hover. */
  .site-nav__link::after {
    content: "";
    position: absolute;
    left: var(--space-3);
    right: var(--space-3);
    bottom: 2px;
    height: 2px;
    background: linear-gradient(to right, var(--teal-bright), var(--signal-bright));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--duration-base) var(--ease-out);
  }

  .site-nav__link:hover::after,
  .site-nav__link[aria-current="page"]::after {
    transform: scaleX(1);
  }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.header-actions .header-cta {
  display: none;
}

@media (min-width: 720px) {
  .header-actions .header-cta {
    display: inline-flex;
  }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  margin-top: var(--space-8);
  background: var(--bg);
  border-top: var(--rule-heavy) solid var(--text);
  padding-block: var(--space-6);
  font-size: var(--text-sm);
}

.site-footer__grid {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .site-footer__grid {
    grid-template-columns: 1.7fr 1fr 1fr;
  }
}

.site-footer h2 {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-kicker);
  color: var(--text);
  margin-bottom: var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: var(--rule-width) solid var(--rule);
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer li + li {
  margin-top: var(--space-2);
}

/* :not(.btn) matters — these selectors outrank .btn--primary on specificity
   and would otherwise repaint the footer's call-to-action. */
.site-footer a:not(.btn) {
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer a:not(.btn):hover {
  color: var(--accent);
  text-decoration: underline;
}

.site-footer__disclaimer {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: var(--rule-width) solid var(--rule);
  color: var(--text-subtle);
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  max-width: 92ch;
}

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */

@media print {
  .site-header,
  .site-footer__grid,
  .skip-link,
  .filter-bar,
  .map-shell,
  .hero-figure {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }
}

/* The map, in the nav, on every page.

   Not a third button in the header action row — that row already carries The
   Alley and Report an issue, and a third crowds a laptop bar and pushes the
   brand off a phone. A filled pill in the nav is findable at a glance and
   costs no room the nav was not already spending. */
.site-nav__link--map {
  background: var(--teal-bright);
  color: var(--bg-ink);
  border-radius: var(--radius-pill);
  padding-inline: var(--space-4);
  font-weight: var(--weight-bold);
}

.site-nav__link--map:hover,
.site-nav__link--map:focus-visible {
  background: #3fd3d7;
  color: var(--bg-ink);
}

/* The underline the other nav links grow on hover would sit oddly under a
   filled pill. */
.site-nav__link--map::after {
  display: none;
}
