/**
 * Trial class block.
 *
 * Values mirror the Tilda original (bebestschool.es/en/english/a1, record
 * rec2036959003): a 720 px #ff5c00 band holding a 30 px bold white heading
 * 60 px from the top, a 20 px/1.2 line 15 px under it, two points with a
 * 30×33 yellow tick and 20 px/1.55 text, and a 360 px form.
 *
 * The form's controls follow the record's own form settings: 50 px tall,
 * white, 1 px black border, 16 px black text, 20 px apart; 14 px checkbox
 * labels; a 200×50 black button with a 15 px radius and 14 px/600 white text.
 * The form markup comes from Contact Form 7, so the rules below are written
 * against CF7's output.
 */

.bbs-trial-class {
    --bbs-trial-class-font: 'ApercuPro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    --bbs-trial-class-bg: #ff5c00;
    --bbs-trial-class-ink: #000000;
    --bbs-trial-class-gutter: 20px;
    --bbs-trial-class-form: 360px;

    padding: 60px 0 30px;
    background: var(--bbs-trial-class-bg);
    font-family: var(--bbs-trial-class-font);
}

.bbs-trial-class *,
.bbs-trial-class *::before,
.bbs-trial-class *::after {
    box-sizing: border-box;
}

.bbs-trial-class__inner {
    max-width: calc(1200px + var(--bbs-trial-class-gutter) * 2);
    margin: 0 auto;
    padding: 0 var(--bbs-trial-class-gutter);
    text-align: center;
}

.bbs-trial-class__title {
    margin: 0;
    color: #ffffff;
    font-size: 30px;
    line-height: 1.2;
    font-weight: 700;
}

.bbs-trial-class__subtitle {
    margin: 15px 0 0;
    color: #ffffff;
    font-size: 20px;
    line-height: 1.2;
    font-weight: 400;
}

/* ── Ticked points ──
 * 232 px between the two, which centred on the grid puts the first tick at
 * 289 px, where the original has it. */
.bbs-trial-class__points {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    column-gap: 232px;
    row-gap: 10px;
    margin: 24px 0 0;
    padding: 0;
    list-style: none;
}

.bbs-trial-class__point {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 0;
    color: #ffffff;
    font-size: 20px;
    line-height: 1.55;
    text-align: left;
}

.bbs-trial-class__tick {
    flex: none;
    width: 30px;
    height: 33px;
    object-fit: contain;
}

/* ── Form ── */
.bbs-trial-class__form {
    width: min(100%, var(--bbs-trial-class-form));
    margin: 13px auto 0;
    text-align: left;
}

.bbs-trial-class__form .wpcf7-form p {
    margin: 0;
}

.bbs-trial-class__form .wpcf7-form-control-wrap {
    display: block;
}

.bbs-trial-class__form input[type="text"],
.bbs-trial-class__form input[type="email"],
.bbs-trial-class__form input[type="tel"],
.bbs-trial-class__form input[type="url"],
.bbs-trial-class__form input[type="number"],
.bbs-trial-class__form input[type="date"],
.bbs-trial-class__form select,
.bbs-trial-class__form textarea {
    display: block;
    width: 100%;
    height: 50px;
    margin: 0 0 20px;
    padding: 0 20px;
    border: 1px solid var(--bbs-trial-class-ink);
    border-radius: 0;
    background: #ffffff;
    color: var(--bbs-trial-class-ink);
    font-family: inherit;
    font-size: 16px;
    line-height: 1.33;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}

.bbs-trial-class__form textarea {
    height: 120px;
    padding: 14px 20px;
    resize: vertical;
}

.bbs-trial-class__form input::placeholder,
.bbs-trial-class__form textarea::placeholder {
    color: #777777;
    opacity: 1;
}

.bbs-trial-class__form input:focus,
.bbs-trial-class__form select:focus,
.bbs-trial-class__form textarea:focus {
    outline: 2px solid var(--bbs-trial-class-ink);
    outline-offset: 0;
}

/* The "If you have a promotional code" line the form carries between fields.
   .wpcf7-form in the selector so it outranks the margin reset on every p above. */
.bbs-trial-class__form .wpcf7-form .bbs-form-note {
    margin: 0 0 14px;
    color: var(--bbs-trial-class-ink);
    font-size: 16px;
    line-height: 1.55;
}

/* ── Checkboxes ──
 * A plain square with a black border and a black tick when set, as the
 * original draws them; the browser's own control is replaced, not styled. */
.bbs-trial-class__form .wpcf7-acceptance .wpcf7-list-item,
.bbs-trial-class__form .wpcf7-checkbox .wpcf7-list-item {
    display: block;
    margin: 0 0 20px;
}

.bbs-trial-class__form .wpcf7-list-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--bbs-trial-class-ink);
    font-size: 14px;
    line-height: 1.4;
    cursor: pointer;
}

.bbs-trial-class__form input[type="checkbox"] {
    flex: none;
    width: 20px;
    height: 20px;
    margin: 0;
    border: 2px solid var(--bbs-trial-class-ink);
    border-radius: 2px;
    background: transparent center / 14px 14px no-repeat;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.bbs-trial-class__form input[type="checkbox"]:checked {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3 3 7-7' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.bbs-trial-class__form input[type="checkbox"]:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.bbs-trial-class__form .wpcf7-list-item-label a {
    color: var(--bbs-trial-class-ink);
    text-decoration: underline;
}

/* ── Submit ──
 * The spinner CF7 adds sits out of the flow, so the button stays centred. */
.bbs-trial-class__form .wpcf7-form p:has(.wpcf7-submit) {
    position: relative;
    display: flex;
    justify-content: center;
}

.bbs-trial-class__form .wpcf7-submit {
    display: block;
    width: 200px;
    max-width: 100%;
    height: 50px;
    margin: 0 auto;
    padding: 0 16px;
    border: 0;
    border-radius: 15px;
    background: var(--bbs-trial-class-ink);
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    line-height: 1;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

.bbs-trial-class__form .wpcf7-submit:hover,
.bbs-trial-class__form .wpcf7-submit:focus-visible {
    background: #333333;
}

.bbs-trial-class__form .wpcf7-submit:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 3px;
}

.bbs-trial-class__form .wpcf7-spinner {
    position: absolute;
    top: 50%;
    left: calc(50% + 110px);
    margin: 0;
    transform: translateY(-50%);
}

/* CF7's own red and green do not read on orange; black on white does. */
.bbs-trial-class__form .wpcf7-not-valid-tip {
    margin: -14px 0 14px;
    color: var(--bbs-trial-class-ink);
    font-size: 14px;
    font-weight: 600;
}

.bbs-trial-class__form .wpcf7 form .wpcf7-response-output {
    margin: 16px 0 0;
    padding: 10px 14px;
    border: 0;
    border-radius: 10px;
    background: #ffffff;
    color: var(--bbs-trial-class-ink);
    font-size: 14px;
    line-height: 1.4;
}

.bbs-trial-class__notice {
    width: min(100%, var(--bbs-trial-class-form));
    margin: 20px auto 0;
    padding: 20px;
    border: 2px dashed #ffffff;
    color: #ffffff;
    font-size: 16px;
}

/* ── 1199 and below ── */
@media (max-width: 1199px) {
    .bbs-trial-class {
        padding-top: 42px;
    }

    .bbs-trial-class__points {
        column-gap: 160px;
    }
}

/* ── 959 and below ── */
@media (max-width: 959px) {
    .bbs-trial-class {
        padding-top: 60px;
        padding-bottom: 40px;
    }

    .bbs-trial-class__title {
        font-size: 26px;
    }

    .bbs-trial-class__subtitle {
        font-size: 19px;
    }

    .bbs-trial-class__points {
        column-gap: 60px;
    }
}

/* ── 639 and below ── */
@media (max-width: 639px) {
    .bbs-trial-class {
        --bbs-trial-class-form: 440px;
    }

    .bbs-trial-class__subtitle {
        font-size: 17px;
    }

    .bbs-trial-class__points {
        column-gap: 30px;
    }

    .bbs-trial-class__point {
        font-size: 18px;
    }
}

/* ── 479 and below ── */
@media (max-width: 479px) {
    .bbs-trial-class {
        --bbs-trial-class-gutter: 16px;
    }

    .bbs-trial-class__points {
        flex-direction: column;
        align-items: flex-start;
        width: fit-content;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bbs-trial-class__form .wpcf7-submit {
        transition: none;
    }
}

/* ── In a popup (popups/popups.php) ──
 * The trial class popup on bebestschool.es/en/beginners (rec1951383713): the
 * same contents on an orange card instead of a full band — 813 px wide with a
 * 15 px radius, the heading 18 px from its top. The card narrows to 609 px
 * below 960, to 462 px below 640 (where the fields are 40 px tall and 10 px
 * apart) and runs the full width at 320.
 *
 * Two classes deep so these win over the band's own rules at every width,
 * and over the popup's "fill the width" rule for its contents. */
.bbs-trial-class.bbs-trial-class--popup {
    width: min(100% - 40px, 813px);
    margin: 0 auto;
    padding: 18px 0 30px;
    border-radius: 15px;
}

.bbs-trial-class.bbs-trial-class--popup .bbs-trial-class__points {
    column-gap: 232px;
}

@media (max-width: 959px) {
    .bbs-trial-class.bbs-trial-class--popup {
        --bbs-trial-class-form: 280px;

        width: min(100% - 30px, 609px);
        padding: 23px 0 30px;
    }

    .bbs-trial-class.bbs-trial-class--popup .bbs-trial-class__subtitle {
        max-width: 494px;
        margin-left: auto;
        margin-right: auto;
    }

    .bbs-trial-class.bbs-trial-class--popup .bbs-trial-class__points {
        column-gap: 60px;
    }
}

@media (max-width: 639px) {
    .bbs-trial-class.bbs-trial-class--popup {
        --bbs-trial-class-form: 440px;

        width: min(100% - 20px, 462px);
        padding: 21px 0 26px;
    }

    .bbs-trial-class.bbs-trial-class--popup .bbs-trial-class__subtitle {
        max-width: 323px;
    }

    .bbs-trial-class.bbs-trial-class--popup .bbs-trial-class__points {
        column-gap: 30px;
    }

    .bbs-trial-class.bbs-trial-class--popup .bbs-trial-class__form input[type="text"],
    .bbs-trial-class.bbs-trial-class--popup .bbs-trial-class__form input[type="email"],
    .bbs-trial-class.bbs-trial-class--popup .bbs-trial-class__form input[type="tel"],
    .bbs-trial-class.bbs-trial-class--popup .bbs-trial-class__form input[type="url"],
    .bbs-trial-class.bbs-trial-class--popup .bbs-trial-class__form input[type="number"],
    .bbs-trial-class.bbs-trial-class--popup .bbs-trial-class__form select {
        height: 40px;
        margin-bottom: 10px;
    }

    .bbs-trial-class.bbs-trial-class--popup .bbs-trial-class__form .wpcf7-acceptance .wpcf7-list-item,
    .bbs-trial-class.bbs-trial-class--popup .bbs-trial-class__form .wpcf7-checkbox .wpcf7-list-item {
        margin-bottom: 10px;
    }
}

@media (max-width: 479px) {
    .bbs-trial-class.bbs-trial-class--popup {
        width: 100%;
        padding: 24px 0 24px;
    }

    .bbs-trial-class.bbs-trial-class--popup .bbs-trial-class__subtitle {
        max-width: 262px;
        font-size: 20px;
    }
}

/* ── Card on a page ──
 * The same card as the popup's, set on the page the way the exercise pages
 * have it (rec2018290583 on /en/exercises/english-date-exercises-with-answers):
 * 42 px above and 10 px below it, 25/27 px from 1199 down, 67/28 px from 959,
 * 44/35 px from 639, and flush to the top with 26 px below from 479. */
.bbs-trial-class.bbs-trial-class--card {
    margin-top: 42px;
    margin-bottom: 10px;
}

@media (max-width: 1199px) {
    .bbs-trial-class.bbs-trial-class--card {
        margin-top: 25px;
        margin-bottom: 27px;
    }
}

@media (max-width: 959px) {
    .bbs-trial-class.bbs-trial-class--card {
        margin-top: 67px;
        margin-bottom: 28px;
    }
}

@media (max-width: 639px) {
    .bbs-trial-class.bbs-trial-class--card {
        margin-top: 44px;
        margin-bottom: 35px;
    }
}

@media (max-width: 479px) {
    .bbs-trial-class.bbs-trial-class--card {
        margin-top: 0;
        margin-bottom: 26px;
    }
}
