/* ============================================================
   «Бизнес ПК» — ОБЩИЙ КАРКАС САЙТА
   Этап 1 редизайна (по макету): светлая двухуровневая шапка
   (логотип + поиск + действия / каталог-навигация), светлый
   футер с инфо-ссылками. Синий акцент --hd-blue (#0645d8).
   Порядок: theme-mono.css -> ui/* -> site.css -> <page>.css
   ============================================================ */

/* ---------- ТОКЕНЫ НОВОГО ЯЗЫКА (витрина) ---------- */
:root {
    --nv-ink: #101114;          /* тёмный: шапка, футер, CTA */
    --nv-ink-hover: #26272c;    /* hover тёмных кнопок */
    --nv-ink-soft: #1a1b20;     /* тёмные вставки */
    --nv-on-ink: #ffffff;       /* текст на тёмном */
    --nv-on-ink-dim: #a7a9b2;   /* приглушённый на тёмном */
    --nv-ink-line: #2b2c31;     /* рамки на тёмном */
    --nv-canvas: #f4f4f6;       /* светлое полотно страницы */
    --nv-panel: #ffffff;        /* белые панели */
    --nv-line: #e6e6ea;         /* рамки панелей */
    --nv-line-soft: #eeeef1;    /* лёгкие разделители */
    --nv-tx: #16171a;           /* основной текст */
    --nv-tx-2: #6b6d75;         /* вторичный */
    --nv-tx-3: #9a9ca4;         /* подписи, лейблы */
    --hd-blue: #0645d8;         /* сдержанный синий акцент (макет) */
    --hd-blue-dark: #0338b5;    /* hover акцента (по ТЗ) */
    --hd-bg: #ffffff;           /* фон шапки */
    --hd-line: #e2e7eb;         /* рамки шапки */
    --hd-search-bg: #f8fafb;    /* фон поиска */
    --hd-muted: #56616b;        /* вторичный текст шапки */
}

/* ---------- СВЕТЛАЯ ГАММА ВИТРИНЫ (Этап 2) ----------
   Тёмные --nv-ink заменены синим акцентом ТОЛЬКО на витрине:
   body.admin (админка) продолжает видеть исходные тёмные токены.
   Затронуто: .btn--primary/.btn--icon-fill (ui), рамки/фокусы/
   активные табы каталога, CTA — всё синее вместо #101114. */
body:not(.admin) {
    /* Вторичный текст витрины читается и на белых, и на серых панелях. */
    --nv-tx-3: #626875;
    --nv-tx-2: #535965;
    --color-text-secondary: #595f68;
    --color-text-muted: #626875;
    --color-text-faint: #626875;
    --nv-ink: var(--hd-blue);
    --nv-ink-hover: var(--hd-blue-dark);
    /* Тот же синий для компонентов на --color-primary (кнопки,
       фокусы, радио, инпуты): админка (.admin) видит исходный чёрный. */
    --color-primary: var(--hd-blue);
    --color-primary-hover: var(--hd-blue-dark);
}

/* ---------- ШАПКА (Этап 1 редизайна, по макету) ----------
   Светлая двухуровневая: логотип + поиск + действия / каталог-навигация.
   Классы .nav-*/ /* (is-active, бейджи) сохранены — их дёргает JS. */

/* Тонкая синяя кромка сверху (как в макете) */
#bpk-header-root {
    position: sticky;
    top: 0;
    z-index: 200;
    display: block;
    background: var(--hd-bg);
    border-top: 5px solid var(--hd-blue);
    border-bottom: 1px solid var(--hd-line);
}
#bpk-header-root.is-scrolled { box-shadow: 0 6px 18px rgba(16, 35, 53, 0.12); }

/* Ряд 1 */
#bpk-header-root .hdr-main {
    display: flex;
    align-items: center;
    gap: 24px;
    max-width: var(--container);
    min-height: 78px;
    margin: 0 auto;
    padding: 0 24px;
    box-sizing: border-box;
}

/* Логотип-ссылка: синий знак + бренд */
#bpk-header-root .logo {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    font-weight: 800;
    font-size: 20px;
    letter-spacing: 0;
    color: #19232d;
    text-decoration: none;
    white-space: nowrap;
}
#bpk-header-root .logo-mark {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    margin-right: 8px;
    border-radius: 8px;
    background: var(--hd-blue);
    color: #fff;
    font-size: 19px;
}
#bpk-header-root img.logo-mark {
    display: block;
    padding: 0;
    background: none;
    object-fit: contain;
}
#bpk-header-root .logo:hover .logo-mark { background: var(--hd-blue-dark); }
#bpk-header-root .logo:hover img.logo-mark { background: none; }
#bpk-header-root a.logo:focus-visible { outline: 2px solid var(--hd-blue); outline-offset: 3px; }

/* Поиск: тянется, не давит соседей */
#bpk-header-root .hdr-search {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
}
#bpk-header-root .hdr-search-ico {
    position: absolute;
    left: 14px;
    display: inline-flex;
    color: #77818a;
    pointer-events: none;
}
#bpk-header-root .hdr-search-ico svg { width: 17px; height: 17px; }
#bpk-header-root #hdr-search {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 40px 14px 40px;
    border: 1px solid #dce2e7;
    border-radius: 8px;
    background: var(--hd-search-bg);
    color: #19232d;
    font: inherit;
    font-size: 0.85rem;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    appearance: none;
    -webkit-appearance: none;
}
/* Крестик очистки — свой, не системный (webkit уродливый) */
#bpk-header-root #hdr-search::-webkit-search-cancel-button { display: none; }
#bpk-header-root #hdr-search::placeholder { color: #77818a; }
#bpk-header-root #hdr-search:focus {
    outline: none;
    border-color: var(--hd-blue);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(6, 69, 216, 0.12);
}
#bpk-header-root .hdr-search-clear {
    position: absolute;
    right: 8px;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1.05rem;
    line-height: 1;
    color: #77818a;
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}
#bpk-header-root .hdr-search-clear:hover { color: #19232d; background: #eef2f5; }
/* Атрибут hidden должен побеждать display:inline-flex у класса */
#bpk-header-root .hdr-search-clear[hidden] { display: none; }
#bpk-header-root .hdr-search-clear:focus-visible { outline: 2px solid var(--hd-blue); outline-offset: 1px; }

/* Выпадашка результатов */
#bpk-header-root .hdr-search-drop {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: min(70vh, 560px);
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--hd-line);
    border-radius: 10px;
    box-shadow: 0 14px 30px rgba(16, 35, 53, 0.14);
    z-index: 300;
}
#bpk-header-root .hdr-search-group + .hdr-search-group {
    border-top: 1px solid #eef1f4;
}
#bpk-header-root .hdr-search-group-title {
    padding: 8px 14px 4px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #8a95a0;
}
#bpk-header-root .hdr-search-item {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 9px 14px;
    color: #19232d;
    font-size: 0.85rem;
    text-decoration: none;
}
#bpk-header-root .hdr-search-item:hover,
#bpk-header-root .hdr-search-item.is-active { background: #f1f6fa; }
#bpk-header-root .hdr-search-name { min-width: 0; overflow-wrap: anywhere; }
#bpk-header-root .hdr-search-name mark,
#bpk-header-root .hdr-search-sub mark {
    background: #e5eeff;
    color: #0645d8;
    border-radius: 3px;
    padding: 0 2px;
}
#bpk-header-root .hdr-search-sub { flex-shrink: 0; font-size: 0.72rem; color: var(--hd-muted); }
#bpk-header-root .hdr-search-price {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 700;
    color: #19232d;
}
#bpk-header-root .hdr-search-empty { padding: 12px 14px; font-size: 0.82rem; color: var(--hd-muted); }
#bpk-header-root .hdr-search-all {
    display: block;
    padding: 11px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--hd-blue);
    background: #f7f9fb;
    border-top: 1px solid #eef1f4;
    text-decoration: none;
}
#bpk-header-root .hdr-search-all:hover { background: #eef3f9; }

/* Действия справа */
#bpk-header-root .nav-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
#bpk-header-root .nav-action {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 44px;
    padding: 0 10px;
    margin: 0;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--hd-muted);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease, background-color 0.2s ease;
}
#bpk-header-root .nav-action svg { width: 18px; height: 18px; }
#bpk-header-root .nav-action:hover { color: #19232d; background: #f1f4f6; }
#bpk-header-root .nav-action.is-active { color: var(--hd-blue); }
#bpk-header-root .nav-action:focus-visible { outline: 2px solid var(--hd-blue); outline-offset: 2px; }

/* Бейдж количества */
#bpk-header-root .cart-count {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-pill);
    background: var(--hd-blue);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1;
}

/* Ряд 2 — навигация каталога (по центру) */
#bpk-header-root .hdr-nav { border-top: 1px solid var(--hd-line); }
#bpk-header-root .nav-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}
#bpk-header-root .nav-links::-webkit-scrollbar { display: none; }
#bpk-header-root .nav-link {
    position: relative;
    padding: 16px 0;
    color: #19232d;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    transition: color 0.2s ease;
}
#bpk-header-root .nav-link:hover { color: var(--hd-blue); }
#bpk-header-root .nav-link.is-active { color: var(--hd-blue); }
#bpk-header-root .nav-link:focus-visible { outline: 2px solid var(--hd-blue); outline-offset: -2px; }

/* Кнопка звука — круглая, как была (светлый вариант) */
#bpk-header-root .nav-sound {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--hd-line);
    border-radius: 50%;
}
#bpk-header-root .nav-sound:hover { border-color: #b9c4cc; background: #f1f4f6; }
#bpk-header-root .nav-sound:active { transform: scale(0.92); }
#bpk-header-root .nav-sound svg { width: 16px; height: 16px; }

/* (старая тёмная шапка удалена на Этапе 1 — см. блок выше) */

/* ---------- ФУТЕР (светлый, Этап 1) ---------- */
#bpk-footer-root {
    display: block;
    background: var(--nv-panel);
    border-top: 1px solid var(--hd-line);
    margin-top: 56px;
    padding: 25px max(24px, calc((100% - var(--container)) / 2));
    color: #68747f;
    font-size: 0.8rem;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    max-width: var(--container);
    margin: 0 auto;
}

.footer-brand { font-weight: 800; letter-spacing: 0.04em; color: #19232d; }

.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-link { color: #68747f; text-decoration: none; }
.footer-link:hover { color: var(--hd-blue); }
.footer-link.is-active { color: var(--hd-blue); font-weight: 700; }
.footer-link:focus-visible { outline: 2px solid var(--hd-blue); outline-offset: 2px; }

/* ---------- STICKY FOOTER: тёмный футер всегда прижат к низу экрана ----------
   Контент короче вьюпорта — без этого футер «зависал» посередине,
   а ниже оставалась белая пустота. Админка исключена (свой каркас). */
body:not(.admin) {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
body:not(.admin) > #bpk-header-root,
body:not(.admin) > #bpk-footer-root { flex-shrink: 0; }
body:not(.admin) > main { flex: 1 0 auto; }

/* ---------- Кнопка «ВСЕ КАТЕГОРИИ» + название категории ---------- */
.cat-crumbs-head {
    position: relative;
    max-width: min(100% - 48px, 1080px);
    margin: 64px auto 40px;
}

.cat-crumbs-head .page-title {
    margin: 0;
    width: 100%;
    max-width: none;
    text-align: center;
}

.cat-all-link {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--color-text-secondary);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-btn);
    white-space: nowrap;
    transition:
        color 0.2s ease,
        border-color 0.2s ease,
        background-color 0.2s ease,
        transform 0.15s ease;
}
.cat-all-link:hover {
    color: var(--color-text);
    border-color: var(--color-text);
    background: var(--color-surface-soft);
}
.cat-all-link:active { transform: translateY(-50%) scale(0.97); }
.cat-all-link:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

.cat-all-ico {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .cat-crumbs-head { margin: 40px auto 28px; }
    .cat-all-link {
        position: static;
        top: auto;
        left: auto;
        transform: none;
        font-size: 0.76rem;
        padding: 8px 14px;
    }
    .cat-all-link:active { transform: scale(0.97); }
    .cat-crumbs-head .page-title { margin: 14px 0 0; font-size: 24px; }
}

/* ---------- АДАПТИВНОСТЬ ШАПКИ (Этап 1) ----------
   ≤900px: ряд 1 (лого + действия иконками), ряд 2 — поиск во всю
   ширину, ряд 3 — навигация горизонтальной лентой (мобильное меню
   без гамбургера: предсказуемо, ничего не перекрывает). */
@media (max-width: 900px) {
    #bpk-header-root .hdr-main {
        flex-wrap: wrap;
        gap: 10px 16px;
        min-height: 0;
        padding: 12px 16px;
    }

    #bpk-header-root .logo { font-size: 17px; }
    #bpk-header-root .logo-mark { width: 30px; height: 30px; font-size: 17px; }

    #bpk-header-root .nav-actions { gap: 2px; }
    #bpk-header-root .nav-action > span:not(.cart-count) { display: none; } /* только иконки */
    #bpk-header-root .nav-action { height: 44px; gap: 0; padding: 0 10px; }

    #bpk-header-root .hdr-search { order: 3; flex-basis: 100%; }

    #bpk-header-root .hdr-nav { border-top: 0; }
    /* Лента на мобильном: старт слева, иначе центрирование в overflow
       уводит первые пункты в отрицательную зону и делает их
       недоступными (ГЛАВНАЯ / РАБОЧЕЕ МЕСТО обрезались). */
    #bpk-header-root .nav-links { gap: 20px; padding: 4px 16px 12px; justify-content: flex-start; }
    #bpk-header-root .nav-link { font-size: 0.74rem; padding: 8px 0; }

    .footer-inner { gap: 10px; }
    .footer-links { gap: 14px; }
}

/* ============================================================
   ЭФФЕКТЫ И АНИМАЦИИ (общие)
   ============================================================ */

@keyframes fx-up {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fx-pop {
    0%   { transform: scale(0.82); }
    55%  { transform: scale(1.08); }
    100% { transform: scale(1); }
}
@keyframes fx-bump {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.14); }
    70%  { transform: scale(0.96); }
    100% { transform: scale(1); }
}
@keyframes fx-shake {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-5px); }
    50%      { transform: translateX(5px); }
    75%      { transform: translateX(-3px); }
}

.fx-pop  { animation: fx-pop 0.32s cubic-bezier(0.2, 1.4, 0.4, 1); }
.fx-bump { animation: fx-bump 0.36s ease; }
.fx-shake { animation: fx-shake 0.3s ease; }

/* ---------- Анимация появления контента (без стаггера после 6 шт) ---------- */
body:not(.admin) main { animation: fx-up 0.36s ease both; }

body:not(.admin) .page-title,
body:not(.admin) main > section { animation: fx-up 0.36s ease both; }
body:not(.admin) main > section:nth-of-type(2) { animation-delay: 0.04s; }
body:not(.admin) main > section:nth-of-type(3) { animation-delay: 0.08s; }

body:not(.admin) .products-grid > *,
body:not(.admin) .categories > * { animation: fx-up 0.36s ease both; }
body:not(.admin) .products-grid > *:nth-child(2),
body:not(.admin) .categories > *:nth-child(2) { animation-delay: 0.04s; }
body:not(.admin) .products-grid > *:nth-child(3),
body:not(.admin) .categories > *:nth-child(3) { animation-delay: 0.08s; }
body:not(.admin) .products-grid > *:nth-child(4),
body:not(.admin) .categories > *:nth-child(4) { animation-delay: 0.12s; }
body:not(.admin) .products-grid > *:nth-child(5),
body:not(.admin) .categories > *:nth-child(5) { animation-delay: 0.16s; }
body:not(.admin) .products-grid > *:nth-child(6),
body:not(.admin) .categories > *:nth-child(6) { animation-delay: 0.2s; }

/* ---------- Микровзаимодействия кнопок ---------- */
.cmp-cart:active { transform: scale(0.97); }

/* ---------- SEO-блок: короткий текст для поисковиков ---------- */
.seo-note {
    max-width: 860px;
    margin: 8px auto 0;
    padding: 18px 22px;
    background: var(--nv-panel);
    border: 1px solid var(--nv-line);
    border-radius: 12px;
}
.seo-note h2 {
    margin: 0 0 8px;
    font-size: 1.05rem;
}
.seo-note p {
    margin: 0 0 8px;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--nv-tx-2);
}
.seo-note p:last-child { margin-bottom: 0; }
.seo-note a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- SEO-автоблок (noscript-каталог, виден без JS) ---------- */
.seo-auto { max-width: var(--container); margin: 18px auto 0; padding: 0 24px; }
.seo-auto h2 { font-size: 1rem; color: #19232d; }
.seo-auto ul { margin: 8px 0 0; padding-left: 20px; font-size: 0.88rem; color: #4d5a66; }
.seo-auto li { margin-bottom: 6px; line-height: 1.5; }

/* ---------- Хлебные крошки (SEO + навигация, статичный HTML) ---------- */
.crumbs {
    max-width: var(--container);
    margin: 0 auto;
    padding: 14px 24px 0;
    font-size: 0.78rem;
    color: #68747f;
}
.crumbs a { color: inherit; text-decoration: none; }
.crumbs a:hover { color: var(--hd-blue); text-decoration: underline; }
.crumbs .crumb-sep { margin: 0 8px; color: #aab4bc; }
.crumbs [aria-current="page"] { color: #19232d; }

/* (старая тёмная кнопка звука удалена на Этапе 1 — см. светлый вариант в блоке шапки выше) */

/* ---------- Уважение к настройке reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001s !important;
    }
}

/* ---------- Опт/розница (ставка и порог — из настроек магазина) ----------
   Опт крупно первым, розница серым выше + пометка про порог. */
.bpk-prices { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.bpk-retail { font-size: 0.72em; color: #8a93a0; font-weight: 400; }
.bpk-opt { font-size: 1em; font-weight: 800; color: inherit; }
.bpk-opt-note { font-size: 0.68em; color: #5f8f5f; font-weight: 600; white-space: nowrap; }
.bpk-opt-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 0.72em; font-weight: 700; color: #2e7d32; background: #e6f4ea; border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.bpk-opt-badge svg { width: 13px; height: 13px; flex: none; }
.bpk-stock { display: inline-flex; align-items: center; gap: 5px; background: #e7f8ee; color: #138845; font-size: 11px; font-weight: 750; border-radius: 30px; padding: 7px 10px; white-space: nowrap; }
.bpk-stock svg { width: 13px; height: 13px; flex: none; }
/* Общий степпер количества (карточки/байбокс, как в ветке с локалки 8080). */
.qty-stepper { display: inline-flex; align-items: stretch; border: 1.5px solid #dfe3ea;
    border-radius: 12px; overflow: hidden; background: #fff; flex: none; }
.qs-btn { width: 40px; min-height: 46px; border: 0; background: #f1f3f7; color: #3c4350;
    font-size: 20px; font-weight: 600; line-height: 1; cursor: pointer; }
.qs-btn:hover { background: #e6eaf1; }
.qs-btn:disabled { opacity: 0.4; cursor: default; }
.qs-input { width: 44px; border: 0; text-align: center; font-size: 16px; font-weight: 700;
    color: #19232d; background: #fff; outline: none; -moz-appearance: textfield; }
.qs-input::-webkit-outer-spin-button, .qs-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.card-foot-actions .qty-stepper { margin-right: 8px; }
.cfg-total-price .bpk-prices { align-items: flex-end; text-align: right; }

.product-stock { display:block; color:#26713b; font-size:13px; font-weight:500; line-height:1.4; margin-top:6px; }

/* Retail identity below the shared brand. */
#bpk-header-root .retail-brand-text{display:flex;flex-direction:column;gap:4px;line-height:1.1}
#bpk-header-root .retail-brand-text small{font-size:9px;font-weight:500;letter-spacing:1.3px;color:#64789b;white-space:nowrap}
