/* Stories overview (Figma 34-16895, 34-18220). Colours and fonts come from the theme tokens (base/_tokens.scss). */

.block--stories-overview__grid {
    display: grid;
    /* minmax(0, 1fr): an auto track would grow to the longest word and scroll the page sideways. */
    grid-template-columns: minmax(0, 1fr);
    gap: 0.875rem;
}

@media (min-width: 768px) {
    .block--stories-overview__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .block--stories-overview__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* Editor-only stand-in while there are no cards. */
.block--stories-overview__placeholder {
    opacity: 0.4;
}

/* Story teaser, also used without the block (stories archive, related stories). */

.story-teaser {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0.4375rem 0.4375rem 1.6875rem;
    border-radius: var(--radius-image);
    background-color: var(--color-beige);
    color: var(--color-dark);
}

.block--beige .story-teaser {
    background-color: var(--color-off-white);
}

.story-teaser.story-teaser--dark {
    background-color: var(--color-dark);
    color: var(--color-beige);
}

.story-teaser__media {
    position: relative;
    flex: none;
    aspect-ratio: 281 / 188;
    border-radius: 0.6875rem;
    overflow: hidden;
    background-color: color-mix(in srgb, currentColor 8%, transparent);
}

.story-teaser__media picture,
.story-teaser__image {
    display: block;
    width: 100%;
    height: 100%;
}

.story-teaser__image {
    object-fit: cover;
}

.story-teaser__label,
.story-teaser__pill {
    padding: 0.375rem 0.75rem;
    border-radius: 100px;
    background-color: var(--color-off-white);
    color: var(--color-dark);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.story-teaser__label {
    position: absolute;
    top: 0.25rem;
    left: 0.25rem;
    max-width: calc(100% - 0.5rem);
}

.story-teaser__label--custom {
    background-color: var(--color-action);
}

.story-teaser__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 1rem 0.8125rem 0 1.0625rem;
}

.story-teaser__title {
    font-size: 1.5625rem;
    font-weight: 300;
    line-height: 1.2;
    letter-spacing: -0.275px;
    color: inherit;
    overflow-wrap: anywhere;
}

/* The whole card is the link. */
.story-teaser__link::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-image);
}

.story-teaser__text {
    margin: 0.75rem 0 0;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

/* At the bottom of the card, so the pills in a row line up. */
.story-teaser__pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: auto;
    padding-top: 1.375rem;
}

.story-teaser__pill {
    display: block;
    /* Figma's 0.3px line, as a lighter 1px line that does not move the content. */
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-dark) 30%, transparent);
}

/* Figma's dark line disappears on the dark card, and drawing it leaves a light edge. */
.story-teaser--dark .story-teaser__pill,
.story-teaser .story-teaser__pill--service {
    box-shadow: none;
}

.story-teaser__pill--service {
    background-color: var(--color-action);
}

/* In the editor a click on a card selects the block instead of following the link. */
.acf-block-preview .story-teaser__link {
    pointer-events: none;
}
