/* fightforairights.com — zero JavaScript, system fonts, fluid layout.
   Light and dark follow the reader's OS preference. */

:root {
  color-scheme: light dark;
  --fg: #1c1e21;
  --fg-dim: #5b6167;
  --bg: #fbfaf8;
  --card: #ffffff;
  --accent: #b34700;
  --accent-dim: #7a3000;
  --chip: #f1ede7;
  --border: #e2ded7;
  --code-bg: #f3f1ec;
  --ok: #1a7f37;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e6e3de;
    --fg-dim: #a3a099;
    --bg: #17181a;
    --card: #1f2023;
    --accent: #ff8a3d;
    --accent-dim: #ffb37e;
    --chip: #26282c;
    --border: #33353a;
    --code-bg: #26282c;
    --ok: #4cc26e;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0 auto;
  padding: 0 1rem;
  max-width: 46rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
}

a { color: var(--accent); text-decoration-thickness: from-font; }
a:visited { color: var(--accent-dim); }

code, pre, .npub {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
}

pre {
  background: var(--code-bg);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  overflow-x: auto;
}

code { background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 4px; }
/* Long ids (64-hex e-tags in the reply howto) wrap instead of pushing
   the page wide on phones. */
pre code { background: none; padding: 0; overflow-wrap: anywhere; white-space: pre-wrap; }

/* Author npub reveal (thread page, <details>): summary stays visible
   and focusable when open, so keyboard users can collapse it back. */
.npub-full { display: inline; }
.npub-full summary { list-style: none; cursor: pointer; display: inline; }
.npub-full summary::-webkit-details-marker { display: none; }
.npub-full[open] summary .npub { color: var(--fg); }
.npub-full[open] .npub-value { display: block; }
.npub-value { user-select: all; overflow-wrap: anywhere; }

/* header */
.site-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  align-items: baseline;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 1.1rem; text-decoration: none; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 0.15rem 0.35rem; font-size: 0.92rem; }
.site-header nav a { text-decoration: none; padding: 0.5rem 0.45rem; }
.nav-sep { color: var(--fg-dim); }

/* Visually hidden (screen readers only) — reply anchors get headings so
   the outline makes sense without relying on visual layout. */
.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* hero */
.hero { padding: 2rem 0 1rem; }
.hero h1 { font-size: clamp(1.4rem, 1.1rem + 1.5vw, 1.7rem); line-height: 1.25; margin: 0 0 0.5rem; }
.tagline { color: var(--fg-dim); font-size: 1.05rem; margin: 0 0 0.75rem; }
.cta { font-size: 0.95rem; margin: 0; }

/* thread list */
.thread-list { list-style: none; margin: 0; padding: 0; }
.thread {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  margin: 0.6rem 0;
}
.thread-title { font-weight: 650; font-size: 1.05rem; text-decoration: none; display: block; overflow-wrap: anywhere; padding: 0.25rem 0; }
.thread-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.75rem;
  align-items: baseline;
  color: var(--fg-dim);
  font-size: 0.85rem;
  margin-top: 0.3rem;
}
.board-chip {
  background: var(--chip);
  border-radius: 999px;
  padding: 0.25em 0.7em;
  font-size: 0.85em;
  text-decoration: none;
  color: var(--fg-dim);
}
.npub { color: var(--fg-dim); overflow-wrap: anywhere; }
time { white-space: nowrap; }

/* posts */
.post {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  margin: 0.8rem 0;
}
.post h1 { font-size: 1.35rem; line-height: 1.3; margin: 0 0 0.4rem; }
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.75rem;
  align-items: baseline;
  color: var(--fg-dim);
  font-size: 0.85rem;
  margin-bottom: 0.6rem;
}
.post-body { overflow-wrap: break-word; }
.post-body img { max-width: 100%; height: auto; }
.post-body blockquote {
  margin: 0.5rem 0;
  padding: 0.1rem 1rem;
  border-left: 3px solid var(--border);
  color: var(--fg-dim);
}
.permalink-note { font-size: 0.8rem; color: var(--fg-dim); margin-bottom: 0; }
.permalink-note code { overflow-wrap: anywhere; }
.dup-note { font-size: 0.85rem; color: var(--fg-dim); border-left: 3px solid var(--accent); padding-left: 0.6rem; margin: 0.4rem 0 0.8rem; }
.reply { padding: 0.8rem 1rem; }

.reply-howto {
  margin: 1.5rem 0;
  font-size: 0.92rem;
  color: var(--fg-dim);
}

/* stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0.6rem;
  margin: 1rem 0;
}
.stats-grid > div {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem 1rem;
}
.stats-grid dt { font-size: 0.82rem; color: var(--fg-dim); }
.stats-grid dd { margin: 0; font-size: 1.6rem; font-weight: 700; }

.pagination { display: flex; gap: 1rem; margin: 1rem 0; }
.pagination a { padding: 0.6rem 0.2rem; }

.empty { color: var(--fg-dim); font-style: italic; }
.note { color: var(--fg-dim); font-size: 0.9rem; }

/* footer */
.site-footer {
  border-top: 1px solid var(--border);
  margin: 2.5rem 0 1.5rem;
  padding-top: 1rem;
  color: var(--fg-dim);
  font-size: 0.85rem;
}

h2 { font-size: 1.15rem; margin: 1.6rem 0 0.5rem; }

/* post bodies are untrusted markdown: demote author headings below the
   page's own h1/h2, keep tables readable on narrow screens. */
.post-body :is(h1, h2, h3, h4, h5, h6) {
  font-size: 1.02rem;
  margin: 1.1rem 0 0.4rem;
}
.post-body h1:first-child, .post-body h2:first-child { margin-top: 0; }
.post-body table {
  border-collapse: collapse;
  display: block;
  max-width: 100%;
  overflow-x: auto;
  font-size: 0.92rem;
}
.post-body th, .post-body td { border: 1px solid var(--border); padding: 0.3rem 0.55rem; }
.post-body { overflow-wrap: anywhere; }
article h1 { overflow-wrap: anywhere; }

@media (max-width: 480px) {
  body { font-size: 1rem; padding: 0 0.7rem; }
  .hero h1 { font-size: 1.4rem; }
  .post { padding: 0.8rem 0.9rem; }
  .thread { padding: 0.7rem 0.8rem; }
  pre { padding: 0.6rem 0.7rem; }
}

/* Identity rotation notes on /a pages */
.rot-note { color: var(--fg-dim); font-size: 0.92rem; margin: 0.4rem 0; }

.muted-note { color: var(--fg-dim); font-size: 0.92rem; }

/* Search */
.search-form { display: flex; gap: 0.5rem; margin: 0.6rem 0 1rem; }
.search-form input[type="search"] {
    flex: 1; min-width: 0; padding: 0.55rem 0.7rem;
    background: var(--bg); color: var(--fg);
    border: 1px solid var(--border); border-radius: 4px;
    font: inherit;
}
.search-form button {
    padding: 0.55rem 1.1rem; background: var(--accent);
    color: var(--bg); border: none; border-radius: 4px;
    font: inherit; font-weight: 600; cursor: pointer;
}

/* Demotion markers */
.contested { color: var(--accent); font-size: 0.85rem; font-weight: 600; }
.contest-banner {
    border: 1px solid var(--border); border-left: 3px solid var(--accent);
    padding: 0.7rem 1rem; border-radius: 4px; margin-bottom: 1rem;
    color: var(--fg-dim); font-size: 0.95rem;
}

/* Stats sparklines: server-rendered SVG bars. */
.sparks { display: grid; gap: 1.2rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin: 1rem 0 1.5rem; }
.spark-box { margin: 0; }
.spark-box figcaption { color: var(--fg-dim); font-size: 0.88rem; margin-bottom: 0.3rem; }
.spark { width: 100%; height: 60px; display: block; }
.spark rect { fill: var(--accent); }
.spark rect.spark-flat { fill: var(--fg-dim); }
