/* Related posts slider on single posts (mirrors the homepage category carousel). */
.related-posts--slider {
    --related-card-width: min(21rem, 78vw);
    --related-edge: color-mix(in oklab, currentColor 28%, transparent);
}

.related-posts--slider .related-posts__header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
}

.related-posts__controls {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 0.45rem;
}

.related-posts__arrow {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 2.45rem;
    height: 2.45rem;
    min-width: 0;
    min-height: 0;
    padding: 0;
    box-sizing: border-box;
    line-height: 0;
    appearance: none;
    border: 1px solid color-mix(in oklab, currentColor 25%, transparent);
    border-radius: 999px;
    background: color-mix(in oklab, currentColor 5%, transparent);
    color: inherit;
    cursor: pointer;
}

.related-posts__arrow-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2em;
    height: 1.2em;
    flex: none;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 400;
    line-height: 1;
    transform: rotate(45deg);
    transform-origin: 50% 50%;
    pointer-events: none;
}

.related-posts__arrow-glyph--left {
    transform: rotate(-135deg);
}

.related-posts__arrow:hover:not(:disabled),
.related-posts__arrow:focus-visible:not(:disabled) {
    border-color: var(--color-primary, currentColor);
    color: var(--color-primary, currentColor);
}

.related-posts__arrow:disabled {
    opacity: 0.28;
    cursor: default;
}

.related-posts__viewport {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 4rem), transparent 100%);
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 4rem), transparent 100%);
}

.related-posts__viewport::-webkit-scrollbar {
    display: none;
}

.related-posts__viewport:focus-visible {
    outline: 2px solid var(--color-primary, currentColor);
    outline-offset: 2px;
}

.related-posts__track {
    display: flex;
    align-items: stretch;
    gap: 1.25rem;
    position: relative;
    width: max-content;
    min-width: 100%;
    box-sizing: border-box;
    padding-bottom: 0.4rem;
}

.related-posts__item {
    flex: 0 0 var(--related-card-width);
    width: var(--related-card-width);
    min-width: 0;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    opacity: var(--related-slide-opacity, 1);
    transition: opacity 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

.related-posts__item .post-card {
    height: 100%;
    box-sizing: border-box;
}

/* Final card leads to the full category archive. */
.related-posts__item--explore {
    display: flex;
    align-items: stretch;
}

.related-posts__explore {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: space-between;
    gap: 2.5rem;
    min-height: 100%;
    box-sizing: border-box;
    padding: 1.5rem;
    overflow: hidden;
    border: 1px solid color-mix(in oklab, currentColor 17%, transparent);
    border-radius: 1rem;
    background:
        radial-gradient(circle at 100% 0%, color-mix(in oklab, var(--color-primary, currentColor) 14%, transparent), transparent 56%),
        color-mix(in oklab, currentColor 4%, transparent);
    color: inherit;
    text-decoration: none;
    isolation: isolate;
}

.related-posts__explore-top {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.9rem;
}

.related-posts__explore-kicker {
    display: inline-block;
    padding: 0.4rem 0.65rem;
    border: 1px solid color-mix(in oklab, var(--color-primary, currentColor) 40%, transparent);
    border-radius: 999px;
    color: var(--color-primary, currentColor);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.04em;
}

.related-posts__explore-heading {
    max-width: 14ch;
    font-size: clamp(1.6rem, 5vw, 2.2rem);
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -0.04em;
    text-wrap: balance;
    overflow-wrap: anywhere;
}

.related-posts__explore-description {
    max-width: 32ch;
    color: color-mix(in oklab, currentColor 65%, transparent);
    font-size: 0.9rem;
    line-height: 1.55;
}

.related-posts__explore-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1.1rem;
    border-top: 1px solid color-mix(in oklab, currentColor 15%, transparent);
}

.related-posts__explore-label {
    max-width: 21ch;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
}

.related-posts__explore-arrow {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 3rem;
    height: 3rem;
    border: 1px solid color-mix(in oklab, currentColor 25%, transparent);
    border-radius: 50%;
    font-size: 1.2rem;
    line-height: 1;
}

.related-posts__explore:hover,
.related-posts__explore:focus-visible {
    border-color: var(--color-primary, currentColor);
}

.related-posts__explore:hover .related-posts__explore-arrow,
.related-posts__explore:focus-visible .related-posts__explore-arrow {
    border-color: var(--color-primary, currentColor);
    background: var(--color-primary, currentColor);
    color: var(--color-primary-content, #fff);
}

.related-posts__explore:focus-visible {
    outline: 2px solid var(--color-primary, currentColor);
    outline-offset: -4px;
}

@media (max-width: 39.99rem) {
    .related-posts--slider {
        --related-card-width: 76vw;
    }

    .related-posts__arrow {
        width: 2.25rem;
        height: 2.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .related-posts__item {
        transition: none;
    }
}
