/* Discourse HTML Archive — shared stylesheet (local, no dependencies) */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e3e6ea;
  --text: #1b1f24;
  --muted: #6b7480;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --chip-bg: #eef1f4;
  --like: #e0245e;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.04);
  --maxw: 880px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Header ---- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 22px 0;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(140%) blur(6px);
}
.site-header h1 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: -.01em;
}
.subtitle { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }
.subtitle a { color: var(--muted); font-weight: 600; }

.header-inner { display: flex; flex-direction: column; gap: 14px; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: .9rem; font-weight: 600; width: fit-content;
}
.back-link:hover { color: var(--accent); text-decoration: none; }
.back-icon { display: block; }

.topic-heading h1 { font-size: 1.5rem; margin: 0; letter-spacing: -.02em; }
.topic-sub { margin: 6px 0 0; color: var(--muted); font-size: .9rem;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---- Chips ---- */
.chip {
  display: inline-block;
  background: var(--chip-bg);
  color: var(--muted);
  font-size: .76rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.cat-link { text-decoration: none; }
.cat-link:hover { color: var(--accent); }

/* ---- Index: categories nav ---- */
.cat-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 4px; }

/* ---- Index: topic list ---- */
.section-title { font-size: 1.05rem; color: var(--muted); margin: 28px 0 14px;
  text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }

.topic-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1em; }
.topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color .15s ease, transform .15s ease;
}
.topic-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.topic-link { display: block; padding: 14px 18px; }
.topic-title { display: block; font-size: 1.05rem; font-weight: 650; color: var(--text); }
.topic-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-top: 6px; color: var(--muted); font-size: .84rem; padding: 5px 5px; }

/* ---- Topic page: posts ---- */
.posts { display: grid; gap: 16px; margin: 28px 0; }
.post {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.post-author { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.avatar { border-radius: 50%; object-fit: cover; background: var(--chip-bg); }
.author-meta { display: flex; flex-direction: column; line-height: 1.25; }
.author-name { font-weight: 650; font-size: .88rem; word-break: break-word; }
.author-username { color: var(--muted); font-size: .76rem; }

.post-body { min-width: 0; }
.post-meta {
  display: flex; align-items: center; gap: 10px;
  color: var(--muted); font-size: .8rem; margin-bottom: 8px;
}
.post-anchor { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.post-anchor:hover { text-decoration: none; opacity: .7; }
.op-badge {
  background: var(--accent-soft); color: var(--accent);
  font-size: .7rem; font-weight: 700; padding: 1px 8px; border-radius: 999px;
}

.post-content { font-size: .96rem; word-wrap: break-word; overflow-wrap: anywhere; }
.post-content p { margin: 0 0 12px; }
.post-content p:last-child { margin-bottom: 0; }
.post-content img { max-width: 100%; height: auto; border-radius: 8px; }
.post-content a { color: var(--accent); }
.post-content pre {
  background: #0f172a; color: #e2e8f0; padding: 12px 14px;
  border-radius: 8px; overflow-x: auto; font-size: .85rem; line-height: 1.5;
}
.post-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em;
}
.post-content :not(pre) > code {
  background: var(--chip-bg); padding: .12em .38em; border-radius: 5px;
}
.post-content blockquote {
  margin: 0 0 12px; padding: 8px 14px;
  border-left: 3px solid var(--border); color: var(--muted); background: var(--bg);
  border-radius: 0 8px 8px 0;
}
.post-content ul, .post-content ol { padding-left: 22px; margin: 0 0 12px; }
.post-content table { border-collapse: collapse; margin: 0 0 12px; width: 100%; }
.post-content th, .post-content td { border: 1px solid var(--border); padding: 6px 10px; }
.post-content h1, .post-content h2, .post-content h3 { line-height: 1.3; margin: 18px 0 8px; }

.post-footer { margin-top: 12px; display: flex; align-items: center; }
.likes {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--like); font-weight: 650; font-size: .85rem;
  background: #fdeef3; padding: 3px 10px; border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.likes--none { color: var(--muted); background: var(--chip-bg); }
.heart { display: block; }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--border); margin-top: 32px;
  padding: 18px 0; color: var(--muted); font-size: .8rem; text-align: center;
}

/* ---- Responsive ---- */
@media (max-width: 560px) {
  .post { grid-template-columns: 1fr; }
  .post-author { flex-direction: row; align-items: center; text-align: left; gap: 10px; }
}

/* ---- Dark mode ---- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --surface: #171a21; --border: #262b34;
    --text: #e6e9ee; --muted: #9aa3af; --accent: #8b8cff;
    --accent-soft: #232544; --chip-bg: #20252e; --like: #ff5c8a;
  }
  .post-content pre { background: #000; }
  .post-content :not(pre) > code { background: #20252e; }
}