:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --text: #1c1f23;
  --muted: #5f6772;
  --line: #e2e4e8;
  --accent: #1f5fbf;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --code: #f1f2f4;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1c1f25;
    --text: #e8eaed;
    --muted: #9aa3ae;
    --line: #2e333b;
    --accent: #7aa9f7;
    --accent-text: #10131a;
    --danger: #f2877f;
    --code: #262a31;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }
main.wrap { flex: 1; padding-top: 28px; padding-bottom: 48px; }

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

h1 { font-size: 1.9rem; line-height: 1.25; margin: 0 0 12px; }
h2 { font-size: 1.3rem; line-height: 1.3; margin: 0 0 4px; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap,
.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
nav form { margin: 0; }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; }

.muted, .meta { color: var(--muted); }
.meta { font-size: 0.9rem; margin: 0 0 8px; }
.empty { color: var(--muted); padding: 32px 0; text-align: center; }
.error {
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 6px;
  padding: 8px 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 14px;
}
.card p:last-child { margin-bottom: 0; }
.card h2 a { color: var(--text); }

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 1px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}

.search { display: flex; gap: 8px; margin-bottom: 20px; }
.search input { flex: 1; min-width: 0; }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; }

.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.row.start { justify-content: flex-start; margin-top: 8px; }

input, textarea, button, .button { font: inherit; }
input[type="search"], input[type="password"], input:not([type]), textarea {
  width: 100%;
  padding: 8px 10px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92rem; resize: vertical; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button, .button {
  display: inline-block;
  padding: 8px 16px;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
.button:hover { text-decoration: none; }
button.link {
  padding: 0;
  color: var(--accent);
  background: none;
  border-radius: 0;
}
button.link:hover { text-decoration: underline; }
button.link.danger { color: var(--danger); }

.form { display: grid; gap: 6px; }
.form.narrow { max-width: 420px; }
.form label { font-weight: 600; margin-top: 10px; }
.form label .muted { font-weight: 400; }
.form .check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.form .check input { width: auto; }
.form.narrow button { margin-top: 12px; justify-self: start; }

.table { width: 100%; border-collapse: collapse; margin-top: 16px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.actions { display: flex; gap: 14px; justify-content: flex-end; white-space: nowrap; }
.actions form { margin: 0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.post .body { overflow-wrap: break-word; }
.post .body h2 { margin-top: 28px; }
.post .body img { max-width: 100%; height: auto; }
.post .body pre {
  overflow-x: auto;
  padding: 12px 14px;
  background: var(--code);
  border-radius: 6px;
}
.post .body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--code);
  padding: 1px 5px;
  border-radius: 4px;
}
.post .body pre code { padding: 0; background: none; }
.post .body blockquote {
  margin: 16px 0;
  padding: 2px 16px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

@media (max-width: 560px) {
  .table thead { display: none; }
  .table tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .table td { display: block; padding: 2px 0; border: 0; }
  .actions { justify-content: flex-start; margin-top: 6px; }
}
