/* ==========================================================================
   Blog post media, contents and callouts (blog detail pages only).
   Built on the site tokens in design-tokens.css. No gradients, glows or
   decorative badges: every element here carries information.
   ========================================================================== */

/* Breadcrumb: replaces the section kicker on post pages */
.post-crumbs {
  margin-bottom: var(--s-4);
  font-size: var(--t-micro);
  color: var(--ink-3);
}
.post-crumbs ol {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}
.post-crumbs li {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  white-space: nowrap;
}
.post-crumbs li + li::before {
  content: "/";
  margin: 0 var(--s-2);
  color: var(--ink-4);
}
.post-crumbs ol {
  width: 100%;
}
.post-crumbs li[aria-current="page"] {
  display: block;
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-3);
}
.post-crumbs a {
  color: var(--ink-2);
  text-decoration: none;
}
.post-crumbs a:hover {
  color: var(--accent);
}

/* Hero image (cover_image): first thing inside the article */
.post-hero {
  margin: 0 0 var(--s-6);
}
.post-hero img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line-1);
  border-radius: var(--r-2);
}

/* Captions shared by hero and in-body figures */
.post-hero figcaption,
.post-figure figcaption,
.post-example figcaption {
  margin-top: var(--s-2);
  font-size: var(--t-micro);
  line-height: 1.5;
  color: var(--ink-3);
}
.post-figure__credit {
  display: block;
  margin-top: 2px;
  color: var(--ink-3);
}

/* In-body figures */
.post-figure {
  margin: var(--s-7) 0;
}
.post-figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--line-1);
  border-radius: var(--r-2);
}
.post-figure svg {
  display: block;
  margin: 0 auto;
}

/* Tables inside posts: wrap long tokens instead of pushing the column off-screen */
.post-content .table-scroll {
  margin: var(--s-6) 0;
}
.post-content table {
  font-size: 0.9rem;
}
.post-content th,
.post-content td {
  overflow-wrap: break-word;
  vertical-align: top;
}
.post-content table th:nth-child(2),
.post-content table td:nth-child(2) {
  width: 5.5em;
}

/* Before/after example blocks */
.post-example {
  margin: var(--s-6) 0;
}
.post-example pre {
  margin: 0 0 var(--s-3);
  padding: var(--s-4) var(--s-5);
  background: var(--bg-1);
  border: 1px solid var(--line-1);
  border-radius: var(--r-2);
  overflow-x: auto;
}
.post-example code {
  display: block;
  padding: 0;
  background: none;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--ink-1);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Key takeaways: a plain panel with one accent rule */
.post-callout {
  margin: var(--s-6) 0;
  padding: var(--s-4) var(--s-5) var(--s-2);
  background: var(--bg-1);
  border: 1px solid var(--line-1);
  border-left: 2px solid var(--accent);
  border-radius: var(--r-2);
}
.post-callout__title {
  margin: 0 0 var(--s-2);
  font-size: var(--t-small);
  font-weight: 600;
  color: var(--ink-1);
}
.post-callout ul {
  margin: 0 0 var(--s-3);
  padding-left: 1.2em;
}
.post-callout li {
  margin-bottom: var(--s-2);
}
.post-callout li:last-child {
  margin-bottom: 0;
}

/* On this page: two-column list between hairlines */
.post-toc {
  margin: var(--s-6) 0;
  padding: var(--s-4) 0;
  border-top: 1px solid var(--line-2);
  border-bottom: 1px solid var(--line-2);
}
.post-toc__title {
  margin: 0 0 var(--s-2);
  font-size: var(--t-small);
  font-weight: 600;
  color: var(--ink-1);
}
.post-toc ol {
  margin: 0;
  padding-left: 1.4em;
  columns: 2;
  column-gap: var(--s-7);
}
.post-toc li {
  break-inside: avoid;
  margin-bottom: var(--s-1);
  font-size: 0.95rem;
}
.post-toc a {
  color: var(--ink-2);
}
.post-toc a:hover {
  color: var(--accent);
}

/* Related reading written into the post body */
.post-related {
  margin-top: var(--s-7);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line-1);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Headings reached from the contents must clear the sticky header */
.post-content h2[id],
.post-content h3[id] {
  scroll-margin-top: calc(var(--header-height) + var(--s-5));
}

/* Visible focus for keyboard users */
.blog-article a:focus-visible,
.post-crumbs a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (max-width: 600px) {
  .post-toc ol {
    columns: 1;
  }
}

@media (max-width: 480px) {
  .blog-article {
    padding: var(--s-5) var(--s-4);
  }
  .post-callout {
    padding: var(--s-4) var(--s-4) var(--s-2);
  }
  .post-content th,
  .post-content td {
    padding: var(--s-2) var(--s-3);
  }
}
