@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400&family=Source+Serif+4:ital,opsz,wght@0,8..60,300;0,8..60,400;0,8..60,600;1,8..60,300;1,8..60,400&display=swap');

/* ============================================================
   WAREHOUSE FIRES — Stylesheet
   Newspaper-inspired · Accessible (WCAG 2.1 AA) · Dark-mode-aware
   ============================================================ */

/* ─── Custom Properties ───────────────────────────────────── */

:root {
  /* Ink / paper */
  --bg:          #faf9f6;
  --bg-alt:      #f0ede6;
  --ink:         #1a1a1a;
  --ink-muted:   #5c5a55;
  --ink-faint:   #908c85;
  --rule:        #cdc3b0;
  --accent:      #9b1c1c;
  --link:        #1a3a6b;
  --link-visited:#4a2a6b;

  /* Status — arson */
  --arson-bg:    #fdf0f0;
  --arson-ink:   #6b0000;
  --arson-border:#c47a7a;

  /* Status — not arson */
  --ok-bg:       #f0f7f2;
  --ok-ink:      #1a4a2c;
  --ok-border:   #60a878;

  /* Status — unknown */
  --unk-bg:      #fdf8f0;
  --unk-ink:     #5a3e0a;
  --unk-border:  #c09040;

  /* Labor flag */
  --labor-bg:    #1a1a1a;
  --labor-ink:   #faf9f6;

  /* Typography */
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body:    'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-ui:      system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;

  /* Layout */
  --max-w:  860px;
  --pad:    1.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #0f0e0d;
    --bg-alt:      #1a1917;
    --ink:         #e8e0d0;
    --ink-muted:   #9a9288;
    --ink-faint:   #6a6460;
    --rule:        #2e2b27;
    --accent:      #c95050;
    --link:        #7aacde;
    --link-visited:#b07ade;

    --arson-bg:    #1e0a0a;
    --arson-ink:   #f0a0a0;
    --arson-border:#7a3030;

    --ok-bg:       #0a1e12;
    --ok-ink:      #80c090;
    --ok-border:   #307850;

    --unk-bg:      #1e1808;
    --unk-ink:     #c8a860;
    --unk-border:  #7a6020;

    --labor-bg:    #e8e0d0;
    --labor-ink:   #0f0e0d;
  }
}

/* ─── Reset & Base ────────────────────────────────────────── */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.7;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

/* ─── Skip Link ───────────────────────────────────────────── */

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.5em 1em;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ─── Typography ──────────────────────────────────────────── */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.2;
  font-weight: 700;
  margin: 0 0 0.5em;
  color: var(--ink);
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.75rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; }
h4 { font-size: 1rem; font-weight: 700; font-style: italic; }

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

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

a:visited { color: var(--link-visited); }

a:hover {
  color: var(--accent);
  text-decoration-thickness: 2px;
}

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

blockquote {
  margin: 1.5em 0;
  padding: 0.75em 0 0.75em 1.25em;
  border-left: 3px solid var(--rule);
  font-style: italic;
  color: var(--ink-muted);
}

blockquote p { margin: 0; }

ul, ol { padding-left: 1.5em; margin: 0 0 1em; }
li { margin-bottom: 0.35em; }

/* ─── Tables ──────────────────────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  margin: 1em 0 1.5em;
}

th {
  text-align: left;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.75rem;
  padding: 0.5em 0.75em;
  border-bottom: 2px solid var(--ink);
  background: var(--bg-alt);
}

td {
  padding: 0.5em 0.75em;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }

/* ─── Definition List ─────────────────────────────────────── */

dl {
  margin: 0 0 1.5em;
}

dt {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0.75em 0 0.1em;
}

dt:first-child { margin-top: 0; }

dd {
  margin: 0 0 0.25em 0;
  font-size: 0.9875rem;
}

/* ─── Layout ──────────────────────────────────────────────── */

body > header,
main,
body > footer {
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

main {
  padding-top: 2rem;
  padding-bottom: 4rem;
}

/* ─── Page Header / Masthead ──────────────────────────────── */

body > header {
  padding-top: 2rem;
  padding-bottom: 0;
}

.masthead {
  text-align: center;
  padding-bottom: 1.25rem;
  border-bottom: 4px double var(--ink);
}

.masthead__eyebrow {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 0.75rem;
}

.masthead__title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0;
  color: var(--ink);
  text-decoration: none;
}

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

a.masthead__title:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

.masthead__subtitle {
  font-family: var(--font-body);
  font-size: 1rem;
  font-style: italic;
  color: var(--ink-muted);
  margin: 0.5rem 0 0;
  font-weight: 300;
}

.masthead__meta {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0.75rem 0 0;
}

.masthead__meta a {
  color: var(--ink-faint);
}

/* ─── Stats Bar ───────────────────────────────────────────── */

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 1.75rem 0;
  border: 1px solid var(--rule);
  border-radius: 2px;
  overflow: hidden;
}

.stats__item {
  flex: 1 1 120px;
  padding: 0.9rem 1rem;
  text-align: center;
  border-right: 1px solid var(--rule);
  background: var(--bg-alt);
}

.stats__item:last-child { border-right: none; }

.stats__value {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  color: var(--ink);
}

.stats__label {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-top: 0.3rem;
}

/* ─── Context paragraph ───────────────────────────────────── */

.context {
  border-top: 1px solid var(--rule);
  padding: 1.5rem 0;
}

.context p {
  font-size: 0.975rem;
  line-height: 1.7;
  color: var(--ink-muted);
}

/* ─── Filter ──────────────────────────────────────────────── */

fieldset {
  border: none;
  padding: 0;
  margin: 0 0 1.75rem;
}

legend {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.6rem;
  float: left;
  width: 100%;
}

.filter__options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  clear: both;
}

.filter__option {
  display: inline-flex;
}

/* Visually hide the radio input while keeping it accessible */
.filter__option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.filter__option span {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.35em 0.85em;
  border: 1px solid var(--rule);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  color: var(--ink-muted);
  background: var(--bg);
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  user-select: none;
}

.filter__option input[type="radio"]:checked + span {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.filter__option input[type="radio"]:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.filter__option span:hover {
  border-color: var(--ink-muted);
  color: var(--ink);
}

.filter__count {
  font-size: 0.7em;
  opacity: 0.7;
  font-weight: 400;
}

/* ─── Live Region (screen readers) ───────────────────────── */

[aria-live] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ─── Feed ────────────────────────────────────────────────── */

.feed {
  list-style: none;
  padding: 0;
  margin: 0;
}

.feed > li {
  border-top: 1px solid var(--rule);
  padding: 1.75rem 0;
}

.feed > li:last-child {
  border-bottom: 1px solid var(--rule);
}

.feed > li[hidden] {
  display: none;
}

/* Highlight the key incident */
.feed > li[data-status="arson"][data-primary] {
  background: var(--arson-bg);
  margin: 0 calc(-1 * var(--pad));
  padding-left: var(--pad);
  padding-right: var(--pad);
  border-top: 2px solid var(--arson-border);
}

/* ─── Card (article within feed) ─────────────────────────── */

.feed > li > article {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.card__dateline {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0;
}

.feed > li > article > header {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.feed > li > article > header h2 {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  margin: 0;
}

.feed > li > article > header h2 a {
  color: var(--ink);
  text-decoration: none;
}

.feed > li > article > header h2 a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.feed > li > article > header h2 a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.feed > li > article > p {
  color: var(--ink-muted);
  font-size: 0.9875rem;
  margin: 0;
  max-width: 65ch;
}

.card__footer {
  margin-top: 0.25rem;
}

.card__footer a {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--accent);
}

.card__footer a:hover {
  text-decoration: underline;
}

.card__footer a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ─── Badges ──────────────────────────────────────────────── */

.badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.2em 0.55em;
  border: 1px solid;
  border-radius: 2px;
  white-space: nowrap;
  line-height: 1.4;
}

.badge--arson {
  background: var(--arson-bg);
  color: var(--arson-ink);
  border-color: var(--arson-border);
}

.badge--not-arson {
  background: var(--ok-bg);
  color: var(--ok-ink);
  border-color: var(--ok-border);
}

.badge--unknown {
  background: var(--unk-bg);
  color: var(--unk-ink);
  border-color: var(--unk-border);
}

.badge--labor {
  background: var(--labor-bg);
  color: var(--labor-ink);
  border-color: var(--labor-bg);
}

/* ─── Breadcrumb ──────────────────────────────────────────── */

.breadcrumb {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.breadcrumb li + li::before {
  content: '›';
  color: var(--rule);
}

.breadcrumb a {
  color: var(--ink-muted);
}

/* ─── Fire Detail Page ────────────────────────────────────── */

article.fire {
  max-width: 72ch;
}

article.fire > header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--rule);
}

article.fire > header .card__dateline {
  margin-bottom: 0.5rem;
}

article.fire > header h1 {
  margin: 0.25rem 0 0.75rem;
}

article.fire > header .card__badges {
  margin-top: 0.5rem;
}

article.fire .fire-meta {
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  border-radius: 2px;
}

article.fire .fire-meta dl {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem 1.5rem;
  margin: 0;
}

article.fire .fire-meta dt {
  margin-top: 0;
}

article.fire section {
  margin-bottom: 2rem;
}

article.fire section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-ui);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.35rem;
  margin-bottom: 1rem;
}

article.fire h3 {
  font-size: 1.1rem;
  margin-top: 1.25rem;
}

/* ─── Sources Section ─────────────────────────────────────── */

article.fire section.sources {
  border-top: 2px solid var(--rule);
  padding-top: 1.5rem;
  margin-top: 3rem;
}

article.fire section.sources h2 {
  font-size: 1.1rem;
}

article.fire section.sources ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

article.fire section.sources li {
  font-size: 0.875rem;
  padding: 0.4em 0;
  border-bottom: 1px solid var(--rule);
  margin: 0;
}

article.fire section.sources li:last-child {
  border-bottom: none;
}

/* ─── Key Quote ───────────────────────────────────────────── */

.key-quote {
  margin: 1.5em 0;
  padding: 1.25em 1.5em;
  border-left: 4px solid var(--accent);
  background: var(--bg-alt);
}

.key-quote p {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-style: italic;
  color: var(--ink);
  margin: 0;
}

/* ─── Page Footer ─────────────────────────────────────────── */

body > footer {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
  border-top: 1px solid var(--rule);
  margin-top: 2rem;
}

body > footer p {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--ink-faint);
  margin: 0;
  text-align: center;
}

.footer__ai-note {
  margin-top: 0.6rem;
  font-style: italic;
  font-size: 0.75rem;
}

/* ─── Utility ─────────────────────────────────────────────── */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Responsive ──────────────────────────────────────────── */

@media (max-width: 560px) {
  :root { --pad: 1rem; }

  .stats { flex-direction: column; }
  .stats__item { border-right: none; border-bottom: 1px solid var(--rule); }
  .stats__item:last-child { border-bottom: none; }

  .masthead__title { font-size: clamp(2rem, 11vw, 2.5rem); }
}

/* ─── Print ───────────────────────────────────────────────── */

@media print {
  body { background: white; color: black; font-size: 11pt; }
  .skip-link, fieldset, .card__footer { display: none; }
  a { color: black; text-decoration: none; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; }
  body > header { border-bottom: 2pt solid black; }
  .feed > li { page-break-inside: avoid; }
}
