/* ==========================================================================
   Blog — list pages, post cards (also on the home page) and the article page.
   ========================================================================== */

/* Covers: same ratio as the social-media image (1200×630) ------------------- */
.pm-ratio-cover { --bs-aspect-ratio: 52.5%; }   /* 630 / 1200 */
.pm-post-cover { width: 100%; height: 100%; object-fit: cover; }

/* Post card ------------------------------------------------------------------ */
.pm-post-card__media { background: var(--pm-primary-soft); }
.pm-post-card__media img { transition: transform 0.4s ease; }
.pm-post-card:hover .pm-post-card__media img { transform: scale(1.03); }

/* The whole card is one link (stretched-link): the focus outline goes around the
   card instead of the title text. Only where :has() works; older browsers keep
   the title link's own outline (main.css), so focus is never invisible. */
@supports selector(:has(*)) {
  .pm-post-card__title a:focus-visible,
  .pm-featured-post .stretched-link:focus-visible { outline: none; }
  .pm-post-card:has(.pm-post-card__title a:focus-visible),
  .pm-featured-post:has(.stretched-link:focus-visible) {
    outline: var(--pm-focus-width) solid var(--pm-focus-color);
    outline-offset: var(--pm-focus-offset);
  }
}
.pm-post-card__title a:hover { color: var(--pm-primary) !important; }

/* Three lines max, so cards in a row keep a similar height. */
.pm-post-card__excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
.pm-post-card__category:hover,
.pm-featured-post .badge:hover { background: var(--pm-primary) !important; color: var(--pm-white) !important; }

.pm-post-meta .list-inline-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.pm-post-meta .list-inline-item:not(:last-child) { margin-right: 1rem; }

/* Featured post -------------------------------------------------------------- */
.pm-featured-post { box-shadow: var(--pm-shadow); }
.pm-featured-post__media { background: var(--pm-primary-soft); min-height: 100%; }
.pm-featured-post:hover .pm-featured-post__media img { transform: scale(1.02); }
.pm-featured-post__media img { transition: transform 0.4s ease; }

/* Category pills ------------------------------------------------------------- */
.pm-blog-pills {
  /* Containing block of the badges' absolutely positioned .visually-hidden
     text: without it, that text escapes the phone scroller below and widens
     the whole page. */
  position: relative;
  --bs-nav-pills-border-radius: 999px;
  --bs-nav-pills-link-active-bg: var(--pm-primary);
  --bs-nav-link-padding-y: 0.4rem;
}
.pm-blog-pills .nav-link {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--pm-border);
  background: var(--pm-white);
  color: var(--pm-ink);
  font-weight: 600;
  white-space: nowrap;
}
.pm-blog-pills .nav-link:hover,
.pm-blog-pills .nav-link:focus-visible { border-color: var(--pm-primary-light); color: var(--pm-primary); }
.pm-blog-pills .nav-link.active { border-color: var(--pm-primary); color: var(--pm-white); }
.pm-blog-pills .badge { background: var(--pm-primary-soft); color: var(--pm-primary-dark); }
.pm-blog-pills .nav-link.active .badge { background: rgba(255, 255, 255, 0.2); color: var(--pm-white); }
.pm-blog-pills--sub .nav-link { font-size: 0.9rem; font-weight: 500; background: var(--pm-surface); }

/* On phones the pills scroll horizontally instead of wrapping on many lines.
   A scroller clips whatever sticks out of it, focus outlines included: the
   padding leaves room for the outline and the negative margin keeps the pills
   aligned with the text (it stays inside the container's own padding). */
@media (max-width: 767.98px) {
  .pm-blog-pills {
    --pm-pills-focus-room: calc(var(--pm-focus-width) + var(--pm-focus-offset));
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: var(--pm-pills-focus-room) var(--pm-pills-focus-room) calc(var(--pm-pills-focus-room) + 0.4rem);
    margin-inline: calc(var(--pm-pills-focus-room) * -1);
    scrollbar-width: thin;
  }
}

/* Search form in the hero ------------------------------------------------------- */
.pm-blog-search .input-group .form-control { border-radius: 999px 0 0 999px; }
.pm-blog-search .input-group .btn { border-radius: 0 999px 999px 0; }

/* Empty state ---------------------------------------------------------------- */
.pm-blog-empty { max-width: 32rem; }

/* Pagination ----------------------------------------------------------------- */
.pm-blog .pagination {
  --bs-pagination-color: var(--pm-primary);
  --bs-pagination-hover-color: var(--pm-primary-dark);
  --bs-pagination-active-bg: var(--pm-primary);
  --bs-pagination-active-border-color: var(--pm-primary);
  /* No pale ring (also shown on mouse focus): main.css draws the solid focus outline. */
  --bs-pagination-focus-box-shadow: none;
  gap: 0.25rem;
}
.pm-blog .pagination .page-link { border-radius: var(--pm-radius-sm); min-width: 2.5rem; text-align: center; }

/* Article page ----------------------------------------------------------------- */
/* Title, cover, text and share row share one column, limited to a comfortable
   line length, so their left edges line up. */
.pm-post__column { max-width: calc(44rem + var(--bs-gutter-x, 1.5rem)); }
.pm-post-hero { padding-bottom: clamp(4rem, 9vw, 6.5rem); }
/* Article titles are long sentences in a narrow column: smaller than the page hero title. */
.pm-post-hero .pm-page-hero__title { font-size: clamp(1.75rem, 1.2rem + 1.9vw, 2.75rem); }
.pm-post-hero .pm-post-meta { font-size: 0.95rem; }
.pm-post__cover {
  margin-top: clamp(-5rem, -7vw, -2.5rem);
  margin-bottom: 2.5rem;
  border-radius: var(--pm-radius);
  overflow: hidden;
  background: var(--pm-primary-soft);
  box-shadow: var(--pm-shadow);
}
.pm-post__body > :first-child { margin-top: 0; }
.pm-post__body a { text-underline-offset: 0.2em; }
.pm-post__body ul,
.pm-post__body ol { padding-left: 1.4rem; margin-bottom: 1.25rem; }
.pm-post__body li { margin-bottom: 0.35rem; }
.pm-post__body blockquote { margin: 2rem 0; }
.pm-post__body blockquote p:last-child { margin-bottom: 0; }
.pm-post__body hr { margin-block: 2.5rem; opacity: 0.15; }
.pm-post__body pre {
  background: var(--pm-surface);
  border-radius: var(--pm-radius-sm);
  padding: 1rem;
  overflow-x: auto;
}
.pm-post__body table { display: block; overflow-x: auto; }

@media (prefers-reduced-motion: reduce) {
  .pm-post-card:hover .pm-post-card__media img,
  .pm-featured-post:hover .pm-featured-post__media img { transform: none; }
}
