:root {
  color-scheme: light dark;
  --fg: #1a1a1a;
  --bg: #fdfdfb;
  --muted: #6b6b6b;
  --line: #e3e0d8;
  --accent: #7a4f2b;
  --ok: #2d6a3e;
  --fail: #a4342a;
  --quality-high: #2d6a3e;
  --quality-medium: #8a6a1f;
  --quality-low: #8a4a2f;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e8e6e1;
    --bg: #15140f;
    --muted: #9a968a;
    --line: #322f27;
    --accent: #c9986a;
    --ok: #6fbf7f;
    --fail: #e08177;
    --quality-high: #6fbf7f;
    --quality-medium: #d4ac4e;
    --quality-low: #d4885e;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

/* Two columns: articles left, everything else right. See topic.js. */
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 0 2.5rem; align-items: start; }
.columns .col { min-width: 0; }  /* let long titles wrap instead of forcing the track wider */
.columns .col > h2:first-child { margin-top: 1rem; }
@media (max-width: 900px) {
  .columns { grid-template-columns: 1fr; gap: 0; }
}
header.site { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 0.5rem; }
header.site a { color: var(--fg); text-decoration: none; font-weight: 600; }
nav.topics a { margin-right: 1rem; color: var(--muted); text-decoration: none; font-size: 0.9rem; }
nav.topics a.active { color: var(--accent); font-weight: 600; }
h1 { font-size: 1.5rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.1rem; margin: 2rem 0 0.5rem; border-bottom: 1px solid var(--line); padding-bottom: 0.25rem; }
.muted { color: var(--muted); font-size: 0.9rem; }
ul.items { list-style: none; margin: 0; padding: 0; }
ul.items li { padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
ul.items li a.title { font-weight: 600; color: var(--fg); text-decoration: none; }
ul.items li a.title:hover { text-decoration: underline; }
.meta { color: var(--muted); font-size: 0.85rem; }
.badge { display: inline-block; font-size: 0.75rem; padding: 0.1rem 0.4rem; border: 1px solid var(--line); border-radius: 4px; margin-left: 0.4rem; color: var(--muted); }
.badge.quality-high { color: var(--quality-high); border-color: var(--quality-high); }
.badge.quality-medium { color: var(--quality-medium); border-color: var(--quality-medium); }
.badge.quality-low { color: var(--quality-low); border-color: var(--quality-low); }
.badge.quality-unscored { border-style: dashed; }
.badge.featured { color: var(--accent); border-color: var(--accent); }
.month-heading { margin-top: 2.5rem; }

#controls { margin: 1rem 0 0.5rem; padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: 8px; }
#search-input { width: 100%; padding: 0.5rem 0.6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); font-size: 0.95rem; }
.quality-filter { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 0.7rem; font-size: 0.9rem; }
.quality-filter label { display: flex; align-items: center; gap: 0.3rem; cursor: pointer; }
.view-toggle { margin-top: 0.7rem; display: flex; gap: 0.4rem; }
.view-toggle button { padding: 0.3rem 0.7rem; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); font-size: 0.85rem; cursor: pointer; }
.view-toggle button.active { color: var(--bg); background: var(--accent); border-color: var(--accent); }
#result-count { margin: 0.6rem 0 0; }
#controls .note { margin: 0.4rem 0 0; font-size: 0.8rem; opacity: 0.85; }
#sync-status { font-weight: 600; margin-right: 0.3rem; }
#sync-status.sync-synced { color: var(--ok); }
#sync-status.sync-denied { color: var(--fail); }
#sync-connect {
  padding: 0.1rem 0.45rem; margin-right: 0.4rem; border: 1px solid var(--line);
  border-radius: 4px; background: transparent; color: var(--muted);
  font-size: 0.75rem; cursor: pointer;
}
#sync-connect:hover { color: var(--fg); border-color: var(--muted); }
#send-corrections { color: var(--bg); background: var(--accent); border-color: var(--accent); font-weight: 600; }

#source-panel { margin-top: 0.8rem; border-top: 1px solid var(--line); padding-top: 0.6rem; }
#source-list { list-style: none; margin: 0.4rem 0 0; padding: 0; max-height: 15rem; overflow-y: auto; }
#source-list li { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0; font-size: 0.88rem; }
#source-list .src-name { flex: 1; }
#source-list .src-name.muted { text-decoration: line-through; color: var(--muted); }
#source-list .src-count { color: var(--muted); font-size: 0.8rem; }

/* Always visible, just quiet. These were hover-only at first, which made
   them undiscoverable — you had to happen to mouse over a row to learn
   the controls existed at all, which defeats the point of having them. */
.item-actions { margin-top: 0.3rem; display: flex; gap: 0.4rem; flex-wrap: wrap; opacity: 0.5; transition: opacity 0.12s; }
ul.items li:hover .item-actions, ul.items li:focus-within .item-actions { opacity: 1; }
ul.items li.is-suppressed { opacity: 0.55; }
ul.items li.is-suppressed .item-actions { opacity: 1; }
button.act {
  padding: 0.1rem 0.45rem; border: 1px solid var(--line); border-radius: 4px;
  background: transparent; color: var(--muted); font-size: 0.75rem; cursor: pointer;
}
button.act:hover { color: var(--fg); border-color: var(--muted); }
button.act.on { color: var(--accent); border-color: var(--accent); font-weight: 600; }
span.act.published {
  display: inline-block; padding: 0.1rem 0.45rem; border: 1px solid var(--accent);
  border-radius: 4px; font-size: 0.75rem; color: var(--accent); font-weight: 600;
}
.badge.suppressed { color: var(--fail); border-color: var(--fail); }
.badge.bookmarked { color: var(--accent); border-color: var(--accent); }
#bookmarked-toggle.active { color: var(--bg); background: var(--accent); border-color: var(--accent); }
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
th, td { text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
th { color: var(--muted); font-weight: 600; }
.ok { color: var(--ok); }
.fail { color: var(--fail); font-weight: 600; }
.cards { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; }
.card { border: 1px solid var(--line); border-radius: 8px; padding: 1rem; min-width: 200px; flex: 1; }
.card a { color: var(--fg); text-decoration: none; font-weight: 600; }
.card .count { font-size: 1.8rem; font-weight: 700; color: var(--accent); }

#new-topic-form { display: flex; flex-direction: column; gap: 0.6rem; max-width: 520px; margin-top: 0.75rem; }
#new-topic-form input, #new-topic-form textarea {
  padding: 0.5rem 0.6rem; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--fg); font: inherit; resize: vertical;
}
#new-topic-form button {
  align-self: flex-start; padding: 0.45rem 0.9rem; border: 1px solid var(--accent);
  border-radius: 6px; background: var(--accent); color: var(--bg); font-weight: 600; cursor: pointer;
}
