/* Huginn: one stylesheet, no framework. Colours follow the system light/dark setting. */
:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1b2430;
  --muted: #5d6b7a;
  --line: #dde2e8;
  --accent: #1f5fa8;
  --accent-text: #ffffff;
  --bad: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12171d;
    --card: #1b2430;
    --text: #e8edf2;
    --muted: #9fb0c0;
    --line: #2c3948;
    --accent: #7fb4ee;
    --accent-text: #0d1319;
    --bad: #ff8a80;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; }
.top, .filters, .stories, .pager, .status { max-width: 860px; margin: 0 auto; padding: 0 16px; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 10px; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.3rem; font-weight: 700; text-decoration: none; }
.logout { display: flex; align-items: center; gap: 10px; margin: 0; }
.user { color: var(--muted); font-size: .9rem; }
button {
  font: inherit; cursor: pointer; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--text); padding: 6px 12px;
}

/* Filter chips */
.filters { padding-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0; }
.label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; min-width: 68px; }
.chip {
  text-decoration: none; font-size: .88rem; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
}
.chip small { color: var(--muted); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip.on small { color: inherit; opacity: .8; }
details.chips { display: block; }
details.chips summary { cursor: pointer; margin-bottom: 6px; }
/* The chips inside <details> are not flex items, so space them by hand. */
details.chips .chip { display: inline-block; margin: 0 4px 6px 0; }

/* Story list */
.story {
  display: flex; gap: 14px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; margin: 10px 0;
}
.thumb { flex: 0 0 168px; }
.thumb img { width: 168px; height: 112px; object-fit: cover; border-radius: 8px; display: block; background: var(--line); }
.text { min-width: 0; flex: 1; }
.meta { margin: 0 0 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: .82rem; color: var(--muted); }
.badge {
  background: var(--accent); color: var(--accent-text); border-radius: 5px; padding: 1px 7px;
  font-weight: 600; text-decoration: none;
}
.section { text-decoration: none; text-transform: capitalize; }
.section:hover, .tag:hover { text-decoration: underline; }
.meta time { margin-left: auto; white-space: nowrap; }
.story h2 { margin: 0 0 4px; font-size: 1.12rem; line-height: 1.3; }
.story h2 a { text-decoration: none; }
.story h2 a:hover { text-decoration: underline; }
.story h2 a:visited { color: var(--muted); }
.summary {
  margin: 0; color: var(--text); opacity: .9; font-size: .95rem;
  /* Show at most three lines of the lead. */
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
}
/* Full articles keep their paragraphs and get more room. */
.summary.full { white-space: pre-line; -webkit-line-clamp: 8; line-clamp: 8; }
.extra { margin: 6px 0 0; font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.tag { text-decoration: none; }
.tag::before { content: "#"; opacity: .6; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* Pager and footer */
.pager { display: flex; justify-content: center; align-items: center; gap: 18px; padding-top: 10px; padding-bottom: 10px; color: var(--muted); }
.pager a { color: var(--accent); text-decoration: none; font-weight: 600; }
.status { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: .78rem; color: var(--muted); padding-top: 8px; padding-bottom: 28px; border-top: 1px solid var(--line); margin-top: 8px; }
.status .bad, .error { color: var(--bad); }

/* Login page */
.login { max-width: 340px; margin: 12vh auto 0; padding: 0 16px; text-align: center; }
.login h1 { margin: 8px 0 20px; }
.login form { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.login label { font-size: .85rem; color: var(--muted); margin-top: 8px; }
.login input[type=text], .login input[type=password] {
  font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--text);
}
.login button { margin-top: 16px; background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; padding: 10px; }

/* Phones: stack the picture above the text */
@media (max-width: 560px) {
  .story { flex-direction: column; }
  .thumb { flex-basis: auto; }
  .thumb img { width: 100%; height: auto; aspect-ratio: 16 / 9; }
  .label { min-width: 100%; }
}
