/* Curated Search – one small stylesheet, no framework or build step.
   Styles semantic elements directly so django-allauth's plain markup fits in. */

:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --text: #1d1f23;
  --muted: #666b75;
  --border: #e3e4e8;
  --accent: #2f6fde;
  --accent-text: #ffffff;
  --mark: #fff1a8;
  --error: #b42318;
  --success: #067647;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --surface: #1d2024;
    --text: #e7e8ea;
    --muted: #9a9fa8;
    --border: #2e3238;
    --accent: #7aa7ff;
    --accent-text: #0d1117;
    --mark: #5c4d00;
    --error: #ff8a80;
    --success: #6fdc9b;
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .75rem; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.2rem; }
form + h2, form + section, ul + h2 { margin-top: 2rem; }
code { font-size: .9em; background: var(--border); padding: .05em .3em; border-radius: 4px; }
mark { background: var(--mark); color: inherit; padding: 0 .1em; border-radius: 2px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

.wrap { max-width: 52rem; margin: 0 auto; padding: 0 1rem; }
main.wrap { padding-top: 2rem; padding-bottom: 3rem; min-height: 70vh; }
main.narrow { max-width: 28rem; }
main.prose { max-width: 42rem; }
main.prose li { margin-bottom: .4rem; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 3.5rem; }
.brand { font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.site-header nav { display: flex; align-items: center; gap: 1.25rem; font-size: .95rem; }
.site-header nav > a { color: var(--muted); }
.site-header nav > a:hover { color: var(--text); text-decoration: none; }

.menu { position: relative; }
.menu summary { cursor: pointer; color: var(--muted); list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: " ▾"; font-size: .8em; }
.menu-items {
  position: absolute; right: 0; top: 2rem; z-index: 10; min-width: 12rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgb(0 0 0 / .12); padding: .35rem 0;
}
.menu-items > a, .menu-items button.link {
  display: block; width: 100%; text-align: left; padding: .4rem 1rem; color: var(--text);
}
.menu-items form { margin: 0; }
.menu-items > a:hover, .menu-items button.link:hover { background: var(--bg); text-decoration: none; }

.site-footer { color: var(--muted); font-size: .85rem; padding-bottom: 2rem; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; }
.site-footer nav { display: flex; gap: 1rem; }
.site-footer a { color: var(--muted); }

/* Forms */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=url], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: .55rem .75rem;
}
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent;
}
form p, form > div { margin: 0 0 1rem; }
form .helptext, form p > span { display: block; color: var(--muted); font-size: .85rem; margin-top: .25rem; }
ul.errorlist { list-style: none; padding: 0; margin: 0 0 .5rem; color: var(--error); font-size: .9rem; }

button, .button {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: var(--accent-text); border: 0; border-radius: var(--radius);
  padding: .55rem 1.1rem;
}
button:hover, .button:hover { filter: brightness(1.08); text-decoration: none; }
.button.small { padding: .3rem .8rem; font-size: .9rem; }
.site-header nav > a.button { color: var(--accent-text); }
button.link { background: none; color: inherit; font-weight: normal; padding: 0; border-radius: 0; }
button.link.muted { color: var(--muted); }
/* Destructive actions; --surface is light on light and dark on dark, so it
   contrasts with --error in both. */
button.danger { background: var(--error); color: var(--surface); }
a.danger { color: var(--error); }
button + a { margin-left: 1rem; }
section.account-data { margin-top: 2.5rem; border-top: 1px solid var(--border); }

/* Search */
.hero { text-align: center; padding: 2.5rem 0 1.5rem; }
.hero h1 { font-size: 2.1rem; letter-spacing: -.02em; }
form.search { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.5rem; }
form.search input[type=search] { flex: 1 1 16rem; font-size: 1.05rem; padding: .7rem .9rem; }
form.search select { flex: 0 1 11rem; width: auto; }
.hero form.search { max-width: 36rem; margin: 1.25rem auto 0; }
.htmx-request .count { opacity: .5; }

.count { font-size: .9rem; margin: 0 0 1rem; }
.suggestion { margin: 0 0 .5rem; font-size: 1.05rem; }
.suggestion a { font-weight: 600; }
ol.results { list-style: none; padding: 0; margin: 0; }
.result { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.result:last-child { border-bottom: 0; }
.result-title { font-size: 1.1rem; font-weight: 600; }
.result p { margin: .35rem 0 0; }
.meta { color: var(--muted); font-size: .85rem; }
.meta a { color: inherit; }
.tags { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; padding: 0; margin: .5rem 0 0; }
.tags li { font-size: .75rem; color: var(--muted); border: 1px solid var(--border); border-radius: 99px; padding: 0 .55rem; }
.empty { color: var(--muted); padding: 1rem 0; }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 1.5rem; color: var(--muted); }

/* Article page */
.entry-detail { margin-bottom: 2.5rem; }
.entry-detail h1 { font-size: 1.9rem; letter-spacing: -.01em; }
.entry-detail .lead { font-size: 1.1rem; margin: 1rem 0; }
.entry-detail .button { margin-top: .5rem; }

/* Library */
form.bookmark, form.inline { display: inline; margin: 0; }
form.bookmark button, form.inline button { font-size: inherit; color: var(--accent); }
form.bookmark button.on { color: var(--text); }
.library-section { margin-bottom: 2.5rem; }
ul.saved-searches { list-style: none; padding: 0; margin: 0; }
ul.saved-searches li { display: flex; align-items: center; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--border); }
ul.saved-searches form { margin: 0; }
ul.saved-searches form.digest { margin-left: auto; }
ul.saved-searches select { width: auto; padding: .2rem .5rem; font-size: .85rem; }
.badge { font-size: .75rem; font-weight: 600; background: var(--accent); color: var(--accent-text); border-radius: 99px; padding: .05rem .5rem; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; }
.num { text-align: right; }

/* Feed health */
.status { font-size: .8rem; font-weight: 600; border-radius: 99px; padding: .05rem .55rem; border: 1px solid var(--border); }
.status-failing { color: var(--error); border-color: var(--error); }
.status-stale { color: #b54708; border-color: #b54708; }
.status-ok { color: var(--success); border-color: var(--success); }
.status-inactive, .status-new { color: var(--muted); }
.error-text { color: var(--error); overflow-wrap: anywhere; }

/* Two-factor setup: the QR code is black on transparent; give it a white
   background so phones can scan it in dark mode too. */
img[src^="data:image/svg+xml"] { background: #fff; padding: .75rem; border-radius: var(--radius); }

/* Topics */
.chip { display: inline-block; font-size: .8rem; padding: .1rem .6rem; margin: .15rem .3rem .15rem 0; border: 1px solid var(--border); border-radius: 99px; color: var(--text); background: var(--surface); }
.chip:hover { border-color: var(--accent); text-decoration: none; }
nav.topics { margin: 0 0 1.25rem; }
.chip.current { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
h2.day { font-size: .95rem; color: var(--muted); font-weight: 600; margin: 1.75rem 0 .25rem; }
.topic-page { display: grid; grid-template-columns: minmax(0, 1fr) 16rem; gap: 2.5rem; }
ul.topic-feeds { list-style: none; padding: 0; margin: 0; }
ul.topic-feeds li { padding: .45rem 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: .5rem; }
ul.topic-feeds .small { white-space: nowrap; }
@media (max-width: 48rem) { .topic-page { grid-template-columns: 1fr; } }

/* Search insights */
.insights { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 0 2rem; }
.insights td:first-child { overflow-wrap: anywhere; }
nav.periods { margin-bottom: 1rem; }

/* Feed suggestions */
ul.suggestions { list-style: none; padding: 0; }
ul.suggestions li { padding: .5rem 0; border-bottom: 1px solid var(--border); }
ul.suggestions .url { overflow-wrap: anywhere; margin-right: .5rem; }
.status-pending { color: #b54708; border-color: #b54708; }
.status-approved { color: var(--success); border-color: var(--success); }
.status-rejected { color: var(--muted); }

/* Messages */
ul.messages { list-style: none; padding: 0; margin: 0 0 1.5rem; }
ul.messages li { padding: .6rem 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
ul.messages li.success { border-color: var(--success); }
ul.messages li.error { border-color: var(--error); }

@media (max-width: 36rem) {
  .site-header .wrap { height: auto; min-height: 3.5rem; flex-wrap: wrap; gap: .25rem 1rem; padding-block: .6rem; }
  .site-header nav { gap: .25rem .9rem; font-size: .9rem; flex-wrap: wrap; }
  .menu summary { max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hero h1 { font-size: 1.6rem; }
  form.search select { flex: 1 1 45%; }
}
