/* Blog: the /blog hub, topic pages, post cards, and what app/blog_extras.py
   places inside a post (CTA bands, photos, screenshots and diagrams).
   Colors and type come from redesign.css. */

/* ── Topic navigation ───────────────────────────────────────────── */
.topic-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}
.topic-nav a {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--rule);
  background: #fff;
  font-size: 14px;
  line-height: 1.3;
  color: var(--ink);
}
.topic-nav a:hover { border-color: var(--navy); }
.topic-nav a .count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--slate);
}
.topic-nav a.current { background: var(--navy); border-color: var(--navy); color: var(--ivory); }
.topic-nav a.current .count { color: rgba(245,241,232,.7); }

/* ── Cards ─────────────────────────────────────────────────────── */
.card { display: block; color: var(--ink); }
.card-media {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--navy);
  margin-bottom: 16px;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card-media img { transform: scale(1.03); }
.card-media--empty {
  display: flex;
  align-items: flex-end;
  padding: 18px;
  font-family: "Newsreader", Georgia, serif;
  font-size: 20px;
  color: var(--ivory);
}
.card-topic {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
  margin: 0 0 8px;
}
.card-title {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 500;
  font-size: 23px;
  line-height: 1.22;
  letter-spacing: -0.01em;
  color: var(--navy);
  margin: 0 0 10px;
}
.card:hover .card-title { color: var(--red); }
.card-dek {
  font-size: 15px;
  line-height: 1.55;
  color: var(--slate);
  margin: 0 0 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slate);
  margin: 0;
}
.card--lead .card-title { font-size: 32px; }
.card--lead .card-dek { font-size: 16.5px; -webkit-line-clamp: 4; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 48px 32px;
}
@media (max-width: 1000px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .card-grid { grid-template-columns: 1fr; gap: 40px; } }

/* ── Hub: latest ───────────────────────────────────────────────── */
.blog-hub-hero { padding-bottom: 48px; }
.hub-block { padding: 72px 0; border-top: 1px solid var(--rule); }
.hub-block--tint { background: var(--ivory); }
.hub-block-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 32px;
}
.hub-block-head h2 {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 500;
  font-size: 34px;
  line-height: 1.15;
  color: var(--navy);
  margin: 0;
}
.latest-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px 32px;
}
@media (max-width: 1000px) {
  .latest-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .latest-grid .card--lead { grid-column: 1 / -1; }
}
@media (max-width: 640px) { .latest-grid { grid-template-columns: 1fr; } }

/* ── Hub: one section per topic ────────────────────────────────── */
.topic-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}
.topic-head .eyebrow { margin-bottom: 12px; }
.topic-head h2 {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 500;
  font-size: 34px;
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--navy);
  margin: 0 0 14px;
}
.topic-head p { font-size: 16px; line-height: 1.6; color: var(--slate); margin: 0 0 20px; }
.topic-links { display: flex; flex-direction: column; gap: 10px; }
.topic-links a {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--navy);
}
.topic-links a:hover { color: var(--red); }
.topic-links a .arrow { color: var(--red); }

.headline-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.headline-list li { border-bottom: 1px solid var(--rule); }
.headline-list a { display: block; padding: 16px 0; color: var(--ink); }
.headline-list .hl-title {
  display: block;
  font-family: "Newsreader", Georgia, serif;
  font-weight: 500;
  font-size: 19px;
  line-height: 1.3;
  color: var(--navy);
  margin-bottom: 6px;
}
.headline-list a:hover .hl-title { color: var(--red); }
.headline-list .hl-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slate);
}
@media (max-width: 1000px) {
  .topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topic-head { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .hub-block { padding: 52px 0; }
  .topic-grid { grid-template-columns: 1fr; gap: 28px; }
  .topic-head h2, .hub-block-head h2 { font-size: 28px; }
  .card--lead .card-title { font-size: 26px; }
}

/* ── Topic pages ───────────────────────────────────────────────── */
.category-hero .crumbs {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate);
  margin: 0 0 14px;
}
.category-hero .crumbs a { color: var(--red); }
.category-hero .guide-link { margin-top: 18px; font-size: 16px; }
.category-hero .guide-link a { color: var(--red); text-decoration: underline; text-underline-offset: 3px; }
.category-list { padding: 64px 0 88px; }
.category-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate);
  margin: 0 0 28px;
}
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate);
}
.pager a { color: var(--ink); }
.pager a:hover { color: var(--red); }
.pager .disabled { color: var(--rule); }
.empty-state {
  padding: 80px 0;
  text-align: center;
  font-family: "Newsreader", Georgia, serif;
  font-size: 22px;
  color: var(--slate);
}

/* ── Related posts under an article ────────────────────────────── */
.related-posts { padding: 64px 0 80px; border-top: 1px solid var(--rule); background: var(--ivory); }
.related-posts h2 {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 500;
  font-size: 30px;
  color: var(--navy);
  margin: 0 0 32px;
}

/* ── Inside a post: CTA bands ──────────────────────────────────── */
.blog-body .post-cta {
  margin: 48px 0;
  padding: 30px 32px 32px;
  background: var(--navy);
  border-top: 3px solid var(--red);
  color: var(--ivory);
}
.blog-body .post-cta .post-cta-eyebrow {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #E9827D;
  margin: 0 0 10px;
}
.blog-body .post-cta .post-cta-heading {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 500;
  font-size: 27px;
  line-height: 1.18;
  color: var(--ivory);
  margin: 0 0 10px;
}
.blog-body .post-cta .post-cta-text {
  font-size: 16px;
  line-height: 1.6;
  color: rgba(245,241,232,.82);
  margin: 0 0 22px;
}
.blog-body .post-cta-buttons { display: flex; flex-wrap: wrap; gap: 12px; }
.blog-body .post-cta a.btn { text-decoration: none; }
.blog-body .post-cta a.btn-primary, .blog-body .post-cta a.btn-primary:hover { color: #fff; }
.blog-body .post-cta a.btn-ghost-light { color: var(--ivory); }
.blog-body .post-cta a.btn-ghost-light:hover { color: var(--navy); }

/* ── Inside a post: figures ────────────────────────────────────── */
.blog-body .post-figure { margin: 28px 0 40px; }
.blog-body .post-figure img { display: block; width: 100%; height: auto; margin: 0; }
/* Photos come in many shapes; one wide frame keeps a tall one from taking
   over the screen. Screenshots and diagrams keep their own proportions. */
.blog-body .post-figure--photo img { aspect-ratio: 16 / 9; object-fit: cover; }
.blog-body .post-figure--screenshot img { border: 1px solid var(--rule); background: #fff; }
.blog-body .post-figure figcaption {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--slate);
}
/* On a wide screen, pictures, diagrams and bands step out past the text
   column, which is what makes them read as breaks rather than more text. */
@media (min-width: 1000px) {
  .blog-body .post-figure,
  .blog-body .post-cta { margin-left: -80px; margin-right: -80px; }
  .blog-body .post-cta { padding: 34px 80px 36px; }
}

/* ── Diagrams ──────────────────────────────────────────────────── */
.dg {
  background: #fff;
  border: 1px solid var(--rule);
  padding: 28px 30px 30px;
}
.blog-body .dg p { margin: 0; font-size: inherit; line-height: inherit; }
.blog-body .dg .dg-title {
  font-family: "Newsreader", Georgia, serif;
  font-weight: 500;
  font-size: 22px;
  line-height: 1.25;
  color: var(--navy);
  margin: 0 0 22px;
}
.blog-body .dg ol, .blog-body .dg ul, .dg ol, .dg ul { list-style: none; margin: 0; padding: 0; }
.blog-body .dg li { margin: 0; font-size: 15px; line-height: 1.5; }

/* Timelines: a rail with a dot per date, the election in red. */
.dg-tracks { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 36px; }
.blog-body .dg .dg-track-name {
  font-weight: 600;
  font-size: 17px;
  color: var(--navy);
  margin-bottom: 4px;
}
.blog-body .dg .dg-track-who { font-size: 13.5px; line-height: 1.5; color: var(--slate); margin-bottom: 18px; }
.dg-steps { position: relative; }
.dg-steps li {
  position: relative;
  padding: 0 0 16px 26px;
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 2px 14px;
}
.dg-steps li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 6px;
  bottom: -6px;
  width: 2px;
  background: var(--rule);
}
.dg-steps li:last-child::before { display: none; }
.dg-steps li::after {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--navy);
  box-shadow: 0 0 0 2px #fff;
}
.dg-steps li.is-final::after { background: var(--red); }
.dg-date {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  font-weight: 500;
  color: var(--navy);
}
.dg-what { color: var(--ink); }
.dg-steps li.is-final .dg-what { font-weight: 600; }
.dg-tracks .dg-steps li { grid-template-columns: 1fr; }
@media (max-width: 720px) {
  .dg { padding: 22px 18px 24px; }
  .dg-tracks { grid-template-columns: 1fr; }
  .dg-steps li { grid-template-columns: 1fr; }
}

/* Flows: numbered steps that wrap, the last one in red. */
.dg-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px 20px;
  counter-reset: dgflow;
}
.dg-flow--four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dg-flow li {
  counter-increment: dgflow;
  border-top: 2px solid var(--navy);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dg-flow li::before {
  content: counter(dgflow, decimal-leading-zero);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--slate);
}
.dg-flow li.is-final { border-top-color: var(--red); }
.dg-flow-step { font-weight: 600; color: var(--navy); }
.dg-flow-note { font-size: 14px; color: var(--slate); }
@media (max-width: 720px) {
  .dg-flow, .dg-flow--four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Bars: one series, so one color and no legend; the value sits at the tip. */
.dg-bars li { padding: 10px 0; border-top: 1px solid var(--rule); }
.dg-bars li:first-child { border-top: none; padding-top: 0; }
.dg-bar-label { display: block; font-size: 14px; color: var(--slate); margin-bottom: 6px; }
.dg-bar-label strong { color: var(--ink); font-weight: 600; margin-right: 6px; }
.dg-bar-track { display: flex; align-items: center; gap: 10px; }
.dg-bar {
  display: block;
  height: 20px;
  background: var(--navy);
  border-radius: 0 4px 4px 0;
}
.dg-bar-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
}

/* Anatomy of a text: a message bubble beside the numbered parts. */
.dg-anatomy-row { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 28px; align-items: center; }
.dg-phone {
  background: var(--ivory);
  border: 1px solid var(--rule);
  border-radius: 22px;
  padding: 26px 18px;
}
.blog-body .dg .dg-bubble {
  background: #E9E9EB;
  color: #111;
  border-radius: 18px 18px 18px 4px;
  padding: 12px 14px;
  font-size: 15px;
  line-height: 1.45;
}
.dg-part { display: inline; }
.dg-part sup, .dg-parts li::before {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  vertical-align: 1px;
}
.dg-part sup { margin-right: 4px; }
.dg-parts { counter-reset: dgpart; display: flex; flex-direction: column; gap: 14px; }
.dg-parts li { counter-increment: dgpart; display: grid; grid-template-columns: 18px 1fr; gap: 10px; }
.dg-parts li::before { content: counter(dgpart); margin-top: 3px; }
.dg-parts strong { color: var(--navy); }
@media (max-width: 720px) {
  .dg-anatomy-row { grid-template-columns: 1fr; }
}
