/* Светлая шапка учебника в цвет страницы: туманный фон, тёмный текст, кобальт и золото.
   Включается классом tb-light-header на <body> (блок body_class в notebook_list/base.html).
   Разметка шапки общая для всей платформы, здесь меняются только цвета.
   Здесь же шрифты Wix Madefor для страниц учебника. */
@font-face {
    font-family: "Wix Madefor Display";
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("../../home/school/fonts/wix-madefor-display-cyrillic.4ae2d48436b3.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: "Wix Madefor Display";
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("../../home/school/fonts/wix-madefor-display-latin.9b9969b22238.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}

@font-face {
    font-family: "Wix Madefor Text";
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("../../home/school/fonts/wix-madefor-text-cyrillic.209d88f118c0.woff2") format("woff2");
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
    font-family: "Wix Madefor Text";
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url("../../home/school/fonts/wix-madefor-text-latin.f6130b85efb3.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}

@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 500 700;
    font-display: swap;
    src: url("../../home/school/fonts/jetbrains-mono-bold.cab9936e90bd.woff") format("woff");
}

body.tb-light-header {
    --tb-ink: #0c0e13;
    --tb-fog: #e9edf2;
    --tb-cobalt: #1f3dff;
    --tb-gold: #ffbe46;
    --tb-line: rgba(12, 14, 19, .1);
    background: var(--tb-fog);
}

/* Шапка платформы */
body.tb-light-header .site-global-header.header,
body.tb-light-header .site-global-header .nav__links,
body.tb-light-header .site-global-header .nav__links li,
body.tb-light-header .site-global-header .nav__links li a,
body.tb-light-header .site-global-header .cta {
    background: var(--tb-fog);
}

body.tb-light-header .site-global-header.header {
    border-bottom: 1px solid var(--tb-line);
}

body.tb-light-header .site-global-header * {
    font-family: "Wix Madefor Text", "Helvetica Neue", Arial, sans-serif;
}

body.tb-light-header .site-global-header .header-logo-link {
    flex: none;
    max-width: none;
    color: var(--tb-ink);
    font: 600 22px/1 "Wix Madefor Display", "Helvetica Neue", Arial, sans-serif;
    letter-spacing: -.02em;
    white-space: nowrap;
}

body.tb-light-header .site-global-header .nav__links {
    color: var(--tb-ink);
    font-size: 17px;
}

body.tb-light-header .site-global-header .nav__links li > a {
    transition-property: color, background-color;
}

body.tb-light-header .site-global-header .nav__links li a:hover {
    color: var(--tb-cobalt);
    background: var(--tb-fog) !important;
}

body.tb-light-header .site-global-header .nav__links li a.nav-link--active,
body.tb-light-header .site-global-header .nav__links li a.nav-link--active:hover,
body.tb-light-header .site-global-header .nav__links li a.nav-link--active:focus-visible {
    color: #fff;
    background: var(--tb-cobalt) !important;
    border-radius: 99px;
}

body.tb-light-header .site-global-header .profile-btn {
    color: var(--tb-ink);
    border-color: var(--tb-ink);
    font-size: 16px;
    font-weight: 600;
}

body.tb-light-header .site-global-header .profile-btn:hover {
    color: #fff;
    background-color: var(--tb-cobalt);
    border-color: var(--tb-cobalt);
    box-shadow: none;
}

body.tb-light-header .site-global-header .profile-menu__trigger {
    color: var(--tb-ink);
    background: #fff;
    border-color: var(--tb-line);
}

body.tb-light-header .site-global-header .profile-menu__trigger:hover,
body.tb-light-header .site-global-header .profile-menu__trigger:focus-visible {
    border-color: var(--tb-cobalt);
    background: #fff;
}

body.tb-light-header .site-global-header .profile-cart-indicator span,
body.tb-light-header .site-global-header .profile-menu__notification-badge {
    border-color: var(--tb-fog);
}

@media (min-width: 781px) and (max-width: 900px) {
    body.tb-light-header .site-global-header .nav__links--staff {
        font-size: 15px;
    }

    body.tb-light-header .site-global-header .nav__links--staff > li {
        padding-inline: 6px;
    }
}

@media (max-width: 780px) {
    body.tb-light-header .header-container:has(.profile-actions) {
        display: grid;
        grid-template-columns: minmax(max-content, 1fr) auto 1fr;
        column-gap: 8px;
        justify-items: start;
    }

    body.tb-light-header .site-menu-toggle:not(.site-menu-toggle--without-profile) {
        position: static;
        transform: none;
    }

    body.tb-light-header .site-menu-toggle {
        color: var(--tb-ink);
        background: #fff;
        border-color: var(--tb-line);
    }

    body.tb-light-header .header-container nav.site-header-navigation {
        background: #fff;
        border-color: var(--tb-line);
        box-shadow: 0 20px 50px rgba(12, 14, 19, .12);
    }

    body.tb-light-header .site-header-navigation .nav__links,
    body.tb-light-header .site-header-navigation .nav__links li,
    body.tb-light-header .site-header-navigation .nav__links li a {
        background: #fff;
    }

    body.tb-light-header .site-header-navigation .nav__links a:hover,
    body.tb-light-header .site-header-navigation .nav__links a:focus-visible {
        color: var(--tb-cobalt);
        background: rgba(31, 61, 255, .08) !important;
    }
}

/* ---------- Переключатель разделов учебника (сегменты в духе iOS) ----------
   «Учебник» — синяя таблетка, из неё продолжается дорожка с разделами; текущий раздел —
   белый «бегунок». На широком экране всё в шапке, уже — таблетка в шапке и дорожка под ней. */
body.tb-light-header .site-global-header .nav__links li.tb-seg-item {
    padding: 0 6px;
}

.tb-seg {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 99px;
    background: rgba(12, 14, 19, .07);
    font-family: "Wix Madefor Text", "Helvetica Neue", Arial, sans-serif;
}

.tb-seg__track {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

body.tb-light-header .tb-seg a,
body.tb-light-header .site-global-header .tb-seg a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 16px;
    border-radius: 99px;
    background: transparent !important;
    color: #414857;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color .2s, color .2s, box-shadow .2s;
}

body.tb-light-header .tb-seg a:hover,
body.tb-light-header .site-global-header .tb-seg a:hover {
    color: var(--tb-ink);
}

body.tb-light-header .tb-seg .tb-seg__root,
body.tb-light-header .site-global-header .tb-seg .tb-seg__root,
body.tb-light-header .site-global-header .tb-seg .tb-seg__root:hover {
    background: var(--tb-cobalt) !important;
    color: #fff;
}

body.tb-light-header .tb-seg .tb-seg__track a[aria-current],
body.tb-light-header .site-global-header .tb-seg .tb-seg__track a[aria-current] {
    background: #fff !important;
    color: var(--tb-ink);
    box-shadow: 0 1px 3px rgba(12, 14, 19, .14), 0 0 0 1px rgba(12, 14, 19, .04);
}

body.tb-light-header .tb-seg a:focus-visible {
    outline: 3px solid var(--tb-gold);
    outline-offset: 2px;
}

/* Дорожка под шапкой: показывается, только когда в шапке ей не хватает места */
.tb-seg--below {
    display: none;
}

/* У преподавателя и админа пунктов больше всего: дорожка в шапке только на широком экране,
   шапка там шире. На экранах уже 1600px в шапке «Учебник», дорожка под ней. */
@media (min-width: 1600px) {
    body.tb-light-header:has(.tb-seg--compact) .site-global-header .header-container {
        width: min(1520px, calc(100% - 64px));
    }
}

@media (max-width: 1599px) {
    body.tb-light-header .site-global-header .tb-seg--compact {
        padding: 0;
        background: none;
    }

    body.tb-light-header .site-global-header .tb-seg--compact .tb-seg__track {
        display: none;
    }

    body.tb-light-header:has(.tb-seg--compact) .tb-seg--below {
        display: flex;
        width: max-content;
        max-width: calc(100% - 32px);
        margin: 14px auto 0;
    }
}

/* У вошедшего ученика в шапке ещё кабинет и профиль: шапка шире, дорожка в ней — от 1440px */
@media (min-width: 1440px) {
    body.tb-light-header:has(.tb-seg--crowded) .site-global-header .header-container {
        width: min(1360px, calc(100% - 48px));
    }
}

@media (max-width: 1439px) {
    body.tb-light-header .site-global-header .tb-seg--crowded {
        padding: 0;
        background: none;
    }

    body.tb-light-header .site-global-header .tb-seg--crowded .tb-seg__track {
        display: none;
    }

    body.tb-light-header:has(.tb-seg--crowded) .tb-seg--below {
        display: flex;
        width: max-content;
        max-width: calc(100% - 32px);
        margin: 14px auto 0;
    }
}

@media (max-width: 1279px) {
    body.tb-light-header .site-global-header .tb-seg--bar {
        padding: 0;
        background: none;
    }

    body.tb-light-header .site-global-header .tb-seg--bar .tb-seg__track {
        display: none;
    }

    body.tb-light-header .tb-seg--below {
        display: flex;
        width: max-content;
        max-width: calc(100% - 32px);
        margin: 14px auto 0;
    }
}

@media (max-width: 780px) {
    body.tb-light-header .tb-seg--below,
    body.tb-light-header:has(.tb-seg--bar) .tb-seg--below {
        display: grid;
        width: auto;
        max-width: none;
        margin: 12px 16px 0;
    }

    body.tb-light-header .tb-seg--below .tb-seg__track {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    body.tb-light-header .tb-seg--below a {
        min-width: 0;
        padding: 10px 4px;
        font-size: 14px;
        letter-spacing: -.01em;
    }

    /* В выпадающем меню «Учебник» — обычный активный пункт */
    body.tb-light-header .site-header-navigation .tb-seg--bar {
        display: block;
    }

    body.tb-light-header .site-header-navigation .tb-seg--bar .tb-seg__root {
        display: flex;
        justify-content: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.tb-light-header .tb-seg a {
        transition: none;
    }
}
