:root {
  --paper: #ece8df;
  --ink: #14110d;
  --red: #a81e0e;
  --faint: #6b6356;
  --line: #c4bdae;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Newsreader', Georgia, serif;
  font-size: 18px;
  line-height: 1.55;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 28px, rgba(20,17,13,0.025) 28px, rgba(20,17,13,0.025) 29px);
}

.wrap { max-width: 760px; margin: 0 auto; padding: 0 24px; }

header {
  border-bottom: 3px solid var(--ink);
  padding: 70px 0 28px;
  margin-bottom: 8px;
}
.kicker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 0.42em; text-transform: uppercase;
  color: var(--red); font-weight: 700; margin-bottom: 22px;
}
h1 {
  font-family: 'JetBrains Mono', monospace; font-weight: 800;
  font-size: clamp(38px, 9vw, 74px); line-height: 0.92;
  letter-spacing: -0.02em; text-transform: uppercase; margin-bottom: 24px;
}
.standfirst { font-size: 21px; line-height: 1.45; max-width: 600px; }
.meta {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.1em;
  color: var(--faint); margin-top: 30px; text-transform: uppercase; line-height: 1.9;
}

/* ---- Quick nav ---- */
.quick-nav {
  margin-top: 20px;
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase;
}
.quick-nav a {
  color: var(--red); text-decoration: none;
  border-bottom: 1px solid transparent;
  margin-right: 18px; padding-bottom: 2px;
}
.quick-nav a:hover { border-bottom-color: var(--red); }

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

/* ---- JS-only elements (hidden without JS, shown when .js class present) ---- */
.js-only { display: none; }
.js .js-only { display: flex; }

/* ---- Filter bar ---- */
.filters {
  position: sticky; top: 0; z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 10px 0; margin-bottom: 40px;
}
.filter-bar-head {
  display: flex; align-items: center; gap: 16px;
}
.filter-toggle {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  background: transparent; color: var(--ink);
  border: 1px solid var(--ink); padding: 4px 10px;
  cursor: pointer; display: flex; align-items: center; gap: 6px;
  transition: all .12s; white-space: nowrap;
}
.filter-toggle:hover { background: var(--ink); color: var(--paper); }
.filter-toggle[aria-expanded="true"] { background: var(--ink); color: var(--paper); }
.filter-toggle-arrow {
  display: inline-block; transition: transform .2s;
  font-style: normal; font-size: 13px;
}
.filter-toggle[aria-expanded="true"] .filter-toggle-arrow { transform: rotate(180deg); }

.filter-body { padding-top: 14px; }
.filter-body[hidden] { display: none; }

.filter-group { margin-bottom: 10px; }
.filter-group:last-child { margin-bottom: 4px; }
.filter-label {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint);
  display: block; margin-bottom: 6px;
}
.chip {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  letter-spacing: 0.04em; text-transform: uppercase;
  background: transparent; color: var(--ink);
  border: 1px solid var(--line); padding: 4px 10px; margin: 0 4px 4px 0;
  cursor: pointer; transition: all .12s;
}
.chip:hover { border-color: var(--red); color: var(--red); }
.chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.filter-meta {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--faint);
}
.filter-meta a { color: var(--red); text-decoration: none; border-bottom: 1px solid transparent; }
.filter-meta a:hover { border-bottom-color: var(--red); }
.filter-meta.inline-meta { margin-top: 0; }

/* ---- Search box ---- */
.search-wrap {
  position: relative;
  align-items: center;
  flex: 1 1 0;
  min-width: 0;
  max-width: 340px;
}
.search-input {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  letter-spacing: 0.06em;
  width: 100%; background: transparent;
  border: 1px solid var(--line); color: var(--ink);
  padding: 4px 28px 4px 10px;
  outline: none; appearance: none; -webkit-appearance: none;
}
.search-input::placeholder { color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; }
.search-input:focus { border-color: var(--red); }
/* Remove native clear button in WebKit */
.search-input::-webkit-search-decoration,
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-clear {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: 28px; background: transparent; border: none;
  color: var(--faint); font-family: 'JetBrains Mono', monospace; font-size: 12px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.search-clear:hover { color: var(--red); }

/* ---- Search results ---- */
/* Title matches: strong, on-brand */
h3 mark {
  background: var(--red); color: var(--paper); padding: 0 1px;
}
/* Body matches: lighter tint, keeps text readable */
.body mark {
  background: rgba(168, 30, 14, 0.16);   /* --red at ~16% */
  color: inherit;
  padding: 0 1px;
  border-radius: 1px;
}

/* Section eyebrow on entries in flat search mode */
.entry-section-eyebrow {
  display: block;
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--red); margin-bottom: 6px;
}

/* Empty state */
.search-empty {
  font-family: 'JetBrains Mono', monospace; font-size: 13px;
  color: var(--faint); padding: 40px 0 20px;
  letter-spacing: 0.04em;
}
.search-empty a { color: var(--red); text-decoration: none; border-bottom: 1px solid var(--red); }
.search-empty a:hover { background: var(--red); color: var(--paper); }

/* Reduced-motion: kill FLIP transitions */
@media (prefers-reduced-motion: reduce) {
  .entry { transition: none !important; }
}

/* ---- Sections & entries ---- */
section { margin-bottom: 64px; scroll-margin-top: 120px; }
.sec-head {
  display: flex; align-items: baseline; gap: 16px;
  border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 6px;
}

/* Toggle affordance — only when JS is present */
.js .sec-head[data-sec-toggle] {
  cursor: pointer; user-select: none;
}
.js .sec-head[data-sec-toggle]:hover h2 { color: var(--red); }
.js .sec-head[data-sec-toggle]:focus-visible {
  outline: 2px solid var(--red); outline-offset: 2px;
}

/* Caret */
.sec-caret {
  display: none; /* hidden without JS */
  font-family: 'JetBrains Mono', monospace; font-size: 14px;
  color: var(--faint); margin-left: auto;
  transition: transform 0.18s ease;
}
.js .sec-caret { display: inline-block; }
.sec-head[aria-expanded="false"] .sec-caret { transform: rotate(-90deg); }

/* Expand-all button */
.expand-all-btn {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  background: transparent; color: var(--faint);
  border: 1px solid var(--line); padding: 4px 10px;
  cursor: pointer; white-space: nowrap;
  transition: all .12s;
}
.expand-all-btn:hover { border-color: var(--ink); color: var(--ink); }
.expand-all-btn:disabled {
  opacity: 0.5;
  pointer-events: none;
  border-color: var(--line);
  color: var(--faint);
}

/* sec-content: no height animation — just snap (clean for long pages) */
.sec-content[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  .sec-caret { transition: none; }
}

/* Mobile filter bar layout (< 600px) */
@media (max-width: 599px) {
  .filter-bar-head {
    flex-wrap: wrap;
    gap: 12px;
  }
  .filter-toggle,
  .expand-all-btn {
    flex: 1 1 auto;
    text-align: center;
  }
  .search-wrap {
    flex: 1 1 100%;
    max-width: 100%;
  }
  .filter-meta.inline-meta {
    flex: 1 1 100%;
    margin-top: 8px;
  }
}

.sec-num { font-family: 'JetBrains Mono', monospace; font-weight: 800; font-size: 13px; color: var(--red); }
h2 {
  font-family: 'JetBrains Mono', monospace; font-weight: 800;
  font-size: clamp(22px, 5vw, 30px); text-transform: uppercase;
  letter-spacing: -0.01em; line-height: 1.05;
}
.sec-sub { font-size: 16px; color: var(--faint); font-style: italic; margin: 14px 0 30px; }
.sec-empty {
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  color: var(--faint); padding: 12px 0; font-style: normal;
}

.entry { padding: 22px 0; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: none; }
.entry h3 {
  font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 16px;
  text-transform: uppercase; letter-spacing: 0.01em; margin-bottom: 8px; line-height: 1.3;
}
.entry h3 .tag { color: var(--red); font-size: 11px; letter-spacing: 0.1em; display: block; margin-bottom: 5px; }
.entry p { margin-bottom: 12px; }
.entry .body > *:last-child { margin-bottom: 0; }

.sources {
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  letter-spacing: 0.02em; line-height: 1.8;
}
.sources a {
  color: var(--ink); text-decoration: none;
  border-bottom: 1px solid var(--red); padding-bottom: 1px; word-break: break-word;
}
.sources a:hover { background: var(--red); color: var(--paper); border-bottom-color: var(--ink); }
.sources .label { color: var(--faint); text-transform: uppercase; margin-right: 6px; }
.sources .label.vid { color: var(--red); font-weight: 700; }
.sources span.src { display: block; margin-top: 4px; }
.sources .src-sep { color: var(--faint); margin: 0 2px; border: none; }
.sources a.archive-link {
  color: var(--faint); border-bottom: 1px dotted var(--faint);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
}
.sources a.archive-link:hover { background: var(--ink); color: var(--paper); border-bottom-color: var(--ink); }
.verified {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint);
  margin-top: 10px;
}

.pullquote {
  font-family: 'JetBrains Mono', monospace; font-weight: 700;
  font-size: clamp(18px, 4vw, 24px); line-height: 1.3; text-transform: uppercase;
  border-left: 5px solid var(--red); padding: 8px 0 8px 24px; margin: 50px 0;
}

/* ---- Contact ---- */
.contact { border-top: 3px solid var(--ink); padding-top: 40px; }
.contact label {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--faint); display: block; margin: 16px 0 6px;
}
.contact input, .contact textarea, .contact select {
  width: 100%; background: transparent; border: 1px solid var(--line);
  color: var(--ink); font-family: 'Newsreader', Georgia, serif; font-size: 16px;
  padding: 10px 12px;
}
.contact textarea { min-height: 120px; resize: vertical; }
.contact button {
  font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer;
  background: var(--ink); color: var(--paper); border: none; padding: 12px 24px; margin-top: 20px;
}
.contact button:hover { background: var(--red); }
.contact button:disabled { background: var(--faint); cursor: not-allowed; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-note {
  font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--faint);
  margin-top: 14px; line-height: 1.7;
}
#form-status { margin-top: 14px; font-family: 'JetBrains Mono', monospace; font-size: 12px; }

footer {
  border-top: 3px solid var(--ink); margin-top: 60px; padding: 40px 0 90px;
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  letter-spacing: 0.05em; line-height: 1.9; color: var(--faint);
}
footer strong { color: var(--ink); }
footer a { color: var(--red); text-decoration: none; border-bottom: 1px solid var(--red); }
footer a:hover { background: var(--red); color: var(--paper); }
footer .disclaim {
  border: 1px solid var(--line); padding: 18px 20px; margin: 24px 0;
  text-transform: none; line-height: 1.7;
}

::selection { background: var(--red); color: var(--paper); }
