/**
 * Courses block — language tabs with a horizontal card slider.
 *
 * Values mirror the Tilda original (bebestschool.es/en, records rec601161391 and
 * rec601161393): 1200 px grid, 380x380 cards with a 25 px gap and a 50 px radius,
 * 36 px titles in ApercuPro Bold, three accents cycling down the row.
 */

.bbs-courses {
    --bbs-courses-font: 'ApercuPro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    --bbs-courses-container: 1200px;
    --bbs-courses-gutter: 20px;

    --bbs-courses-card-bg: #f1f1f1;
    --bbs-courses-card-w: 380px;
    --bbs-courses-card-h: 380px;
    --bbs-courses-card-gap: 25px;
    --bbs-courses-card-radius: 50px;

    /* Distance from the viewport edge to the 1200 px grid. */
    --bbs-courses-edge: max(var(--bbs-courses-gutter), calc(50% - var(--bbs-courses-container) / 2));

    --bbs-courses-tab: #777777;
    --bbs-courses-tab-active: #222222;
    --bbs-courses-tab-line: #eeeeee;

    padding: 60px 0 20px;
    font-family: var(--bbs-courses-font);
}

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

/* ── Tabs ── */
.bbs-courses__bar {
    max-width: calc(var(--bbs-courses-container) + var(--bbs-courses-gutter) * 2);
    margin: 0 auto;
    padding: 0 var(--bbs-courses-gutter);
}

.bbs-courses__tabs {
    display: flex;
}

.bbs-courses__tab {
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
    padding: 0 10px 18px;
    border: 0;
    border-bottom: 1px solid var(--bbs-courses-tab-line);
    border-radius: 0;
    background: none;
    color: var(--bbs-courses-tab);
    font-family: inherit;
    font-size: 16px;
    line-height: 1.35;
    font-weight: 400;
    text-align: center;
    cursor: pointer;
    transition: color 0.3s ease;
}

.bbs-courses__tab:hover {
    color: var(--bbs-courses-tab-active);
}

.bbs-courses__tab.is-active {
    border-bottom-color: var(--bbs-courses-tab-active);
    color: var(--bbs-courses-tab-active);
    font-weight: 600;
    cursor: default;
}

.bbs-courses__tab:focus-visible {
    outline: 2px solid var(--bbs-courses-tab-active);
    outline-offset: -2px;
}

.bbs-courses__panel {
    padding-top: 60px;
}

.bbs-courses--single .bbs-courses__panel {
    padding-top: 0;
}

.bbs-courses__track {
    display: flex;
    gap: var(--bbs-courses-card-gap);
    overflow-x: auto;
    /* Line the first card up with the grid, keep the row full-bleed to the right. */
    padding: 0 var(--bbs-courses-edge);
    /* Without this the snap points ignore the padding and the row starts flush
       against the viewport edge on load. */
    scroll-padding: 0 var(--bbs-courses-edge);
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

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

.bbs-courses__track:focus-visible {
    outline: 2px solid var(--bbs-courses-tab-active);
    outline-offset: 4px;
}

/* Pointer drag, driven by script.js. */
.bbs-courses__track.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
    scroll-behavior: auto;
    user-select: none;
}

.bbs-courses__track.is-dragging a {
    pointer-events: none;
}

/* ── Card ── */
.bbs-courses__card {
    position: relative;
    display: flex;
    flex: 0 0 var(--bbs-courses-card-w);
    flex-direction: column;
    width: var(--bbs-courses-card-w);
    min-height: var(--bbs-courses-card-h);
    padding: 30px 15px 27px;
    overflow: hidden;
    border-radius: var(--bbs-courses-card-radius);
    background: var(--bbs-courses-card-bg);
    scroll-snap-align: start;
}

.bbs-courses__card--orange { --bbs-courses-accent: #ff5c00; }
.bbs-courses__card--purple { --bbs-courses-accent: #a40acf; }
.bbs-courses__card--red    { --bbs-courses-accent: #ff4e60; }

/* One tintable mask instead of a coloured image per accent. */
.bbs-courses__globe {
    position: absolute;
    inset: 0;
    background-color: var(--bbs-courses-accent);
    -webkit-mask: url('images/globe.png') no-repeat center / cover;
    mask: url('images/globe.png') no-repeat center / cover;
    pointer-events: none;
}

.bbs-courses__kicker {
    position: relative;
    /* Holds the rest of the card against the bottom edge, as the original does. */
    margin: 0 0 auto;
    color: #2e2e2e;
    font-size: 20px;
    line-height: 1.25;
    font-weight: 400;
}

/* A paragraph since it stopped being an H3; clear carries over what the theme
   gives every heading, so the card lays out exactly as before. */
.bbs-courses__title {
    clear: both;
    margin: 0 0 5px;
    color: var(--bbs-courses-accent);
    font-size: 28px;
    line-height: 1.1;
    font-weight: 600;
}

.bbs-courses__desc {
    margin: 0 0 5px;
    max-width: 250px;
    color: #000000;
    font-size: 20px;
    line-height: 1.25;
    font-weight: 500;
    opacity: 0.4;
}

.bbs-courses__note {
    margin: 0 0 14px;
    color: #000000;
    font-size: 18px;
    line-height: 1.25;
    font-weight: 400;
}

.bbs-courses__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    width: 280px;
    max-width: 100%;
    min-height: 50px;
    padding: 6px 16px;
    border-radius: 20px;
    background: #ffffff;
    color: #000000;
    font-size: 21px;
    line-height: 1.55;
    font-weight: 400;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.2s ease-in-out;
}

.bbs-courses__btn:hover,
.bbs-courses__btn:focus-visible {
    background: var(--bbs-courses-accent);
    color: #ffffff;
    text-decoration: none;
}

.bbs-courses__btn:focus-visible {
    outline: 2px solid var(--bbs-courses-accent);
    outline-offset: 2px;
}

/* ── Swipe hint ── */
.bbs-courses__hint {
    margin: 20px 0 0;
    text-align: center;
}

.bbs-courses__hint img {
    display: block;
    width: 80px;
    height: auto;
    margin: 0 auto;
}

/* Hidden by script.js when the whole row already fits and there is no scrolling to hint at. */
.bbs-courses__panel.is-static .bbs-courses__hint {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .bbs-courses__tab,
    .bbs-courses__btn {
        transition: none;
    }
}

/* ── 959 and below ── */
@media (max-width: 959px) {
    .bbs-courses {
        --bbs-courses-card-w: 360px;
        --bbs-courses-card-h: 360px;
    }

    .bbs-courses__tab {
        font-size: 14px;
    }

    .bbs-courses__title {
        font-size: 32px;
    }
}

/* ── 639 and below ── */
@media (max-width: 639px) {
    .bbs-courses__tab {
        font-size: 12px;
        padding: 0 6px 14px;
    }

    .bbs-courses__title {
        font-size: 30px;
    }
}

/* ── 479 and below ── */
@media (max-width: 479px) {
    .bbs-courses {
        --bbs-courses-card-w: 320px;
        --bbs-courses-card-h: 330px;
        --bbs-courses-gutter: 16px;

        padding-top: 40px;
    }

    .bbs-courses__panel {
        padding-top: 40px;
    }

    /* Five languages stop fitting — let the row scroll rather than shrink further. */
    .bbs-courses__tabs {
        overflow-x: auto;
        scrollbar-width: none;
    }

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

    .bbs-courses__tab {
        flex: 0 0 auto;
        min-width: 20%;
    }

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

    .bbs-courses__hint img {
        width: 60px;
    }
}
