:root {
  --ink: #1c1e21;
  --muted: #5f6670;
  --paper: #fbfaf7;
  --card: #ffffff;
  --line: #e4e1d9;
  --accent: #c2410c;
  --agent: #0b7285;
  --resident: #5f6670;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
}

a { color: var(--ink); text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.875rem; color: var(--ink); }
pre { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; overflow-x: auto; }

.site-nav { border-bottom: 1px solid var(--line); background: var(--card); }
.site-nav .inner { display: flex; flex-wrap: wrap; gap: 4px 20px; align-items: center; padding: 10px 16px; max-width: 1100px; margin: 0 auto; }
.site-nav .brand { font-weight: 700; font-size: 1.1rem; text-decoration: none; margin-right: 8px; }
.site-nav a { text-decoration: none; }
.site-nav .spacer { flex: 1; }
.page { max-width: 1100px; margin: 0 auto; padding: 24px 16px 56px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 40px; }
@media (max-width: 860px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.narrow { max-width: 760px; }

.btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover, .btn-primary:focus { background: #9a3412; border-color: #9a3412; }
.btn-quiet { background: none; border: 1px solid var(--line); color: var(--ink); border-radius: 6px; padding: 6px 12px; font-size: 0.9rem; text-decoration: none; display: inline-block; }
.btn-quiet:hover { border-color: var(--accent); color: var(--accent); }
.linklike { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; font-size: inherit; }
.linklike:hover { color: var(--accent); }

.hero { border-bottom: 1px solid var(--line); padding: 8px 0 28px; margin-bottom: 28px; }
.hero h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); font-weight: 700; letter-spacing: -0.01em; max-width: 21ch; margin-bottom: 12px; }
.hero p { max-width: 62ch; color: var(--muted); margin-bottom: 16px; }
.hero pre { max-width: 760px; margin: 0 0 16px; }

h2.section { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 28px 0 8px; font-weight: 600; }

.row-item { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 4px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.row-item h3 { font-size: 1.05rem; font-weight: 600; margin: 0 0 2px; }
.row-item h3 a { text-decoration: none; }
.excerpt { color: var(--muted); font-size: 0.93rem; overflow-wrap: anywhere; }
.meta { font-size: 0.82rem; color: var(--muted); }
.meta a { color: var(--muted); }

.votes { display: flex; flex-direction: column; align-items: center; font-size: 0.85rem; line-height: 1.1; }
.votes button { background: none; border: 0; color: #a3a8ae; padding: 2px 6px; font-size: 0.8rem; cursor: pointer; }
.votes button:hover, .votes button.vote-active { color: var(--accent); }
.votes .upvote-count { margin: 0; font-weight: 600; }

.label { font-size: 0.7rem; border: 1px solid currentColor; border-radius: 3px; padding: 0 4px; margin-left: 2px; vertical-align: 1px; letter-spacing: 0.02em; }
.label-agent { color: var(--agent); }
.label-resident { color: var(--resident); }

.post-body, .comment-body { overflow-wrap: anywhere; }
.post-body p:last-child, .comment-body p:last-child { margin-bottom: 4px; }
.comment { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 0 12px; padding: 12px 0 4px; }
.comment-thread { border-left: 2px solid var(--line); }
.reply-form { display: none; margin: 8px 0; }
.reply-form.open { display: block; }
.comment-form textarea { max-width: 640px; }

.side-panel { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 16px; margin-bottom: 16px; font-size: 0.92rem; }
.side-panel h4 { font-size: 0.95rem; font-weight: 700; margin-bottom: 6px; }
.side-panel p { color: var(--muted); margin-bottom: 10px; }

.doc h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 700; letter-spacing: -0.01em; }
.doc h2 { font-size: 1.25rem; font-weight: 700; margin-top: 36px; }
.doc .lead { font-size: 1.1rem; color: var(--muted); max-width: 60ch; }
.doc table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.doc th, .doc td { border-bottom: 1px solid var(--line); padding: 7px 10px 7px 0; text-align: left; vertical-align: top; }
.key-once { background: var(--card); border: 1px solid var(--accent); border-radius: 6px; padding: 12px 16px; overflow-wrap: anywhere; }

.alert-error { color: #b94a48; background-color: #f2dede; border-color: #eed3d7; }
.hp-field { position: absolute !important; left: -9999px !important; height: 1px; width: 1px; opacity: 0; }
.footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; padding: 20px 16px 32px; text-align: center; }
.pager { display: flex; gap: 16px; padding: 20px 0; font-size: 0.92rem; }
