/**
 * Site header.
 *
 * Values mirror the Tilda original (bebestschool.es/en, record rec614636023):
 * a 100 px #a40acf bar, a 160x36 logo hugging the left edge, 18 px white menu
 * items, and a white 189x35 call to action with the email under it.
 *
 * The phone is our addition: the right-hand column already fills the bar with
 * three lines, so rather than a fourth it takes the free space on the top one,
 * left of the language links.
 */

.bbs-header {
    --bbs-header-font: 'ApercuPro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    --bbs-header-bg: #a40acf;
    --bbs-header-ink: #ffffff;
    --bbs-header-height: 100px;
    --bbs-header-gutter: 20px;
    --bbs-header-drawer-bg: #ff6000;

    position: relative;
    z-index: 100;
    background: var(--bbs-header-bg);
    font-family: var(--bbs-header-font);
}

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

.bbs-header__inner {
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: var(--bbs-header-height);
    padding: 0 var(--bbs-header-gutter);
}

/* ── Logo ── */
.bbs-header__logo {
    flex: 0 0 auto;
    display: block;
    line-height: 0;
}

.bbs-header__logo-img {
    display: block;
    width: 160px;
    height: auto;
}

/* ── Panel: the menu and the right-hand column ── */
.bbs-header__panel {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-width: 0;
}

.bbs-header__nav {
    flex: 1 1 auto;
    min-width: 0;
}

.bbs-header__menu {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.bbs-header__menu li {
    position: relative;
    margin: 0;
}

.bbs-header__menu > li > a {
    display: flex;
    align-items: center;
    gap: 8px;
    height: var(--bbs-header-height);
    padding: 0 15px;
    border-radius: 3px;
    color: var(--bbs-header-ink);
    font-size: 18px;
    line-height: 1.55;
    font-weight: 400;
    text-decoration: none;
    transition: background-color 0.2s ease-in-out;
}

.bbs-header__menu > li > a:hover,
.bbs-header__menu > li > a:focus-visible {
    background: rgba(255, 255, 255, 0.15);
    color: var(--bbs-header-ink);
    text-decoration: none;
}

/* Caret on the items that have a dropdown. */
.bbs-header__menu > li.menu-item-has-children > a::after {
    content: '';
    width: 11px;
    height: 7px;
    background: currentColor;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transition: transform 0.2s ease-in-out;
}

.bbs-header__menu > li.menu-item-has-children:hover > a::after,
.bbs-header__menu > li.menu-item-has-children:focus-within > a::after {
    transform: rotate(180deg);
}

/* ── Dropdown panel ──
 * Values mirror the old site's dropdown records (rec614636024 and its five
 * siblings): a white panel 90% of the window wide with a 24 px radius under
 * a #c4c4c4 shadow, a 32 px/700 heading, links as 28 px #a40acf bullets with
 * a 20 px/500 label and a 14 px #808080 line, and a closing row at 16 px/500.
 *
 * The panel is measured from the header, not from its menu item, so it spans
 * the window rather than hanging off one word. */
.bbs-header__menu > li.menu-item-has-children {
    position: static;
}

.bbs-header__mega {
    position: absolute;
    top: 100%;
    left: 5%;
    z-index: 10;
    width: 90%;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 1px 10px 2px #c4c4c4;
    /* Plain display toggling: a dropdown has nothing to gain from a fade, and
       this keeps it out of the accessibility tree while closed. */
    display: none;
}

.bbs-header__menu > li:hover > .bbs-header__mega,
.bbs-header__menu > li:focus-within > .bbs-header__mega,
.bbs-header__menu > li.is-open > .bbs-header__mega {
    display: block;
}

/*
 * 1300, not 1200: the padding is part of the box, so the text inside lands on
 * the site's own 1200 px grid instead of 50 px inside it.
 */
.bbs-header__mega-inner {
    max-width: 1300px;
    margin: 0 auto;
    padding: 20px 50px 40px;
}

.bbs-header__mega-title {
    margin: 0 0 34px;
    color: #000000;
    font-size: 32px;
    line-height: 1.25;
    font-weight: 700;
}

/*
 * auto-fill rather than a fixed six columns: the dropdowns on this site carry
 * anywhere from three links to eight, and the row should reflow rather than
 * leave gaps or squeeze.
 */
.bbs-header__mega-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    column-gap: 24px;
    row-gap: 28px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.bbs-header__mega-list li {
    position: static;
    margin: 0;
}

.bbs-header__mega-link {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 0;
    color: #000000;
    text-decoration: none;
}

/*
 * --bbs-header-mega-accent is set inline on the panel from the "Accent colour"
 * field of its menu item; with nothing chosen it falls back to the bar's own
 * purple, so a menu built before the field existed looks unchanged.
 */
.bbs-header__mega-dot {
    flex: none;
    /* Sits on the label's first line rather than at the very top of the box. */
    margin-top: 1px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bbs-header-mega-accent, var(--bbs-header-bg));
}

.bbs-header__mega-body {
    display: block;
    min-width: 0;
}

.bbs-header__mega-label {
    display: block;
    color: #000000;
    font-size: 20px;
    line-height: 1.25;
    font-weight: 500;
    transition: color 0.15s ease-in-out;
}

.bbs-header__mega-link:hover .bbs-header__mega-label,
.bbs-header__mega-link:focus-visible .bbs-header__mega-label {
    color: var(--bbs-header-mega-accent, var(--bbs-header-bg));
}

.bbs-header__mega-desc {
    display: block;
    margin-top: 9px;
    color: #808080;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 400;
}

.bbs-header__mega-link:focus-visible {
    outline: 2px solid var(--bbs-header-mega-accent, var(--bbs-header-bg));
    outline-offset: 4px;
}

/* ── The row that closes the panel ── */
.bbs-header__mega-foot {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 40px;
    margin-top: 46px;
}

.bbs-header__mega-text {
    max-width: 740px;
    margin: 0;
    color: #000000;
    font-size: 16px;
    line-height: 1.5;
    font-weight: 500;
}

.bbs-header__mega-contacts {
    flex: none;
    text-align: left;
}

.bbs-header__mega-contact {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 0 0 8px;
    color: #000000;
    font-size: 16px;
    line-height: 1.5;
    font-weight: 500;
}

.bbs-header__mega-chat {
    display: block;
    line-height: 0;
    transition: transform 0.2s ease-in-out;
}

.bbs-header__mega-chat:hover,
.bbs-header__mega-chat:focus-visible {
    transform: scale(1.08);
}

.bbs-header__mega-chat-icon {
    display: block;
    width: 45px;
    height: 45px;
}

.bbs-header__mega-email {
    display: inline-block;
    color: #000000;
    font-size: 16px;
    line-height: 1.5;
    font-weight: 500;
    text-decoration: none;
}

.bbs-header__mega-email:hover,
.bbs-header__mega-email:focus-visible {
    color: var(--bbs-header-mega-accent, var(--bbs-header-bg));
    text-decoration: underline;
}

/* ── Right-hand column ── */
.bbs-header__aside {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: auto;
    justify-items: end;
    gap: 4px;
}

.bbs-header__langs {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--bbs-header-ink);
    font-size: 20px;
    line-height: 1.3;
}

.bbs-header__lang + .bbs-header__lang::before {
    content: 'l';
    margin-right: 6px;
}

.bbs-header__lang a {
    color: var(--bbs-header-ink);
    text-decoration: none;
}

.bbs-header__lang a:hover,
.bbs-header__lang a:focus-visible {
    text-decoration: underline;
}

.bbs-header__lang.is-current a {
    font-weight: 600;
    text-decoration: underline;
}

.bbs-header__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 189px;
    min-height: 35px;
    padding: 3px 12px;
    border-radius: 5px;
    background: #ffffff;
    box-shadow: 2px 2px 5px 0 rgba(0, 0, 0, 0.3);
    color: #000000;
    font-size: 18px;
    line-height: 1.55;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s ease-in-out;
}

.bbs-header__cta:hover,
.bbs-header__cta:focus-visible {
    background: #f1f1f1;
    color: #000000;
    text-decoration: none;
}

.bbs-header__cta-icon {
    display: block;
    width: 25px;
    height: 25px;
    flex: 0 0 auto;
}

/* ── Phone ──
 * On the top line of the right-hand column, before the language links, with
 * a handset icon; a thin rule sets it apart from EN | ES. */
.bbs-header__phone {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--bbs-header-ink);
    font-size: 18px;
    line-height: 1.3;
    white-space: nowrap;
    text-decoration: none;
}

.bbs-header__phone:hover,
.bbs-header__phone:focus-visible {
    color: var(--bbs-header-ink);
    text-decoration: none;
}

.bbs-header__phone:hover .bbs-header__phone-number,
.bbs-header__phone:focus-visible .bbs-header__phone-number {
    text-decoration: underline;
}

.bbs-header__phone-icon {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
}

@media (min-width: 980px) {
    /* Two columns for the top line only: phone, then languages. The button
     * and the email below still span the column and hug its right edge. */
    .bbs-header__aside {
        grid-template-columns: auto auto;
        column-gap: 14px;
    }

    .bbs-header__phone {
        grid-row: 1;
        grid-column: 1;
        padding-right: 14px;
        border-right: 1px solid rgba(255, 255, 255, 0.4);
    }

    .bbs-header__langs {
        grid-row: 1;
        grid-column: 2;
    }

    .bbs-header__cta,
    .bbs-header__email {
        grid-column: 1 / -1;
    }
}

.bbs-header__scrim {
    display: none;
}

.bbs-header__email {
    color: var(--bbs-header-ink);
    font-size: 20px;
    line-height: 1.3;
    text-decoration: none;
}

.bbs-header__email:hover,
.bbs-header__email:focus-visible {
    color: var(--bbs-header-ink);
    text-decoration: underline;
}

/* ── Burger, desktop keeps it out of the way ── */
/* Only shown once the script has claimed the header — without it the menu
   stays in the flow instead of hiding behind a button that does nothing. */
.bbs-header__burger {
    display: none;
    position: relative;
    /* Above the drawer, so the same button closes it. */
    z-index: 102;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    margin-left: auto;
    padding: 0;
    border: 0;
    background: none;
    color: var(--bbs-header-ink);
    cursor: pointer;
}

.bbs-header__burger-bars,
.bbs-header__burger-bars::before,
.bbs-header__burger-bars::after {
    display: block;
    width: 26px;
    height: 3px;
    border-radius: 2px;
    background: currentColor;
    transition: transform 0.2s ease-in-out, opacity 0.2s ease-in-out;
}

.bbs-header__burger-bars {
    position: relative;
    margin: 0 auto;
}

.bbs-header__burger-bars::before,
.bbs-header__burger-bars::after {
    content: '';
    position: absolute;
    left: 0;
}

.bbs-header__burger-bars::before {
    top: -8px;
}

.bbs-header__burger-bars::after {
    top: 8px;
}

.bbs-header__burger[aria-expanded="true"] .bbs-header__burger-bars {
    background: transparent;
}

.bbs-header__burger[aria-expanded="true"] .bbs-header__burger-bars::before {
    transform: translateY(8px) rotate(45deg);
}

.bbs-header__burger[aria-expanded="true"] .bbs-header__burger-bars::after {
    transform: translateY(-8px) rotate(-45deg);
}

.bbs-header__burger:focus-visible {
    outline: 2px solid var(--bbs-header-ink);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .bbs-header__menu > li > a,
    .bbs-header__mega-label,
    .bbs-header__mega-chat,
    .bbs-header__cta,
    .bbs-header__burger-bars,
    .bbs-header__burger-bars::before,
    .bbs-header__burger-bars::after {
        transition: none;
    }
}

/* ── Tighter above the drawer breakpoint ── */
@media (max-width: 1279px) {
    .bbs-header__menu > li > a {
        padding: 0 10px;
        font-size: 16px;
    }

    .bbs-header__email,
    .bbs-header__langs {
        font-size: 17px;
    }
}

/* Between the drawer and full width the menu needs every pixel: the phone
 * row is drawn tighter, so the column stays about as wide as the email under
 * it and "Sobre nosotros" keeps to one line. */
@media (min-width: 980px) and (max-width: 1279px) {
    .bbs-header__aside {
        column-gap: 8px;
    }

    .bbs-header__phone {
        gap: 5px;
        padding-right: 8px;
        font-size: 15px;
    }

    .bbs-header__phone-icon {
        width: 13px;
        height: 13px;
    }
}

/* ── 979 and below: burger and a drawer that comes in from the right ── */
@media (max-width: 979px) {
    .bbs-header {
        --bbs-header-height: 70px;
        --bbs-header-drawer-width: 84%;
    }

    .bbs-header[data-bbs-header-ready="1"] .bbs-header__burger {
        display: block;
    }

    /* No script: the panel drops onto its own row under the bar. */
    .bbs-header__inner {
        flex-wrap: wrap;
    }

    .bbs-header__panel {
        flex: 1 0 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
        padding-bottom: 20px;
    }

    .bbs-header[data-bbs-header-ready="1"] .bbs-header__panel {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: auto;
        z-index: 101;
        flex: 0 0 auto;
        width: var(--bbs-header-drawer-width);
        max-width: 420px;
        justify-content: space-between;
        gap: 40px;
        padding: 84px 26px 40px;
        overflow-y: auto;
        background: var(--bbs-header-drawer-bg);
        /* Parked off-screen rather than removed, so it can slide. */
        visibility: hidden;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out, visibility 0.3s;
    }

    .bbs-header[data-bbs-header-ready="1"] .bbs-header__burger[aria-expanded="true"] ~ .bbs-header__panel {
        visibility: visible;
        transform: translateX(0);
    }

    /* Dims whatever the drawer does not cover. */
    .bbs-header[data-bbs-header-ready="1"] .bbs-header__scrim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 100;
        background: rgba(0, 0, 0, 0.45);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease-in-out, visibility 0.3s;
    }

    .bbs-header[data-bbs-header-ready="1"] .bbs-header__burger[aria-expanded="true"] ~ .bbs-header__scrim {
        opacity: 1;
        visibility: visible;
    }

    .bbs-header__nav {
        flex: 0 0 auto;
    }

    .bbs-header__menu {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .bbs-header__menu > li > a {
        justify-content: space-between;
        height: auto;
        padding: 12px 0;
        border-radius: 0;
        font-size: 26px;
        line-height: 1.3;
    }

    .bbs-header__menu > li > a:hover,
    .bbs-header__menu > li > a:focus-visible {
        background: none;
        text-decoration: underline;
    }

    /* On a touch screen a dropdown opens on tap, not on hover, and the panel
       flattens into a plain list inside the drawer. */
    .bbs-header__mega {
        position: static;
        width: auto;
        border-radius: 0;
        background: none;
        box-shadow: none;
    }

    .bbs-header__menu > li:hover > .bbs-header__mega,
    .bbs-header__menu > li:focus-within > .bbs-header__mega {
        display: none;
    }

    .bbs-header__menu > li.is-open > .bbs-header__mega {
        display: block;
    }

    .bbs-header__mega-inner {
        max-width: none;
        padding: 0 0 10px 16px;
    }

    /* The heading would only repeat the item that was just tapped. */
    .bbs-header__mega-title,
    .bbs-header__mega-foot {
        display: none;
    }

    .bbs-header__mega-list {
        display: block;
    }

    .bbs-header__mega-link {
        gap: 10px;
        padding: 8px 0;
        color: var(--bbs-header-ink);
    }

    .bbs-header__mega-dot {
        margin-top: 6px;
        width: 12px;
        height: 12px;
        background: var(--bbs-header-ink);
    }

    .bbs-header__mega-label {
        color: var(--bbs-header-ink);
        font-size: 19px;
    }

    .bbs-header__mega-link:hover .bbs-header__mega-label,
    .bbs-header__mega-link:focus-visible .bbs-header__mega-label {
        color: var(--bbs-header-ink);
        text-decoration: underline;
    }

    .bbs-header__mega-desc {
        margin-top: 2px;
        color: rgba(255, 255, 255, 0.7);
    }

    /* Phone, email and languages sit together at the foot of the drawer. */
    .bbs-header__aside {
        flex: 0 0 auto;
        justify-items: start;
        gap: 6px;
    }

    .bbs-header__phone {
        order: 1;
        gap: 9px;
        font-size: 21px;
        line-height: 1.4;
    }

    .bbs-header__phone-icon {
        width: 18px;
        height: 18px;
    }

    .bbs-header__email {
        order: 2;
        font-size: 21px;
        line-height: 1.4;
    }

    .bbs-header__langs {
        order: 3;
        font-size: 19px;
    }

    /* The bar already carries the button; the drawer lists the contacts. */
    .bbs-header__cta {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bbs-header[data-bbs-header-ready="1"] .bbs-header__panel,
    .bbs-header[data-bbs-header-ready="1"] .bbs-header__scrim {
        transition: none;
    }
}

/* Locks the page behind an open drawer. */
.bbs-header-open,
.bbs-header-open body {
    overflow: hidden;
}
