:root {
  --bg: #fff; --fg: #1a1a1b; --muted: #5f6468; --line: #e3e5e8; --tile: #f1f2f4;
  --accent: #d93a00; --on-accent: #fff; --warn: #fff6e5; --warn-line: #e9c46a; --bad: #fdecea; --bad-line: #e5a39b;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111213; --fg: #e6e7e8; --muted: #a0a5ab; --line: #2c2e31; --tile: #1e2022;
    --accent: #ff6a33; --on-accent: #111213; --warn: #2a2415; --warn-line: #6b5a26; --bad: #2d1a18; --bad-line: #7a3d36;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 system-ui, sans-serif; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -48px; padding: 6px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.skip:focus { top: 8px; }

.site { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: baseline; padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.brand { color: var(--accent); font-weight: 700; font-size: 20px; text-decoration: none; }
main { max-width: 860px; margin: 0 auto; padding: 8px 16px 48px; }

.tabs { display: flex; gap: 20px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 10px 2px; margin-bottom: -1px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; }
.tabs a:hover { color: var(--fg); }
.tabs a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--accent); }

.primary { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 12px; align-items: end; }
.search label { display: grid; gap: 4px; min-width: 0; font-size: 13px; color: var(--muted); }
.search input, .search select, .search button { width: 100%; min-height: 40px; padding: 8px 10px; font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.search input[aria-invalid="true"] { border-color: var(--bad-line); }
.search button { width: auto; padding-inline: 20px; background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; cursor: pointer; }
.search button.secondary { background: none; border-color: var(--line); color: var(--fg); }
.field-error { margin: 8px 0 0; font-size: 14px; }
.filters { margin-top: 10px; font-size: 14px; }
.filters summary { width: fit-content; padding: 4px 0; cursor: pointer; color: var(--muted); }
.active-filters { color: var(--fg); overflow-wrap: anywhere; }
.active-filters::before { content: "· "; color: var(--muted); }
.filter-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: end; padding: 10px 0 4px; }
.filter-grid .wide { grid-column: 1 / -1; }
.filter-grid button { grid-column: 1 / -1; justify-self: start; }

.banner { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; justify-content: space-between; margin-top: 16px; padding: 10px 14px; font-size: 15px; background: var(--warn); border: 1px solid var(--warn-line); border-radius: 6px; }
.banner p { margin: 0; }
.banner.error { background: var(--bad); border-color: var(--bad-line); }
.banner.progress { background: var(--tile); border-color: var(--line); }
.banner.progress:not(.finished) strong::before { content: ""; display: inline-block; width: .7em; height: .7em; margin-right: 8px; border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .banner.progress strong::before { animation: none; } }

.empty { margin-top: 24px; padding: 28px 16px; text-align: center; border: 1px dashed var(--line); border-radius: 6px; overflow-wrap: anywhere; }
.empty h2 { margin: 0 0 4px; font-size: 18px; }
.empty p { margin: 0 0 8px; color: var(--muted); }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-top: 20px; }
.summary { margin: 0; color: var(--muted); font-size: 14px; }
.views { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented { display: flex; font-size: 13px; }
.segmented a { padding: 5px 10px; text-decoration: none; color: var(--muted); border: 1px solid var(--line); }
.segmented a + a { border-left: 0; }
.segmented a:first-child { border-radius: 6px 0 0 6px; }
.segmented a:last-child { border-radius: 0 6px 6px 0; }
.segmented a[aria-current] { color: var(--fg); background: var(--tile); font-weight: 600; }

.subreddits { margin-top: 12px; font-size: 13px; }
.subreddits ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.subreddits a { display: block; padding: 3px 9px; text-decoration: none; background: var(--tile); border: 1px solid transparent; border-radius: 999px; }
.subreddits a span { color: var(--muted); }
.subreddits a[aria-current] { border-color: var(--accent); }
.subreddits details { margin-top: 6px; }
.subreddits summary { cursor: pointer; color: var(--muted); margin-bottom: 6px; }

.results { list-style: none; margin: 12px 0 0; padding: 0; }
.item { padding: 14px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.post { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 12px; }
.title { font-weight: 600; text-decoration: none; }
.title:hover { text-decoration: underline; }
.comment > .title { display: block; width: fit-content; margin-bottom: 10px; font-size: 18px; line-height: 1.3; }
.body { margin: 6px 0; white-space: pre-wrap; }
.more summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.snippet { margin: 4px 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
/* Every part starts with a dot; the left strip is clipped so no line opens with one. */
.meta { display: flex; flex-wrap: wrap; align-items: center; margin: 6px 0 0 -1.2em; color: var(--muted); font-size: 13px; clip-path: inset(-4px -4px -4px 1.2em); }
.meta > *::before { content: "·"; display: inline-block; width: 1.2em; text-align: center; text-decoration: none; }
.meta a:hover { color: var(--fg); }
.tag { color: var(--accent); font-weight: 600; }
.tag.quiet { color: var(--muted); font-weight: 400; }

.thumb { position: relative; display: grid; place-items: center; width: 72px; height: 72px; overflow: hidden; color: var(--muted); font-size: 12px; text-decoration: none; background: var(--tile); border-radius: 6px; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; color: transparent; }
/* Only a failed image renders these pseudo-elements. They hide the browser's broken-image icon. */
.thumb img::after { content: "No image"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); background: var(--tile); }

.group h2 { margin: 24px 0 0; font-size: 16px; }
.group h2 span { color: var(--muted); font-size: 13px; font-weight: 400; }
.group .results { margin-top: 8px; }

.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; }
.pagination a, .pagination span { min-width: 36px; padding: 6px 10px; text-align: center; text-decoration: none; border-radius: 6px; }
.pagination a { border: 1px solid var(--line); }
.pagination a:hover { background: var(--tile); }
.pagination a[aria-current] { color: var(--on-accent); background: var(--accent); border-color: var(--accent); font-weight: 600; }
.pagination .disabled, .pagination .gap { color: var(--muted); }
.pagination .disabled { border: 1px solid transparent; opacity: .6; }

.notice { padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; }

.prose { max-width: 68ch; margin-top: 40px; overflow-wrap: break-word; }
article.prose { margin-top: 16px; }
.prose h1 { margin: 0 0 12px; font-size: 26px; line-height: 1.25; }
.prose h2 { margin: 24px 0 6px; font-size: 18px; line-height: 1.3; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul { margin: 0 0 12px; }
.prose ul { padding-left: 20px; }
.prose li + li { margin-top: 4px; }
.prose a { color: var(--accent); }

footer.site { gap: 4px 16px; max-width: 860px; margin: 0 auto; padding: 16px 16px 32px; border-top: 1px solid var(--line); border-bottom: 0; font-size: 13px; }

@media (max-width: 600px) {
  .primary { grid-template-columns: 1fr; }
  .search button { width: 100%; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .post { grid-template-columns: 56px minmax(0, 1fr); }
  .thumb { width: 56px; height: 56px; font-size: 11px; }
}
.subreddits .note { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.pagination.lazy { border-top: 0; margin-top: 8px; }
