/* ─────────────────────────────────────────────────────────────────
   Design tokens — ported from mapper-chicagocrashes
   src/lib/styles/app.css so the blog matches crashstop.org.
───────────────────────────────────────────────────────────────── */
:root {
  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Source Serif 4', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Consolas, SFMono-Regular, Menlo, monospace;

  /* Surfaces */
  --color-paper: #f7f4ed;
  --color-paper-card: #fafaf7;
  --color-paper-deep: #ede9df;

  /* Lines */
  --color-line: #e5e7eb;
  --color-line-soft: #f3f4f6;
  --color-rule: #d2cab7;
  --color-rule-card: #d8d1bf;

  /* Ink */
  --color-ink: #14110c;
  --color-ink-strong: #111827;
  --color-ink-soft: #3a3127;
  --color-ink-muted: #7a6a55;
  --color-ink-subtle: #9ca3af;

  /* Accents */
  --color-fatal: #a01818;
  --color-link: #2d4a7a;
  --color-link-hover: #1e3359;
  --color-brand: #1d4ed8;
}

* {
  box-sizing: border-box;
}

/* ── Element defaults (mirrors app.css @layer base) ─────────────── */
html {
  font-family: var(--font-sans);
  background: var(--color-paper);
  color: var(--color-ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 1rem;
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.5;
  text-wrap: balance;
  overflow-wrap: break-word;
  color: var(--color-ink);
}

p {
  margin: 0.75rem 0;
  line-height: 1.5;
  text-wrap: pretty;
  overflow-wrap: break-word;
  color: var(--color-ink-soft);
}

ol li,
ul li {
  padding: 0.2rem 0;
}

a {
  color: var(--color-link);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in oklab, var(--color-link) 25%, transparent);
  transition: border-color 0.15s ease;
}

a:hover {
  color: var(--color-link-hover);
  border-bottom-color: var(--color-link-hover);
}

img {
  max-width: 100%;
  height: auto;
}

/* ── Header (adapted from SiteHeader.svelte) ────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--color-paper-card) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-line);
}

.header-row {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 1rem;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

@media (min-width: 768px) {
  .header-row {
    padding: 0 1.5rem;
  }
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  color: var(--color-ink-strong);
  text-decoration: none;
  border-bottom: none;
  flex-shrink: 0;
}

.header-brand:hover {
  color: var(--color-ink-strong);
}

.brand-icon {
  height: 1.5rem;
  width: auto;
  flex-shrink: 0;
}

.brand-title {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.005em;
  line-height: 1;
  text-transform: uppercase;
}

.brand-title em,
.footer-title em {
  font-style: normal;
  color: var(--color-fatal);
}


.brand-subsite{
  font-weight: 800;
  color: #41B6E6;
}

.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 0;
  margin-left: auto;
}

.nav-link {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-ink-soft);
  text-decoration: none;
  border-bottom: none;
  white-space: nowrap;
  transition: color 120ms ease;
}

.nav-link + .nav-link::before {
  content: '\00b7';
  margin-right: 0.5rem;
  color: var(--color-ink-subtle);
}

.nav-link:hover {
  color: var(--color-brand);
  border-bottom: none;
}

.important-link.nav-link {
  color: var(--color-ink);
  font-weight: 700;
}

/* ── Main content column ────────────────────────────────────────── */
main {
  flex: 1;
  width: 100%;
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

@media (min-width: 768px) {
  main {
    max-width: 56rem;
    padding: 2.5rem 1.5rem 4rem;
  }
}

/* ── Post cards (echoes the site's .panel primitive) ────────────── */
.post-card {
  background: var(--color-paper-card);
  border: 1px solid var(--color-rule);
  border-radius: 2px;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  padding: 1.5rem 1.25rem;
  overflow: hidden;
}

@media (min-width: 768px) {
  .post-card {
    padding: 2rem;
  }
}

.post-card + .post-card {
  margin-top: 2rem;
}

.post-date {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-ink-muted);
}

.post-categories {
  margin-left: 0.75rem;
}

.post-category {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-link);
  border-bottom: 1px solid color-mix(in oklab, var(--color-link) 25%, transparent);
}

.post-category:hover {
  color: var(--color-link-hover);
}

.post-category + .post-category {
  margin-left: 0.5rem;
}

.page-title {
  margin: 0 0 1.5rem;
  font-size: 1.75rem;
  line-height: 1.25;
  color: var(--color-ink-strong);
}

.page-empty {
  font-family: var(--font-serif);
  color: var(--color-ink-muted);
}

.page-description {
  margin: -0.75rem 0 1.5rem;
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--color-ink-soft);
}

.page-description p {
  margin: 0 0 0.5rem;
}

/* PDFObject adds this class to the target div when it embeds a PDF. */
.pdfobject-container {
  height: min(50rem, 85vh);
  margin: 1rem 0;
  border: 1px solid var(--color-rule);
}

.post-title {
  margin: 0.375rem 0 0;
  font-size: 1.5rem;
  line-height: 1.25;
}

.post-title a {
  color: var(--color-ink-strong);
  border-bottom: none;
}

.post-title a:hover {
  color: var(--color-link-hover);
  border-bottom: 1px solid color-mix(in oklab, var(--color-link) 25%, transparent);
}

/* Post body: Source Serif 4, the site's narrative/editorial voice. */
.post-body {
  margin-top: 1rem;
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.65;
}

.post-body p {
  line-height: 1.65;
}

.post-body h2 {
  font-size: 1.25rem;
  margin: 1.75rem 0 0.5rem;
}

.post-body h3 {
  font-size: 1.0625rem;
  margin: 1.5rem 0 0.5rem;
}

.post-body blockquote {
  margin: 1rem 0;
  padding: 0.625rem 1rem;
  background: var(--color-paper-deep);
  border-left: 3px solid var(--color-rule);
  color: var(--color-ink-soft);
}

.post-body blockquote p {
  margin: 0.25rem 0;
}

.post-body pre {
  overflow-x: auto;
  padding: 0.75rem 1rem;
  background: var(--color-line-soft);
  border: 1px solid var(--color-line);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.post-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--color-line-soft);
  padding: 0.0625rem 0.25rem;
  border-radius: 2px;
}

.post-body pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

.post-body img {
  border: 1px solid var(--color-rule-card);
}

/* Markdown (kramdown) tables. Data tables use the sans/tabular voice,
   like the stat tables on the main site. */
.post-body table {
  width: 100%;
  margin: 1.25rem 0;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.post-body th {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  color: var(--color-ink-muted);
  padding: 0.375rem 0.75rem;
  border-bottom: 2px solid var(--color-rule);
}

.post-body td {
  padding: 0.4375rem 0.75rem;
  border-bottom: 1px solid var(--color-line);
  color: var(--color-ink-soft);
}

.post-body th:first-child,
.post-body td:first-child {
  padding-left: 0;
}

.post-body th:last-child,
.post-body td:last-child {
  padding-right: 0;
}

.post-body tbody tr:last-child td {
  border-bottom-color: var(--color-rule);
}

/* Back-to-index link on post pages. */
.post-nav {
  margin-top: 1.5rem;
}

.post-nav a {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-bottom: none;
}

.post-nav a:hover {
  color: var(--color-brand);
}

/* ── Footer (adapted from SiteFooter.svelte) ────────────────────── */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--color-rule);
  background: var(--color-paper-deep);
  padding: 2rem 0;
}

.footer-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .footer-inner {
    padding: 0 1.5rem;
  }
}

.footer-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .footer-nav {
    flex-direction: row;
    justify-content: center;
    gap: 0;
  }

  .footer-nav-link + .footer-nav-link::before {
    content: '\00b7';
    margin: 0 0.5rem;
    color: var(--color-ink-subtle);
  }
}

.footer-nav-link {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-ink-soft);
  text-decoration: none;
  border-bottom: none;
  white-space: nowrap;
  transition: color 120ms ease;
}

.footer-nav-link:hover {
  color: var(--color-brand);
}

.footer-nav-link--important {
  color: var(--color-ink);
  font-weight: 700;
}

.footer-base {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .footer-base {
    flex-direction: row;
  }
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.footer-brand > a {
  border-bottom: none;
  display: flex;
}

.footer-icon {
  height: 1.25rem;
  width: auto;
  flex-shrink: 0;
}

.footer-title {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--color-ink);
  text-transform: uppercase;
}

.footer-title a {
  color: inherit;
  text-decoration: none;
  border-bottom: none;
}

.footer-meta {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-ink-muted);
}
