:root {
  --bg: #0d1117;
  --fg: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --card: #161b22;
  --border: #21262d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
}

main {
  max-width: 42rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.command-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 42rem;
  margin: 0.75rem auto -0.25rem;
  padding: 0 1.25rem;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.command-bar input {
  width: 100%;
  padding: 0.5rem 0;
  border: 0;
  border-bottom: 1px solid var(--accent);
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
}

.command-bar input:focus-visible {
  outline: 0;
}

.command-help {
  max-width: 42rem;
  margin: 0.75rem auto -0.25rem;
  padding: 0 1.25rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.command-help dl {
  display: grid;
  grid-template-columns: minmax(5rem, auto) 1fr;
  gap: 0.125rem 0.75rem;
  margin: 0;
}

.command-help dt {
  color: var(--fg);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.command-help dd {
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

header h1 {
  font-size: 1.125rem;
  margin: 0;
  letter-spacing: 0.05em;
}

header h1 a {
  color: inherit;
  text-decoration: none;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 1rem;
}

nav a:hover,
nav a.active {
  color: var(--accent);
}

h2 {
  font-size: 1.5rem;
  margin-top: 0;
}

.hero {
  padding: 2rem 0 1rem;
}

.hero h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.hero p {
  font-size: 1.0625rem;
  max-width: 36rem;
}

.muted {
  color: var(--muted);
}

a {
  color: var(--accent);
}

.card {
  display: block;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  text-decoration: none;
  color: inherit;
  margin-bottom: 0.75rem;
}

.card:hover {
  border-color: var(--accent);
}

.card h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.card p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

textarea {
  width: 100%;
  min-height: 8rem;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  font: inherit;
  resize: vertical;
}

button {
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--bg);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.1);
}

button:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

label {
  display: block;
  margin-bottom: 0.375rem;
  font-weight: 600;
}

.privacy-note {
  margin: 0.375rem 0 0;
  font-size: 0.8125rem;
}

.stats {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.stats strong {
  color: var(--fg);
}

.tool-results {
  display: grid;
  grid-template-columns: minmax(8rem, auto) minmax(0, 1fr);
  gap: 0.5rem 1rem;
  margin: 1rem 0;
}

.tool-results dt {
  color: var(--muted);
}

.tool-results dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.tool-note {
  font-size: 0.8125rem;
}

.tool-error {
  color: #ff7b72;
}

@media (max-width: 34rem) {
  .tool-results {
    grid-template-columns: 1fr;
    gap: 0.125rem;
  }

  .tool-results dd {
    margin-bottom: 0.625rem;
  }
}

.post-search {
  width: 100%;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--fg);
  font: inherit;
}

.post-search:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.post-count {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.grep-results h3 {
  margin: 1.5rem 0 0.25rem;
}

.grep-result {
  display: block;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
}

.grep-result h4 {
  margin: 0;
  font-size: 1rem;
}

.grep-result h4 a {
  text-decoration: none;
}

.grep-result p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.post-summary {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.post-summary:first-child {
  padding-top: 0;
}

.post-summary h3 {
  margin: 0;
  line-height: 1.35;
}

.post-summary h3 a {
  text-decoration: none;
}

.post-summary p:last-child {
  margin-bottom: 0;
}

.post-meta {
  margin: 0.25rem 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.post-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.25rem auto;
  border-radius: 8px;
}

.post-body pre,
.post-body blockquote {
  overflow-x: auto;
  margin: 1rem 0;
  padding: 0.875rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--card);
}

.post-body code,
.post-body pre {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.875rem;
}

.post-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.post-gallery img {
  margin: 0;
}

.pgp-key {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: all;
}
