/* Э0 (T-16): эталон «шапка» specialty_v2 по паспорту docs/design/blocks/header.json.
   Раскладки: мобайл (до 640 px, кадр 320), планшет (640-1279, кадр 640), десктоп (от 1280, кадр 1920: корпус 1200 = --container-max).
   Числа - паспорт (точно), фактические промежутки (gap_list) заданы явно; цвета, радиусы, шрифты - токены. Мега-меню - отдельный блок (Э1). */

/* ---------- мобайл (кадр 320) ---------- */
.sp-hd {
    box-sizing: border-box;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    height: 90px;
    margin: 0;
    padding: 16px 24px 10px;
    border-bottom: 1px solid var(--stroke-grey-light);
    border-radius: var(--radius-0);
    color: var(--text-black);
    background: var(--bg-white);
}

.sp-hd__top {
    display: none;
}

.sp-hd__main {
    box-sizing: border-box;
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: calc(100% + 4px);
    height: 36px;
    padding: 0;
}

.sp-hd__left,
.sp-hd__catalog-search {
    display: contents;
}

.sp-hd__logo {
    display: flex;
    flex: none;
    align-items: center;
    width: 80px;
    height: 20px;
    padding: 0;
    gap: 10px;
    border-radius: var(--radius-0);
    color: var(--color-main);
    text-decoration: none;
}

.sp-hd__logo-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sp-hd__catalog {
    display: none;
}

.sp-hd__search {
    box-sizing: border-box;
    display: flex;
    flex: none;
    align-items: center;
    gap: 50px;
    width: 128px;
    height: 32px;
    margin: 0;
    padding: 8px;
    border: 1px solid var(--stroke-grey-light);
    border-radius: var(--radius-full);
    color: var(--text-gray);
    background: var(--bg-white);
    font: 400 12px/15.6px var(--font-base);
}

.sp-hd__search-input {
    box-sizing: border-box;
    display: flex;
    flex: 1 1 auto;
    gap: 10px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    color: inherit;
    background: transparent;
    font: inherit;
}

.sp-hd__search:focus-within {
    border-color: var(--stroke-focused);
}

.sp-hd__search-input::placeholder {
    color: var(--text-gray);
    opacity: 1;
}

.sp-hd__search-button {
    display: none;
}

.sp-hd__search-icon {
    display: inline-flex;
    flex: none;
    width: 16px;
    height: 16px;
    color: var(--text-dark-grey);
}

.sp-hd__search-icon .sp-icon {
    width: 100%;
    height: 100%;
}

.sp-hd__icons {
    display: none;
}

.sp-hd__burger {
    box-sizing: border-box;
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--radius-0);
    color: var(--text-black);
    background: transparent;
    cursor: pointer;
}

.sp-hd__quick {
    box-sizing: border-box;
    display: flex;
    flex: none;
    gap: 10px;
    width: calc(100% + 24px);
    height: 20px;
    padding: 0;
    overflow: hidden;
    color: var(--text-black);
    font: var(--font-quick-sm);
}

.sp-hd__quick-item {
    flex: none;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.sp-hd__quick-item {
    transition: color var(--motion-fast) ease;
}

.sp-hd__quick-item:hover {
    color: var(--color-main-hover);
}

.sp-hd__burger:focus-visible,
.sp-hd__quick-item:focus-visible,
.sp-hd__nav-button:focus-visible,
.sp-hd__menu-item:focus-visible,
.sp-hd__city:focus-visible,
.sp-hd__logo:focus-visible {
    outline: 2px solid var(--stroke-focused);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ---------- планшет (кадр 640) ---------- */
@media (min-width: 640px) {
    .sp-hd {
        gap: 16px;
        height: 116px;
        padding: 16px 32px;
    }

    .sp-hd__main {
        gap: 40px;
        width: auto;
        height: 48px;
    }

    .sp-hd__left {
        display: flex;
        align-items: center;
        gap: 24px;
    }

    .sp-hd__catalog-search {
        display: contents;
    }

    .sp-hd__logo {
        width: 136px;
        height: 34px;
    }

        .sp-hd__search {
        gap: 0;
        width: 340px;
        height: 48px;
        padding: 0 16px 0 0;
        color: var(--text-gray);
        font: 400 14px/18.2px var(--font-base);
    }

    .sp-hd__search-input {
        height: 48px;
        padding: 15px 16px;
        border-radius: var(--radius-sm);
    }

    .sp-hd__search-icon {
        width: 24px;
        height: 24px;
    }

    .sp-hd__quick {
        gap: 20px;
        width: auto;
    }
}

/* ---------- десктоп (кадр 1920, корпус 1200) ---------- */
@media (min-width: 1280px) {
    .sp-hd {
        gap: 0;
        height: 156px;
        max-width: var(--container-max);
        margin: 0 auto;
        padding: 0;
        border-bottom: 0;
        background: transparent;
    }

    .sp-hd__top {
        box-sizing: border-box;
        display: flex;
        flex: none;
        align-items: center;
        gap: 94px;
        height: 52px;
        padding: 16px 0;
        border-bottom: 1px solid var(--stroke-grey-light);
    }

    .sp-hd__menu {
        display: flex;
        gap: 24px;
    }

    .sp-hd__menu-item {
        display: inline-flex;
        align-items: center;
        gap: 10px;
        padding: 0;
        border-radius: var(--radius-0);
        color: var(--field-description);
        font: var(--font-body-3);
        text-decoration: none;
    }

    .sp-hd__menu-item:hover {
        color: var(--color-main-hover);
    }

    .sp-hd__phone {
        display: flex;
        align-items: center;
        width: 104px;
        height: 20px;
        color: var(--field-description);
        font: 600 12px/14.4px var(--font-base);
        text-decoration: none;
        white-space: nowrap;
    }

    .sp-hd__city {
        box-sizing: border-box;
        display: inline-flex;
        align-items: center;
        gap: 4px;
        height: 20px;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: var(--radius-0);
        color: var(--field-description);
        background: transparent;
        font: var(--font-body-3);
        cursor: pointer;
    }

    .sp-hd__main {
        gap: 26px;
        height: 44px;
        margin-top: 24px;
    }

    .sp-hd__left {
        gap: 24px;
    }

    .sp-hd__catalog-search {
        display: flex;
        gap: 13px;
    }

    .sp-hd__logo {
        width: 180px;
        height: 44px;
    }

        .sp-hd__catalog {
        box-sizing: border-box;
        display: inline-flex;
        flex: none;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 159px;
        height: 44px;
        margin: 0;
        padding: 14px 32px;
        border: 0;
        border-radius: var(--radius-full);
        color: var(--text-white);
        background: var(--color-main);
        font: var(--font-btn-md);
        text-transform: uppercase;
        cursor: pointer;
    }

    .sp-hd__catalog:is(:hover, .is-hover) {
        background: var(--color-main-hover);
    }

    .sp-hd__search {
        gap: 0;
        width: 590px;
        height: 44px;
        padding: 0;
        border-color: var(--stroke-grey-normal);
        font: 400 14px/18.2px var(--font-base);
    }

    .sp-hd__search:is(:hover, .is-hover) {
        border-color: var(--color-main-hover);
    }

    .sp-hd__search-input {
        height: 44px;
        padding: 15px 16px;
        border-radius: 999px 0 0 999px;
    }

    .sp-hd__search-button {
        box-sizing: border-box;
        display: inline-flex;
        flex: none;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 75px;
        height: 44px;
        margin: 0;
        padding: 14px 32px;
        border: 0;
        border-radius: var(--radius-full);
        color: var(--text-white);
        background: var(--color-main);
        cursor: pointer;
    }

    .sp-hd__search-button:is(:hover, .is-hover) {
        background: var(--color-main-hover);
    }

    .sp-hd__search-icon {
        display: none;
    }

    .sp-hd__icons {
        box-sizing: border-box;
        display: flex;
        flex: none;
        align-items: center;
        gap: 16px;
        height: 40px;
        padding: 0;
    }

    .sp-hd__nav-button {
        position: relative;
        box-sizing: border-box;
        display: inline-flex;
        flex: none;
        align-items: center;
        justify-content: center;
        gap: 0;
        width: 40px;
        height: 40px;
        padding: 0;
        border-radius: var(--radius-0);
        color: var(--text-black);
        text-decoration: none;
    }

    .sp-hd__nav-button:hover {
        color: var(--color-main-hover);
    }

    .sp-hd__counter {
        position: absolute;
        top: -4px;
        right: -8px;
        box-sizing: border-box;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 18px;
        height: 18px;
        padding: 2px 6px;
        border-radius: var(--radius-full);
        color: var(--text-white);
        background: var(--color-main);
        font: var(--font-btn-xs);
    }

    .sp-hd__counter[hidden] {
        display: none;
    }

    .sp-hd__burger {
        display: none;
    }

    .sp-hd__quick {
        gap: 24.75px;
        margin-top: 16px;
        font: var(--font-quick-lg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .sp-hd__quick-item,
    .sp-hd__menu-item,
    .sp-hd__nav-button,
    .sp-hd__catalog,
    .sp-hd__search,
    .sp-hd__search-button {
        transition: none;
    }
}
