.mm-post-list { padding: clamp(2rem, 3vw + 1rem, 4rem) 0; }
.mm-post-list__grid {
    display: grid;
    gap: 1.5rem;
}

/* .mm-section-heading lives in mindmixer.css (global) so non-post-list pages
   (e.g. Privacy Policy) can use the same centered-heading + orange-underline
   treatment without enqueuing the post-list block CSS. */

/* Grid layout (News, default) */
.mm-post-list--layout-grid.mm-post-list--cols-2 .mm-post-list__grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.mm-post-list--layout-grid.mm-post-list--cols-3 .mm-post-list__grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.mm-post-list--layout-grid.mm-post-list--cols-4 .mm-post-list__grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
@media (min-width: 880px) {
    .mm-post-list--layout-grid.mm-post-list--cols-2 .mm-post-list__grid { grid-template-columns: repeat(2, 1fr); }
    .mm-post-list--layout-grid.mm-post-list--cols-3 .mm-post-list__grid { grid-template-columns: repeat(3, 1fr); }
    .mm-post-list--layout-grid.mm-post-list--cols-4 .mm-post-list__grid { grid-template-columns: repeat(4, 1fr); }
}

/* Grid card — image-on-top, content below. The global .mm-card rule already
   sets display:flex/column on the article; here we make the media link a
   block so its <img> reliably stretches to the column width and the
   16:9 thumbnail crop renders predictably. */
.mm-post-list--layout-grid .mm-card--grid {
    background: var(--wp--preset--color--mist-0);
    border: 2px solid rgba(0, 0, 0, 0.10);
    border-radius: 5px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.mm-post-list--layout-grid .mm-card--grid .mm-card__media {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}
.mm-post-list--layout-grid .mm-card--grid .mm-card__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.mm-post-list--layout-grid .mm-card--grid .mm-card__body {
    padding: 1.25rem 1.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1 1 auto;
}
.mm-post-list--layout-grid .mm-card--grid .mm-card__meta {
    font-size: 0.8125rem;
    color: rgba(0, 0, 0, 0.55);
}

/* Few-item grid: when a 3- or 4-column grid actually has only 1 or 2 cards,
   the explicit `repeat(N, 1fr)` at >=880px stretches each item to fill its
   1/Nth of the row, leaving the remaining columns empty (e.g. one news card
   pinned at ~1/3 width with two empty cells beside it). Cap the rendered
   column count to the number of children using :has() so the items take a
   natural, balanced share of the row instead of leaving holes.
   :has() is supported in all evergreen browsers (Safari 15.4+, Chrome 105+,
   Firefox 121+). Older browsers fall through to the existing repeat() rule,
   which is acceptable as a worst-case (empty cells, not broken layout). */
@media (min-width: 880px) {
    /* Only one card → center it at a comfortable reading width. Mirrors
       production's .p-num-1 .p-wrapper { width:100%; max-width:360px;
       margin:0 auto } pattern from mindmixer.com/press-news-2026/. */
    .mm-post-list--layout-grid .mm-post-list__grid:has(> .mm-card:only-child) {
        grid-template-columns: minmax(0, 360px);
        justify-content: center;
    }
    /* Exactly two cards in a 3- or 4-col grid → render as a 2-up row,
       centered, so each card keeps a comfortable width without stretching. */
    .mm-post-list--layout-grid.mm-post-list--cols-3 .mm-post-list__grid:has(> .mm-card:nth-child(2):last-child),
    .mm-post-list--layout-grid.mm-post-list--cols-4 .mm-post-list__grid:has(> .mm-card:nth-child(2):last-child) {
        grid-template-columns: repeat(2, minmax(0, 360px));
        justify-content: center;
    }
    /* Exactly three cards in a 4-col grid → render as a 3-up row. */
    .mm-post-list--layout-grid.mm-post-list--cols-4 .mm-post-list__grid:has(> .mm-card:nth-child(3):last-child) {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Press layout — full-width, single-column, logo on left, content on right.
   Matches mindmixer.com/press-news-2026/ .press-wrapper / .press-content. */
.mm-post-list--layout-press .mm-post-list__grid {
    grid-template-columns: 1fr;
    gap: 1rem;
}
.mm-post-list--layout-press .mm-card--press {
    display: grid;
    grid-template-columns: 280px 1fr;
    align-items: center;
    gap: 2rem;
    padding: 1.5rem 2rem;
    background: var(--wp--preset--color--mist-0);
    border: 2px solid rgba(0, 0, 0, 0.10);
    border-radius: 5px;
}
.mm-post-list--layout-press .mm-card--press .mm-card__media {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 280px;
    height: 140px;
    overflow: hidden;
}
.mm-post-list--layout-press .mm-card--press .mm-card__media img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}
.mm-post-list--layout-press .mm-card--press .mm-card__title {
    font-family: var(--wp--preset--font-family--azo-sans, 'Open Sans', sans-serif);
    font-size: 1.125rem;
    line-height: 1.33;
    font-weight: 700;
    margin: 0 0 0.25rem;
}
/* WCAG 1.4.3: prior #777f86 on white = 4.07:1 which fails AA 4.5:1 for body
   text. Use the design-system dark navy (--mm-primary, 15.24:1 on white) so
   press-card titles match the rest of the .mm-card__title rule. */
.mm-post-list--layout-press .mm-card--press .mm-card__title a {
    color: var(--mm-primary, #16243F);
    text-decoration: none;
    transition: color 0.2s ease;
}
.mm-post-list--layout-press .mm-card--press .mm-card__title a:hover {
    /* WCAG 1.4.3: --orange (#E05300) only hits 3.19:1 — use --orange-deep
       (#C34A1D, 4.65:1) so the hover state still passes AA. */
    color: var(--wp--preset--color--orange-deep, #C34A1D);
}
/* Press body uses plain block layout (not the global flex-column from
   .mm-card__body) so the inline-displayed excerpt and readmore can flow on
   the same line. The flex layout is only useful for the grid variant which
   needs margin-top:auto to push the readmore to the card bottom. */
.mm-post-list--layout-press .mm-card--press .mm-card__body {
    display: block;
    padding: 0;
}
.mm-post-list--layout-press .mm-card--press .mm-card__excerpt {
    font-size: 0.875rem;
    line-height: 1.43;
    color: #333;
    margin: 0 0 0.25rem;
    display: inline;
    -webkit-line-clamp: unset;
    overflow: visible;
    max-height: none;
}
.mm-post-list--layout-press .mm-card--press .mm-card__excerpt p {
    display: inline;
    margin: 0;
}
.mm-post-list--layout-press .mm-card--press .mm-card__readmore {
    /* Press cards want the read-more inline immediately after the excerpt
       (no trailing arrow, no top padding). Override the global PATCH 17
       .mm-card__readmore rule which is tuned for the grid card variant. */
    display: inline;
    padding-top: 0;
    margin-top: 0;
    color: var(--wp--preset--color--orange-deep);
    font-weight: 600;
    text-decoration: none;
    margin-left: 0.25rem;
}
.mm-post-list--layout-press .mm-card--press .mm-card__readmore::after {
    /* Suppress the global trailing "→" — press cards end with a period. */
    content: none;
}
.mm-post-list--layout-press .mm-card--press .mm-card__readmore:hover {
    text-decoration: underline;
}
/* Press card without featured image — drop the empty logo column. */
.mm-post-list--layout-press .mm-card--press:not(:has(.mm-card__media)) {
    grid-template-columns: 1fr;
}
@media (max-width: 600px) {
    .mm-post-list--layout-press .mm-card--press {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 1.25rem 1.25rem;
    }
}
