/* ===============================================
    Home page: products slider + news & blog
    Markup: views/partials/slider.hbs (products), views/index.hbs (news & blog)
    Behaviour: public/js/home-sliders.js
------------------------*/

.mp-products,
.mp-news {
    --mp-ink: var(--brand-ink);
    --mp-navy: var(--brand-navy);
    --mp-green: var(--brand-green);
    --mp-accent: var(--brand-orange);
    --mp-accent-dark: var(--brand-orange-text);
    --mp-line: var(--brand-line);
    --mp-muted: var(--brand-muted);
}

.mp-eyebrow {
    margin: 0 0 12px;
    color: var(--mp-accent-dark);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.mp-round {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--mp-line);
    border-radius: 50%;
    background: #fff;
    color: var(--mp-ink);
    cursor: pointer;
    transition: background-color .25s ease, border-color .25s ease, color .25s ease, transform .25s ease, opacity .25s ease;
    -webkit-appearance: none;
    appearance: none;
}

.mp-round:hover:not(:disabled) {
    border-color: var(--mp-navy);
    background: var(--mp-navy);
    color: #fff;
}

.mp-round:active:not(:disabled) {
    transform: scale(.94);
}

.mp-round:disabled {
    opacity: .35;
    cursor: default;
}

.mp-round svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mp-round:focus-visible,
.mp-link:focus-visible,
.mp-card__link:focus-visible,
.mp-slider__track:focus-visible {
    outline: 2px solid var(--mp-green);
    outline-offset: 3px;
}


/* Products slider
   Compact three-up cards (two-up on tablets, one and a bit on phones) on a scroll-snap
   track, with page dots underneath. Cover images are wide banners with their own text,
   so each is shown whole over a blurred copy of itself.
------------------------*/

.mp-products {
    padding: var(--sec-y) 0 calc(var(--sec-y) - 8px);
    overflow: hidden;
    background: linear-gradient(180deg, var(--brand-sky) 0%, #e9f3f9 100%);
}

.mp-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.mp-title {
    margin: 0;
    color: var(--mp-ink);
    font-size: 38px;
    font-weight: 600;
    line-height: 1.2;
}

.mp-head__tools {
    display: flex;
    flex: none;
    align-items: center;
    gap: 28px;
}

.mp-arrows {
    display: flex;
    gap: 10px;
}

.mp-link {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 8px;
    color: var(--brand-green-text);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
}

.mp-link svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .25s ease;
}

.mp-link:hover {
    color: var(--mp-navy);
}

.mp-link:hover svg {
    transform: translateX(4px);
}

/* The track bleeds out to both edges of the window while the first card still lines
   up with the heading. The script measures the real gap on each side (--bleed-l/r),
   because 100vw would include a classic scrollbar and be off by half its width. */
.mp-slider__track {
    --bleed-l: 0px;
    --bleed-r: 0px;

    display: flex;
    gap: 24px;
    margin: 0 calc(-1 * var(--bleed-r)) 0 calc(-1 * var(--bleed-l));
    padding: 8px var(--bleed-r) 24px var(--bleed-l);
    overflow-x: auto;
    scroll-padding-left: var(--bleed-l);
    list-style: none;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
}

.mp-slider__track::-webkit-scrollbar {
    display: none;
}

.mp-slider__track.is-dragging {
    scroll-snap-type: none;
    cursor: grabbing;
    user-select: none;
}

.mp-card {
    flex: 0 0 calc((100% - 48px) / 3);
    min-width: 0;
    margin: 0;
    padding: 0;
    scroll-snap-align: start;
}

.mp-card__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--mp-line);
    border-radius: 22px;
    background: #fff;
    color: inherit;
    text-decoration: none;
    transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
    -webkit-user-drag: none;
}

.mp-card__link:hover {
    border-color: rgba(var(--brand-green-rgb), .35);
    box-shadow: 0 30px 50px -32px rgba(var(--brand-navy-rgb), .5);
    transform: translateY(-6px);
}

/* whole banner shown over a blurred copy of itself, so any upload shape fits */
.mp-card__media {
    position: relative;
    display: block;
    flex: none;
    aspect-ratio: 2 / 1;
    overflow: hidden;
    background: #e4ecf0;
}

.mp-card__bg {
    position: absolute;
    top: -24px;
    left: -24px;
    width: calc(100% + 48px);
    max-width: none;
    height: calc(100% + 48px);
    object-fit: cover;
    filter: blur(24px) saturate(1.15);
}

.mp-card__img {
    position: relative;
    display: block;
    width: 100%;
    max-width: none;
    height: 100%;
    object-fit: contain;
    transition: transform .6s ease;
}

.mp-card__link:hover .mp-card__img {
    transform: scale(1.04);
}

.mp-card__media.is-broken img {
    display: none;
}

.mp-card__media--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e4ecf0, #f3f7f9);
    color: #9db3bd;
}

.mp-card__media--empty svg {
    width: 56px;
    height: 56px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mp-card__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 8px;
    padding: 20px 22px 22px;
}

.mp-card__title {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--mp-ink);
    font-family: Poppins, sans-serif;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.mp-card__desc {
    display: -webkit-box;
    overflow: hidden;
    color: var(--mp-muted);
    font-size: 14.5px;
    line-height: 1.65;
    white-space: pre-line;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.mp-card__more {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 8px;
    color: var(--mp-green);
    font-size: 15px;
    font-weight: 600;
}

.mp-card__more svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .25s ease;
}

.mp-card__link:hover .mp-card__more svg {
    transform: translateX(5px);
}

/* page dots: built by the script, one per position the track can rest on.
   The active one is a pill that fills as the auto-scroll countdown runs. */
.mp-slider__dots {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    margin-top: 2px;
}

.mp-slider__dots:empty {
    display: none;
}

.mp-dot {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    margin: 0;
    padding: 0 5px;
    border: 0;
    background: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.mp-dot__bar {
    position: relative;
    display: block;
    width: 8px;
    height: 8px;
    overflow: hidden;
    border-radius: 8px;
    background: rgba(var(--brand-navy-rgb), .65);
    transition: width .3s ease, background-color .3s ease;
}

.mp-dot:hover .mp-dot__bar {
    background: rgba(var(--brand-navy-rgb), .8);
}

.mp-dot.is-active .mp-dot__bar {
    width: 30px;
    background: rgba(var(--brand-navy-rgb), .18);
}

.mp-dot__fill {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    border-radius: inherit;
    background: var(--mp-accent);
    transform: scaleX(0);
    transform-origin: 0 50%;
}

.mp-dot.is-active .mp-dot__fill {
    transform: scaleX(var(--p, 1));
}

.mp-dot:focus-visible {
    outline: 2px solid var(--mp-green);
    outline-offset: 1px;
    border-radius: 8px;
}

.mp-slider__progress {
    height: 3px;
    overflow: hidden;
    border-radius: 3px;
    background: var(--mp-line);
}

.mp-slider__thumb {
    display: block;
    width: 33%;
    height: 100%;
    border-radius: 3px;
    background: var(--mp-accent);
    transition: transform .15s linear;
}

/* pause/play for the auto-scroll sits between the arrows */
.mp-slider__toggle .mp-icon-play {
    display: none;
    fill: currentColor;
    stroke-width: 1;
}

[data-mp-slider].is-paused .mp-icon-pause {
    display: none;
}

[data-mp-slider].is-paused .mp-icon-play {
    display: block;
}

/* everything already fits: nothing to slide, so no arrows or progress */
[data-mp-slider].is-static .mp-arrows,
[data-mp-slider].is-static .mp-slider__dots,
[data-mp-slider].is-static .mp-slider__progress {
    display: none;
}

[data-mp-slider].is-static .mp-slider__track {
    cursor: default;
}

.mp-avatar {
    position: relative;
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    overflow: hidden;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--mp-green), var(--mp-navy));
    color: #fff;
}

/* no-JS fallback: show only the first letter of the name */
.mp-avatar__initial {
    font-size: 0;
    font-weight: 600;
}

.mp-avatar__initial::first-letter {
    font-size: 24px;
    text-transform: uppercase;
}

.mp-avatar img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    object-fit: cover;
}


/* Responsive
------------------------*/

@media (max-width: 991.98px) {

    .mp-products {
        padding: var(--sec-y) 0 calc(var(--sec-y) - 8px);
    }

    .mp-title {
        font-size: 32px;
    }

    .mp-head {
        margin-bottom: 24px;
    }

    .mp-card {
        flex-basis: calc((100% - 24px) / 2);
    }
}

@media (max-width: 575.98px) {

    .mp-products {
        padding: var(--sec-y) 0 calc(var(--sec-y) - 8px);
    }

    .mp-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        margin-bottom: 20px;
    }

    .mp-title {
        font-size: 28px;
    }

    /* phones swipe, so the arrows go; the pause button stays */
    .mp-slider__prev,
    .mp-slider__next {
        display: none;
    }

    .mp-slider__track {
        gap: 16px;
    }

    .mp-card {
        flex-basis: 84%;
    }

    .mp-card__body {
        padding: 18px 18px 20px;
    }

    .mp-card__title {
        font-size: 17px;
    }
}

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

    .mp-card__link,
    .mp-card__img,
    .mp-dot__bar,
    .mp-slider__thumb,
    .mp-round {
        transition: none;
    }

    .mp-card__link:hover,
    .mp-card__link:hover .mp-card__img {
        transform: none;
    }
}


/* News & blog
   A contained three-up row of post cards on the same scroll-snap track as the products
   slider. On phones it bleeds out to the screen edges, like that one does.
------------------------*/

.mp-news {
    padding: var(--sec-y) 0;
    overflow: hidden;
    background: var(--brand-mint);
}

.mp-post {
    flex: 0 0 calc((100% - 48px) / 3);
    min-width: 0;
    margin: 0;
    padding: 0;
    scroll-snap-align: start;
}

.mp-post__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--mp-line);
    border-radius: 22px;
    background: #fff;
    color: inherit;
    text-decoration: none;
    transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
    -webkit-user-drag: none;
}

.mp-post__link:hover {
    border-color: rgba(var(--brand-green-rgb), .35);
    box-shadow: 0 30px 50px -32px rgba(var(--brand-navy-rgb), .5);
    transform: translateY(-6px);
}

.mp-post__link:focus-visible {
    outline: 2px solid var(--mp-green);
    outline-offset: 3px;
}

/* whole picture shown over a blurred copy of itself, so any upload shape fits */
.mp-post__media {
    position: relative;
    display: block;
    flex: none;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    background: #e4ecf0;
}

.mp-post__bg {
    position: absolute;
    top: -24px;
    left: -24px;
    width: calc(100% + 48px);
    max-width: none;
    height: calc(100% + 48px);
    object-fit: cover;
    filter: blur(24px) saturate(1.15);
}

.mp-post__img {
    position: relative;
    display: block;
    width: 100%;
    max-width: none;
    height: 100%;
    object-fit: contain;
    transition: transform .6s ease;
}

.mp-post__link:hover .mp-post__img {
    transform: scale(1.04);
}

.mp-post__media.is-broken img {
    display: none;
}

.mp-post__media--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e4ecf0, #f3f7f9);
    color: #9db3bd;
}

.mp-post__media--empty svg {
    width: 56px;
    height: 56px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mp-post__date {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 1;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .96);
    color: var(--mp-ink);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: .04em;
    box-shadow: 0 12px 24px -12px rgba(var(--brand-navy-rgb), .55);
}

.mp-post__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 10px;
    padding: 22px 24px 24px;
}

.mp-post__title {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    color: var(--mp-ink);
    font-family: Poppins, sans-serif;
    font-size: 19px;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.mp-post__excerpt {
    display: -webkit-box;
    overflow: hidden;
    color: var(--mp-muted);
    font-size: 15px;
    line-height: 1.7;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.mp-post__more {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 10px;
    color: var(--mp-green);
    font-size: 15px;
    font-weight: 600;
}

.mp-post__more svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .25s ease;
}

.mp-post__link:hover .mp-post__more svg {
    transform: translateX(5px);
}

.mp-news__note {
    margin: 24px 0 0;
    color: var(--mp-muted);
    font-size: 16px;
    line-height: 1.7;
    text-align: center;
}

.mp-news__note a {
    color: var(--brand-green-text);
    font-weight: 600;
    text-decoration: none;
}

.mp-news__note a:hover {
    color: var(--mp-navy);
}

.mp-news__note .mp-news__all {
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (max-width: 991.98px) {

    .mp-news {
        padding: var(--sec-y) 0;
    }

    .mp-post {
        flex-basis: calc((100% - 24px) / 2);
    }
}

@media (max-width: 575.98px) {

    .mp-news {
        padding: var(--sec-y) 0;
    }

    .mp-post {
        flex-basis: 84%;
    }

    .mp-post__body {
        padding: 20px 20px 22px;
    }

    .mp-post__title {
        font-size: 18px;
    }

    /* phones swipe: the arrows have nothing left to show */
    .mp-news .mp-arrows {
        display: none;
    }
}

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

    .mp-post__link,
    .mp-post__img {
        transition: none;
    }

    .mp-post__link:hover,
    .mp-post__link:hover .mp-post__img {
        transform: none;
    }
}
