/* ========================================
   BASSHIM — общая шапка и подвал всех страниц
   Подключается на главной, в прайсе, политике, 404, блоге и каталоге.
   Разметку генерирует scripts/build-blog.js (siteHeader / siteFooter);
   в статичные страницы она вставляется между маркерами SITE-HEADER / SITE-FOOTER.
   Палитра своя (как на главной), чтобы шапка выглядела одинаково везде.
   ======================================== */

:root {
    --ch-bg: 246 249 252;
    --ch-fg: 11 27 51;
    --ch-text: 51 65 85;
    --ch-muted: 100 116 139;
    --ch-accent: 2 132 199;
    --ch-btn-from: #0891B2;
    --ch-btn-to: #2563EB;
    --ch-shadow: 0 4px 24px rgba(11, 27, 51, 0.08);
}

[data-theme="dark"] {
    --ch-bg: 6 13 27;
    --ch-fg: 255 255 255;
    --ch-text: 209 213 219;
    --ch-muted: 107 114 128;
    --ch-accent: 0 212 255;
    --ch-btn-from: #00D4FF;
    --ch-btn-to: #3B82F6;
    --ch-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.ch-wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 16px; box-sizing: border-box; }
@media (min-width: 640px) { .ch-wrap { padding: 0 24px; } }
@media (min-width: 1024px) { .ch-wrap { padding: 0 32px; } }

/* ---- Шапка ---- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgb(var(--ch-bg) / 0.85);
    -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
    border-bottom: 1px solid rgb(var(--ch-fg) / 0.06);
    box-shadow: var(--ch-shadow);
    font-family: 'Inter', system-ui, sans-serif;
    transition: background 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}
/* На главной шапка лежит поверх первого экрана и проявляется при прокрутке */
.site-header--overlay { position: fixed; left: 0; right: 0; }
.site-header--overlay:not(.is-scrolled):not(.is-open) {
    background: transparent; border-bottom-color: transparent; box-shadow: none;
    -webkit-backdrop-filter: none; backdrop-filter: none;
}
@supports (padding: env(safe-area-inset-left)) {
    .site-header { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
}

.site-header__bar { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 80px; }

.ch-logo { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; flex-shrink: 0; }
.ch-logo__mark {
    width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff;
    background: linear-gradient(to bottom right, rgb(var(--ch-accent)), var(--ch-btn-to));
    transition: transform 0.3s ease;
}
.ch-logo:hover .ch-logo__mark { transform: scale(1.1); }
.ch-logo__mark svg { width: 24px; height: 24px; }
.ch-logo__text { font: 700 24px/1.33 'Space Grotesk', sans-serif; letter-spacing: -0.025em; color: rgb(var(--ch-fg)); }
.ch-logo__text span { color: rgb(var(--ch-accent)); }

.ch-nav { display: flex; align-items: center; gap: 32px; }
.ch-nav a, .ch-menu__link {
    font-size: 14px; font-weight: 500; line-height: 20px; color: rgb(var(--ch-text)); text-decoration: none;
    transition: color 0.3s ease;
}
.ch-nav a:hover, .ch-nav a[aria-current="page"], .ch-menu__link:hover, .ch-menu__link[aria-current="page"] { color: rgb(var(--ch-accent)); }

.ch-actions { display: flex; align-items: center; gap: 32px; }
.ch-actions__mobile { display: none; align-items: center; gap: 8px; }

.site-header .theme-toggle, .ch-burger {
    display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0;
    border-radius: 12px; border: 1px solid rgb(var(--ch-fg) / 0.1); background: rgb(var(--ch-fg) / 0.04);
    color: rgb(var(--ch-text)); cursor: pointer; transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.site-header .theme-toggle:hover, .ch-burger:hover { color: rgb(var(--ch-accent)); border-color: rgb(var(--ch-accent) / 0.4); }
.site-header .theme-toggle svg { width: 20px; height: 20px; }
.site-header .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .site-header .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .site-header .theme-toggle .icon-moon { display: none; }

.ch-cta {
    position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 24px; border-radius: 12px; border: 0; white-space: nowrap;
    font: 600 14px/20px 'Inter', sans-serif; color: #fff; text-decoration: none;
    background: linear-gradient(135deg, var(--ch-btn-from) 0%, var(--ch-btn-to) 100%);
    box-shadow: 0 4px 20px rgb(var(--ch-accent) / 0.3);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}
.ch-cta::before {
    content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent); transition: left 0.6s ease;
}
.ch-cta:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 8px 30px rgb(var(--ch-accent) / 0.4); }
.ch-cta:hover::before { left: 100%; }

/* Бургер: три линии, нижняя короче; в открытом меню — крестик */
.ch-burger { flex-direction: column; gap: 6px; border-color: transparent; background: transparent; }
.ch-burger span { display: block; width: 24px; height: 2px; border-radius: 2px; background: rgb(var(--ch-fg)); transition: transform 0.3s ease, opacity 0.3s ease, width 0.3s ease; }
.ch-burger span:nth-child(3) { width: 16px; align-self: flex-start; margin-left: 7px; }
.site-header.is-open .ch-burger span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.site-header.is-open .ch-burger span:nth-child(2) { opacity: 0; }
.site-header.is-open .ch-burger span:nth-child(3) { width: 24px; margin-left: 0; transform: translateY(-8px) rotate(-45deg); }

.ch-menu { display: none; border-top: 1px solid rgb(var(--ch-fg) / 0.06); }
.ch-menu__inner { display: grid; gap: 4px; padding-top: 16px; padding-bottom: 24px; }
.ch-menu__link { display: block; padding: 10px 0; font-size: 18px; line-height: 28px; }
.ch-menu .ch-cta { margin-top: 12px; padding: 12px 32px; font-size: 18px; line-height: 28px; }

@media (max-width: 1079px) {
    .ch-nav, .ch-actions__desktop { display: none; }
    .ch-actions__mobile { display: flex; }
    .site-header.is-open .ch-menu { display: block; }
}

/* ---- Подвал ---- */
.site-footer {
    margin-top: 80px; padding: 56px 0 calc(32px + env(safe-area-inset-bottom));
    border-top: 1px solid rgb(var(--ch-fg) / 0.06); background: rgb(var(--ch-fg) / 0.02);
    font: 400 15px/1.5 'Inter', system-ui, sans-serif; color: rgb(var(--ch-text));
}
.site-footer__grid { display: grid; grid-template-columns: 1.5fr repeat(4, 1fr); gap: 32px; }
.site-footer__about p { margin: 16px 0 0; max-width: 320px; font-size: 14.5px; color: rgb(var(--ch-muted)); }
.site-footer__about .ch-logo__mark { width: 32px; height: 32px; border-radius: 9px; }
.site-footer__about .ch-logo__mark svg { width: 20px; height: 20px; }
.site-footer__about .ch-logo__text { font-size: 18px; }
.site-footer__title { margin: 0 0 14px; font: 600 13px/1.2 'Inter', sans-serif; letter-spacing: 0.08em; text-transform: uppercase; color: rgb(var(--ch-muted)); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.site-footer a { color: rgb(var(--ch-text)); text-decoration: none; transition: color 0.2s; }
.site-footer a:hover { color: rgb(var(--ch-accent)); }
.site-footer__bottom {
    margin-top: 40px; padding-top: 20px; border-top: 1px solid rgb(var(--ch-fg) / 0.06);
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; font-size: 13.5px; color: rgb(var(--ch-muted));
}
.site-footer__bottom a { color: rgb(var(--ch-muted)); }
@media (max-width: 1023px) { .site-footer__grid { grid-template-columns: repeat(2, 1fr); } .site-footer__about { grid-column: 1 / -1; } }
@media (max-width: 479px) { .site-footer__grid { grid-template-columns: 1fr; } }

@media print { .site-header, .site-footer { display: none !important; } }
