/* Blog: the /blog hub, the topic pages, post cards, and what app/blog_extras.py
   places inside a post (CTA bands, photos, screenshots and diagrams).
   Colors and type are Alma's own, from redesign.css: ink and cream, violet
   for emphasis, DM Sans headings, Inter text and JetBrains Mono labels.
   Flat fills and hairline rules; no gradients and no shadows. */

/* ── Hub and topic hero ──────────────────────────────────────────── */
.blog-hub-hero {
  background: var(--cream);
  border-bottom: 1px solid var(--rule);
  padding: 72px 0 48px;
}
.blog-hub-hero h1 {
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  font-size: clamp(36px, 4.6vw, 58px);
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--ink);
  margin: 16px 0 18px;
  max-width: 900px;
}
.blog-hub-hero .lede {
  font-size: 18px;
  line-height: 1.6;
  color: var(--slate);
  max-width: 700px;
  margin: 0;
}
.topic-nav { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.topic-nav .topic-tag { background: var(--paper); }
.topic-nav .topic-tag.is-current { background: var(--ink); border-color: var(--ink); color: var(--cream); }
.topic-nav .topic-tag.is-current .count { color: var(--violet-tint); }

.topic-hero .crumbs {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate);
  margin: 0;
}
.topic-hero .crumbs a { color: var(--violet-deep); }
.topic-hero .crumbs a:hover { color: var(--violet); }
.topic-hero .crumbs .div { color: var(--rule-2); margin: 0 6px; }
.topic-hero .guide-link { margin: 18px 0 0; font-size: 16px; color: var(--ink-2); }
.topic-hero .guide-link a { color: var(--violet-deep); border-bottom: 1px solid currentColor; }
.topic-hero .guide-link a:hover { color: var(--violet); }

/* ── Post cards ──────────────────────────────────────────────────── */
.post-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 14px;
  overflow: hidden;
  color: var(--ink);
  transition: border-color .15s;
}
.post-card:hover { border-color: var(--ink); }
.post-card-media {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--violet-soft);
}
.post-card-media img { width: 100%; height: 100%; object-fit: cover; }
.post-card-media--empty {
  display: flex;
  align-items: flex-end;
  padding: 18px 20px;
  background: var(--ink);
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--cream);
}
.post-card-body { display: flex; flex-direction: column; flex: 1; padding: 20px 22px 20px; }
.post-card-topic {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--violet-deep);
  margin: 0 0 10px;
}
.post-card-title {
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.018em;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 10px;
}
.post-card:hover .post-card-title { color: var(--violet-deep); }
.post-card-dek {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--slate);
  margin: 0 0 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card-meta {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate-2);
}
.post-card-meta .div { color: var(--rule-2); }
.post-card--lead .post-card-title { font-size: clamp(24px, 2.4vw, 30px); line-height: 1.12; }
.post-card--lead .post-card-dek { font-size: 15.5px; -webkit-line-clamp: 4; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
}
@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: 22px; } }

/* ── Hub sections ────────────────────────────────────────────────── */
.hub-block { background: var(--bone); padding: 72px 0; border-bottom: 1px solid var(--rule); }
.hub-block--tint { background: var(--cream); }
.hub-block-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 28px;
}
.hub-block-head h2,
.related-posts h2 {
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  font-size: clamp(26px, 2.8vw, 34px);
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--ink);
  margin: 0;
}
.hub-count {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate);
  margin: 0;
}
.latest-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  align-items: stretch;
}
@media (max-width: 1000px) {
  .latest-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .latest-grid .post-card--lead { grid-column: 1 / -1; }
}
@media (max-width: 640px) { .latest-grid { grid-template-columns: 1fr; gap: 22px; } }

.topic-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}
.topic-head .eyebrow { margin-bottom: 12px; }
.topic-head h2 {
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  font-size: clamp(28px, 2.8vw, 36px);
  letter-spacing: -0.025em;
  line-height: 1.08;
  color: var(--ink);
  margin: 0 0 14px;
}
.topic-head p { font-size: 16px; line-height: 1.6; color: var(--slate); margin: 0 0 22px; }
.topic-links { display: flex; flex-direction: column; gap: 10px; }
.topic-links a {
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
}
.topic-links a:hover { color: var(--violet-deep); }
.topic-links a .arrow { color: var(--violet); }

.headline-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.headline-list li { border-bottom: 1px solid var(--rule); }
.headline-list a { display: block; padding: 16px 0; }
.headline-list .hl-title {
  display: block;
  font-family: "DM Sans", sans-serif;
  font-weight: 600;
  font-size: 17.5px;
  letter-spacing: -0.012em;
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 6px;
}
.headline-list a:hover .hl-title { color: var(--violet-deep); }
.headline-list .hl-meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate-2);
}
@media (max-width: 1000px) {
  .topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topic-head { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .blog-hub-hero { padding: 52px 0 36px; }
  .hub-block { padding: 52px 0; }
  .topic-grid { grid-template-columns: 1fr; gap: 24px; }
}

/* ── Topic pages ─────────────────────────────────────────────────── */
.topic-list { background: var(--bone); padding: 56px 0 88px; }
.topic-list .hub-count { margin-bottom: 24px; }
.topic-list .post-card--lead { grid-column: span 2; }
.topic-list .post-card--lead .post-card-media { aspect-ratio: 16 / 8; }
/* The card beside the lead keeps its own height instead of stretching to match. */
.topic-list .post-card--lead + .post-card { align-self: start; }
@media (max-width: 640px) { .topic-list .post-card--lead { grid-column: auto; } }
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate);
}
.pager a { color: var(--ink); }
.pager a:hover { color: var(--violet-deep); }
.pager .disabled { color: var(--rule-2); }
.empty-state { font-family: "DM Sans", sans-serif; font-size: 22px; color: var(--slate); text-align: center; margin: 40px 0; }

/* ── Post page: hero, cover, end of article, related posts ───────── */
.post-hero::before { display: none; }
.post-hero .post-eyebrow a { color: inherit; }
.post-hero .post-eyebrow a:hover { color: var(--violet); }
.post-hero .post-eyebrow .div { color: var(--rule-2); }
.post-cover { margin-top: 32px; }
.post-cover img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 7;
  object-fit: cover;
  border-radius: 14px;
}
@media (max-width: 720px) { .post-cover img { aspect-ratio: 16 / 10; border-radius: 10px; } }
.post-back {
  max-width: 740px;
  margin: 48px auto 0;
  padding: 22px 32px 0;
  border-top: 1px solid var(--rule);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate);
}
.post-back a { color: var(--ink); }
.post-back a:hover { color: var(--violet-deep); }
.post-back .div { color: var(--rule-2); margin: 0 6px; }
@media (max-width: 720px) { .post-back { padding: 22px 20px 0; } }
.related-posts { background: var(--cream); padding: 72px 0 80px; border-top: 1px solid var(--rule); }
.related-posts h2 { margin-bottom: 28px; }

/* ── Inside a post: CTA bands ────────────────────────────────────── */
/* An ink band on the light page, with the chat-bubble corner from the
   brand mark. It has to read as a break, not as more article. */
.post-prose .post-cta {
  margin: 52px 0;
  padding: 32px 34px 30px;
  background: var(--ink);
  color: var(--cream);
  border-radius: 22px 22px 22px 6px;
}
.post-prose .post-cta p { margin: 0; }
.post-prose .post-cta .post-cta-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #C4B5FD;
  margin-bottom: 12px;
}
.post-prose .post-cta .post-cta-eyebrow::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--violet);
  border-radius: 50% 50% 50% 1px;
}
.post-prose .post-cta .post-cta-heading {
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  font-size: clamp(22px, 2.4vw, 28px);
  letter-spacing: -0.022em;
  line-height: 1.15;
  color: var(--cream);
  margin-bottom: 12px;
}
.post-prose .post-cta .post-cta-text {
  font-size: 16px;
  line-height: 1.6;
  color: rgba(251, 248, 241, .78);
  max-width: 640px;
}
.post-prose .post-cta .post-cta-fact {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .14);
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--cream);
}
.post-prose .post-cta-buttons { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.post-prose .post-cta a.btn { border: 1.5px solid; text-decoration: none; }
.post-prose .post-cta a.btn-primary { color: var(--cream); background: var(--violet); border-color: var(--violet); }
.post-prose .post-cta a.btn-primary:hover { color: var(--cream); background: #6D28D9; border-color: #6D28D9; }
.post-prose .post-cta a.btn-light-outline { color: var(--cream); border-color: rgba(255, 255, 255, .4); }
.post-prose .post-cta a.btn-light-outline:hover { color: var(--ink); background: var(--cream); border-color: var(--cream); }
@media (max-width: 720px) {
  .post-prose .post-cta { margin: 40px 0; padding: 26px 22px 24px; border-radius: 18px 18px 18px 4px; }
}

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

/* ── Diagrams ────────────────────────────────────────────────────── */
.post-prose .dg {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 28px 30px 30px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-2);
}
.post-prose .dg p { margin: 0; color: inherit; }
.post-prose .dg ol, .post-prose .dg ul, .post-prose .dg dl { list-style: none; margin: 0; padding: 0; }
.post-prose .dg li { margin: 0; line-height: 1.5; color: inherit; }
.post-prose .dg .dg-title {
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.015em;
  line-height: 1.25;
  color: var(--ink);
  margin-bottom: 22px;
}

/* Flows: numbered steps that wrap, the last one in violet. */
.post-prose .dg-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px 20px;
  counter-reset: dgflow;
}
.post-prose .dg-flow--four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.post-prose .dg-flow li {
  counter-increment: dgflow;
  border-top: 2px solid var(--ink);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.post-prose .dg-flow li::before {
  content: counter(dgflow, decimal-leading-zero);
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--violet-deep);
}
.post-prose .dg-flow li.is-final { border-top-color: var(--violet); }
.post-prose .dg-flow-step { font-family: "DM Sans", sans-serif; font-weight: 700; font-size: 15.5px; color: var(--ink); }
.post-prose .dg-flow-note { font-size: 14px; color: var(--slate); }

/* Where a lead goes: plans as a short table under the flow. */
.post-prose .dg-plans { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--rule); }
.post-prose .dg-plans .dg-plans-title {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 10px;
}
.post-prose .dg-plans dl > div {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
}
.post-prose .dg-plans dl > div:last-child { border-bottom: none; }
.post-prose .dg-plans dt { font-weight: 600; color: var(--violet-deep); font-size: 14px; }
.post-prose .dg-plans dd { margin: 0; font-size: 14.5px; color: var(--ink); }

/* Two ways the bot answers: side by side, the add-on tinted. */
.post-prose .dg-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.post-prose .dg-col { border: 1px solid var(--rule); border-radius: 12px; padding: 18px 20px 20px; background: var(--bone); }
.post-prose .dg-col--accent { background: var(--violet-soft); border-color: var(--violet-tint); }
.post-prose .dg .dg-col-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--violet-deep);
  margin-bottom: 6px;
}
.post-prose .dg .dg-col-name { font-family: "DM Sans", sans-serif; font-weight: 700; font-size: 18px; color: var(--ink); margin-bottom: 12px; }
.post-prose .dg-points { display: flex; flex-direction: column; gap: 9px; }
.post-prose .dg-points li { position: relative; padding-left: 16px; font-size: 14.5px; }
.post-prose .dg-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--violet);
}

/* A sample conversation: a chat window beside the labeled parts. */
.post-prose .dg-convo-row { display: grid; grid-template-columns: minmax(0, 330px) minmax(0, 1fr); gap: 28px; align-items: start; }
.post-prose .dg-chat {
  background: var(--cream);
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: 0 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}
.post-prose .dg .dg-chat-head {
  margin: 0 -14px 6px;
  padding: 12px 16px;
  background: var(--ink);
  color: var(--cream);
  font-family: "DM Sans", sans-serif;
  font-weight: 700;
  font-size: 14px;
}
.post-prose .dg-msg {
  max-width: 88%;
  padding: 9px 12px;
  font-size: 13.5px;
  line-height: 1.45;
  border-radius: 14px 14px 14px 4px;
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--ink);
}
.post-prose .dg-msg--visitor {
  align-self: flex-end;
  border-radius: 14px 14px 4px 14px;
  background: var(--violet);
  border-color: var(--violet);
  color: var(--cream);
}
.post-prose .dg-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.post-prose .dg-buttons span {
  padding: 4px 10px;
  border: 1px solid var(--violet);
  border-radius: 999px;
  font-size: 12px;
  color: var(--violet-deep);
  background: var(--paper);
}
.post-prose .dg .dg-tag {
  align-self: center;
  padding: 4px 10px;
  border: 1px dashed var(--rule-2);
  border-radius: 999px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--slate);
}
.post-prose .dg-num, .post-prose .dg-parts li::before {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--violet-deep);
  color: #fff;
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
}
.post-prose .dg-num { margin-right: 6px; vertical-align: 1px; }
.post-prose .dg-parts { counter-reset: dgpart; display: flex; flex-direction: column; gap: 14px; }
/* Block, not grid: a grid put the text after <strong> into the 18px number
   column, one word per line. The number sits in the padding instead. */
.post-prose .dg-parts li { counter-increment: dgpart; position: relative; padding-left: 28px; font-size: 14.5px; }
.post-prose .dg-parts li::before { content: counter(dgpart); position: absolute; left: 0; top: 2px; }
.post-prose .dg-parts strong { color: var(--ink); }

@media (max-width: 720px) {
  .post-prose .dg { padding: 22px 18px 24px; }
  .post-prose .dg-flow, .post-prose .dg-flow--four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .post-prose .dg-compare, .post-prose .dg-convo-row { grid-template-columns: 1fr; }
  .post-prose .dg-plans dl > div { grid-template-columns: 1fr; gap: 2px; }
}

/* The click-to-enlarge hint sits at the top of a screenshot, clear of the
   chat button that most widget screenshots show in the bottom corner and of
   the caption under a screenshot that a post carries in its own copy. */
.post-prose .is-zoomable .shot-zoom-hint { top: 10px; bottom: auto; }

/* CTA boxes written into a post's own copy (<aside class="inline-cta">).
   The article's link color used to land on their buttons too, which left
   violet text on a violet button and cream text on a cream box. */
.post-prose .inline-cta {
  margin: 44px 0;
  padding: 26px 28px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: var(--cream);
}
.post-prose .inline-cta.dark { background: var(--ink); border-color: var(--ink); }
.post-prose .inline-cta .inline-cta-row { gap: 18px 24px; }
.post-prose .inline-cta .inline-cta-row > div:first-child { flex: 1 1 300px; }
.post-prose .inline-cta h3 { margin: 0 0 8px; font-size: 21px; }
.post-prose .inline-cta.dark h3 { color: var(--cream); }
.post-prose .inline-cta p { margin: 0; font-size: 15px; line-height: 1.55; color: var(--slate); }
.post-prose .inline-cta.dark p { color: rgba(251, 248, 241, .78); }
.post-prose .inline-cta a.btn { border: 1.5px solid; }
.post-prose .inline-cta a.btn-primary { color: var(--cream); background: var(--violet); border-color: var(--violet); }
.post-prose .inline-cta a.btn-primary:hover { color: var(--cream); background: #6D28D9; border-color: #6D28D9; }
.post-prose .inline-cta a.btn-light-outline,
.post-prose .inline-cta a.btn-outline { color: var(--ink); background: transparent; border-color: var(--rule-2); }
.post-prose .inline-cta a.btn-light-outline:hover,
.post-prose .inline-cta a.btn-outline:hover { color: var(--cream); background: var(--ink); border-color: var(--ink); }
.post-prose .inline-cta.dark a.btn-light-outline { color: var(--cream); border-color: rgba(255, 255, 255, .4); }
.post-prose .inline-cta.dark a.btn-light-outline:hover { color: var(--ink); background: var(--cream); border-color: var(--cream); }
