/**
 * Popups.
 *
 * Each popup is a native <dialog>, so it sits above everything (the header
 * included), keeps keyboard focus inside and closes on Esc by itself. The
 * dialog covers the whole window and scrolls on its own when its content is
 * taller than the screen; the page underneath is dimmed and blurred.
 */

/*
 * The page stops scrolling while a popup is open. Hiding its scrollbar would
 * widen the page by the scrollbar's width and shift everything sideways, so
 * the space the scrollbar took is kept.
 */
html.bbs-popup-open {
    overflow: hidden;
    scrollbar-gutter: stable;
}

.bbs-popup {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 0;
    background: transparent;
    color: inherit;
}

.bbs-popup:not([open]) {
    display: none;
}

.bbs-popup::backdrop {
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.bbs-popup[open],
.bbs-popup[open]::backdrop {
    animation: bbs-popup-fade 0.3s ease-in-out;
}

@keyframes bbs-popup-fade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Centres the content when it is shorter than the window, and is what the
 * close button is placed against, so the button scrolls with the popup. */
.bbs-popup__body {
    position: relative;
    display: flex;
    box-sizing: border-box;
    align-items: center;
    min-height: 100%;
}

.bbs-popup__body > * {
    width: 100%;
}

/* On narrow screens the popup runs to the sides of the window, so the close
 * button goes above it: this keeps a strip free for it there. */
@media (max-width: 959px) {
    .bbs-popup__body {
        padding-top: 52px;
    }
}

/*
 * Close button: a white disc with a dark cross, so it reads on the white
 * card and on the page behind alike. popups/script.js moves
 * it to the popup's top right corner, outside the popup wherever there is
 * room, so it never covers a heading. top/right below only hold it somewhere
 * sensible until then.
 */
.bbs-popup__close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    color: #000000;
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
}

.bbs-popup__close svg {
    display: block;
    width: 14px;
    height: 14px;
}

.bbs-popup__close:hover {
    transform: scale(1.08);
}

/* The dialog focuses the close button as it opens; no ring, as on every
 * other button on the site. */
.bbs-popup__close:focus,
.bbs-popup__close:focus-visible {
    outline: none;
}

@media (prefers-reduced-motion: reduce) {
    .bbs-popup[open],
    .bbs-popup[open]::backdrop {
        animation: none;
    }

    .bbs-popup__close {
        transition: none;
    }
}

/* ─────────────────────────────────────────────────────────────────────────
 * A popup's card
 *
 * What every card popup starts from: an 845 px white card rounded 50 px, a
 * 30 px bold heading, a 20 px line under it, points with 33 px ticks, a
 * 492 px form whose fields are edged in #1cb65a, and a 14 px grey consent
 * line. Each popup then sets its own on top (the resume popup, below).
 * ───────────────────────────────────────────────────────────────────────── */

.bbs-popup-card {
    --bbs-popup-font: 'ApercuPro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;

    box-sizing: border-box;
    width: calc(100% - 20px);
    max-width: 845px;
    margin: 20px auto;
    padding: 45px 40px 37px;
    border-radius: 50px;
    background: #ffffff;
    color: #000000;
    font-family: var(--bbs-popup-font);
    text-align: center;
}

/*
 * The trial lesson popup, as the original's (bebestschool.com/ua/pricing,
 * #popup:webhelper, rec2124224903): a 729 px #f66746 card rounded 50 px with a
 * soft shadow, white type — the heading 30 px regular — yellow ticks, a 360 px
 * form of white 50 px fields edged in black, 20 px apart, and a yellow
 * 200 × 50 button rounded 15 px with black 14 px semibold type. On phones the
 * card is rounded 30 px, the fields 40 px high and 10 px apart.
 */
.bbs-popup-card--trial {
    max-width: 729px;
    background: #f66746;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    color: #ffffff;
}

.bbs-popup-card--trial .bbs-popup-card__title {
    font-weight: 400;
}

.bbs-popup-card--trial .bbs-popup-card__form {
    max-width: 360px;
}

/* Doubled class: over the card's own green edges further down. */
.bbs-popup-card.bbs-popup-card--trial .bbs-cf7 {
    --bbs-cf7-border: #000000;
    --bbs-cf7-button-bg: #ffd72e;
    --bbs-cf7-button-bg-hover: #f5cc1f;
    --bbs-cf7-button-ink: #000000;
}

.bbs-popup-card--trial .bbs-cf7 .wpcf7-submit {
    font-weight: 600;
    text-transform: none;
}

/* The line under the form: white on the coral. */
.bbs-popup-card--trial .bbs-popup-card__consent,
.bbs-popup-card--trial .bbs-popup-card__consent a {
    color: #ffffff;
}

/* Doubled class: over the card's own phone values further down. */
@media (max-width: 639px) {
    .bbs-popup-card.bbs-popup-card--trial {
        border-radius: 30px;
    }

    .bbs-popup-card.bbs-popup-card--trial .bbs-cf7 {
        --bbs-cf7-height: 40px;
        --bbs-cf7-gap: 10px;
    }
}

.bbs-popup-card :where(p) {
    margin: 0;
}

.bbs-popup-card__title {
    font-size: 30px;
    line-height: 1.2;
    font-weight: 700;
}

.bbs-popup-card__subtitle {
    max-width: 560px;
    margin: 15px auto 0;
    font-size: 20px;
    line-height: 1.55;
}

.bbs-popup-card__points {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 116px;
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
}

.bbs-popup-card__point {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    line-height: 1.55;
}

.bbs-popup-card__point img {
    flex: 0 0 33px;
    width: 33px;
    height: 33px;
}

.bbs-popup-card__form {
    max-width: 492px;
    margin: 30px auto 0;
}

/* The form's own look is inc/cf7.css; here only its green edges. */
.bbs-popup-card .bbs-cf7 {
    --bbs-cf7-border: #1cb65a;
}

.bbs-popup-card__consent {
    max-width: 360px;
    margin: 14px auto 0;
    color: #5c5c5c;
    font-size: 14px;
    line-height: 1.25;
}

.bbs-popup-card__consent a {
    color: #1cb65a;
}

@media (max-width: 959px) {
    .bbs-popup-card__form {
        max-width: 461px;
    }
}

@media (max-width: 639px) {
    .bbs-popup-card {
        margin: 0 auto 20px;
        padding: 30px 16px 28px;
        border-radius: 40px;
    }

    .bbs-popup-card__title {
        font-size: 26px;
    }

    .bbs-popup-card__subtitle {
        font-size: 18px;
    }

    .bbs-popup-card__points {
        gap: 6px 40px;
    }

    .bbs-popup-card__point {
        font-size: 18px;
    }

    .bbs-popup-card__point img {
        flex-basis: 29px;
        width: 29px;
        height: 29px;
    }

    .bbs-popup-card__form {
        margin-top: 22px;
    }

    .bbs-popup-card .bbs-cf7 {
        --bbs-cf7-height: 44px;
        --bbs-cf7-gap: 12px;
    }
}

/* Two points one under the other on the narrowest screens, as the original. */
@media (max-width: 479px) {
    .bbs-popup-card__points {
        flex-direction: column;
        align-items: center;
    }
}

/* ─────────────────────────────────────────────────────────────────────────
 * Resume popup
 *
 * Values mirror the Tilda original (bebestschool.com/offer): a plain white
 * 560 px card, 45 px inside it a 36 px heading and a 16 px light line, then
 * 60 px fields rounded 5 px with a #c9c9c9 edge, 25 px apart, a black file
 * button and a black full-width «Надіслати».
 * On phones the card runs to the edges, the heading 28 px, fields 50 px.
 * ───────────────────────────────────────────────────────────────────────── */

.bbs-popup-card--resume {
    max-width: 560px;
    padding: 40px 45px;
    border-radius: 0;
    background: #ffffff;
}

.bbs-popup-card--resume .bbs-popup-card__title {
    font-size: 36px;
    line-height: 1.23;
    font-weight: 600;
}

.bbs-popup-card--resume .bbs-popup-card__subtitle {
    margin-top: 10px;
    font-size: 16px;
    line-height: 1.55;
    font-weight: 300;
}

.bbs-popup-card--resume .bbs-popup-card__form {
    max-width: none;
    margin-top: 24px;
}

.bbs-popup-card--resume .bbs-cf7 {
    --bbs-cf7-border: #c9c9c9;
    --bbs-cf7-height: 60px;
    --bbs-cf7-gap: 25px;
    --bbs-cf7-button-bg: #000000;
    --bbs-cf7-button-bg-hover: #333333;
    --bbs-cf7-button-radius: 5px;
}

.bbs-popup-card--resume .bbs-cf7 :is(input[type="text"], input[type="email"], input[type="tel"]) {
    border-radius: 5px;
}

.bbs-popup-card--resume .bbs-cf7__submit {
    display: block;
}

.bbs-popup-card--resume .bbs-cf7 .wpcf7-submit {
    width: 100%;
    font-size: 16px;
    font-weight: 600;
    text-transform: none;
}

/* On phones the card is the whole screen, as the original's; the close
 * button (popups/script.js) then sits in its top right corner. */
@media (max-width: 639px) {
    .bbs-popup--resume .bbs-popup__body {
        align-items: stretch;
        padding-top: 0;
    }

    .bbs-popup-card--resume {
        width: 100%;
        margin: 0;
        padding: 64px 20px 30px;
    }

    .bbs-popup-card--resume .bbs-popup-card__title {
        font-size: 28px;
    }

    .bbs-popup-card--resume .bbs-popup-card__subtitle {
        margin-top: 6px;
        font-size: 12px;
    }

    .bbs-popup-card--resume .bbs-popup-card__form {
        margin-top: 15px;
    }

    .bbs-popup-card--resume .bbs-cf7 {
        --bbs-cf7-height: 50px;
    }
}

/* ─────────────────────────────────────────────────────────────────────────
 * Feedback popup
 *
 * The resume popup's card (bbs-popup-card--resume) with a comment box and a
 * consent line: as the original's (bebestschool.com/contact, #popup:myform).
 * ───────────────────────────────────────────────────────────────────────── */

.bbs-popup-card--feedback .bbs-cf7 textarea {
    min-height: 102px;
    border-radius: 5px;
}

.bbs-popup-card--feedback .bbs-popup-card__consent {
    max-width: none;
    margin-top: 20px;
}

.bbs-popup-card--feedback .bbs-popup-card__consent a {
    color: inherit;
}


/* ─────────────────────────────────────────────────────────────────────────
 * Summer groups popup
 *
 * As the original's (bebestschool.com/grupove-navchannya-dlya-ditej-vlitku,
 * rec2347750643), on a cream panel: the heading in Tilda Sans Bold 36 px and
 * a 20 px line, then a 672 px white card edged 8 px in #ffd62c and rounded
 * 50 px, its fields 50 px pills under 16 px labels, an orange pill button;
 * on the right the month strip over a photo rounded 40 px. On phones one
 * column and no photo.
 * ───────────────────────────────────────────────────────────────────────── */

.bbs-popup-summer {
    box-sizing: border-box;
    width: calc(100% - 20px);
    max-width: 1200px;
    margin: 20px auto;
    padding: 40px 30px 45px;
    border-radius: 40px;
    background: #fdf6ec;
    color: #000000;
    font-family: 'TildaSans', Arial, sans-serif;
}

.bbs-popup-summer p {
    margin: 0;
}

.bbs-popup-summer__title {
    font-size: 36px;
    line-height: 1.3;
    font-weight: 700;
    text-align: center;
}

.bbs-popup-summer__subtitle {
    margin-top: 8px !important;
    font-size: 20px;
    line-height: 1.55;
    text-align: center;
}

.bbs-popup-summer__columns {
    display: grid;
    grid-template-columns: minmax(0, 672px) minmax(0, 480px);
    justify-content: center;
    align-items: start;
    gap: 28px;
    margin-top: 30px;
}

.bbs-popup-summer__form {
    padding: 31px 52px 34px;
    border: 8px solid #ffd62c;
    border-radius: 50px;
    background: #ffffff;
}

.bbs-popup-summer .bbs-cf7 {
    --bbs-cf7-font: 'TildaSans', Arial, sans-serif;
    --bbs-cf7-border: #8c8c8c;
    --bbs-cf7-gap: 14px;
    --bbs-cf7-button-bg: #ff5f18;
    --bbs-cf7-button-bg-hover: #e94f0c;
    --bbs-cf7-button-radius: 30px;
}

.bbs-popup-summer .bbs-cf7 :is(input[type="text"], input[type="tel"], input[type="email"], select) {
    border-radius: 25px;
}

.bbs-popup-summer .bbs-cf7 .wpcf7-submit {
    padding: 0 30px;
    font-size: 15px;
    font-weight: 400;
    text-transform: none;
}

.bbs-popup-summer__aside {
    display: grid;
    gap: 24px;
    padding-top: 10px;
}

.bbs-popup-summer__aside img {
    display: block;
    width: 100%;
    height: auto;
}

.bbs-popup-summer__photo {
    border-radius: 40px;
}

@media (max-width: 959px) {
    .bbs-popup-summer__columns {
        grid-template-columns: minmax(0, 672px);
    }

    .bbs-popup-summer__photo {
        display: none !important;
    }
}

@media (max-width: 639px) {
    .bbs-popup-summer {
        padding: 30px 12px 25px;
        border-radius: 30px;
    }

    .bbs-popup-summer__title {
        font-size: 26px;
    }

    .bbs-popup-summer__subtitle {
        font-size: 16px;
    }

    .bbs-popup-summer__form {
        padding: 22px 18px 24px;
        border-width: 5px;
        border-radius: 30px;
    }
}
