/* Шапка сайта: синяя полоса с логотипом, поиском, пользователем и вкладками
   разделов. Проект docs/superpowers/specs/2026-10-05-site-header-design.md,
   раздел «Геометрия». Без теней и градиентов. Подсказки поиска и затемнение
   оформлены в header.css. */

.tp-sh {
    --tp-sh-bg: #0a58ca;
    --tp-sh-ink: #fff;
    --tp-sh-soft: rgba(255, 255, 255, .16);
    /* Наведение затемняет: белый текст на светлеющем фоне падал до 3,8:1, на темнеющем 8,2:1. */
    --tp-sh-soft-hover: rgba(0, 0, 0, .16);
    --tp-sh-muted: rgba(255, 255, 255, .8);
    --tp-sh-accent: #ffc107;
    --tp-sh-accent-ink: #16232b;
    /* Подсказки поиска и меню пользователя выпадают поверх контента, а
       затемнение подсказок ложится и на нижнюю липкую панель карточки
       (.sticky-book, 1030 в products.css). */
    position: relative;
    z-index: 1031;
    padding-bottom: 12px;
    background: var(--tp-sh-bg);
    color: var(--tp-sh-ink);
}
/* Без полей 0.8rem сверху и снизу, которые style.css дает всем .container:
   иначе над строкой логотипа и под вкладками по 13 px сверх «Геометрии». */
.tp-sh > .container {
    padding-top: 0;
    padding-bottom: 0;
}
.tp-sh--title:has(.tp-sh__head) { padding-bottom: 32px; }
.tp-sh--hero:has(.tp-sh__head) { padding-bottom: 48px; }

.tp-sh .tp-f-icon {
    display: inline-block;
    flex: none;
    width: 20px;
    height: 20px;
    vertical-align: middle;
    fill: none;
}

/* Строка логотипа. Выше затемнения подсказок (.header-search, 3 в
   header.css): кнопка поиска и пользователь нажимаются с первого раза. */
.tp-sh__bar {
    position: relative;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 72px;
}
.tp-sh__logo {
    display: inline-flex;
    align-items: center;
    flex: none;
    min-height: 44px;
}
.tp-sh__logo img {
    display: block;
    width: 160px;
    height: auto;
    filter: brightness(0) invert(1);
}
.tp-sh__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.tp-sh__round {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--tp-sh-soft);
    color: var(--tp-sh-ink);
}
button.tp-sh__round:hover,
button.tp-sh__round[aria-expanded="true"],
.tp-sh__user:hover .tp-sh__round {
    background: var(--tp-sh-soft-hover);
}

/* Пользователь: гость ссылкой с кругом, вошедший кнопкой меню с аватаром */
.tp-sh__user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--tp-sh-ink);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.tp-sh__user:hover,
.tp-sh__user:focus {
    color: var(--tp-sh-ink);
}
button.tp-sh__user {
    padding: 6px 14px 6px 6px;
    border-radius: 22px;
    background: var(--tp-sh-soft);
}
button.tp-sh__user:hover,
button.tp-sh__user[aria-expanded="true"] {
    background: var(--tp-sh-soft-hover);
}
.tp-sh__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--tp-sh-soft);
}
.tp-sh__user-name {
    display: inline-block;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Вкладки разделов. Список прокручивается вбок на любой ширине: от 768 до
   примерно 900 px три вкладки с городом («Достопримечательности
   Санкт-Петербурга») шире контейнера и иначе выводили страницу за край.
   Поля 4 px внутри списка (и такие же отрицательные снаружи) оставляют
   место обводке фокуса: прокрутка обрезает все, что вне списка. */
.tp-sh__tabs {
    margin-top: 16px;
}
.tp-sh__tablist {
    display: flex;
    gap: 12px;
    margin: -4px;
    padding: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    list-style: none;
    scroll-behavior: smooth;
}
.tp-sh__tablist::-webkit-scrollbar {
    display: none;
}
.tp-sh__tablist > li {
    flex: none;
}
.tp-sh__tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 20px;
    border-radius: 8px;
    background: var(--tp-sh-soft);
    color: var(--tp-sh-ink);
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
}
.tp-sh__tab:hover {
    background: var(--tp-sh-soft-hover);
    color: var(--tp-sh-ink);
}
.tp-sh__tab.is-active,
.tp-sh__tab.is-active:hover {
    background: var(--tp-sh-accent);
    color: var(--tp-sh-accent-ink);
}

/* Поиск: панель под строкой логотипа и крупная форма героя */
.tp-sh__search {
    margin-top: 16px;
}
/* Форма выше затемнения (#header-search-bg, 1 внутри .header-search):
   иначе первое нажатие «Найти» уходит в затемнение, а поле тускнеет. */
.tp-sh__form {
    position: relative;
    z-index: 2;
    display: flex;
    gap: 8px;
    margin: 0;
}
.tp-sh__input.form-control {
    flex: 1 1 auto;
    min-width: 0;
    height: 48px;
    padding: 0 16px;
    border: 0;
    border-radius: 8px;
    font-size: 17px;
}
.tp-sh__input.form-control:focus {
    box-shadow: none;
}
.tp-sh__input.form-control::placeholder {
    color: var(--tp-ink-muted, #5c6b73);
}
.tp-sh__submit {
    flex: none;
    min-width: 44px;
    height: 48px;
    padding: 0 24px;
    border: 0;
    border-radius: 8px;
    background: var(--tp-sh-accent);
    color: var(--tp-sh-accent-ink);
    font-weight: 600;
}
.tp-sh__submit:hover {
    text-decoration: underline;
}
.tp-sh .header-search-popup {
    color: var(--bs-body-color);
}
.tp-sh__find {
    margin-top: 24px;
}
.tp-sh__find .tp-sh__input.form-control,
.tp-sh__find .tp-sh__submit {
    height: 56px;
}
.tp-sh__find .tp-sh__input.form-control {
    font-size: 18px;
}

/* Голова страницы в полосе: крошки, H1, лид, быстрые города */
.tp-sh__head {
    margin-top: 24px;
}
.tp-sh__crumbs {
    font-size: 13px;
}
.tp-sh__crumbs .breadcrumb {
    --bs-breadcrumb-divider-color: var(--tp-sh-muted);
    --bs-breadcrumb-item-active-color: var(--tp-sh-muted);
    margin: 0;
    color: var(--tp-sh-muted);
}
/* Разделитель крошек после пункта, а не перед ним: при переносе строки на
   телефоне косая черта остается в конце строки, а не в начале новой. Пункт
   гибким блоком: пробел после ссылки в разметке не раздвигает черту. */
.tp-sh__crumbs .breadcrumb-item {
    display: flex;
    align-items: baseline;
}
.tp-sh__crumbs .breadcrumb-item + .breadcrumb-item {
    padding-left: 0;
}
.tp-sh__crumbs .breadcrumb-item + .breadcrumb-item::before {
    content: none;
}
.tp-sh__crumbs .breadcrumb-item:not(:last-child)::after {
    padding: 0 var(--bs-breadcrumb-item-padding-x, .5rem);
    color: var(--tp-sh-muted);
    content: "/";
}
.tp-sh__crumbs a {
    color: var(--tp-sh-ink);
    text-decoration: none;
}
.tp-sh__crumbs a:hover {
    color: var(--tp-sh-ink);
    text-decoration: underline;
}
/* Длинное слово («Достопримечательности» в H1 героя на 320 px) переносится
   по слогам или по букве, а не выводит строку за край экрана. Без полей
   16 px, которые style.css дает всем h1 (32 px лишней высоты полосы, у
   заголовка без лида поле снизу 48 px вместо 32): ритм задают отступы
   головы, H1 и лида. */
.tp-sh__h1 {
    margin: 12px 0 0;
    padding: 0;
    color: var(--tp-sh-ink);
    font-size: clamp(24px, 3vw, 36px);
    font-weight: 700;
    line-height: 1.2;
    overflow-wrap: break-word;
    hyphens: auto;
}
/* Герой: голова дальше от вкладок, H1 крупнее. */
.tp-sh--hero .tp-sh__head {
    margin-top: 32px;
}
.tp-sh--hero .tp-sh__h1 {
    font-size: clamp(28px, 4vw, 48px);
    text-wrap: balance;
}
.tp-sh__head > .tp-sh__h1:first-child {
    margin-top: 0;
}
/* Лид не шире 860 px: строка длинного лида города на широком экране читается
   с трудом. */
.tp-sh__lead {
    max-width: 860px;
    margin: 12px 0 0;
    color: var(--tp-sh-ink);
    font-size: 18px;
    line-height: 1.5;
}
/* Ссылки и абзацы внутри лида: белые, ссылки с подчеркиванием; у абзацев лида нет своих полей. */
.tp-sh__lead p {
    margin: 0;
}
.tp-sh__lead p + p {
    margin-top: 8px;
}
.tp-sh__lead a:not(.btn) {
    color: var(--tp-sh-ink);
    text-decoration: underline;
}
.tp-sh__lead a:not(.btn):hover {
    text-decoration-thickness: 2px;
}
.tp-sh__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
    scroll-behavior: smooth;
}
.tp-sh__chip {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 22px;
    background: var(--tp-sh-soft);
    color: var(--tp-sh-ink);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.tp-sh__chip:hover {
    background: var(--tp-sh-soft-hover);
    color: var(--tp-sh-ink);
}

/* Фокус: белая обводка на синем, в белых меню и подсказках синяя */
.tp-sh a:focus-visible,
.tp-sh button:focus-visible,
.tp-sh__input.form-control:focus-visible {
    outline: 2px solid var(--tp-sh-ink);
    outline-offset: 2px;
    box-shadow: none;
}
.tp-sh .dropdown-menu a:focus-visible,
.tp-sh .dropdown-menu button:focus-visible,
.tp-sh .header-search-popup a:focus-visible {
    outline-color: var(--tp-sh-bg);
    outline-offset: -2px;
}

@media (max-width: 767.98px) {
    .tp-sh--title:has(.tp-sh__head) { padding-bottom: 24px; }
    .tp-sh--hero:has(.tp-sh__head) { padding-bottom: 32px; }
    .tp-sh__bar {
        height: 60px;
    }
    .tp-sh__logo img {
        width: 120px;
    }
    /* Подпись остается именем ссылки и кнопки для читалок. */
    .tp-sh__user-name {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        padding: 0 !important;
        margin: -1px !important;
        overflow: hidden !important;
        clip: rect(0, 0, 0, 0) !important;
        white-space: nowrap !important;
        border: 0 !important;
    }
    button.tp-sh__user {
        padding-right: 10px;
    }
    /* Вкладки и быстрые города прокручиваются вбок до краев экрана. */
    .tp-sh__tablist,
    .tp-sh__chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        margin-inline: calc(var(--bs-gutter-x) * -.5);
        padding: 4px calc(var(--bs-gutter-x) * .5);
        scroll-padding-inline: calc(var(--bs-gutter-x) * .5);
    }
    .tp-sh__tablist {
        margin-block: -4px;
    }
    .tp-sh__chips {
        margin-top: 12px;
        margin-bottom: -4px;
    }
    .tp-sh__chips::-webkit-scrollbar {
        display: none;
    }
    .tp-sh__tablist > li,
    .tp-sh__chips > li {
        flex: none;
        scroll-snap-align: start;
    }
    .tp-sh__tab {
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        min-width: 104px;
        height: 64px;
        padding: 0 12px;
        font-size: 14px;
    }
    /* Лид заголовка 16 px: длинный лид города не растягивает полосу на
       полэкрана. Лид героя остается 18 px. */
    .tp-sh--title .tp-sh__lead {
        font-size: 16px;
    }
    .tp-sh__find .tp-sh__form {
        flex-direction: column;
    }
    .tp-sh__find .tp-sh__submit {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tp-sh__tablist,
    .tp-sh__chips {
        scroll-behavior: auto;
    }
}
