/* Yorum: typography and palette in the spirit of LessWrong.
   Serif body (warnock-pro / Palatino), humanist sans UI (Gill Sans / Calibri), warm paper
   background, muted green accents. No web fonts: system stacks only. */

:root {
  --bg: #f8f4ee;
  --surface: #ffffff;
  --surface-2: #fbf9f6;
  --surface-hover: #fcfbf9;
  --text: rgba(0, 0, 0, 0.87);
  --text-2: #424242;
  --muted: #757575;
  --faint: #9e9e9e;
  --border: rgba(0, 0, 0, 0.06);
  --border-2: rgba(0, 0, 0, 0.12);
  --primary: #5f9b65;
  --primary-strong: #477a4c;
  --primary-soft: #7faf83;
  --primary-bg: rgba(95, 155, 101, 0.1);
  --link: #4e8a54;
  --warn: #8a5a00;
  --warn-bg: #fdf3e1;
  --danger: #b3261e;
  --danger-bg: #fbeceb;
  --ok-bg: #edf5ee;
  --header-bg: rgba(255, 255, 255, 0.72);
  --shadow: 0 1px 5px rgba(0, 0, 0, 0.024);
  --shadow-2: 0 4px 18px rgba(0, 0, 0, 0.08);
  --serif: warnock-pro, Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
  --display: ETBookRoman, warnock-pro, Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
  --sans: GreekFallback, Calibri, gill-sans-nova, "Gill Sans", "Gill Sans MT", "Myriad Pro", Myriad, "Liberation Sans", "Nimbus Sans L", Tahoma, Geneva, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 3px;
  --column: 765px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1a18; --surface: #252421; --surface-2: #2a2926; --surface-hover: #2c2b28;
    --text: rgba(255, 255, 255, 0.87); --text-2: #d6d6d6; --muted: #a3a3a3; --faint: #7d7d7d;
    --border: rgba(255, 255, 255, 0.07); --border-2: rgba(255, 255, 255, 0.14);
    --primary: #7faf83; --primary-strong: #94c398; --primary-soft: #5f9b65; --primary-bg: rgba(127, 175, 131, 0.14);
    --link: #8fbf93; --warn: #e2b462; --warn-bg: #3a2f1c; --danger: #f08b84; --danger-bg: #3d2523; --ok-bg: #233226;
    --header-bg: rgba(37, 36, 33, 0.8); --shadow: 0 1px 5px rgba(0, 0, 0, 0.3); --shadow-2: 0 4px 18px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1a18; --surface: #252421; --surface-2: #2a2926; --surface-hover: #2c2b28;
  --text: rgba(255, 255, 255, 0.87); --text-2: #d6d6d6; --muted: #a3a3a3; --faint: #7d7d7d;
  --border: rgba(255, 255, 255, 0.07); --border-2: rgba(255, 255, 255, 0.14);
  --primary: #7faf83; --primary-strong: #94c398; --primary-soft: #5f9b65; --primary-bg: rgba(127, 175, 131, 0.14);
  --link: #8fbf93; --warn: #e2b462; --warn-bg: #3a2f1c; --danger: #f08b84; --danger-bg: #3d2523; --ok-bg: #233226;
  --header-bg: rgba(37, 36, 33, 0.8); --shadow: 0 1px 5px rgba(0, 0, 0, 0.3); --shadow-2: 0 4px 18px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

/* ---------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }
[hidden] { display: none !important; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 6px 10px; z-index: 100; }
.skip-link:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.9em; }
.pad { padding: 12px 16px; margin: 0; }
.dot { color: var(--faint); margin: 0 1px; }
.center { text-align: center; }

/* ---------- header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--header-bg);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05), 0 1px 1px rgba(0, 0, 0, 0.05);
}
.header-inner { height: 56px; display: flex; align-items: center; gap: 8px; padding: 0 16px; }
.wordmark {
  font-family: var(--display);
  font-variant: small-caps;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text);
  margin-right: auto;
}
.wordmark:hover { text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-link { color: var(--text-2); font-size: 15px; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--primary-bg); color: var(--text); }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}
.nav-toggle { display: none; }

.menu { position: relative; }
.menu-trigger {
  list-style: none; cursor: pointer; padding: 6px 10px; border-radius: var(--radius);
  color: var(--text-2); font-size: 15px;
}
.menu-trigger::-webkit-details-marker { display: none; }
.menu-trigger::after { content: "▾"; margin-left: 5px; font-size: 11px; color: var(--faint); }
.menu-trigger:hover { background: var(--primary-bg); }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 4px;
  box-shadow: var(--shadow-2); padding: 6px 0; z-index: 30;
}
.menu-panel a, .menu-panel button {
  display: block; width: 100%; text-align: left; padding: 8px 16px;
  color: var(--text); font: inherit; background: none; border: 0; cursor: pointer;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--primary-bg); text-decoration: none; }
.menu-panel form { margin: 0; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }

/* ---------- layout */
.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.main { width: 100%; max-width: var(--column); margin: 24px auto 80px; min-width: 0; }
.sidebar { position: sticky; top: 56px; align-self: start; max-height: calc(100vh - 56px); overflow-y: auto; padding: 20px 0 40px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 7px 12px; border-radius: var(--radius);
  color: var(--text); font-size: 15px;
}
.nav-item svg { color: var(--muted); flex: none; }
.nav-item:hover { background: var(--primary-bg); text-decoration: none; }
.nav-heading { margin: 18px 12px 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); }
.nav-sub { display: block; padding: 4px 12px 4px 42px; color: var(--text-2); font-size: 14px; border-radius: var(--radius); }
.nav-sub:hover { background: var(--primary-bg); text-decoration: none; color: var(--text); }

@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0; }
  .nav-toggle { display: inline-grid; margin-left: -8px; }
  .sidebar {
    position: fixed; top: 56px; left: 0; bottom: 0; width: 260px; max-height: none; z-index: 15;
    background: var(--surface); box-shadow: var(--shadow-2); padding: 16px 8px;
    transform: translateX(-105%); transition: transform 0.2s ease;
  }
  .nav-open .sidebar { transform: none; }
  .main { padding: 0 16px; margin-top: 16px; }
}

/* ---------- section headings */
.section-title { font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1.2; color: var(--text-2); margin: 8px 0 6px; }
.section-sub { color: var(--muted); margin: 0 0 18px; font-size: 15px; }
.subsection-title { font-family: var(--display); font-weight: 400; font-size: 22px; color: var(--text-2); margin: 32px 0 10px; }

/* ---------- spotlight */
.spotlight {
  background: var(--surface); box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 22px;
  border-left: 3px solid var(--primary-soft);
}
.spotlight-title { font-family: var(--display); font-variant: small-caps; font-weight: 400; font-size: 26px; margin: 0 0 6px; letter-spacing: 0.02em; }
.spotlight p { font-family: var(--serif); font-size: 16px; line-height: 1.55; margin: 0 0 14px; color: var(--text-2); max-width: 60ch; }

/* ---------- tabs */
.tabs { display: flex; gap: 6px; margin: 4px 0 10px; flex-wrap: wrap; }
.tab {
  padding: 3px 9px; border-radius: var(--radius); font-size: 14px;
  color: var(--muted); background: transparent; border: 1px solid transparent;
}
.tab:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.tab.active { background: var(--primary-soft); color: #fff; }
:root[data-theme="dark"] .tab.active { color: #111; }
.tab .count { margin-left: 4px; opacity: 0.8; }

/* ---------- post list */
.post-list { background: var(--surface); box-shadow: var(--shadow); }
.post-item {
  display: grid; grid-template-columns: 42px minmax(0, 1fr) auto 38px 44px; align-items: center; column-gap: 8px;
  padding: 8px 10px 8px 4px; border-bottom: 2px solid var(--border); min-height: 42px;
}
.post-item:last-of-type { border-bottom: 0; }
.post-item:hover { background: var(--surface-hover); }
.post-karma { text-align: center; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.post-main { min-width: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.post-item-title { font-family: var(--serif); font-size: 17px; line-height: 1.38; color: var(--text); }
.post-item-title:visited { color: var(--muted); }
.post-item-title:hover { text-decoration: none; opacity: 0.75; }
.post-domain { color: var(--faint); font-size: 13px; }
.post-author { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; text-align: right; }
.post-age { color: var(--muted); font-size: 14px; text-align: right; }
.post-comments { position: relative; justify-self: end; display: grid; place-items: center; width: 30px; height: 24px; color: #fff; font-size: 12px; }
.post-comments svg { position: absolute; inset: 0; width: 30px; height: 26px; fill: var(--border-2); }
.post-comments span { position: relative; top: -2px; color: var(--muted); font-variant-numeric: tabular-nums; }
.post-comments:hover { text-decoration: none; }
.post-comments:hover svg { fill: var(--primary-bg); }
.cn-tag { font-size: 11px; letter-spacing: 0.05em; color: var(--warn); border: 1px solid currentColor; border-radius: 2px; padding: 0 4px; line-height: 1.5; }
.more-row { padding: 10px; text-align: center; }
.empty-state { padding: 40px 20px; text-align: center; color: var(--muted); background: var(--surface); }
.empty-state p { font-family: var(--serif); font-size: 17px; }

@media (max-width: 640px) {
  .post-item { grid-template-columns: 34px minmax(0, 1fr) 40px; grid-template-areas: "karma main comments" "karma meta comments"; row-gap: 2px; }
  .post-karma { grid-area: karma; }
  .post-main { grid-area: main; }
  .post-comments { grid-area: comments; }
  .post-author, .post-age { grid-area: meta; text-align: left; font-size: 13px; }
  .post-age { justify-self: start; margin-left: calc(min(150px, 50%) + 4px); }
  .post-author { max-width: 50%; }
}

/* ---------- buttons and inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text); font: inherit; font-size: 15px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { text-decoration: none; border-color: var(--primary-soft); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
:root[data-theme="dark"] .btn-primary { color: #111; }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-small { padding: 4px 10px; font-size: 14px; }
.btn-block { width: 100%; padding: 9px 14px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.link-btn:hover { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
summary.link-btn { list-style: none; }
summary.link-btn::-webkit-details-marker { display: none; }

.input {
  width: 100%; padding: 9px 11px; border-radius: var(--radius); border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text); font: inherit; font-size: 15px;
}
.input:focus { outline: none; border-color: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-bg); }
.input-title { font-family: var(--serif); font-size: 22px; padding: 10px 12px; }
.input-small { padding: 5px 8px; font-size: 14px; width: auto; flex: 1 1 200px; }
.textarea, .comment-form textarea {
  width: 100%; resize: vertical; font-family: var(--serif); font-size: 17px; line-height: 1.55;
  padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
}
.textarea:focus, .comment-form textarea:focus { outline: none; border-color: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-bg); }
.field { display: block; margin-bottom: 18px; }
.field-label { display: block; font-size: 14px; color: var(--text-2); margin-bottom: 5px; }
.field-help { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; }
.optional { color: var(--faint); font-size: 13px; margin-left: 4px; }
.form-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.form-row-end { align-items: flex-start; }
.hint { color: var(--muted); font-size: 13px; margin: 0; flex: 1 1 260px; }
.errors { list-style: none; margin: 0 0 14px; padding: 10px 14px; background: var(--danger-bg); color: var(--danger); border-radius: var(--radius); font-size: 14px; }
.errors li + li { margin-top: 4px; }
.form-errors:empty { display: none; }
.form-errors .errors { margin: 8px 0 0; }
.notice { padding: 10px 14px; background: var(--surface); border-radius: var(--radius); color: var(--text-2); box-shadow: var(--shadow); font-size: 15px; }
.notice-warn { background: var(--warn-bg); color: var(--warn); box-shadow: none; }
.notice-ok { background: var(--ok-bg); color: var(--primary-strong); box-shadow: none; }
.radio { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 14px; cursor: pointer; }
.stack > * + * { margin-top: 0; }

/* ---------- auth */
.auth-card { max-width: 420px; margin: 24px auto; background: var(--surface); box-shadow: var(--shadow); padding: 28px 28px 22px; }
.auth-card .section-title { margin-top: 0; }
.auth-switch { text-align: center; color: var(--muted); font-size: 14px; margin: 18px 0 0; }

/* ---------- post page */
.post { background: var(--surface); box-shadow: var(--shadow); padding: 36px 48px 24px; }
@media (max-width: 640px) { .post { padding: 24px 18px 16px; margin: 0 -16px; } }
.post-header { margin-bottom: 26px; }
.post-title { font-family: var(--display); font-weight: 400; font-size: clamp(30px, 5vw, 42px); line-height: 1.15; margin: 0 0 12px; color: var(--text); letter-spacing: -0.005em; }
.post-byline { color: var(--muted); font-size: 15px; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.byline-author { color: var(--link); }
.post-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 14px; }
.post-link svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.topic-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tag {
  display: inline-block; padding: 4px 10px; border-radius: var(--radius); font-size: 13px;
  color: var(--primary-strong); background: var(--surface); border: 1px solid var(--border-2); box-shadow: var(--shadow);
}
.tag:hover { text-decoration: none; border-color: var(--primary-soft); }
.tag-plain { color: var(--muted); }

.post-body { font-family: var(--serif); font-size: 19px; line-height: 1.6; color: var(--text); overflow-wrap: anywhere; }
.post-body.small { font-size: 16px; }
.post-body > :first-child { margin-top: 0; }
.post-body p { margin: 0 0 1.05em; }
.post-body h1, .post-body h2, .post-body h3 { font-family: var(--display); font-weight: 400; line-height: 1.25; margin: 1.6em 0 0.5em; }
.post-body h1 { font-size: 1.6em; } .post-body h2 { font-size: 1.35em; } .post-body h3 { font-size: 1.15em; }
.post-body a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent); text-underline-offset: 2px; }
.post-body blockquote { margin: 1.2em 0; padding: 0 0 0 18px; border-left: 3px solid var(--border-2); color: var(--text-2); }
.post-body code { font-family: var(--mono); font-size: 0.82em; background: var(--surface-2); padding: 1px 5px; border-radius: 3px; border: 1px solid var(--border); }
.post-body pre { background: var(--surface-2); padding: 14px 16px; overflow-x: auto; border-radius: 4px; border: 1px solid var(--border); line-height: 1.45; }
.post-body pre code { background: none; border: 0; padding: 0; font-size: 14px; }
.post-body ul, .post-body ol { padding-left: 1.4em; margin: 0 0 1.05em; }
.post-body li + li { margin-top: 0.3em; }
.post-body hr { border: 0; border-top: 1px solid var(--border-2); margin: 2em auto; width: 40%; }
.post-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--border); }
.post-footer-actions { display: flex; align-items: center; gap: 16px; }
.prose-page .post-body h2 { font-size: 1.3em; }

/* content notes */
.content-note { border: 1px solid var(--border-2); border-radius: 4px; background: var(--surface-2); }
.content-note > summary {
  cursor: pointer; list-style: none; padding: 12px 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 15px; color: var(--text-2);
}
.content-note > summary::-webkit-details-marker { display: none; }
.cn-label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--warn); border: 1px solid currentColor; border-radius: 2px; padding: 1px 5px; }
.cn-reveal { margin-left: auto; color: var(--link); font-size: 14px; }
.content-note[open] .cn-reveal { display: none; }
.content-note[open] > summary { border-bottom: 1px solid var(--border); }
.content-note > .post-body, .content-note > .comment-body { padding: 18px 16px 4px; }
.content-note.small > summary { padding: 6px 10px; font-size: 14px; }

/* moderation banner */
.mod-banner {
  display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap;
  margin: -12px -24px 26px; padding: 14px 18px; border-radius: 4px;
  background: var(--primary-bg); color: var(--text-2); font-size: 15px;
}
.mod-banner > div { flex: 1 1 300px; }
.mod-banner p { margin: 3px 0 0; }
.mod-banner.is-held { background: var(--warn-bg); }
.mod-banner.is-rejected { background: var(--danger-bg); }
.mod-banner .support { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-2); }
.reasons-details { flex-basis: 100%; font-size: 14px; }
.reasons-details summary { cursor: pointer; color: var(--muted); }
.reasons { white-space: pre-line; margin: 6px 0 0; color: var(--text-2); }
@media (max-width: 640px) { .mod-banner { margin: -8px 0 20px; } }

.spinner {
  width: 18px; height: 18px; flex: none; margin-top: 2px; border-radius: 50%;
  border: 2px solid var(--primary-bg); border-top-color: var(--primary); animation: spin 0.8s linear infinite;
}
.spinner.tiny { width: 10px; height: 10px; border-width: 1.5px; margin: 0 5px 0 0; display: inline-block; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* ---------- votes */
.vote { display: inline-flex; align-items: center; gap: 2px; font-size: 14px; color: var(--muted); position: relative; }
.vote-btn {
  display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--faint); cursor: pointer;
}
.vote-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.vote-btn:hover { color: var(--primary); background: var(--primary-bg); }
.vote-btn.on { color: var(--primary); }
.vote-btn.down.on { color: var(--danger); }
.vote-score { min-width: 18px; text-align: center; font-variant-numeric: tabular-nums; color: var(--text-2); }
.vote-error {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 5; width: 240px;
  background: var(--surface); border: 1px solid var(--border-2); box-shadow: var(--shadow-2);
  padding: 6px 9px; font-size: 13px; color: var(--text-2); border-radius: var(--radius);
}
.htmx-request.vote-btn, .htmx-request .vote-btn { opacity: 0.5; }

/* ---------- flags */
.flag-menu { position: relative; display: inline-block; }
.flag-form {
  position: absolute; z-index: 10; top: calc(100% + 6px); right: -10px; width: 260px;
  background: var(--surface); border: 1px solid var(--border-2); box-shadow: var(--shadow-2); border-radius: 4px; padding: 12px 14px;
}
.flag-title { margin: 0 0 6px; font-weight: 600; font-size: 14px; color: var(--text); }
.flag-form .btn { margin-top: 8px; }
.flash { font-size: 14px; color: var(--primary-strong); }

/* ---------- comments */
.comments { margin-top: 28px; }
.comments-title { font-family: var(--display); font-weight: 400; font-size: 24px; color: var(--text-2); margin: 0 0 14px; }
.comments-title .count { color: var(--faint); font-size: 18px; margin-left: 4px; }
.comment-form { margin-bottom: 18px; }
.comment-list { background: transparent; }
.comment {
  background: var(--surface); border: 1px solid var(--border); border-radius: 3px;
  padding: 10px 14px 8px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.comment-children:empty { display: none; }
.comment-children { margin-top: 10px; }
.comment-children > .comment { border-left: 2px solid var(--border-2); border-radius: 0 3px 3px 0; margin-bottom: 8px; box-shadow: none; }
.comment-children > .comment:nth-child(n) { background: var(--surface-2); }
.comment-children .comment-children > .comment { background: var(--surface); }
.comment.is-pending, .comment.is-held { border-style: dashed; border-color: var(--border-2); }
.comment-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; margin-bottom: 4px; }
.comment-author { color: var(--text); font-weight: 600; }
.comment-age { color: var(--faint); }
.comment-body { font-family: var(--serif); font-size: 16.5px; line-height: 1.55; overflow-wrap: anywhere; }
.comment-body p { margin: 0 0 0.7em; }
.comment-body > :last-child { margin-bottom: 0.3em; }
.comment-body blockquote { margin: 0.6em 0; padding-left: 12px; border-left: 3px solid var(--border-2); color: var(--text-2); }
.comment-body pre { background: var(--surface-2); padding: 10px; overflow-x: auto; font-size: 13px; }
.comment-body code { font-family: var(--mono); font-size: 0.85em; }
.comment-actions { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.reply-slot:empty { display: none; }
.reply-form { margin: 10px 0 2px; }
.badge {
  display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 10px; font-size: 12px;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border-2); white-space: nowrap;
}
.badge-pending { background: var(--primary-bg); color: var(--primary-strong); border-color: transparent; }
.badge-held { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge-rejected { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.badge-published { background: var(--ok-bg); color: var(--primary-strong); border-color: transparent; }
.badge-mod { background: var(--primary-bg); color: var(--primary-strong); border-color: transparent; }

/* ---------- editor */
.editor { background: var(--surface); box-shadow: var(--shadow); padding: 26px 32px; }
@media (max-width: 640px) { .editor { padding: 20px 16px; margin: 0 -16px; } }
.editor .section-title { margin-top: 0; }
.editor-tabs { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; flex-wrap: wrap; }
.editor-tab { background: none; border: 0; padding: 4px 10px; border-radius: var(--radius); color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.editor-tab.active { background: var(--primary-bg); color: var(--primary-strong); }
.preview-pane { min-height: 300px; border: 1px dashed var(--border-2); border-radius: var(--radius); padding: 14px 16px; }

/* ---------- profile */
.profile-header { margin-bottom: 8px; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); }
.mod-tools { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 10px 12px; background: var(--surface); box-shadow: var(--shadow); font-size: 14px; }
.mod-tools form { margin: 0; }
.profile-comments { display: grid; gap: 10px; }
.profile-comment { background: var(--surface); box-shadow: var(--shadow); padding: 10px 14px; }
.profile-comment-post { color: var(--muted); font-size: 14px; }
.profile .post-item { grid-template-columns: 42px minmax(0, 1fr) 38px 44px; }

/* ---------- moderation queue */
.queue { display: grid; gap: 12px; }
.queue-item { background: var(--surface); box-shadow: var(--shadow); padding: 14px 18px; border-left: 3px solid var(--warn); }
.queue-head { display: flex; align-items: baseline; gap: 10px; }
.queue-title { font-family: var(--serif); font-size: 17px; color: var(--text); }
.queue-meta { color: var(--muted); font-size: 14px; margin-top: 4px; }
.queue-reasons { margin-top: 10px; padding: 8px 12px; background: var(--surface-2); border-radius: var(--radius); font-size: 14px; }
.queue-actor { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); }
.queue-reasons .reasons { margin-top: 2px; }
.queue-content { margin-top: 10px; }
.queue-content summary { cursor: pointer; color: var(--link); font-size: 14px; }
.queue-content .post-body { margin-top: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.queue-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; background: var(--surface); box-shadow: var(--shadow); }
.log { width: 100%; border-collapse: collapse; font-size: 14px; }
.log th, .log td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.log th { font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.log .reasons { max-width: 380px; margin: 0; }

.narrow { max-width: 520px; margin: 40px auto; }

/* ---------- deletion: tombstones and locked threads */
.post-tombstone { padding: 26px 32px; }
.tombstone-notice { font-family: var(--serif); font-size: 19px; font-style: italic; color: var(--muted); margin: 0 0 6px; }
.tombstone-sub { color: var(--faint); font-size: 14px; margin: 0; }
.tombstone-title { font-family: var(--display); font-weight: 400; font-size: 24px; margin: 12px 0 6px; }
.post-tombstone .queue-content { margin-top: 16px; }
.inline-form { margin: 12px 0 0; }
.comment-tombstone { font-style: italic; color: var(--faint); }
.comment.is-gone { background: transparent; box-shadow: none; border-style: dashed; }
/* Like faded comments on Hacker News: readable for context, clearly not live. */
.thread-locked .comment-list { color: var(--faint); }
.thread-locked .comment-body,
.thread-locked .comment-author,
.thread-locked .vote-score { color: var(--faint); opacity: 0.72; }
.thread-locked .comment-body a { color: inherit; }
.thread-locked .comment { background: var(--surface-2); box-shadow: none; }
.vote-locked { padding: 0 6px; }

.confirm-menu { position: relative; display: inline-block; }
.confirm-menu > summary { list-style: none; }
.confirm-menu > summary::-webkit-details-marker { display: none; }
.confirm-panel {
  position: absolute; z-index: 10; top: calc(100% + 6px); right: -10px; width: 280px;
  background: var(--surface); border: 1px solid var(--border-2); box-shadow: var(--shadow-2); border-radius: 4px; padding: 12px 14px;
  display: grid; gap: 8px;
}
.confirm-panel p { margin: 0; font-size: 14px; color: var(--text-2); }
.confirm-panel .input-small { width: 100%; }
.comment-actions .confirm-panel { right: auto; left: 0; }

/* ---------- title suggestions */
html:not(.js) .js-only { display: none !important; }
.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row .input { flex: 1 1 auto; min-width: 0; }
.suggest-btn { white-space: nowrap; }
.suggest-btn .when-busy { display: none; align-items: center; }
.suggest-btn.htmx-request { opacity: 0.75; pointer-events: none; }
.suggest-btn.htmx-request .when-idle { display: none; }
.suggest-btn.htmx-request .when-busy { display: inline-flex; }
.field-error { color: var(--danger); }
.field-ok { color: var(--primary-strong); }
@media (max-width: 480px) { .input-row { flex-direction: column; } }

/* ---------- markdown toolbar */
.md-toolbar { display: flex; align-items: center; gap: 2px; margin-left: auto; flex-wrap: wrap; }
.md-btn {
  display: inline-grid; place-items: center; width: 30px; height: 28px; padding: 0;
  border: 1px solid transparent; border-radius: var(--radius); background: transparent;
  color: var(--muted); cursor: pointer; font: inherit;
}
.md-btn:hover { background: var(--primary-bg); color: var(--text); }
.md-btn:active { background: var(--border-2); }
.md-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.md-btn svg .fill { fill: currentColor; stroke: none; }
.md-text { font-family: var(--serif); font-size: 17px; line-height: 1; }
.md-sep { width: 1px; height: 18px; background: var(--border-2); margin: 0 4px; }
.editor-tabs { gap: 4px 4px; }
@media (max-width: 560px) { .md-toolbar { margin-left: 0; width: 100%; } }
.comment-form .md-toolbar { margin: 0 0 4px; }
.md-compact .md-btn { width: 28px; height: 26px; }
.md-compact .md-btn svg { width: 16px; height: 16px; }
.comment-form .editor-tabs { margin-bottom: 4px; }
.comment-form .md-toolbar { margin: 0 0 0 auto; }
.editor-tabs-compact .editor-tab { padding: 3px 8px; font-size: 13px; }
.preview-compact { min-height: 86px; background: var(--surface); padding: 10px 14px; }
@media (max-width: 560px) { .comment-form .md-toolbar { margin-left: 0; } }

/* ---------- language switcher & automatic translation attribution */
.lang-switch {
  display: inline-flex; align-items: center; padding: 2px; border-radius: var(--radius);
  border: 1px solid var(--border-2); background: var(--surface-2); margin: 0;
}
.lang-btn {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px;
  font-weight: 600; letter-spacing: 0.04em; padding: 3px 7px; border-radius: 2px; cursor: pointer;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active { background: var(--primary); color: #fff; }
:root[data-theme="dark"] .lang-btn.active { color: #111; }

.pref-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 14px; padding: 12px 16px; background: var(--surface); box-shadow: var(--shadow);
  border-left: 3px solid var(--primary-soft); border-radius: var(--radius);
}
.pref-label { display: block; font-size: 14px; color: var(--text); }
.pref-help { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.pref-lang-form { display: flex; gap: 6px; margin: 0; }

.translation-bar {
  display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin-top: 14px; padding: 5px 10px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border-2);
  color: var(--muted); font-size: 13px; line-height: 1.4;
}
.translation-bar svg { color: var(--primary); flex: none; }
.translation-bar.is-original svg { color: var(--muted); }
.translation-bar-compact { margin: 2px 0 6px; padding: 2px 8px; font-size: 12.5px; }
.translation-toggle { color: var(--link); font-weight: 500; }
.translation-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 2px; padding: 0 6px; line-height: 1.65;
}
.translation-pill svg { width: 12px; height: 12px; color: var(--primary); flex: none; }

