/**
 * Hero block.
 *
 * Values mirror the Tilda original (bebestschool.com, record rec591365137 — a
 * CR30N slider with a Zero block in each slide): 1200 px grid, 661 px tall,
 * 62/55/52/48/36 px headings in ApercuPro, #f66746 headings, #1cb65a buttons,
 * yellow #ffd62c arrows and dots, and one #fcc216 slide.
 *
 * The Zero blocks placed every element by hand at each width; here the text
 * and the picture sit in two columns that flow instead, and stack below 640 px.
 * Slides change with a fade.
 */

.bbs-hero {
    --bbs-hero-coral: #f66746;
    --bbs-hero-green: #1cb65a;
    --bbs-hero-green-hover: #169c4c;
    --bbs-hero-yellow: #ffd62c;
    --bbs-hero-gold: #fcc216;
    --bbs-hero-gold-hover: #eab30f;
    --bbs-hero-text: #000000;
    --bbs-hero-font: 'ApercuPro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;

    --bbs-hero-container: 1200px;
    --bbs-hero-gutter: 20px;
    /* The text column; the picture takes the rest. */
    --bbs-hero-content: 615px;
    /* Headings may run on over the picture's column, as the original's do. */
    --bbs-hero-title-width: 769px;
    /* How far the picture reaches back under the text: it starts at 568 px on
       the 1200 px grid. */
    --bbs-hero-overlap: 67px;
    --bbs-hero-min-height: 661px;
    --bbs-hero-pad: 30px;
    --bbs-hero-fade: 0.5s;

    position: relative;
    background: #ffffff;
    color: var(--bbs-hero-text);
    font-family: var(--bbs-hero-font);
}

/* Don't lean on the theme's reset — the block ships its own box model. */
.bbs-hero *,
.bbs-hero *::before,
.bbs-hero *::after {
    box-sizing: border-box;
}

/* ── Track: the slides stacked in one cell, as tall as the tallest, fading
   into one another ── */
.bbs-hero__track {
    display: grid;
    overflow: hidden;
}

.bbs-hero__slide {
    grid-area: 1 / 1;
    display: flex;
    min-width: 0;
    min-height: var(--bbs-hero-min-height);
    /* Each slide carries its own background, so the one below never shows
       through the one fading in. */
    background-color: #ffffff;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--bbs-hero-fade) ease-in-out, visibility 0s linear var(--bbs-hero-fade);
}

.bbs-hero__slide.is-active {
    z-index: 1;
    opacity: 1;
    visibility: visible;
    transition: opacity var(--bbs-hero-fade) ease-in-out, visibility 0s;
}

/* White 50 % over black 5 % on white, flattened. */
.bbs-hero__slide--gradient {
    background-image: linear-gradient(to bottom, #ffffff, #f2f2f2);
}

.bbs-hero__inner {
    display: grid;
    grid-template-columns: minmax(0, var(--bbs-hero-content)) minmax(0, 1fr);
    align-items: center;
    width: 100%;
    max-width: var(--bbs-hero-container);
    margin: 0 auto;
    padding: var(--bbs-hero-pad) calc(var(--bbs-hero-gutter) * 2) 0;
}

.bbs-hero__slide--no-image .bbs-hero__inner {
    grid-template-columns: minmax(0, 1fr);
}

/* The text sits a little above the middle, clear of the dots. */
.bbs-hero__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-bottom: 16px;
}

.bbs-hero__media {
    display: flex;
    justify-content: center;
    align-items: center;
    align-self: stretch;
    margin-left: calc(var(--bbs-hero-overlap) * -1);
    padding-bottom: var(--bbs-hero-pad);
}

.bbs-hero__slide--image-side-left .bbs-hero__media {
    justify-content: flex-start;
}

.bbs-hero__slide--image-side-right .bbs-hero__media {
    justify-content: flex-end;
}

/* A cut-out person stands on the slide's lower edge. */
.bbs-hero__slide--image-bottom .bbs-hero__media {
    align-items: flex-end;
    padding-bottom: 0;
}

.bbs-hero__img {
    display: block;
    width: var(--bbs-hero-image-width, 80%);
    max-width: 100%;
    height: auto;
    transform: rotate(var(--bbs-hero-image-tilt, 0deg));
}

/* ── Type ── */
.bbs-hero__title {
    width: max-content;
    max-width: min(var(--bbs-hero-title-width), calc(100vw - var(--bbs-hero-gutter) * 2));
    margin: 0;
    font-size: 62px;
    line-height: 1.2;
    font-weight: 700;
    color: var(--bbs-hero-coral);
}

.bbs-hero__slide--yellow .bbs-hero__title {
    line-height: 1.25;
    font-weight: 900;
    color: var(--bbs-hero-gold);
}

.bbs-hero__text {
    margin: 14px 0 0;
    max-width: 615px;
    font-size: 23px;
    line-height: 1.55;
    font-weight: 400;
}

.bbs-hero__details {
    margin-top: 22px;
    max-width: 487px;
    font-size: 17px;
    line-height: 1.55;
    font-weight: 400;
}

.bbs-hero__details > * {
    margin: 0;
}

.bbs-hero__details > * + * {
    margin-top: 16px;
}

.bbs-hero__details ul,
.bbs-hero__details ol {
    padding-left: 1.4em;
}

.bbs-hero__details a {
    color: inherit;
}

.bbs-hero__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 250px;
    min-height: 45px;
    margin-top: 26px;
    padding: 6px 16px;
    border-radius: 20px;
    background: var(--bbs-hero-green);
    color: #ffffff;
    font-size: 16px;
    line-height: 1.55;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.2s ease-in-out;
}

.bbs-hero__btn:visited {
    color: #ffffff;
}

.bbs-hero__btn:hover,
.bbs-hero__btn:focus-visible {
    background: var(--bbs-hero-green-hover);
    color: #ffffff;
    text-decoration: none;
}

.bbs-hero__btn:focus-visible {
    outline: 2px solid var(--bbs-hero-green);
    outline-offset: 3px;
}

.bbs-hero__slide--yellow .bbs-hero__btn {
    min-width: 273px;
    min-height: 55px;
    margin-top: 38px;
    background: var(--bbs-hero-gold);
    color: #000000;
}

.bbs-hero__slide--yellow .bbs-hero__btn:visited {
    color: #000000;
}

.bbs-hero__slide--yellow .bbs-hero__btn:hover,
.bbs-hero__slide--yellow .bbs-hero__btn:focus-visible {
    background: var(--bbs-hero-gold-hover);
    color: #000000;
}

/* ── Arrows and dots ── */
.bbs-hero__nav[hidden] {
    display: none;
}

.bbs-hero__arrow {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin: -15px 0 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--bbs-hero-yellow);
    color: #222222;
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
}

.bbs-hero__arrow--prev {
    left: 30px;
}

.bbs-hero__arrow--next {
    right: 30px;
}

.bbs-hero__arrow:hover {
    transform: scale(1.1);
}

.bbs-hero__arrow:focus-visible {
    outline: 2px solid var(--bbs-hero-green);
    outline-offset: 2px;
}

.bbs-hero__arrow svg {
    display: block;
    width: 7px;
    height: 13px;
}

.bbs-hero__dots {
    position: absolute;
    left: 50%;
    bottom: 25px;
    z-index: 2;
    display: flex;
    gap: 10px;
    transform: translateX(-50%);
}

.bbs-hero__dot {
    position: relative;
    display: block;
    width: 10px;
    height: 10px;
    padding: 0;
    border: 2px solid var(--bbs-hero-green);
    border-radius: 50%;
    background: var(--bbs-hero-yellow);
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

/* A larger hit area than the 10 px dot. */
.bbs-hero__dot::after {
    content: '';
    position: absolute;
    inset: -6px;
}

.bbs-hero__dot:hover,
.bbs-hero__dot.is-active {
    background: var(--bbs-hero-green);
}

.bbs-hero__dot:focus-visible {
    outline: 2px solid var(--bbs-hero-green);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .bbs-hero__slide,
    .bbs-hero__slide.is-active,
    .bbs-hero__btn,
    .bbs-hero__arrow,
    .bbs-hero__dot {
        transition: none;
    }

    .bbs-hero__arrow:hover {
        transform: none;
    }
}

/* The grid's own 20 px gutter is all the 1200 px layout needs; the doubled one
   above only keeps the text off the arrows on narrower screens. */
@media (min-width: 1200px) {
    .bbs-hero__inner {
        padding-left: var(--bbs-hero-gutter);
        padding-right: var(--bbs-hero-gutter);
    }
}

/* Arrows move in off the text when the page is barely wider than the grid. */
@media (max-width: 1319px) {
    .bbs-hero__arrow--prev {
        left: 10px;
    }

    .bbs-hero__arrow--next {
        right: 10px;
    }
}

/* ── 1199 and below: the 960 px grid ── */
@media (max-width: 1199px) {
    .bbs-hero {
        --bbs-hero-container: 960px;
        --bbs-hero-title-width: 693px;
        --bbs-hero-content: 486px;
        --bbs-hero-overlap: 20px;
        --bbs-hero-min-height: 560px;
    }

    .bbs-hero__title {
        font-size: 55px;
    }

    .bbs-hero__slide--yellow .bbs-hero__title {
        font-size: 48px;
    }

    .bbs-hero__text {
        max-width: 486px;
    }

    .bbs-hero__details {
        max-width: 486px;
        margin-top: 20px;
    }

    /* The picture's column is too narrow to move a picture about in. */
    .bbs-hero__slide .bbs-hero__media {
        justify-content: center;
    }
}

/* ── 959 and below: the 640 px grid ── */
@media (max-width: 959px) {
    .bbs-hero {
        --bbs-hero-min-height: 0px;
        --bbs-hero-pad: 50px;
        --bbs-hero-title-width: 100%;
    }

    .bbs-hero__inner {
        grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
        padding-bottom: var(--bbs-hero-pad);
    }

    .bbs-hero__slide--image-bottom .bbs-hero__inner {
        padding-bottom: 0;
    }

    .bbs-hero__content {
        padding-bottom: 24px;
    }

    .bbs-hero__slide--image-bottom .bbs-hero__content {
        padding-bottom: calc(var(--bbs-hero-pad) + 24px);
    }

    .bbs-hero__media {
        padding-bottom: 0;
    }

    /* The heading wraps by itself from here down. */
    .bbs-hero__title br {
        display: none;
    }

    .bbs-hero__title,
    .bbs-hero__slide--yellow .bbs-hero__title {
        font-size: 52px;
    }

    .bbs-hero__slide--yellow .bbs-hero__title {
        font-size: 48px;
        line-height: 1.3;
    }

    .bbs-hero__text {
        font-size: 21px;
    }

    .bbs-hero__details {
        font-size: 16px;
    }

    .bbs-hero__img {
        width: 100%;
    }
}

/* ── 639 and below: the picture drops below the text ── */
@media (max-width: 639px) {
    .bbs-hero {
        --bbs-hero-gutter: 16px;
    }

    .bbs-hero__inner,
    .bbs-hero__slide--no-image .bbs-hero__inner {
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
        align-content: start;
        row-gap: 32px;
        padding-left: var(--bbs-hero-gutter);
        padding-right: var(--bbs-hero-gutter);
        /* Room for the dots under the picture. */
        padding-bottom: 60px;
    }

    .bbs-hero__slide--image-bottom .bbs-hero__inner {
        align-content: space-between;
        padding-bottom: 0;
    }

    .bbs-hero__content,
    .bbs-hero__slide--image-bottom .bbs-hero__content {
        padding-bottom: 0;
    }

    .bbs-hero__media {
        margin-left: 0;
    }

    .bbs-hero__img {
        width: var(--bbs-hero-image-width, 80%);
        max-width: min(100%, 420px);
    }

    .bbs-hero__title {
        font-size: 48px;
    }

    .bbs-hero__slide--yellow .bbs-hero__title {
        font-size: 35px;
    }

    .bbs-hero__text {
        font-size: 20px;
    }

    .bbs-hero__details {
        font-size: 16px;
    }

    .bbs-hero__btn,
    .bbs-hero__slide--yellow .bbs-hero__btn {
        margin-top: 32px;
    }

    /* Swipe and the dots are enough on a phone; the arrows would sit on the text. */
    .bbs-hero__arrow {
        display: none;
    }

    .bbs-hero__dots {
        bottom: 22px;
    }
}

/* ── 479 and below: headings and lead centre, as the original's first slide ── */
@media (max-width: 479px) {
    .bbs-hero {
        --bbs-hero-pad: 44px;
    }

    .bbs-hero__content {
        align-items: center;
        text-align: center;
    }

    .bbs-hero__title {
        font-size: 36px;
    }

    .bbs-hero__slide--yellow .bbs-hero__title {
        font-size: 27px;
    }

    .bbs-hero__text {
        margin-top: 16px;
        font-size: 18px;
    }

    /* A list reads badly centred: the block centres, its lines stay left. */
    .bbs-hero__details {
        margin-top: 16px;
        font-size: 15px;
        text-align: left;
    }

    .bbs-hero__details > p {
        text-align: center;
    }

    .bbs-hero__btn,
    .bbs-hero__slide--yellow .bbs-hero__btn {
        width: 100%;
        max-width: 280px;
        min-width: 0;
        margin-top: 28px;
    }
}
