:root {
  --bg: #fff;
  --fg: #111;
  --fg-muted: #555;
  --border: #d0d0d0;
  --accent: #0057d8;
  --header-bg: #fff;
  --header-border: #111;
  --font: system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "Fira Mono", "Menlo", monospace;
  --max-w: 720px;
  --img-w: 240px;
  --img-h: 160px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e0e;
    --fg: #e8e8e8;
    --fg-muted: #888;
    --border: #2e2e2e;
    --accent: #5b9eff;
    --header-bg: #0e0e0e;
    --header-border: #e8e8e8;
  }
}

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

html {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ── Header ── */

header {
  border-bottom: 2px solid var(--header-border);
  background: var(--header-bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

.site-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.site-title:hover {
  text-decoration: none;
}

.date-nav {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-left: auto;
  font-size: 0.9rem;
}

.date-nav a {
  color: var(--accent);
}

.date-nav a.disabled {
  color: var(--fg-muted);
  pointer-events: none;
}

#nav-date {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--fg-muted);
}

/* ── Main ── */

main {
  flex: 1;
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
}

.status {
  padding: 48px 0;
  color: var(--fg-muted);
}

.error-msg {
  padding: 48px 0;
}

/* ── Topic ── */

.topic {
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
}

.topic:last-child {
  border-bottom: none;
}

.topic-header {
  margin-bottom: 12px;
}

.topic-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 3px;
}

.topic-meta {
  font-size: 0.78rem;
  color: var(--fg-muted);
}

.topic-meta span + span::before {
  content: " · ";
}

/* ── Lead Article ── */

.article {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.article-image {
  flex-shrink: 0;
  width: var(--img-w);
}

.article-image img {
  display: block;
  width: var(--img-w);
  height: var(--img-h);
  object-fit: cover;
  border-radius: 4px;
}

.article-body {
  flex: 1;
  min-width: 0;
}

.article-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 5px;
}

.article-title a {
  color: var(--fg);
}

.article-title a:hover {
  color: var(--accent);
  text-decoration: none;
}

.article-source {
  font-size: 0.78rem;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.article-source span + span::before {
  content: " · ";
}

.article-description {
  font-size: 0.88rem;
  color: var(--fg-muted);
  line-height: 1.55;
  /* Clamp to 3 lines to keep cards manageable */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Links list ── */

.article-links {
  list-style: none;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.article-link-item {
  display: flex;
  align-items: baseline;
  gap: 0;
  min-width: 0;
  font-size: 0.84rem;
  line-height: 1.4;
  overflow: hidden;
}

/* Source badge */
.link-source {
  flex-shrink: 0;
  color: var(--fg-muted);
  font-weight: 600;
  white-space: nowrap;
  margin-right: 6px;
}

.link-source::after {
  content: " ·";
  font-weight: 400;
}

/* Title — truncates dynamically to fill remaining line width */
.link-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-title a {
  color: var(--fg);
}

.link-title a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* ── Footer ── */

footer {
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 12px 16px;
  font-size: 0.78rem;
  color: var(--fg-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 16px;
}

.footer-inner a {
  color: var(--fg-muted);
}

.footer-inner a:hover {
  color: var(--accent);
}

/* ── Imprint page ── */

.imprint {
  padding: 32px 0 48px;
}

.imprint h1 {
  font-size: 1.4rem;
  margin-bottom: 32px;
}

.imprint h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  margin: 28px 0 6px;
}

.imprint p {
  font-size: 0.95rem;
  line-height: 1.65;
}

/* ── Responsive ── */

/* Medium screens: shrink image slightly */
@media (max-width: 600px) {
  :root {
    --img-w: 160px;
    --img-h: 108px;
  }
}

/* Small screens: stack image above text */
@media (max-width: 460px) {
  :root {
    --img-w: 100%;
    --img-h: 180px;
  }

  .article {
    flex-direction: column;
    gap: 10px;
  }

  .article-image {
    width: 100%;
  }

  .article-image img {
    width: 100%;
    height: var(--img-h);
  }
}
