/**
 * Hero block.
 *
 * Values mirror the Tilda original (bebestschool.kz, record rec591697013 — a
 * CR30N slider with a Zero block in each slide): 1200 px grid, 680 px tall,
 * 62/55/52/48/34 px headings in ApercuPro, #f66746 headings, #1cb65a buttons,
 * yellow #ffd62c arrows and dots.
 *
 * 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.
 */

.bbs-hero {
    --bbs-hero-orange: #f66746;
    --bbs-hero-green: #1cb65a;
    --bbs-hero-green-hover: #169c4c;
    --bbs-hero-yellow: #ffd62c;
    --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: 640px;
    /* Headings may run on over the picture's column, as the original's do. */
    --bbs-hero-title-width: 780px;
    --bbs-hero-min-height: 680px;
    --bbs-hero-pad: 60px;

    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: a scroll-snapping row, so swiping works with or without the script ── */
.bbs-hero__track {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}

.bbs-hero__track::-webkit-scrollbar {
    display: none;
}

.bbs-hero__slide {
    display: flex;
    flex: 0 0 100%;
    min-width: 0;
    min-height: var(--bbs-hero-min-height);
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.bbs-hero__slide--gradient {
    background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.75), rgba(223, 223, 223, 0.25));
}

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

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

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

.bbs-hero__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-bottom: 24px;
}

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

/* The picture reaches a little under the text, as in the original, where it
   starts at 580 px on the 1200 px grid. */
.bbs-hero__media {
    display: flex;
    justify-content: center;
    align-items: center;
    align-self: stretch;
    margin-left: -40px;
}

.bbs-hero__slide--image-bottom .bbs-hero__media {
    align-items: flex-end;
}

.bbs-hero__img {
    display: block;
    width: var(--bbs-hero-image-width, 100%);
    max-width: 100%;
    height: auto;
}

/* ── 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-orange);
}

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

.bbs-hero__details {
    margin-top: 22px;
    max-width: 560px;
    font-size: 18px;
    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: 48px;
    padding: 6px 24px;
    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;
}

/* ── 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 {
    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 {
    position: relative;
}

.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;
}

/* In the editor the slides can't be scrolled by hand, and the script may not
   run inside the preview — show the first slide as it will load. */
.bbs-hero--preview .bbs-hero__track {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .bbs-hero__track {
        scroll-behavior: auto;
    }

    .bbs-hero__btn,
    .bbs-hero__arrow,
    .bbs-hero__dot {
        transition: none;
    }

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

/* 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: 530px;
        --bbs-hero-min-height: 560px;
        --bbs-hero-pad: 50px;
    }

    .bbs-hero__inner {
        padding-left: calc(var(--bbs-hero-gutter) + 20px);
        padding-right: calc(var(--bbs-hero-gutter) + 20px);
    }

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

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

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

    .bbs-hero__btn {
        margin-top: 40px;
    }
}

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

    .bbs-hero {
        --bbs-hero-title-width: 100%;
    }

    .bbs-hero__inner {
        grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    }

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

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

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

    .bbs-hero__media {
        margin-left: -20px;
    }
}

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

    .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 {
        max-width: 420px;
    }

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

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

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

    .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: 34px;
    }

    .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 {
        width: 100%;
        max-width: 280px;
        min-width: 0;
        margin-top: 28px;
    }
}
