/* ===========================================================================
   site.css — the report's shared design system
   Editorial / investigative-report look: serif display, roomy measure,
   light canvas, one accent colour. Dark figures where the data is dark.
   =========================================================================== */

:root {
  --ink: #1a1a1a;
  --muted: #5c5c5c;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --line: #e6e2d9;
  --accent: #a00; /* investigative red */
  --accent-ink: #fff;
  --link: #8a1f1f;
  --code-bg: #f4f1ea;
  --measure: 68ch;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

/* ---- site chrome --------------------------------------------------------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(251, 250, 247, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

.site-nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.01em;
  margin-right: auto;
  padding: 14px 0;
}
.brand a {
  color: var(--ink);
  text-decoration: none;
}
.brand .brand-kicker {
  display: block;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.site-nav a.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
}
.site-nav a.nav-link:hover {
  color: var(--ink);
  background: #f0ede4;
}
.site-nav a.nav-link.active {
  color: var(--ink);
  background: #efe9dd;
}

.site-footer {
  margin-top: 80px;
  border-top: 1px solid var(--line);
  padding: 40px 20px;
  font-size: 14px;
  color: var(--muted);
}
.site-footer-inner {
  max-width: 1080px;
  margin: 0 auto;
}

/* ---- layout -------------------------------------------------------------- */

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

.prose {
  max-width: var(--measure);
  margin: 0 auto;
}

/* headings */
h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  line-height: 1.25;
  color: var(--ink);
}
h1 {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
h2 {
  font-size: 26px;
  font-weight: 700;
  margin-top: 1.6em;
}
h3 {
  font-size: 20px;
  font-weight: 700;
}
h4 {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.lede {
  font-size: 21px;
  line-height: 1.5;
  color: #333;
}

p {
  margin: 1em 0;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover {
  text-decoration: none;
}

strong {
  font-weight: 650;
}
code {
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace;
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 0.1em 0.3em;
  border-radius: 4px;
}

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 3em auto;
  max-width: var(--measure);
}

/* pull / verdict blocks */
.callout {
  border-left: 4px solid var(--accent);
  background: #faf6f0;
  padding: 16px 20px;
  margin: 2em 0;
  border-radius: 0 8px 8px 0;
  font-size: 18px;
}
.callout .callout-label {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
}

.verdict {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  padding: 22px 26px;
  margin: 2.2em 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.verdict h3 {
  margin-top: 0;
}

/* ---- footnotes ------------------------------------------------------------
   The tone rules ask for sentences a general reader can finish. A qualifier
   that is true but technical (which denominator, which date, which of two
   sources) belongs under the article, not inside the sentence. The marker is
   a link both ways so a reader never loses their place.
   -------------------------------------------------------------------------- */

.fn {
  font-family: var(--sans);
  font-size: 0.68em;
  font-weight: 700;
  line-height: 0;
  vertical-align: super;
  margin-left: 1px;
}
.fn a {
  text-decoration: none;
  color: var(--accent);
}
.fn a:hover {
  text-decoration: underline;
}

.footnotes {
  max-width: var(--measure);
  margin: 3em auto 0;
  padding-top: 1.2em;
  border-top: 1px solid var(--line);
  font-size: 15px;
  color: var(--muted);
}
.footnotes h2 {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.8em;
}
.footnotes ol {
  margin: 0;
  padding-left: 1.4em;
}
.footnotes li {
  margin-bottom: 0.7em;
  line-height: 1.55;
}
.footnotes li:target {
  background: #faf6f0;
  box-shadow: 0 0 0 6px #faf6f0;
  border-radius: 2px;
}
.fn-back {
  text-decoration: none;
  margin-left: 4px;
}

.kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---- tables -------------------------------------------------------------- */

table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.4em 0;
  font-size: 15px;
}
th,
td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 2px solid #d8d3c7;
}
td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
tr:last-child td {
  border-bottom: none;
}
caption {
  caption-side: bottom;
  font-size: 13px;
  color: var(--muted);
  padding-top: 8px;
}

.figure {
  margin: 2.2em 0;
}
.figure figcaption {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}
.figure .fig-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
}

/* ---- directory table (/tabel/) ------------------------------------------ */

.tabel-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 1.6em 0 0.8em;
}
.tabel-toolbar input[type="search"] {
  flex: 1 1 280px;
  min-width: 220px;
}
.tabel-toolbar select {
  flex: 0 0 auto;
}
.tabel-toolbar input,
.tabel-toolbar select {
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
}
.tabel-toolbar input:focus,
.tabel-toolbar select:focus {
  outline: 2px solid rgba(170, 0, 0, 0.22);
  border-color: var(--accent);
}

.tabel-toolbar .tabel-wide-btn {
  margin-left: auto;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}
.tabel-toolbar .tabel-wide-btn:hover {
  background: #f0ede4;
}
body.tabel-wide .tabel-toolbar .tabel-wide-btn {
  border-color: var(--accent);
  color: var(--accent);
  background: #faf6f0;
}

/* Full-width table: break the instrument out of the 1080 px measure. */
.tabel-bleed {
  /* no-op unless body.tabel-wide is set */
}
body.tabel-wide .tabel-bleed {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding-left: 20px;
  padding-right: 20px;
}

.tabel-count {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 10px;
}

.tabel-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}
#grid {
  width: 100%;
  min-width: 1080px;
  margin: 0;
  font-size: 14px;
}
#grid td {
  vertical-align: top;
}
#grid th button.sort {
  background: none;
  border: none;
  font: inherit;
  font-size: 12px;
  text-transform: inherit;
  letter-spacing: inherit;
  color: inherit;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
#grid th .caret {
  font-size: 9px;
  color: var(--accent);
}

.coop-name {
  font-weight: 600;
}
.coop-id {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.map-link {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--link);
  text-decoration: none;
  white-space: nowrap;
}
.map-link:hover {
  background: #f0ede4;
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.land-cover {
  white-space: nowrap;
}
.spark {
  display: inline-block;
  vertical-align: middle;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-ok {
  color: #14532d;
  background: #e8f7ec;
  border-color: #b9e3c4;
}
.badge-warn {
  color: #713f12;
  background: #fdf3d9;
  border-color: #f3e0a3;
}
.badge-neutral {
  color: #44403c;
  background: #f5f5f4;
  border-color: #e7e5e4;
}
.badge-danger {
  color: #7f1d1d;
  background: #fdeaea;
  border-color: #f6c4c4;
}
.badge-accent {
  color: #8a1f1f;
  background: #fceceb;
  border-color: #f0c6c3;
}

.tabel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}
.tabel-pager {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.tabel-footer button {
  font: inherit;
  font-size: 13px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink);
}
.tabel-footer button:hover:not(:disabled) {
  background: #f0ede4;
}
.tabel-footer button:disabled {
  opacity: 0.45;
  cursor: default;
}
.tabel-footer select {
  font: inherit;
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}
.tabel-note {
  font-size: 13px;
  color: var(--muted);
  margin-top: 16px;
  padding-left: 1.2em;
}
.tabel-note li {
  margin: 5px 0;
}

/* stat strip */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin: 2em 0;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
}
.stat .value {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 800;
  color: var(--ink);
}
.stat .value small {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
}
.stat .label {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

/* ---- index / card grids -------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin: 2em 0;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 24px;
  text-decoration: none;
  color: var(--ink);
  display: block;
  transition:
    transform 0.08s ease,
    box-shadow 0.08s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}
.card h3 {
  margin: 6px 0 8px;
}
.card .card-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.card p {
  font-size: 14.5px;
  color: var(--muted);
  margin: 0;
}

/* ---- scrollytelling ------------------------------------------------------ */
/* The home page's two-column scrolly, hero, map and verdict styling live in
   app/story.css — the front page is its own instrument. */

/* ---- markdown (methods) -------------------------------------------------- */

.md-prose {
  max-width: 72ch;
  margin: 0 auto;
}
.md-prose h1 {
  font-size: 30px;
}
.md-prose h2 {
  font-size: 22px;
}
.md-prose img {
  max-width: 100%;
}
.md-prose table {
  display: block;
  overflow-x: auto;
}
.md-prose code {
  overflow-wrap: anywhere;
}

/* The interactive map's chrome lives in app/explore.css — it is a different
   instrument from the reading pages and carries its own type scale. */

/* responsive */
@media (max-width: 720px) {
  h1 {
    font-size: 30px;
  }
  .lede {
    font-size: 18px;
  }
}
