/* ==========================================================================
   Pattern: Article Slider V1
   Heading, intro and button above a Forge slider of the article categories.
   The section is full width: heading and controls line up with the content
   column while the track runs past the right edge so the next card peeks in.
   ========================================================================== */

/* --- Section grid ---------------------------------------------------------- */

.forge-article-slider-v1 {
    /* Half the space beside the content column on a wide screen, the plain
       gutter on a narrow one. Consumed as grid tracks so it resolves against
       the section once. */
    --gutter: max(
        var(--wp--preset--spacing--sm),
        calc((100% - var(--wp--style--global--content-size)) / 2)
    );

    display: grid;
    grid-template-columns: var(--gutter) minmax(0, 1fr) var(--gutter);
    row-gap: var(--wp--preset--spacing--xl);
}

.forge-article-slider-v1__header {
    grid-column: 2;
}

/* Starts on the content column and runs through the right gutter to the
   screen edge. */
.forge-article-slider-v1 > .cf-article-categories {
    grid-column: 2 / -1;
    min-width: 0;
}

/* Keeps the last card off the screen edge; on the viewport so only the
   clipped track narrows and the controls keep the full width. */
.forge-article-slider-v1 .forge-slider__viewport {
    margin-right: var(--wp--preset--spacing--md);
}

/* The controls belong to the content column: the slider is one gutter wider
   than the column, so that gutter comes back as padding. */
.forge-article-slider-v1 .forge-slider__controls {
    padding-right: max(
        var(--wp--preset--spacing--sm),
        calc(100% - var(--wp--style--global--content-size))
    );
}

/* --- Card ----------------------------------------------------------------- */

.forge-article-slider-v1 .forge-slider__slide {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* The whole card is one link (Forge link wrapper, which lays its children
   out in a row by default). Stack them and keep the text colours. */
.forge-article-slider-v1__card.forge-link-wrapper {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    color: var(--wp--preset--color--foreground);
    text-decoration: none;
}

.forge-article-slider-v1__card.forge-link-wrapper > * {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
}

/* Spacing steps down with the card: at about 275px wide the desktop rhythm
   left the text stranded under the image. */
.forge-article-slider-v1__card .forge-article-slider-v1__media {
    width: 100%;
    margin-bottom: var(--wp--preset--spacing--sm);
}

.forge-article-slider-v1__card .forge-article-slider-v1__media img {
    aspect-ratio: 4 / 3;
}

.forge-article-slider-v1__card .forge-article-slider-v1__pill {
    margin-bottom: var(--wp--preset--spacing--2-xs);
}

.forge-article-slider-v1__card .forge-article-slider-v1__title {
    margin-bottom: var(--wp--preset--spacing--sm);
    transition: opacity var(--wp--custom--transition--base);
}

.forge-article-slider-v1__card:hover .forge-article-slider-v1__title {
    opacity: 0.7;
}

.forge-article-slider-v1__card .forge-article-slider-v1__excerpt {
    color: var(--wp--preset--color--foreground-muted);
    font-size: var(--wp--preset--font-size--small);
    line-height: var(--wp--custom--line-height--normal);
}

.forge-article-slider-v1__media {
    width: 100%;
    overflow: hidden;
    border-radius: 16px;
}

.forge-article-slider-v1__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.forge-article-slider-v1 .forge-slider__slide:hover .forge-article-slider-v1__media img {
    transform: scale(1.04);
}

/* Reading time pill. */
.forge-article-slider-v1__pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 var(--wp--preset--spacing--xs);
    border-radius: 30px;
    background-color: color-mix(in srgb, var(--wp--preset--color--secondary) 24%, transparent);
    color: var(--wp--preset--color--primary);
    font-size: var(--wp--preset--font-size--x-small);
    line-height: 1;
    text-decoration: none;
    transition: background-color var(--wp--custom--transition--base);
}

.forge-article-slider-v1__title a {
    text-decoration: none;
    transition: opacity var(--wp--custom--transition--base);
}

.forge-article-slider-v1__title a:hover {
    opacity: 0.7;
}

.forge-article-slider-v1__excerpt p {
    margin: 0;
}

/* --- Controls ------------------------------------------------------------- */

.forge-article-slider-v1 .forge-slider {
    --forge-slider-arrow-size: 44px;
    --forge-slider-arrow-color: var(--wp--preset--color--primary);
    --forge-slider-arrow-border: 1px solid var(--wp--preset--color--primary);
    --forge-slider-progress-color: var(--wp--preset--color--primary);
    --forge-slider-progress-bg: var(--wp--preset--color--background-alt);
    --forge-slider-progress-height: 2px;
    --forge-slider-controls-margin: var(--wp--preset--spacing--xl);
    --forge-slider-controls-gap: var(--wp--preset--spacing--sm);
}

/* Progress first, then the arrows pushed to the right. */
.forge-article-slider-v1 .forge-slider__progress {
    order: 0;
    margin-right: var(--wp--preset--spacing--md);
}

.forge-article-slider-v1 .forge-slider__arrow--prev {
    order: 1;
}

.forge-article-slider-v1 .forge-slider__arrow--next {
    order: 2;
    background: var(--wp--preset--color--primary);
    color: var(--wp--preset--color--background);
}

/* Phosphor arrow-right in place of the plugin's chevrons; the previous
   arrow is the same glyph mirrored. */
.forge-article-slider-v1 .forge-slider__arrow svg {
    display: none;
}

.forge-article-slider-v1 .forge-slider__arrow::before {
    content: "";
    width: 20px;
    height: 20px;
    background-color: currentColor;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M221.66,133.66l-72,72a8,8,0,0,1-11.32-11.32L196.69,136H40a8,8,0,0,1,0-16H196.69L138.34,61.66a8,8,0,0,1,11.32-11.32l72,72A8,8,0,0,1,221.66,133.66Z'/%3E%3C/svg%3E");
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
}

.forge-article-slider-v1 .forge-slider__arrow--prev::before {
    transform: scaleX(-1);
}

.forge-article-slider-v1 .forge-slider__arrow:not(:disabled):hover {
    background: var(--wp--preset--color--secondary);
    border-color: var(--wp--preset--color--secondary);
    color: var(--wp--preset--color--background);
}
