/**
 * Site header.
 *
 * Values mirror the Tilda original (bebestschool.kz, rec830950729 to
 * rec830950733): a 90 px white bar on the 1200 px grid — a 104 px logo, 18 px
 * menu items that turn #1cb65a on hover with a small black caret, and the
 * contacts on the right (19 px phone, 13 px note, 16 px email).
 *
 * "Про школу" opens a white panel 90 % of the window wide, rounded 24 px: a
 * 32 px heading, six links to a row each with a 28 px green dot, a 20 px name
 * and a 14 px grey line, and along its foot a paragraph, the contacts and the
 * social links. The languages open a 250 px #099e45 list whose items open a
 * 450 px #1cb65a list to the side, 20 px white type.
 *
 * Up to 980 px — the original's switch — the bar keeps only the logo and a
 * burger of three green lines, which opens a #1cb65a drawer from the left.
 */

.bbs-header {
    --bbs-header-font: 'ApercuPro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    --bbs-header-green: #1cb65a;
    --bbs-header-green-dark: #099e45;
    --bbs-header-yellow: #ffd72e;
    --bbs-header-grey: #808080;
    --bbs-header-height: 90px;

    position: relative;
    z-index: 100;
    background: #ffffff;
    color: #000000;
    font-family: var(--bbs-header-font);
}

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

.bbs-header :where(a) {
    color: inherit;
    text-decoration: none;
}

.bbs-header :where(ul) {
    margin: 0;
    padding: 0;
    list-style: none;
}

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

.bbs-header :where(button) {
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.bbs-header a:focus-visible,
.bbs-header button:focus-visible {
    outline: 2px solid var(--bbs-header-green);
    outline-offset: 3px;
}

/* The resets above sit at zero specificity (:where), so every class below
   wins over them whatever its order. */

/* ── Bar ── */
.bbs-header__bar {
    display: flex;
    align-items: center;
    max-width: 1240px;
    height: var(--bbs-header-height);
    margin: 0 auto;
    padding: 0 20px;
}

.bbs-header__logo {
    flex: 0 0 auto;
    display: block;
    width: 104px;
    line-height: 0;
}

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

/* ── Menu ── */
.bbs-header__nav {
    align-self: stretch;
    margin-left: 63px;
}

.bbs-header__menu {
    display: flex;
    height: 100%;
    gap: 60px;
}

.bbs-header__item {
    display: flex;
    align-items: center;
}

.bbs-header__link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 100%;
    font-size: 18px;
    line-height: 1.55;
    font-weight: 400;
    white-space: nowrap;
    transition: color 0.2s ease-in-out;
}

.bbs-header__link:hover,
.bbs-header__item.is-open > .bbs-header__link,
.bbs-header__item.is-current > .bbs-header__link {
    color: var(--bbs-header-green);
}

/* The small black triangle after an item that opens something. */
.bbs-header__caret {
    width: 0;
    height: 0;
    border-top: 9px solid #000000;
    border-right: 5.5px solid transparent;
    border-left: 5.5px solid transparent;
    transition: transform 0.2s ease-in-out;
}

.bbs-header__item.is-open .bbs-header__caret {
    transform: rotate(180deg);
}

/* ── Contacts ── */
.bbs-header__contacts {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: auto;
    text-align: right;
}

.bbs-header__phone {
    font-size: 19px;
    line-height: 1.4;
}

.bbs-header__note {
    font-size: 13px;
    line-height: 1.3;
}

.bbs-header__email {
    margin-top: 2px;
    font-size: 16px;
    line-height: 1.25;
}

.bbs-header__phone:hover,
.bbs-header__email:hover {
    color: var(--bbs-header-green);
}

/* ── Open states ──
 * An item opens on hover where there is a mouse, and on a click or Enter
 * anywhere (script.js sets .is-open). */
.bbs-header__panel,
.bbs-header__dropdown {
    display: none;
}

.bbs-header__item.is-open > .bbs-header__panel,
.bbs-header__item.is-open > .bbs-header__dropdown {
    display: block;
}

@media (hover: hover) and (min-width: 981px) {
    .bbs-header__item:hover > .bbs-header__panel,
    .bbs-header__item:hover > .bbs-header__dropdown {
        display: block;
    }

    .bbs-header__item:hover > .bbs-header__link {
        color: var(--bbs-header-green);
    }
}

/* ── White panel ("Про школу") ── */
.bbs-panel {
    position: absolute;
    top: 100%;
    left: 50%;
    width: 90vw;
    max-width: 1440px;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.14);
    transform: translateX(-50%);
}

.bbs-panel__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 20px 44px;
}

.bbs-panel__title {
    font-size: 32px;
    line-height: 1.55;
    font-weight: 700;
}

.bbs-panel__links {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 30px 20px;
    margin-top: 24px;
}

.bbs-panel__link {
    position: relative;
    display: flex;
    flex-direction: column;
    padding-left: 43px;
}

/* The dot before each link; yellow for the page you are on and under the pointer. */
.bbs-panel__link::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bbs-header-green);
    transition: background-color 0.2s ease-in-out;
}

.bbs-panel__link:hover::before,
.bbs-panel__item.is-current .bbs-panel__link::before {
    background: var(--bbs-header-yellow);
}

.bbs-panel__name {
    font-size: 20px;
    line-height: 1.55;
    font-weight: 500;
}

.bbs-panel__desc {
    margin-top: 8px;
    max-width: 150px;
    color: var(--bbs-header-grey);
    font-size: 14px;
    line-height: 1.25;
}

.bbs-panel__foot {
    display: grid;
    grid-template-columns: 343px minmax(0, 1fr) auto;
    column-gap: 92px;
    align-items: start;
    margin-top: 40px;
}

.bbs-panel__text {
    font-size: 16px;
    line-height: 1.55;
    font-weight: 500;
}

.bbs-panel-contacts {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    font-weight: 500;
}

.bbs-panel-contacts__label {
    font-size: 16px;
    line-height: 1.25;
}

.bbs-panel-contacts__phone-line {
    margin-top: 6px;
}

.bbs-panel-contacts__phone {
    font-size: 20px;
    line-height: 1.55;
    font-weight: 400;
}

.bbs-panel-contacts__note {
    margin-left: 6px;
    font-size: 13px;
    font-weight: 400;
}

.bbs-panel-contacts__icons,
.bbs-panel__socials {
    display: flex;
    gap: 10px;
}

.bbs-panel-contacts__icons {
    margin-top: 10px;
}

.bbs-panel-contacts__email {
    margin-top: 12px;
    font-size: 16px;
    line-height: 1.25;
}

.bbs-panel-contacts__icon,
.bbs-panel__social {
    display: block;
    width: 30px;
    height: 30px;
    line-height: 0;
}

.bbs-panel-contacts__icon img,
.bbs-panel__social img {
    display: block;
    width: 100%;
    height: 100%;
}

.bbs-panel a:hover .bbs-panel__name,
.bbs-panel-contacts a:hover {
    color: var(--bbs-header-green);
}

/* ── Green list ("Иностранные языки онлайн") ── */
.bbs-header__item--dropdown {
    position: relative;
}

.bbs-dropdown {
    position: absolute;
    top: 100%;
    left: -6px;
}

.bbs-dropdown__list {
    position: relative;
    width: 250px;
    padding: 8px 0;
    background: var(--bbs-header-green-dark);
}

.bbs-dropdown__link,
.bbs-dropdown__sublink {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 9px 20px;
    color: #ffffff;
    font-size: 20px;
    line-height: 1.7;
    text-align: left;
    transition: background-color 0.15s ease-in-out;
}

.bbs-header .bbs-dropdown__link,
.bbs-header .bbs-dropdown__sublink {
    color: #ffffff;
}

.bbs-dropdown__arrow {
    width: 0;
    height: 0;
    border-top: 3.5px solid transparent;
    border-bottom: 3.5px solid transparent;
    border-left: 4px solid #ffffff;
}

/* The side list: level with the top of the first list, as tall as it needs. */
.bbs-dropdown__sub {
    position: absolute;
    top: 0;
    left: 100%;
    display: none;
    width: 450px;
    min-height: 100%;
    padding: 8px 0;
    background: var(--bbs-header-green);
}

.bbs-dropdown__item.is-open > .bbs-dropdown__sub {
    display: block;
}

.bbs-dropdown__item.is-open > .bbs-dropdown__link,
.bbs-dropdown__link:hover,
.bbs-dropdown__sublink:hover {
    background: rgba(255, 255, 255, 0.12);
}

@media (hover: hover) and (min-width: 981px) {
    .bbs-dropdown__item:hover > .bbs-dropdown__sub {
        display: block;
    }

    .bbs-dropdown__item:hover > .bbs-dropdown__link,
    .bbs-dropdown__item:hover > .bbs-dropdown__row {
        background: rgba(255, 255, 255, 0.12);
    }
}

/* An item with its own page: the name is a link, the arrow a button beside it. */
.bbs-dropdown__row {
    display: flex;
    align-items: stretch;
    transition: background-color 0.15s ease-in-out;
}

.bbs-dropdown__item.is-open > .bbs-dropdown__row {
    background: rgba(255, 255, 255, 0.12);
}

.bbs-dropdown__row > .bbs-dropdown__link--page {
    flex: 1 1 auto;
    padding-right: 0;
}

.bbs-dropdown__row > .bbs-dropdown__link--page:hover {
    background: none;
}

.bbs-dropdown__toggle {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: flex-end;
    width: 44px;
    padding: 0 20px 0 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.bbs-dropdown__toggle:focus-visible,
.bbs-dropdown__link--page:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: -2px;
}

/* ── Burger and drawer (phones) ── */
.bbs-header__burger {
    display: none;
}

.bbs-drawer[hidden] {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .bbs-header__link,
    .bbs-header__caret,
    .bbs-panel__link::before,
    .bbs-dropdown__link,
    .bbs-dropdown__sublink {
        transition: none;
    }
}

/* ── 1199 and below: tighter bar and panel ── */
@media (max-width: 1199px) {
    .bbs-header__nav {
        margin-left: 32px;
    }

    .bbs-header__menu {
        gap: 28px;
    }

    .bbs-header__link {
        font-size: 17px;
    }

    .bbs-panel {
        width: 98vw;
    }

    .bbs-panel__links {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .bbs-panel__foot {
        grid-template-columns: 315px minmax(0, 1fr) auto;
        column-gap: 40px;
    }
}

/* ── 980 and below: logo and burger, the menu in a drawer ── */
@media (max-width: 980px) {
    .bbs-header {
        --bbs-header-height: 100px;
    }

    .bbs-header__nav,
    .bbs-header__contacts {
        display: none;
    }

    /* The original scales its phone bar up with the screen; the logo with it. */
    .bbs-header__logo {
        width: clamp(58px, 23vw, 92px);
    }

    .bbs-header__burger {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        margin: 0 -10px 0 auto;
    }

    .bbs-header__burger-lines {
        display: flex;
        flex-direction: column;
        gap: 3px;
        width: 25px;
    }

    .bbs-header__burger-lines span {
        display: block;
        height: 3px;
        background: var(--bbs-header-green);
    }

    .bbs-drawer {
        position: fixed;
        inset: 0;
        z-index: 1000;
    }

    .bbs-drawer__overlay {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        animation: bbs-drawer-fade 0.25s ease-out;
    }

    .bbs-drawer__panel {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        display: flex;
        flex-direction: column;
        width: min(500px, 100%);
        padding: 36px 30px 30px;
        overflow-y: auto;
        overscroll-behavior: contain;
        background: var(--bbs-header-green);
        color: #ffffff;
        animation: bbs-drawer-in 0.3s ease-out;
    }

    .bbs-drawer__close {
        position: absolute;
        top: 14px;
        right: 14px;
        width: 40px;
        height: 40px;
    }

    .bbs-drawer__close::before,
    .bbs-drawer__close::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 22px;
        height: 2px;
        background: #ffffff;
    }

    .bbs-drawer__close::before {
        transform: translate(-50%, -50%) rotate(45deg);
    }

    .bbs-drawer__close::after {
        transform: translate(-50%, -50%) rotate(-45deg);
    }

    .bbs-drawer__menu {
        display: flex;
        flex-direction: column;
        gap: 4px;
        padding-right: 40px;
    }

    .bbs-drawer__link {
        display: inline-flex;
        align-items: center;
        gap: 10px;
        padding: 2px 0;
        color: #ffffff;
        font-size: 22px;
        line-height: 1.4;
        text-align: left;
    }

    .bbs-header .bbs-drawer__link,
    .bbs-header .bbs-drawer__sublink,
    .bbs-header .bbs-drawer-contacts a {
        color: #ffffff;
    }

    .bbs-drawer__caret {
        width: 0;
        height: 0;
        border-top: 5px solid #ffffff;
        border-right: 3.5px solid transparent;
        border-left: 3.5px solid transparent;
        transition: transform 0.2s ease-in-out;
    }

    .bbs-drawer__link[aria-expanded="true"] .bbs-drawer__caret,
    .bbs-drawer__toggle[aria-expanded="true"] .bbs-drawer__caret {
        transform: rotate(180deg);
    }

    /* An item with its own page: the name links to it, the caret opens the list. */
    .bbs-drawer__row {
        display: inline-flex;
        align-items: center;
    }

    .bbs-drawer__toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        padding: 0;
        border: 0;
        background: none;
        cursor: pointer;
    }

    .bbs-drawer__sub {
        display: flex;
        flex-direction: column;
        gap: 2px;
        margin: 4px 0 10px;
        padding-left: 16px;
    }

    .bbs-drawer__sub[hidden] {
        display: none;
    }

    .bbs-drawer__sublink {
        display: block;
        padding: 3px 0;
        font-size: 17px;
        line-height: 1.4;
        opacity: 0.92;
    }

    .bbs-drawer__sublink:hover,
    .bbs-drawer__link:hover {
        text-decoration: underline;
    }

    .bbs-drawer-contacts {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        margin-top: auto;
        padding-top: 40px;
        font-size: 18px;
        line-height: 1.4;
    }

    .bbs-drawer-contacts__note {
        font-size: 16px;
    }

    .bbs-drawer-contacts__icons {
        display: flex;
        gap: 10px;
        margin-top: 8px;
    }

    .bbs-drawer-contacts__icon {
        display: block;
        width: 30px;
        height: 30px;
        line-height: 0;
    }

    .bbs-drawer-contacts__icon img {
        display: block;
        width: 100%;
        height: 100%;
    }
}

@media (max-width: 959px) {
    .bbs-header {
        --bbs-header-height: 86px;
    }
}

@keyframes bbs-drawer-in {
    from { transform: translateX(-100%); }
    to   { transform: none; }
}

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

@media (prefers-reduced-motion: reduce) {
    .bbs-drawer__overlay,
    .bbs-drawer__panel {
        animation: none;
    }
}

/* While the drawer is open the page underneath stays put. */
.bbs-drawer-is-open {
    overflow: hidden;
}
