/* ============================================================
   ПЕСКОВОЗ.РФ — ШАПКА КАТАЛОГА СПЕЦТЕХНИКИ
   Стили синхронизированы с index.html (peskovoz.css)
   ============================================================ */


/* ============================================================
   1. БАЗА / ПЕРЕМЕННЫЕ
   ============================================================ */
.site-header {
    --psv-primary: #E8B56B;
    --psv-primary-dark: #D49A4E;
    --psv-dark: #2A2A2A;
    --psv-line: #f1f5f9;

    position: sticky;
    top: 0;
    z-index: 1000;
    background: #fff;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.06);
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    color: var(--psv-dark);
}

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

.site-header__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    position: relative;
}


/* ============================================================
   2. ЛОГОТИП
   ============================================================ */
.site-header__brand {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    flex-shrink: 0;
    min-width: 0;
}

.site-header__brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.site-header__brand-title {
    font-family: 'Roboto', sans-serif;
    font-weight: 800;
    font-size: 1.6rem;
    line-height: 1.05;
    color: var(--psv-dark);
    white-space: nowrap;
    letter-spacing: -0.02em;
}

.site-header__brand-accent { color: var(--psv-primary); }

.site-header__brand-caption {
    font-family: 'Roboto', sans-serif;
    font-size: 0.66rem;
    font-weight: 500;
    color: #94a3b8;
    letter-spacing: 0.03em;
    margin-top: 3px;
    line-height: 1;
    white-space: nowrap;
}

.site-header__brand-logo {
    height: 50px;
    width: auto;
    display: block;
    flex-shrink: 0;
}


/* ============================================================
   3. НАВИГАЦИЯ (десктоп)
   ============================================================ */
.site-header__nav {
    display: flex;
    align-items: center;
    gap: 30px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;
    margin-left: auto;
}

.site-header__nav > li > a {
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--psv-dark);
    text-decoration: none;
    transition: color 0.3s ease;
    white-space: nowrap;
}
.site-header__nav > li > a:hover { color: var(--psv-primary); }

/* Пункты-кнопки «Позвонить/Заказать» — по умолчанию скрыты.
   Показываются только в бургере на ≤500px, когда mobile bar
   отключён (body.mobile-bar-hidden). */
.site-header__nav-actions { display: none; }


/* ============================================================
   4. БЛОК ДЕЙСТВИЙ (телефон + кнопка заказа) — десктоп
   ============================================================ */
.site-header__actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: 25px;
    flex-shrink: 0;
    white-space: nowrap;
}

.site-header__phone {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    font-weight: 700;
    color: var(--psv-primary);
    font-size: 1.25rem;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.3s ease;
}
.site-header__phone:hover { color: var(--psv-primary-dark); }

.site-header__order {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    background: var(--psv-primary);
    color: #fff !important;
    font-family: 'Montserrat', sans-serif;
    box-shadow: 0 4px 12px rgba(232, 181, 107, 0.3);
    transition: all 0.25s ease;
    cursor: pointer;
    border: 0;
    white-space: nowrap;
    text-decoration: none;
/*
    font-size: 1.05rem;
    line-height: 1.2;
    font-weight: 700;
    border-radius: 6px;
*/
    font-size: 1rem;
    line-height: 1.6;
    font-weight: 600;
    border-radius: 4px;
}
.site-header__order:hover {
    background: var(--psv-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(232, 181, 107, 0.4);
    color: #fff !important;
}

/* Двухсостоятельные элементы — по умолчанию полный вид */
.site-header__phone-text { display: inline; }
.site-header__order-icon { display: none; }


/* ============================================================
   5. БУРГЕР — скрыт на десктопе
   ============================================================ */
.site-header__hamburger {
    display: none;
    background: none;
    border: 0;
    font-size: 1.5rem;
    color: var(--psv-dark);
    padding: 8px;
    cursor: pointer;
    line-height: 1;
    border-radius: 6px;
    transition: background 0.2s ease;
}


/* ============================================================
   АДАПТИВНОСТЬ ШАПКИ — 4 этапа + мелкая правка ≤480
   ============================================================ */

/* --- ЭТАП 1: 1085–941 — телефон → иконка-контур --- */
@media (max-width: 1085px) and (min-width: 941px) {
    .site-header__phone-text { display: none; }
    .site-header__actions .site-header__phone {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 10px;
        border: 1.5px solid var(--psv-primary);
        color: var(--psv-primary);
        background: transparent;
        font-size: 1.05rem;
    }
    .site-header__actions .site-header__phone:hover {
        background: var(--psv-primary);
        color: #fff;
    }
    .site-header__actions .site-header__phone i { margin-right: 0; }
}

/* --- ЭТАП 2: ≤940 — мобильный режим (бургер слева, меню свёрнуто) --- */
@media (max-width: 940px) {
    .site-header__inner { gap: 8px; }

    /* Бургер слева */
    .site-header__hamburger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        order: -1;
        min-width: 44px;
        min-height: 44px;
        margin: 0 4px 0 0;
    }

    /* Бренд прижимает actions вправо */
    .site-header__brand { margin-right: auto; }

    /* Выпадающее меню */
    .site-header__nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: #fff;
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
        padding: 8px 20px 20px;
        z-index: 200;
        border-top: 1px solid var(--psv-line);
        max-height: calc(100vh - 69px);
        max-height: calc(100dvh - 69px);
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
    .site-header__nav.is-open { display: flex; }
    .site-header__nav > li { border-bottom: 1px solid var(--psv-line); }
    .site-header__nav > li:last-child { border-bottom: 0; }
    .site-header__nav > li > a {
        display: block;
        width: 100%;
        padding: 15px 4px;
        font-size: 1rem;
        text-align: left;
    }

    /* Телефон → иконка */
    .site-header__phone-text { display: none; }
    .site-header__actions {
        gap: 12px;
        margin-left: 12px;
    }
    .site-header__actions .site-header__phone {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 10px;
        border: 1.5px solid var(--psv-primary);
        color: var(--psv-primary);
        background: transparent;
        font-size: 1.05rem;
    }
    .site-header__actions .site-header__phone i { margin-right: 0; }

    /* Заказ — ещё с текстом (до 600) */
    .site-header__actions .site-header__order {
        padding: 12px 22px;
        font-size: 1rem;
    }
}

/* --- ЭТАП 3: ≤600 — заказ → иконка --- */
@media (max-width: 600px) {
    .site-header__order-text { display: none; }
    .site-header__order-icon { display: inline-block; }
    .site-header__actions .site-header__order {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        border-radius: 10px;
        font-size: 1.05rem;
    }
}

/* --- ЭТАП 4: ≤500 — бургер справа, actions скрыть, nav-actions в бургере --- */
@media (max-width: 500px) {
    /* Бургер справа */
    .site-header__hamburger {
        order: 1;
        margin: 0 0 0 auto;
    }
    .site-header__brand { margin-right: 0; }

    /* Блок действий скрыт — работают кнопки в mobile bar */
    .site-header__actions { display: none; }

    /* Пункты-кнопки в бургере — показываем только когда mobile bar выключен */
    body.mobile-bar-hidden .site-header__nav-actions {
        display: block;
        border-bottom: 1px solid var(--psv-line);
    }

    body.mobile-bar-hidden .site-header__nav-call,
    body.mobile-bar-hidden .site-header__nav-order {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        padding: 15px 4px;
        border: 0;
        background: none;
        font-family: inherit;
        font-size: 1rem;
        font-weight: 600;
        color: var(--psv-primary);
        text-align: left;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    body.mobile-bar-hidden .site-header__nav-call:hover,
    body.mobile-bar-hidden .site-header__nav-order:hover {
        color: var(--psv-primary-dark);
    }

    body.mobile-bar-hidden .site-header__nav-order {
        background: var(--psv-primary);
        color: #fff;
        border-radius: 8px;
        justify-content: center;
        margin-top: 6px;
    }

    body.mobile-bar-hidden .site-header__nav-order:hover {
        background: var(--psv-primary-dark);
        color: #fff;
    }

    body.mobile-bar-hidden .site-header__nav-actions:last-child {
        border-bottom: 0;
        padding-bottom: 8px;
    }
}

/* --- Совсем маленькие экраны: подпись логотипа мельче --- */
@media (max-width: 480px) {
    .site-header__brand-caption { font-size: 0.6rem; }
}


/* ============================================================
   ЗАТЕНЕНИЕ КОНТЕНТА ПРИ ОТКРЫТОМ МЕНЮ
   z-index 900 — выше контента, ниже .site-header (1000)
   и .mobile-action-bar (950).
   ============================================================ */
body:has(.site-header__nav.is-open) {
    overflow: hidden;
}
body:has(.site-header__nav.is-open)::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 900;
    animation: menuOverlayIn 0.2s ease;
    pointer-events: none;
}
@keyframes menuOverlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}


/* ============================================================
   MOBILE ACTION BAR — быстрый доступ к «Позвонить» / «Заказать»
   Показывается на ≤500px. Позиция и sticky — из конфига в HTML
   (window.MOBILE_BAR_CONFIG).
   ============================================================ */
.mobile-action-bar {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    z-index: 950;
    background: #fff;
    gap: 10px;
    /* Базовая позиция — снизу */
    bottom: 0;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.06);
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.mobile-action-bar *,
.mobile-action-bar *::before,
.mobile-action-bar *::after { box-sizing: border-box; }

/* Бар полностью выключен через конфиг show: false */
body.mobile-bar-hidden .mobile-action-bar {
    display: none !important;
}

/* Модификатор: бар вверху.
   top: 74px = высота шапки (лого 50px + padding 12px × 2). */
body.mobile-bar-position-top .mobile-action-bar {
    top: 74px;
    bottom: auto;
    border-top: none;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
    padding: 8px 12px;
}

.mobile-action-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 52px;
    padding: 0 16px;
    border-radius: 10px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    -webkit-tap-highlight-color: transparent;
    border: 0;
}
.mobile-action-btn:active { transform: scale(0.97); }

.mobile-action-btn--call {
    background: #fff;
    color: var(--psv-primary, #E8B56B);
    border: 1.5px solid var(--psv-primary, #E8B56B);
}
.mobile-action-btn--order {
    background: var(--psv-primary, #E8B56B);
    color: #fff;
    border: 1.5px solid var(--psv-primary, #E8B56B);
    box-shadow: 0 4px 12px rgba(232, 181, 107, 0.35);
}

/* Sticky-hide при скролле */
body.mobile-bar-sticky.mobile-bar-position-top .mobile-action-bar.is-hidden {
    transform: translateY(-100%);
}
body.mobile-bar-sticky.mobile-bar-position-bottom .mobile-action-bar.is-hidden {
    transform: translateY(100%);
}

@media (prefers-reduced-motion: reduce) {
    .mobile-action-bar { transition: none; }
}

/* Показ на ≤500 + компенсации под бар */
@media (max-width: 500px) {
    .mobile-action-bar { display: flex; }

    body.mobile-bar-position-bottom {
        padding-bottom: calc(69px + env(safe-area-inset-bottom));
    }
}


/* ============================================================
   DETAIL-СТРАНИЦА: компенсация padding под mobile bar сверху
   ============================================================ */
@media (max-width: 500px) {
    body.mobile-bar-position-top:not(.mobile-bar-hidden) .catalog-hero {
        padding-top: calc(38px + 69px);
    }
    body.mobile-bar-position-top:not(.mobile-bar-hidden) .detail-hero {
        padding-top: calc(38px + 69px);
    }
}