/* Blog front-end design refresh — editorial polish on Bootstrap 5.
   Loaded only from blog templates via {% block extra_css %}.
   Preserve SEO markup; this file is visual only. */

/* --- Page shell ---------------------------------------------------------- */

.blog-page {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

.blog-page__header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}

.blog-page__title {
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.blog-page__lede {
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.75));
  font-size: 1.125rem;
  line-height: 1.55;
  /* Fill the page shell — do not re-constrain narrower than .blog-page__main */
  max-width: none;
  margin-bottom: 0;
}

.blog-page__main {
  /* Shared measure for list, detail, category, and author pages */
  max-width: 56rem;
}

/* --- Post cards (list / category / author) ------------------------------- */

.blog-post-card {
  border: 0;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 0.125rem 0.35rem rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: 1.5rem;
  background-color: var(--bs-body-bg, #fff);
}

.blog-post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.1);
}

.blog-post-card__media {
  display: block;
  min-height: 100%;
  background-color: var(--bs-tertiary-bg, #f8f9fa);
}

.blog-post-card__media img {
  width: 100%;
  height: 100%;
  min-height: 10rem;
  object-fit: cover;
  display: block;
}

@media (min-width: 768px) {
  .blog-post-card__media img {
    min-height: 100%;
    position: absolute;
    inset: 0;
  }

  .blog-post-card__media-col {
    position: relative;
    min-height: 11rem;
  }
}

.blog-post-card__body {
  padding: 1.25rem 1.35rem;
}

.blog-post-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
}

.blog-post-card__title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.blog-post-card__title a {
  color: inherit;
  text-decoration: none;
}

.blog-post-card__title a:hover,
.blog-post-card__title a:focus-visible {
  color: var(--bs-link-color, #0d6efd);
}

.blog-post-card__excerpt {
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.75));
  margin-bottom: 0.75rem;
  line-height: 1.55;
}

.blog-post-card__readmore {
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
}

/* --- Category chip ------------------------------------------------------- */

.blog-chip {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.35em 0.7em;
  border-radius: 2rem;
  text-decoration: none;
  background-color: var(--bs-primary-bg-subtle, #cfe2ff);
  color: var(--bs-primary-text-emphasis, #052c65);
  border: 1px solid var(--bs-primary-border-subtle, #9ec5fe);
  line-height: 1.2;
}

.blog-chip:hover,
.blog-chip:focus-visible {
  background-color: var(--bs-primary, #0d6efd);
  color: #fff;
  border-color: var(--bs-primary, #0d6efd);
  text-decoration: none;
}

/* Staff-only draft marker on list/category cards (anonymous never see drafts). */
.blog-badge-draft {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.3em 0.55em;
  border-radius: 0.35rem;
  line-height: 1.2;
  background-color: var(--bs-warning-bg-subtle, #fff3cd);
  color: var(--bs-warning-text-emphasis, #664d03);
  border: 1px solid var(--bs-warning-border-subtle, #ffecb5);
}

.blog-meta-date {
  font-size: 0.875rem;
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.75));
}

/* --- Article detail ------------------------------------------------------ */

/* Width matches the list/category shell (.blog-page__main → 56rem).
   Do not re-constrain the article narrower than the post-link cards. */
.blog-article {
  max-width: none;
  width: 100%;
}

.blog-article__breadcrumb .breadcrumb {
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.blog-article__title {
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.blog-article__byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
  margin-bottom: 1.5rem;
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.75));
  font-size: 0.95rem;
}

.blog-article__byline a {
  font-weight: 600;
  text-decoration: none;
}

.blog-article__byline a:hover {
  text-decoration: underline;
}

.blog-article__hero {
  width: 100%;
  height: auto;
  border-radius: 1rem;
  margin-bottom: 1.75rem;
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.08);
}

/* Markdown body — longform reading measure (narrower than page shell) */
.blog-content {
  font-size: 1.125rem; /* 18px — slight step up from 17px for longform */
  line-height: 1.75;
  color: var(--bs-body-color, #212529);
  /* Midpoint between tight 42rem prose and full ~56rem shell; hero/byline/related stay wide */
  max-width: 48rem;
}

.blog-content > *:first-child {
  margin-top: 0;
}

/* Heading scale must strictly decrease with level.
   Without explicit h5/h6 rules, Bootstrap's defaults win (h5 = 1.25rem)
   and invert the hierarchy under our smaller h4 (was 1.1rem). */
.blog-content h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.blog-content h2 {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  line-height: 1.25;
}

.blog-content h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.blog-content h4 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

.blog-content h5 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 1.15rem;
  margin-bottom: 0.4rem;
  line-height: 1.4;
}

.blog-content h6 {
  font-size: 0.975rem;
  font-weight: 600;
  margin-top: 1rem;
  margin-bottom: 0.35rem;
  line-height: 1.45;
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.85));
}

.blog-content p {
  margin-bottom: 1.15rem;
}

.blog-content ul,
.blog-content ol {
  margin-bottom: 1.15rem;
  padding-left: 1.35rem;
}

.blog-content li {
  margin-bottom: 0.35rem;
}

.blog-content li > p {
  margin-bottom: 0.35rem;
}

.blog-content ul ul,
.blog-content ul ol,
.blog-content ol ul,
.blog-content ol ol {
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
}

.blog-content a {
  font-weight: 500;
  text-underline-offset: 0.15em;
}

.blog-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 1rem 0;
}

/* Pasted figure HTML from admin (PostImage.as_figure_html) */
.blog-content figure.blog-figure {
  margin: 1.75rem 0;
  text-align: center;
}

.blog-content figure.blog-figure img {
  display: block;
  margin: 0 auto 0.6rem;
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

.blog-content figure.blog-figure figcaption {
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.75));
  font-style: italic;
  max-width: 36rem;
  margin: 0 auto;
}

.blog-content blockquote {
  border-left: 4px solid var(--bs-primary-border-subtle, #9ec5fe);
  margin: 1.5rem 0;
  padding: 0.5rem 0 0.5rem 1.15rem;
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.85));
  font-style: italic;
}

.blog-content pre {
  background: var(--bs-tertiary-bg, #f8f9fa);
  border-radius: 0.5rem;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1.15rem;
}

.blog-content code {
  font-size: 0.9em;
}

.blog-content hr {
  margin: 2rem 0;
  opacity: 0.2;
}

/* Markdown Extra tables */
.blog-content table {
  width: 100%;
  margin: 1.25rem 0 1.5rem;
  border-collapse: collapse;
  font-size: 0.975rem;
  line-height: 1.45;
}

.blog-content th,
.blog-content td {
  border: 1px solid var(--bs-border-color, #dee2e6);
  padding: 0.55rem 0.75rem;
  vertical-align: top;
  text-align: left;
}

.blog-content thead th {
  background-color: var(--bs-tertiary-bg, #f8f9fa);
  font-weight: 600;
}

.blog-content tbody tr:nth-child(even) {
  background-color: rgba(0, 0, 0, 0.02);
}

/* Definition lists (Markdown Extra) */
.blog-content dl {
  margin-bottom: 1.15rem;
}

.blog-content dt {
  font-weight: 700;
  margin-top: 0.75rem;
}

.blog-content dd {
  margin-left: 1.15rem;
  margin-bottom: 0.35rem;
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.85));
}

/* Footnotes (Markdown Extra) */
.blog-content .footnote {
  font-size: 0.9rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--bs-border-color, #dee2e6);
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.85));
}

.blog-content .footnote ol {
  padding-left: 1.25rem;
}

/* --- Author profile page (/about/<slug>/) -------------------------------- */

.blog-author-page__header {
  margin-bottom: 1.75rem;
  padding: 1.5rem 1.5rem 1.35rem;
  border-radius: 1rem;
  background: linear-gradient(
    135deg,
    var(--bs-primary-bg-subtle, #cfe2ff) 0%,
    var(--bs-tertiary-bg, #f8f9fa) 60%
  );
  border: 1px solid var(--bs-primary-border-subtle, #9ec5fe);
}

.blog-author-page__identity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem 1.5rem;
}

.blog-author-page__photo {
  flex-shrink: 0;
  width: 8rem;
  height: 8rem;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 0.2rem 0.6rem rgba(0, 0, 0, 0.12);
}

.blog-author-page__titles {
  min-width: 0;
  flex: 1 1 12rem;
}

.blog-author-page__eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bs-primary-text-emphasis, #052c65);
}

.blog-author-page__name {
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin-bottom: 0.25rem;
}

.blog-author-page__role {
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.75));
  font-size: 1.05rem;
  margin-bottom: 0.85rem;
}

.blog-author-page__social {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.blog-author-page__social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.4em 0.85em;
  border-radius: 2rem;
  background-color: #fff;
  color: var(--bs-body-color, #212529);
  border: 1px solid var(--bs-border-color, #dee2e6);
  line-height: 1.2;
}

.blog-author-page__social-link:hover,
.blog-author-page__social-link:focus-visible {
  background-color: var(--bs-primary, #0d6efd);
  border-color: var(--bs-primary, #0d6efd);
  color: #fff;
  text-decoration: none;
}

.blog-author-page__bio {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--bs-body-color, #212529);
  margin-bottom: 2.25rem;
}

.blog-author-page__bio p {
  margin-bottom: 1.1rem;
}

.blog-author-page__bio p:last-child {
  margin-bottom: 0;
}

.blog-author-page__posts {
  margin-top: 0.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--bs-border-color, #dee2e6);
}

.blog-author-page__posts-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1.25rem;
}

.blog-author-page__posts-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 0;
}

.blog-author-page__posts-all {
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
}

.blog-author-page__posts-all:hover {
  text-decoration: underline;
}

/* --- Author bio (post detail footer card) -------------------------------- */

.blog-author-bio {
  margin-top: 2.5rem;
  padding: 1.35rem 1.5rem;
  border-radius: 1rem;
  background: linear-gradient(
    135deg,
    var(--bs-primary-bg-subtle, #cfe2ff) 0%,
    var(--bs-tertiary-bg, #f8f9fa) 55%
  );
  border: 1px solid var(--bs-primary-border-subtle, #9ec5fe);
}

.blog-author-bio__label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bs-primary-text-emphasis, #052c65);
  margin-bottom: 0.15rem;
}

.blog-author-bio__name {
  font-size: 1.1rem;
  font-weight: 700;
  text-decoration: none;
  color: inherit;
}

.blog-author-bio__name:hover {
  color: var(--bs-link-color, #0d6efd);
}

.blog-author-bio__text {
  margin-top: 0.35rem;
  margin-bottom: 0;
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.8));
  font-size: 0.95rem;
  line-height: 1.5;
}

.blog-author-bio__photo {
  flex-shrink: 0;
  border: 3px solid #fff;
  box-shadow: 0 0.125rem 0.35rem rgba(0, 0, 0, 0.1);
}

/* --- Related resources --------------------------------------------------- */

.blog-related {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--bs-border-color, #dee2e6);
}

.blog-related__title {
  font-weight: 700;
  margin-bottom: 1rem;
}

.blog-related .card {
  border: 0;
  border-radius: 0.75rem;
  box-shadow: 0 0.125rem 0.35rem rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.blog-related .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.4rem 1rem rgba(0, 0, 0, 0.1);
}

/* --- Empty state / pagination -------------------------------------------- */

.blog-empty {
  padding: 2rem 0;
  color: var(--bs-secondary-color, rgba(33, 37, 41, 0.75));
}

.blog-page .pagination {
  margin-top: 2rem;
}

/* Draft banner already uses Bootstrap alert; slight spacing only */
.blog-draft-banner {
  border-radius: 0;
  margin-bottom: 0;
}
