*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: oklch(0.12 0.02 280);
  --bg-elevated: oklch(0.16 0.018 280);
  --surface: oklch(0.2 0.015 280 / 0.55);
  --surface-hover: oklch(0.24 0.018 280 / 0.7);
  --border: oklch(0.92 0.01 280 / 0.1);
  --border-strong: oklch(0.92 0.01 280 / 0.16);
  --text-primary: oklch(0.97 0.01 280);
  --text-secondary: oklch(0.78 0.02 280);
  --text-muted: oklch(0.62 0.02 280);
  --accent: oklch(0.72 0.17 45);
  --accent-soft: oklch(0.72 0.17 45 / 0.14);
  --font: 'Avenir Next', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 14px;
  --preview-size: 160px;
}

html { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, oklch(0.45 0.12 45 / 0.12), transparent),
    radial-gradient(circle at 100% 100%, oklch(0.35 0.08 280 / 0.15), transparent 40%);
  min-height: 100%;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  position: fixed;
  left: 16px;
  top: 16px;
  width: auto;
  height: auto;
  padding: 10px 14px;
  background: oklch(0.98 0 0);
  color: oklch(0.15 0 0);
  z-index: 9999;
  border-radius: var(--radius-sm);
}

main#main { flex: 1; width: 100%; }

.page {
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.intro { margin-bottom: 28px; max-width: 52ch; }
.intro-kicker {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.intro-lede {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.search-wrap {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 14px;
}
.search-wrap svg { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }
.search-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  padding: 12px 0;
  outline: none;
}
.search-input::placeholder { color: var(--text-muted); }
.search-wrap:focus-within {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-ghost {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.85rem;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.18s var(--ease-out), color 0.18s var(--ease-out);
}
.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.result-count {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-left: auto;
}

.catalog-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 32px;
  align-items: start;
}

.lists-aside {
  position: sticky;
  top: 88px;
  transition: top .2s ease;
}
/* Autohide companion: keep the aside 20px off the top once the bar leaves. */
body:has(.header-bar.header-hidden) .lists-aside { top: 20px; }

.lists-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.list-pills {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.list-pill {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.18s var(--ease-out), color 0.18s var(--ease-out), border-color 0.18s var(--ease-out);
}
.list-pill:hover {
  background: var(--surface);
  color: var(--text-primary);
}
.list-pill.active {
  background: var(--accent-soft);
  border-color: oklch(0.72 0.17 45 / 0.35);
  color: var(--text-primary);
  font-weight: 600;
}

.list-hint {
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.sites-feed {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.status-msg {
  color: var(--text-muted);
  padding: 32px 16px;
  text-align: center;
  font-size: 0.95rem;
}
.status-msg--error { color: oklch(0.75 0.12 25); }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 16px;
  font-size: 0.95rem;
}

.site-row {
  display: grid;
  grid-template-columns: var(--preview-size) 1fr;
  min-height: var(--preview-size);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s var(--ease-out), transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}
.site-row:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px oklch(0 0 0 / 0.35);
}
.site-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.site-row__preview {
  position: relative;
  width: var(--preview-size);
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  background: oklch(0.14 0.02 280);
  overflow: hidden;
}
.site-row__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.site-row__preview .preview-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.site-row__preview .preview-fallback.is-visible {
  display: flex;
}

.site-row__body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.site-row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.site-row__domain {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.site-row__hub {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 7px;
  border-radius: 4px;
}

.site-row__name {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.site-row__desc {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.site-row__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.site-row__tag {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 5px;
  background: oklch(0.25 0.02 280 / 0.6);
  color: var(--text-muted);
}

.api-panel {
  margin-top: 48px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.88rem;
}
.api-panel summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-primary);
}
.api-note {
  margin-top: 12px;
  line-height: 1.55;
  color: var(--text-muted);
}
.api-note code {
  font-size: 0.88em;
  background: var(--surface-hover);
  padding: 2px 6px;
  border-radius: 4px;
}
.api-panel ul { margin-top: 12px; padding-left: 1.2rem; line-height: 1.85; }
.api-panel a { color: var(--accent); text-decoration: none; }
.api-panel a:hover { text-decoration: underline; }


.btn-ghost:focus-visible,
.list-pill:focus-visible,
.header-logo a:focus-visible,
.header-title-link:focus-visible,
.header-home:focus-visible,

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .site-row:hover { transform: none; }
}

@media (max-width: 820px) {
  .catalog-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .lists-aside { position: static; }
  .list-pills {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .list-pill { width: auto; }
  .list-hint {
    margin-top: 10px;
    padding-top: 0;
    border-top: none;
  }
}

@media (max-width: 600px) {
  .page { padding: 22px 16px 36px; }
  .site-row {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .site-row__preview {
    width: 100%;
    max-width: none;
    aspect-ratio: 1 / 1;
  }
  .result-count { width: 100%; margin-left: 0; }
}
