/* GROUP OBJECTS / FLICKITY
=================================================== */
/* Notes...

	- e.g. >> Home > 'Our Stories'

*/
/* HTML Example...

    .c-flickity-wrapper <-- needed on a container higher up e.g. .o-slide, to prevent overflow
        .c-flickity
            .c-flickity__cell
                iframe or img
                .c-flickity__video-grippy <-- two of these if we're loading video
                .c-flickity__video-grippy

*/
/* Modifiers...

    .c-flickity-wrapper--left-align <-- align everything left

*/
/* GROUP OBJECTS / FLICKITY / LAYOUT
=================================================== */
.c-flickity-wrapper {
    /* Needed because of the way we've got flickity working off-screen. This might go on a higher wrapper like .o-slide */
    overflow-x: hidden;
}

.flickity-viewport {
    /* To show 'download transcript'. I hope this doesn't break anything */
    overflow: initial;
}

.o-slide--with-flickity {
    padding-inline-start: 0;
    padding-inline-end: 0;
}

.o-slide--with-flickity .c-flickity {
    position: relative;
    left: var(--spacing-l);
}

.flickity-prev-next-button {
    --button-position: 3em;
}

.flickity-prev-next-button.next {
    right: var(--button-position);
}

.flickity-prev-next-button.previous {
    left: initial;
    right: calc(var(--button-position) * 3);
}

/* Custom */
@media (max-width: 1499px) {
    .o-slide--with-flickity h2 {
        padding-inline-start: var(--spacing-l);
        padding-inline-end: var(--spacing-l);
    }
}

/* Custom */
@media (min-width: 1500px) {
    .o-slide--with-flickity .c-flickity-wrapper > *,
    .o-slide--with-flickity .o-hero-buttons,
    .o-slide--with-flickity .c-flickity-wrapper--left-align {
        left: calc((100vw - var(--max-width-2) + var(--spacing-l) * 2) / 2);
    }

    .flickity-page-dots {
        right: calc((100vw - var(--max-width-2) + var(--spacing-l) * 2) / 2);
    }

    .flickity-prev-next-button.next {
        right: calc((100vw - var(--max-width-2)) / 2 + var(--button-position));
    }

    .flickity-prev-next-button.previous {
        right: calc((100vw - var(--max-width-2)) / 2 + var(--button-position) * 3);
    }
}

/* Custom */
@media (min-width: 2300px) {
    /* Budge over */
    .flickity-prev-next-button.next {
        right: calc((100vw - var(--max-width-2)) / 2 + var(--button-position) * 2);
    }

    .flickity-prev-next-button.previous {
        right: calc((100vw - var(--max-width-2)) / 2 + var(--button-position) * 4);
    }
}

.c-flickity__cell {
    position: relative;
    margin-inline-end: var(--spacing-l-1);
}

.c-flickity-wrapper--left-align h2 {
    /* e.g. >> /about-us > Flickity */
    position: relative;
}

.c-flickity-wrapper--left-align * {
    text-align: left;
}
/* GROUP OBJECTS / FLICKITY / SPACING
=================================================== */
.c-flickity {
    padding-block-end: var(--spacing-l-3);
}

.flickity-page-dots .dot {
    background: var(--colour-pink);
}

.c-flickity__link {
    display: block;
    position: relative;
    top: var(--spacing-s);
}
/* --mq-max-width-reading-before */
@media (max-width: 36.999em) {
    .o-slide--with-flickity .o-hero-buttons,
    .o-slide--with-flickity h2 {
        padding-inline-start: var(--spacing-l);
        /* Avoid clashing with arrow */
        padding-inline-end: var(--spacing-l-3);
    }
}

/* --mq-max-width-reading-after to max-width-2 */
@media (min-width: 37em) and (max-width: 84.999rem) {
    .flickity-page-dots {
        right: var(--spacing-l);
    }
}
/* GROUP OBJECTS / FLICKITY / DECORATION / (CROSS POLLINATED)
=================================================== */
.c-flickity__link {
    font-size: var(--font-size-s-0);
}
/* GROUP OBJECTS / FLICKITY / DECORATION / ACCESSIBILITY / FOCUS
=================================================== */
.flickity-button:focus {
    /* Override default */
    box-shadow: 0 0 0 5px var(--colour-blue);
}
/* GROUP OBJECTS / FLICKITY / GRIPPY
=================================================== */
/* https://codepen.io/daveybrown/pen/WZEqdx */
.c-flickity__video-grippy {
    --bottom: 33.33%;
    position: absolute;
    left: 0;
    width: 40%;
    top: 0;
    bottom: var(--bottom);
    z-index: 3;
}

.c-flickity__video-grippy:before {
    position: absolute;
    display: block;
    content: '';
    width: 60%;
    /* Remove middle button, causes usability issues when grabbing and accidentally playing */
    /* height: 35%; */
    height: 35%;
    top: 0;
    left: 100%;
}

.c-flickity__video-grippy:not(:first-of-type)::before {
    height: calc(35% - var(--bottom));
}

.c-flickity__video-grippy + .c-flickity__video-grippy {
    left: auto;
    right: 0;
}

.c-flickity__video-grippy + .c-flickity__video-grippy:before {
    bottom: 0;
    top: auto;
    right: 100%;
    left: auto;
}

/* Debug */
/* .c-flickity__video-grippy,
.c-flickity__video-grippy:before {
    border: 2px solid green;
}
.c-flickity__video-grippy:not(:first-of-type)::before {
    border: 3px solid red;
} */
/* GROUP FLICKITY / OVERRIDES / (CROSS POLLINATED)
=================================================== */
.flickity-button {
    width: 4em;
    height: 4em;

    /* Override button CSS */
    padding: 0;

    background: initial;
}

.flickity-prev-next-button {
    border-radius: 0;
}

.flickity-prev-next-button .flickity-button-icon {
    transform: scaleX(-1);
    width: 95%;
    height: 95%;
    color: var(--colour-pink);
}

.flickity-prev-next-button.next,
.flickity-prev-next-button.previous {
    top: -3.3em;
}

/* --mq-max-width-reading-before */
@media (max-width: 36.999em) {
    .flickity-prev-next-button.previous {
        display: none;
    }
}

.flickity-prev-next-button.previous:disabled {
    /* Decrease */
    opacity: 0;
}

/* --mq-root-variable-adjustments-1 */
@media (min-width: 450px) {
    .flickity-button {
        /* Increase */
        width: 5em;
        height: 5em;
    }
    .flickity-prev-next-button.next,
    .flickity-prev-next-button.previous {
        top: -5em;
    }

    .c-flickity--cards .flickity-prev-next-button.next,
    .c-flickity--cards .flickity-prev-next-button.previous {
        top: -3.65em;
    }
}

.flickity-button:hover {
    background: none;
}




/* GROUP OBJECTS / FLICKITY / WITH VIDEO / LAYOUT
=================================================== */
.c-flickity--with-video .c-flickity__cell,
.c-flickity--with-video .c-flickity__cell iframe {
    --width: 320px;
    --height: calc(var(--width) * 0.5625);

    width: var(--width);
    height: var(--height);
}

/* Custom */
@media (min-width: 730px) {
    .c-flickity--with-video .c-flickity__cell,
    .c-flickity--with-video .c-flickity__cell iframe {
        --width: 640px;
    }
}




/* GROUP OBJECTS / FLICKITY / CARDS / LAYOUT
=================================================== */
.c-flickity--cards .c-flickity__cell {
    --width: calc(13em + 2vw);

    width: var(--width);
}


/* GROUP OBJECTS / FLICKITY / CARDS / SPACING
=================================================== */
.c-flickity--cards img {
    padding-block-end: var(--spacing-m);
}
/* GROUP OBJECTS / FLICKITY / CARDS / DECORATION
=================================================== */
.c-flickity--cards h3 {
    color: var(--colour-blue);
    font-family: var(--font-family-main);
    font-size: var(--font-size-s-1);
}

.c-flickity--cards p {
    /*     font-size: var(--font-size-s); */
}

.c-flickity--cards button {
    color: var(--colour-pink);
    font-family: var(--font-family-main-bold);
    text-decoration: underline;
    padding-inline-start: 0;
    padding-inline-end: 0;
}




/* GROUP OBJECTS / FLICKITY / CARDS / JS Enhancements
=================================================== */
.js .js__flickity-read-more-content {
    display: none;
}

.js-added--flickity__cell-expanded .js__flickity-read-more-content {
    display: initial;
}

.c-flickity--cards .js-added--flickity__cell-expanded {
    --width: calc(20em + 2vw);
}
