/* MailSecHub v3 — custom design system. No framework.
   Fonts: Fraunces (display serif) + Archivo (UI sans), self-hosted variable woff2. */

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Theme tokens ---------- */
:root {
  --bg: #f7f4ee;
  --surface: #fffdf9;
  --surface-2: #efeadf;
  --border: #e2dccd;
  --text: #1d1f24;
  --muted: #6f7280;
  --accent: #0d7a6f;
  --accent-contrast: #ffffff;
  --accent-soft: rgba(13, 122, 111, 0.11);
  --danger: #b3382f;
  --danger-soft: rgba(179, 56, 47, 0.1);
  --shadow: 0 1px 2px rgba(24, 22, 15, 0.05), 0 10px 30px rgba(24, 22, 15, 0.07);
  --shadow-lift: 0 2px 4px rgba(24, 22, 15, 0.06), 0 16px 40px rgba(24, 22, 15, 0.12);
  --radius: 18px;
  --radius-sm: 10px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0d1117;
  --surface: #151b23;
  --surface-2: #1d2531;
  --border: #2a3341;
  --text: #e8eaee;
  --muted: #8f99a8;
  --accent: #3ad0b5;
  --accent-contrast: #08211d;
  --accent-soft: rgba(58, 208, 181, 0.13);
  --danger: #f0716a;
  --danger-soft: rgba(240, 113, 106, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.4), 0 16px 40px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Archivo", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
}

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

.icon { width: 1.15em; height: 1.15em; vertical-align: -0.2em; }
.icon-sm { width: 0.95em; height: 0.95em; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0.7rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand em {
  font-style: italic;
  color: var(--accent);
}

.header-actions { display: flex; gap: 0.4rem; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, transform 0.2s;
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
  transform: translateY(-1px);
}
.icon-btn .icon { width: 1.25rem; height: 1.25rem; }

/* Theme toggle: show one icon per theme. */
#theme-toggle .icon-moon { display: none; }
[data-theme="dark"] #theme-toggle .icon-moon { display: block; }
[data-theme="dark"] #theme-toggle .icon-sun { display: none; }

/* ---------- Layout ---------- */
.page {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
  flex: 1 0 auto;
}

/* ---------- Hero ---------- */
.hero { padding: 1.2rem 0 0.4rem; }
.hero h1 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.9rem, 4.5vw, 2.7rem);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 0.5rem;
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
}
.hero p {
  color: var(--muted);
  max-width: 46rem;
  margin: 0 0 1.4rem;
}

/* ---------- Weekly AI briefing ---------- */
.briefing {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem 1rem;
  box-shadow: var(--shadow);
  margin: 0 0 1.4rem;
}
.briefing-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.briefing-head h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.15rem;
  margin: 0;
}
.briefing-head .ai-note { margin: 0; }
.briefing-headline {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.05rem;
  font-style: italic;
  color: var(--text);
  margin: 0.5rem 0 0.6rem;
}
.briefing-list {
  margin: 0 0 0.4rem;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.93rem;
}
.briefing-list li { margin-bottom: 0.35rem; }

/* ---------- Toolbar (search) ---------- */
.toolbar {
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
  margin-bottom: 0.9rem;
}

.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 1rem;
  color: var(--muted);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-box input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 0.7rem 0;
  min-width: 0;
}
.search-box input:focus { outline: none; }
.search-box input::placeholder { color: var(--muted); }
.search-box kbd {
  font-family: inherit;
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.1rem 0.45rem;
  background: var(--surface-2);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font: inherit;
  font-weight: 550;
  font-size: 0.92rem;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-accent {
  background: var(--accent);
  color: var(--accent-contrast);
}
.btn-accent:hover { filter: brightness(1.08); color: var(--accent-contrast); }

.btn-outline {
  border-color: var(--border);
  color: var(--text);
  background: var(--surface);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

/* ---------- Source chips ---------- */
.chips {
  display: flex;
  gap: 0.45rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 0.15rem 0 0.6rem;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.32rem 0.85rem;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.chip:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}
.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

@media (min-width: 700px) {
  .chips { flex-wrap: wrap; overflow: visible; }
}

/* ---------- Feed meta row ---------- */
.feed-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.3rem 0 1rem;
  color: var(--muted);
  font-size: 0.88rem;
}
.feed-count strong { color: var(--text); }

/* Hide-read switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 2.15rem;
  height: 1.2rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  position: relative;
  transition: background-color 0.2s, border-color 0.2s;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 2px;
  transform: translateY(-50%);
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: var(--muted);
  transition: left 0.2s, background-color 0.2s;
}
.switch input:checked + .track {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.switch input:checked + .track::after {
  left: calc(100% - 0.85rem - 2px);
  background: var(--accent);
}
.switch input:focus-visible + .track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Article cards ---------- */
.feed { display: flex; flex-direction: column; gap: 1rem; }
.feed.hide-read .article-read { display: none; }

.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem 1.15rem;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.25s, border-color 0.2s;
}
.article-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

.article-read { opacity: 0.55; }
.article-read:hover { opacity: 0.8; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.55rem;
}

.source-badge {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  white-space: nowrap;
  /* --h is set per-source by app.js; 165 = fallback teal */
  color: hsl(var(--h, 165) 55% 30%);
  background: hsl(var(--h, 165) 55% 45% / 0.13);
}
[data-theme="dark"] .source-badge {
  color: hsl(var(--h, 165) 65% 72%);
  background: hsl(var(--h, 165) 65% 60% / 0.13);
}

.timeago {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.card-title {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 0.45rem;
}
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--accent); text-decoration: none; }

.card-snippet {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-snippet.is-ai {
  color: var(--text);
  -webkit-line-clamp: 4;
  margin-bottom: 0.35rem;
}

/* Small, discreet "AI summary" attribution under summarized text. */
.icon-xs { width: 0.8em; height: 0.8em; vertical-align: -0.08em; }
.ai-note {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-style: italic;
  letter-spacing: 0.02em;
  color: var(--muted);
  opacity: 0.85;
  margin: 0 0 0.75rem;
}
.ai-note .icon { color: var(--accent); }

.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.9rem; }
.tag {
  font-size: 0.72rem;
  font-weight: 550;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 0.14rem 0.5rem;
}

/* AI classification chips */
.tag-threat {
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 600;
}
.tag-sev-medium { color: #8a6d00; background: rgba(212, 167, 30, 0.16); }
.tag-sev-high { color: #a04b00; background: rgba(230, 126, 34, 0.16); }
.tag-sev-critical { color: var(--danger); background: var(--danger-soft); font-weight: 700; }
[data-theme="dark"] .tag-sev-medium { color: #e8c554; }
[data-theme="dark"] .tag-sev-high { color: #f0a35e; }
.tag-cve {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.7rem;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px dashed var(--border);
}
.tag-cve:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* Topic chips row: slightly tighter than the source row */
.chips-topics { padding-top: 0; margin-top: -0.2rem; }
.chips-topics .chip { font-size: 0.78rem; padding: 0.24rem 0.7rem; }

.card-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.mark-as-read-btn.is-read {
  color: var(--accent);
  cursor: default;
  pointer-events: none;
}

/* Bookmarks */
.bookmark-btn.is-saved { color: var(--accent); }
.bookmark-btn.is-saved .icon-bookmark { fill: currentColor; }
.feed.saved-only .article-card:not(.is-bookmarked) { display: none; }
.feed-switches { display: inline-flex; gap: 1.1rem; align-items: center; }

/* Keyboard navigation focus (j/k) */
.article-card.kbd-focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 2.3rem;
  height: 2.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color 0.2s, color 0.2s, background-color 0.2s;
}
a.page-btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.page-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}
.page-btn.is-disabled { opacity: 0.4; pointer-events: none; }
.page-ellipsis { color: var(--muted); padding: 0 0.2rem; }

/* ---------- Notices ---------- */
.notice {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  color: var(--muted);
  margin: 1rem 0;
}
.notice-error {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: transparent;
}

/* ---------- Article detail ---------- */
.detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem 1.8rem 1.5rem;
  box-shadow: var(--shadow);
  margin-top: 0.8rem;
}
.detail-title {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  line-height: 1.18;
  letter-spacing: -0.015em;
  margin: 0.4rem 0 0.7rem;
}
.detail-snippet {
  font-size: 1.05rem;
  color: var(--text);
  margin: 0.4rem 0 1.4rem;
}
.detail-url {
  margin: 1.2rem 0 0;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}
.detail-url a { color: var(--muted); }

/* ---------- Related articles ---------- */
.related { margin-top: 1.6rem; }
.related h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.2rem;
  margin: 0 0 0.7rem;
}
.related-list { list-style: none; margin: 0; padding: 0; }
.related-list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  flex-wrap: wrap;
}
.related-list a { color: var(--text); font-weight: 550; }
.related-list a:hover { color: var(--accent); text-decoration: none; }
.related-meta { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }

/* ---------- Error pages ---------- */
.error-page { text-align: center; padding: 4rem 0; }
.error-code {
  font-family: "Fraunces", Georgia, serif;
  font-size: 5rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
  line-height: 1;
}
.error-page h1 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  margin: 0.6rem 0 1.6rem;
}

/* ---------- Footer ---------- */
.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.84rem;
  padding: 1.1rem 1rem;
}
.site-footer a { color: var(--muted); text-decoration: underline; }
.site-footer a:hover { color: var(--accent); }

/* ---------- Admin ---------- */
.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.8rem 0 1rem;
}
.admin-head-actions { display: flex; gap: 0.5rem; align-items: center; }
.admin-title {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 2rem;
  margin: 0;
}
.admin-sub { color: var(--muted); margin: 0.3rem 0; }
.admin-hint { color: var(--muted); font-size: 0.84rem; margin: 0.5rem 0 0.8rem; }

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.2rem;
}
.admin-card h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.25rem;
  margin: 0 0 0.6rem;
}
.admin-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.admin-card-head h2 { margin: 0; }

.count-pill {
  font-family: "Archivo", sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  vertical-align: 0.15em;
}

.table-wrap { overflow-x: auto; margin-bottom: 1rem; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.admin-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table .row-disabled .cell-name,
.admin-table .row-disabled .cell-url { opacity: 0.45; }
.cell-url a { color: var(--muted); font-size: 0.82rem; word-break: break-all; }
.cell-num { text-align: right; color: var(--muted); }
.cell-actions { white-space: nowrap; }
.cell-actions form { display: inline-flex; align-items: center; gap: 0.35rem; margin-left: 0.4rem; }
.mini-check {
  font-size: 0.72rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
}

.admin-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.6rem;
}
.admin-label { color: var(--muted); font-size: 0.9rem; }

.input {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input-grow { flex: 1; min-width: 220px; }
.input-num { width: 6.5rem; }

.btn-xs { padding: 0.3rem 0.75rem; font-size: 0.8rem; }
.btn-danger {
  background: transparent;
  border-color: transparent;
  color: var(--danger);
}
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }

.kw-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.4rem 0 0.6rem; }
.kw-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.22rem 0.4rem 0.22rem 0.75rem;
  margin: 0;
}
.kw-x {
  font: inherit;
  line-height: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 50%;
  width: 1.2rem;
  height: 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s, color 0.15s;
}
.kw-x:hover { background: var(--danger-soft); color: var(--danger); }

.notice-ok {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: transparent;
}
.text-danger { color: var(--danger); }
.error-list { color: var(--danger); font-size: 0.82rem; margin: 0.4rem 0 0; padding-left: 1.2rem; }

/* Source health badges */
.health {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}
.health-ok { color: var(--accent); background: var(--accent-soft); }
.health-warn { color: #8a6d00; background: rgba(212, 167, 30, 0.16); }
[data-theme="dark"] .health-warn { color: #e8c554; }
.health-bad { color: var(--danger); background: var(--danger-soft); }
.health-off { color: var(--muted); background: var(--surface-2); }

/* Multi-row settings form */
.admin-form-col { flex-direction: column; align-items: flex-start; gap: 0.7rem; }
.admin-form-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.admin-login { max-width: 26rem; margin: 3rem auto; text-align: center; }
.admin-login .admin-form { justify-content: center; }
.code-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  overflow-x: auto;
  text-align: left;
}

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  .toolbar { flex-direction: column; }
  .toolbar .btn-accent { justify-content: center; }
  .search-box kbd { display: none; }
  .card-head { flex-wrap: wrap; }
  .article-card { padding: 1.05rem 1.1rem 1rem; }
}

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  html { scroll-behavior: auto; }
}
