/* ==========================================================================
   Blog Feed
   ========================================================================== */

.ssb-blog-feed {
    padding-block: var(--space-2xl);
}

/* Section background
   ========================================================================== */

.ssb-blog-feed--bg-subtle {
    background-color: var(--color-surface-subtle);
}

.ssb-blog-feed--bg-base {
    background-color: var(--color-light);
}

.ssb-blog-feed--bg-dark {
    background-color: var(--color-dark);
    color: var(--color-light);
}

/* Header
   ========================================================================== */

.ssb-blog-feed__header {
    margin-bottom: var(--space-xl);
}

.ssb-blog-feed--align-center .ssb-blog-feed__header {
    text-align: center;
}

.ssb-blog-feed__eyebrow {
    margin-bottom: var(--space-xs);
}

.ssb-blog-feed__title {
    margin: 0;
}

.ssb-blog-feed__description {
    max-width: 60ch;
    margin-top: var(--space-sm);
}

.ssb-blog-feed--align-center .ssb-blog-feed__description {
    margin-inline: auto;
}

/* Posts container
   ========================================================================== */

.ssb-blog-feed__posts {
    display: grid;
    gap: var(--space-lg);
}

.ssb-blog-feed--cols-2 .ssb-blog-feed__posts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ssb-blog-feed--cols-3 .ssb-blog-feed__posts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ssb-blog-feed--cols-4 .ssb-blog-feed__posts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 991px) {

    .ssb-blog-feed--cols-3 .ssb-blog-feed__posts,
    .ssb-blog-feed--cols-4 .ssb-blog-feed__posts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

/*
 * One column on a phone.
 *
 * The modifier has to be named here. Written as a bare
 * `.ssb-blog-feed__posts` this weighed one class against the two of
 * `.ssb-blog-feed--cols-3 .ssb-blog-feed__posts` above and lost, so a
 * three or four column feed stayed at two columns all the way down —
 * 132px-wide cards on a 360px screen, with the rule that was meant to
 * prevent it sitting right here doing nothing.
 */
@media (max-width: 599px) {

    .ssb-blog-feed--cols-2 .ssb-blog-feed__posts,
    .ssb-blog-feed--cols-3 .ssb-blog-feed__posts,
    .ssb-blog-feed--cols-4 .ssb-blog-feed__posts {
        grid-template-columns: minmax(0, 1fr);
    }

}

/* List layout
   ========================================================================== */

.ssb-blog-feed--list .ssb-blog-feed__posts {
    grid-template-columns: 1fr;
}

.ssb-blog-feed--list .ssb-blog-feed__post {
    display: grid;
    grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
    gap: var(--space-lg);
    align-items: start;
}

.ssb-blog-feed--list .ssb-blog-feed__post + .ssb-blog-feed__post {
    padding-top: var(--space-lg);
    border-top: 1px solid var(--color-border);
}

@media (max-width: 767px) {

    .ssb-blog-feed--list .ssb-blog-feed__post {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

}

/* Post
   ========================================================================== */

.ssb-blog-feed__post {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/*
 * A collapsed card, for Load More.
 *
 * The browser's own `[hidden] { display: none }` is a UA rule, and it
 * loses to ANY author `display` declaration — the `display: flex` above,
 * or the `display: grid` the list layout sets. So `hidden` on a card does
 * nothing at all here unless this rule exists, and the symptom is a Load
 * More button that collapses nothing and reveals nothing while every
 * selector involved looks right. That is the bug the IHC series listing
 * shipped with.
 *
 * Two classes rather than one, because `.ssb-blog-feed--list
 * .ssb-blog-feed__post` is also two and a tie is settled by source
 * order. The ancestor is always there -- the grid is inside the block --
 * so this matches exactly the cards the one-class form would.
 */
.ssb-blog-feed .ssb-blog-feed__post[hidden] {
    display: none;
}

/* Image
   ========================================================================== */

.ssb-blog-feed__image {
    position: relative;
    overflow: hidden;
    margin-bottom: var(--space-sm);
}

.ssb-blog-feed--list .ssb-blog-feed__image {
    margin-bottom: 0;
}

.ssb-blog-feed__image a {
    display: block;
    position: relative;
    width: 100%;
}

.ssb-blog-feed__image--landscape a {
    aspect-ratio: 3 / 2;
}

.ssb-blog-feed__image--square a {
    aspect-ratio: 1 / 1;
}

.ssb-blog-feed__image--portrait a {
    aspect-ratio: 3 / 4;
}

.ssb-blog-feed__image--wide a {
    aspect-ratio: 16 / 9;
}

.ssb-blog-feed__image-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    transition: transform .6s cubic-bezier(.22, .61, .36, 1);
}

.ssb-blog-feed__post:hover .ssb-blog-feed__image-img,
.ssb-blog-feed__post:focus-within .ssb-blog-feed__image-img {
    transform: scale(1.06);
}

/* Content
   ========================================================================== */

.ssb-blog-feed__content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.ssb-blog-feed__category {
    margin-bottom: 0.35rem;
    font-family: var(--font-condensed);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-primary);
}

.ssb-blog-feed--bg-dark .ssb-blog-feed__category {
    color: var(--color-highlight);
}

.ssb-blog-feed__post-title {
    margin: 0 0 0.35rem;
    font-size: 1.125rem;
    line-height: 1.3;
}

.ssb-blog-feed__post-title a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.ssb-blog-feed__post-title a:hover,
.ssb-blog-feed__post-title a:focus-visible {
    color: var(--color-primary);
}

.ssb-blog-feed__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    margin-bottom: var(--space-xs);
    font-size: 0.8125rem;
    color: var(--color-muted);
}

.ssb-blog-feed--bg-dark .ssb-blog-feed__meta {
    color: rgba(255, 255, 255, .7);
}

.ssb-blog-feed__excerpt {
    font-size: 0.9375rem;
    line-height: 1.6;
}

.ssb-blog-feed__more {
    margin-top: var(--space-sm);
    font-family: var(--font-condensed);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-decoration: none;
}

/* Footer
   ========================================================================== */

.ssb-blog-feed__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    margin-top: var(--space-xl);
}

/*
 * View All.
 *
 * .btn--outline is white wherever it is defined, for use on a dark hero.
 * On any light band that was white text inside a white border on cream --
 * rendering at full size and completely invisible, which is the same
 * fault the Content block's sidebar had.
 *
 * currentColor rather than a rule per surface: the block sets its own
 * text color on a dark band and inherits the section's everywhere else,
 * so the button takes whatever the words around it take. That also covers
 * the case a surface list cannot -- a band set to None sitting inside a
 * dark Section, where the background is not the block's to know about.
 *
 * The hover was rgba(255,255,255,.1), which is a white wash: visible on
 * the dark band it was written for and nothing at all anywhere else. A
 * wash of the button's own color works on either.
 */
.ssb-blog-feed .btn--outline {
    color: inherit;
    border-color: currentColor;
}

.ssb-blog-feed .btn--outline:hover,
.ssb-blog-feed .btn--outline:focus-visible {
    background: rgba(128, 128, 128, .14);
    background: color-mix(in srgb, currentColor 14%, transparent);
}

@media (prefers-reduced-motion: reduce) {

    .ssb-blog-feed__image-img,
    .ssb-blog-feed__post-title a {
        transition: none;
    }

    .ssb-blog-feed__post:hover .ssb-blog-feed__image-img,
    .ssb-blog-feed__post:focus-within .ssb-blog-feed__image-img {
        transform: none;
    }

}


/* A title that leaves the site
   --------------------------------------------------------------------------
   Posts can carry an External Link, and then the title goes to another
   site in a new tab. A screen reader is told so in words inside the link;
   this is the same fact for everyone else.

   Keyed to target="_blank" rather than a class of its own. The attribute
   is the thing that makes the link behave this way, so the mark and the
   behavior cannot come apart.

   A mask rather than a character in `content`. Some screen readers read
   generated content out, and the link already says "(opens in a new tab)"
   in words — a glyph announced after it would be the same fact twice.
   currentColor through the mask, so it follows the title into a hover or
   a dark surface without a second rule.
   ========================================================================== */

.ssb-blog-feed__post-title a[target="_blank"]::after {
    content: "";
    display: inline-block;
    width: .62em;
    height: .62em;
    margin-left: .3em;
    vertical-align: baseline;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M4 10L10 4M5.5 4H10v4.5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M4 10L10 4M5.5 4H10v4.5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / contain;
}
