:root {
  --bg: #e9eef2;
  --bg-deep: #dfe7ed;
  --ink: #0f172a;
  --muted: #475569;
  --accent: #0f766e;
  --accent-ink: #134e4a;
  --line: #cbd5e1;
  --surface: #f8fafc;
  --max: 52rem;
  --display: "Syne", "Avenir Next", "Segoe UI", sans-serif;
  --body: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --ui: "Syne", "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { font-size: 18px; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.6;
  background:
    radial-gradient(ellipse 80% 50% at 0% 0%, rgba(15, 118, 110, 0.12), transparent 55%),
    linear-gradient(180deg, #f1f5f9 0%, var(--bg) 45%, var(--bg-deep) 100%);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.wrap { width: min(100% - 2rem, var(--max)); margin-inline: auto; }
.wrap-home { width: min(100% - 2rem, 72rem); }

.home-layout {
  display: grid;
  grid-template-columns: minmax(11rem, 13.5rem) minmax(0, 1fr) minmax(11rem, 13.5rem);
  grid-template-areas: "right center left";
  gap: 1.5rem 1.75rem;
  align-items: start;
  padding-top: 1.25rem;
  padding-bottom: 3rem;
}
.home-rail-left { grid-area: left; }
.digest-feed-home { grid-area: center; }
.home-rail-right { grid-area: right; }
.home-rail {
  font-family: var(--ui);
  position: sticky;
  top: 4.25rem;
}
.rail-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 0.85rem;
}
.rail-subtitle {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 1.35rem 0 0.65rem;
}
.rail-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.channel-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.channel-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--ink);
  padding: 0.35rem 0;
  border-bottom: 1px solid transparent;
  font-size: 0.88rem;
  font-weight: 600;
}
.channel-row:hover {
  color: var(--accent);
  border-bottom-color: var(--line);
}
.channel-row-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.channel-row-count {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.stat-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.stat-list div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.stat-list dt {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-list dd {
  margin: 0;
  font-family: var(--display);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.chips-rail {
  margin-top: 0;
}
.chip-count {
  opacity: 0.7;
  font-size: 0.85em;
  margin-left: 0.15rem;
}

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: #fff; padding: .5rem 1rem;
}
.skip-link:focus { left: 1rem; z-index: 10; }

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.88);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 5;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 0;
}
.brand {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--ink);
  font-size: 1.15rem;
}
nav a {
  font-family: var(--ui);
  color: var(--muted);
  text-decoration: none;
  margin-left: 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
}
nav a:hover, a:hover { color: var(--accent); }

.hero {
  padding: 1.75rem 0 1.25rem;
  animation: rise 0.55s ease both;
}
.brand-mark {
  font-family: var(--ui);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 0.5rem;
}
.hero h1 {
  font-family: var(--display);
  font-size: clamp(1.85rem, 4.5vw, 2.6rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0 0 0.6rem;
}
.lede {
  color: var(--muted);
  max-width: 32rem;
  margin: 0;
  font-size: 1.05rem;
}

.digest-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-bottom: 3.5rem;
}
.digest-feed-home {
  padding-top: 0;
  padding-bottom: 0;
  min-width: 0;
}

.digest {
  padding: 1.75rem 0 2rem;
  border-top: 1px solid var(--line);
  animation: rise 0.6s ease both;
}
.digest:nth-child(1) { animation-delay: 0.05s; }
.digest:nth-child(2) { animation-delay: 0.12s; }
.digest:nth-child(3) { animation-delay: 0.18s; }

.digest-layout {
  display: grid;
  grid-template-columns: minmax(9rem, 12.5rem) 1fr;
  gap: 1.25rem 1.5rem;
  align-items: start;
}
.digest-thumb {
  margin: 0;
  position: sticky;
  top: 4.5rem;
}
.digest-thumb a {
  display: block;
  line-height: 0;
  text-decoration: none;
}
.digest-thumb img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: var(--line);
  border-radius: 0.35rem;
}
.digest-body { min-width: 0; }

.digest-header { margin-bottom: 0.85rem; }
.digest-meta {
  font-family: var(--ui);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 0.4rem;
}
.digest-meta a {
  color: var(--accent-ink);
  text-decoration: none;
}
.digest-title {
  font-family: var(--display);
  font-size: clamp(1.25rem, 3vw, 1.55rem);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0;
}
.digest-title a {
  color: inherit;
  text-decoration: none;
  text-decoration-color: transparent;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
  transition: color 0.18s ease, text-decoration-color 0.18s ease;
}
.digest-title a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: rgba(15, 118, 110, 0.45);
}
.digest-title a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 0.12rem;
}

.digest-summary {
  margin: 0 0 1.1rem;
  font-size: 1.05rem;
  color: var(--ink);
}

.article-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: -0.25rem 0 1.5rem;
}

.policy-page {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}
.policy-article {
  max-width: 42rem;
}
.policy-header {
  margin-bottom: 2rem;
}
.policy-header h1 {
  font-family: var(--display);
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: 0.95;
  margin: 0.25rem 0 1rem;
}
.policy-intro {
  color: var(--muted);
  font-size: 1.12rem;
  margin: 0;
}
.policy-article section {
  border-top: 1px solid var(--line);
  padding-top: 1.25rem;
  margin-top: 1.25rem;
}
.policy-article h2 {
  font-family: var(--ui);
  font-size: 0.95rem;
  line-height: 1.25;
  margin: 0 0 0.5rem;
}
.policy-article p,
.policy-article li {
  color: var(--ink);
}
.policy-article ul {
  margin: 0;
  padding-left: 1.1rem;
}
.policy-contact {
  font-family: var(--ui);
}
.policy-contact a {
  color: var(--accent);
}

.digest-takeaways h3 {
  font-family: var(--ui);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 0.65rem;
}
.digest-takeaways ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: takeaway;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.digest-takeaways li {
  counter-increment: takeaway;
  padding-left: 1.75rem;
  position: relative;
}
.digest-takeaways li::before {
  content: counter(takeaway);
  position: absolute;
  left: 0;
  top: 0.1rem;
  font-family: var(--ui);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  width: 1.25rem;
  height: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--surface);
}
.digest-takeaways strong {
  font-family: var(--ui);
  font-size: 0.95rem;
}
.digest-takeaways p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.ts {
  font-family: var(--ui);
  font-size: 0.78rem;
  font-weight: 600;
  margin-left: 0.4rem;
  color: var(--accent);
  text-decoration: none;
}
.ts:hover { text-decoration: underline; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  list-style: none;
  padding: 0;
  margin: 1.1rem 0 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--ui);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.28rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
a.chip:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
  background: #ecfdf8;
}
.chip-channel {
  border-color: #99f6e4;
  background: #f0fdfa;
  color: var(--accent-ink);
}
.chip-topic {
  color: var(--muted);
}
.topics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}
.topics a {
  display: inline-flex;
  font-family: var(--ui);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  padding: 0.28rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--surface);
}
.topics a:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
}

.digest-actions {
  margin: 1.25rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  font-family: var(--ui);
  font-size: 0.88rem;
  font-weight: 600;
}
.action-primary {
  color: #fff;
  background: var(--accent);
  text-decoration: none;
  padding: 0.45rem 0.9rem;
  border-radius: 0.35rem;
}
.action-primary:hover { background: var(--accent-ink); color: #fff; }
.action-secondary {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.48rem 0.85rem;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  border-radius: 0.35rem;
  background: color-mix(in srgb, var(--accent) 7%, #fff);
  color: var(--accent-ink);
  font-family: var(--ui);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}
.action-secondary:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, #fff);
  color: var(--accent-ink);
}
.action-secondary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.action-muted {
  color: var(--muted);
  text-decoration: none;
}
.action-muted:hover { color: var(--accent); }

.empty { color: var(--muted); padding: 2rem 0; }

/* Knowledge graph */
.graph-page {
  padding-top: 1.35rem;
  padding-bottom: 3.5rem;
}
.graph-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.25rem;
  align-items: end;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--line);
}
.graph-snapshot {
  margin: 0;
  min-width: 12rem;
  text-align: right;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.78rem;
}
.graph-snapshot strong {
  display: block;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.15rem;
  line-height: 1.1;
}
.graph-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.1rem 0 1rem;
  font-family: var(--ui);
}
.graph-tab {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 0.35rem;
  padding: 0.45rem 0.75rem;
  font-family: var(--ui);
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
}
.graph-tab[aria-selected="true"] {
  border-color: var(--accent);
  background: #ecfdf8;
  color: var(--accent-ink);
}
.graph-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(17rem, 21rem);
  gap: 1.25rem;
  align-items: start;
}
.graph-shell {
  min-width: 0;
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
}
.graph-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.8rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
  font-family: var(--ui);
}
.graph-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.graph-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: rgba(248, 250, 252, 0.72);
  padding: 0.28rem 0.55rem;
}
.graph-filter input {
  accent-color: var(--accent);
}
.graph-search {
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: var(--surface);
  min-height: 2rem;
  padding: 0.35rem 0.55rem;
  font-family: var(--ui);
  font-size: 0.82rem;
  color: var(--ink);
  width: min(100%, 13rem);
}
.graph-canvas {
  position: relative;
  overflow: hidden;
  min-height: 30rem;
  background: rgba(248, 250, 252, 0.42);
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  padding: 0.85rem;
}
.kg-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
  align-items: baseline;
  justify-content: space-between;
  font-family: var(--ui);
  margin-bottom: 0.85rem;
}
.kg-summary strong {
  color: var(--ink);
  font-size: 0.98rem;
}
.kg-summary span,
.kg-more {
  color: var(--muted);
  font-size: 0.76rem;
  font-family: var(--ui);
}
.kg-clusters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}
.kg-cluster {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  border-left: 0.35rem solid var(--accent);
  border-radius: 0.35rem;
  min-width: 0;
  overflow: hidden;
}
.kg-cluster.entity { border-left-color: #2563eb; }
.kg-cluster.technique { border-left-color: #7c3aed; }
.kg-cluster.article { border-left-color: #64748b; }
.kg-cluster-main {
  appearance: none;
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(203, 213, 225, 0.72);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 0.22rem;
  padding: 0.75rem 0.85rem 0.7rem;
  text-align: left;
  font-family: var(--ui);
}
.kg-cluster-main:hover,
.kg-related:hover {
  background: rgba(236, 253, 248, 0.7);
}
.kg-cluster-main strong {
  font-family: var(--display);
  font-size: 1rem;
  line-height: 1.15;
}
.kg-cluster-main span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}
.kg-type {
  color: var(--accent-ink) !important;
  font-size: 0.66rem !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.kg-related-list {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding: 0.55rem;
}
.kg-related {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 0.3rem;
  background: rgba(248, 250, 252, 0.78);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.42rem 0.5rem;
  text-align: left;
  font-family: var(--ui);
  font-size: 0.78rem;
  font-weight: 700;
}
.kg-related span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kg-related small {
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 0.68rem;
}
.kg-related.topic { border-left: 0.22rem solid #0f766e; }
.kg-related.entity { border-left: 0.22rem solid #2563eb; }
.kg-related.technique { border-left: 0.22rem solid #7c3aed; }
.kg-related.article { border-left: 0.22rem solid #64748b; }
.kg-related-empty {
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.76rem;
  padding: 0.35rem 0.3rem;
}
.kg-more {
  margin: 0.85rem 0 0;
}
.graph-empty[hidden] { display: none; }
.graph-detail {
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
  position: sticky;
  top: 4.5rem;
}
.graph-detail h2 {
  font-family: var(--display);
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 0.35rem;
}
.graph-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  margin: 0 0 1rem;
}
.graph-metrics div {
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  padding: 0.55rem;
  background: rgba(248, 250, 252, 0.62);
  font-family: var(--ui);
}
.graph-metrics strong {
  display: block;
  font-family: var(--display);
  font-size: 1.15rem;
  line-height: 1.05;
}
.graph-metrics span,
.evidence-title {
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.evidence-title {
  color: var(--accent-ink);
  margin: 0 0 0.65rem;
}
.graph-evidence {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.graph-evidence a {
  color: var(--ink);
  text-decoration: none;
  font-family: var(--ui);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.25;
}
.graph-evidence a:hover { color: var(--accent); }
.graph-evidence p {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.pager {
  display: flex;
  justify-content: flex-end;
  margin: 1.75rem 0 0.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.pager-next {
  font-family: var(--ui);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-ink);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.pager-next:hover { color: var(--accent); }
.pager-next::after { content: " →"; }

/* Detail page */
.video-page .video-header { margin-top: 1.5rem; }
.video-page h1 {
  font-family: var(--display);
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.video-page .thumb img { width: 100%; height: auto; display: block; border-radius: 0.35rem; }
.embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  margin: 1.5rem 0 2rem;
  background: #0f172a;
  border-radius: 0.35rem;
  overflow: hidden;
}
.embed iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}
.eyebrow {
  font-family: var(--ui);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 700;
}
.eyebrow a { color: var(--muted); text-decoration: none; }
.meta { font-family: var(--ui); font-size: 0.8rem; color: var(--muted); margin: 0; }
.video-page section { margin: 2rem 0; }
.video-page h2 {
  font-family: var(--ui);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.attribution {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 2.5rem 0;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.85rem;
}
.attribution p {
  margin: 0;
}
.attribution-description {
  line-height: 1.45;
}
.related-digests {
  margin: 2rem 0 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.related-digests h2 {
  font-family: var(--ui);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 0.9rem;
}
.related-digest-list {
  display: grid;
  gap: 0.9rem;
}
.digest-related-card {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 0.85rem;
  align-items: start;
}
.digest-related-card-no-thumb {
  grid-template-columns: minmax(0, 1fr);
}
.digest-related-thumb {
  display: block;
  line-height: 0;
}
.digest-related-thumb img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  border-radius: 0.35rem;
  background: var(--line);
}
.digest-related-body h3 {
  font-family: var(--display);
  font-size: 1rem;
  line-height: 1.25;
  margin: 0 0 0.35rem;
}
.digest-related-body h3 a {
  color: var(--ink);
  text-decoration: none;
}
.digest-related-body h3 a:hover { color: var(--accent); }
.digest-related-body p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 2rem 0 3rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-family: var(--ui);
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin: 0.75rem 0;
}
.footer-links a {
  color: var(--muted);
  text-decoration: none;
}
.footer-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 960px) {
  /* Articles first; rails become compact strips below. */
  .home-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "center"
      "right"
      "left";
    gap: 1.1rem;
    padding-top: 0.85rem;
    min-width: 0;
  }
  .home-rail {
    position: static;
    min-width: 0;
    padding: 0.75rem 0 0;
    border-top: 1px solid var(--line);
  }
  .channel-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.45rem;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .channel-list li { flex: 0 0 auto; }
  .channel-row {
    border: 1px solid var(--line);
    border-radius: 0.35rem;
    padding: 0.4rem 0.7rem;
    background: var(--surface);
    white-space: nowrap;
  }
  .channel-row-name { white-space: nowrap; }

  .stat-list {
    flex-direction: row;
    gap: 1.75rem;
  }
  .stat-list dd { font-size: 1.35rem; }
  .rail-subtitle { margin-top: 0.9rem; }
  .chips-rail {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.4rem;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .chips-rail li { flex: 0 0 auto; margin: 0; }

  .graph-head,
  .graph-layout {
    grid-template-columns: 1fr;
  }
  .graph-snapshot {
    text-align: left;
  }
  .graph-detail {
    position: static;
  }
}

@media (max-width: 720px) {
  .digest-layout {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }
  .digest-thumb { position: static; }
  .digest-related-card {
    grid-template-columns: 6rem minmax(0, 1fr);
  }
  .digest-related-card-no-thumb {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 540px) {
  html { font-size: 16px; }
  .wrap,
  .wrap-home {
    width: min(100% - 1rem, var(--max));
  }
  .site-header .wrap {
    flex-wrap: wrap;
    gap: 0.45rem 0.85rem;
  }
  nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.85rem;
  }
  nav a {
    margin-left: 0;
  }
  .hero {
    padding-top: 1.25rem;
  }
  .digest {
    padding: 1.35rem 0 1.55rem;
  }
  .digest-title {
    font-size: clamp(1.18rem, 8vw, 1.38rem);
  }
  .digest-summary {
    font-size: 1rem;
  }
  .digest-actions {
    gap: 0.65rem 0.9rem;
  }
  .graph-toolbar {
    align-items: stretch;
  }
  .graph-search {
    width: 100%;
  }
  .graph-canvas {
    min-height: 25rem;
    padding: 0.65rem;
  }
  .kg-clusters {
    grid-template-columns: 1fr;
  }
  .graph-metrics {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
