/* Каркас: объявление, шапка-«таблетка», меню, подвал, нижняя панель */

/* Слот иконки: картинка из static/img/icon-<имя>.png|svg|webp, пока файла нет, слот пустой (или с текстом) */
.icon-slot { display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; }
.icon-slot img { width: 100%; height: 100%; object-fit: contain; }
.icon-slot:empty { display: none; }
.icon-slot.has-text { width: auto; height: auto; font-size: 13px; font-weight: 600; white-space: nowrap; }
.bottom-nav .icon-slot { width: 24px; height: 24px; }

/* Тема: иконки и подписи */
[data-theme="dark"] .icon-moon, [data-theme="dark"] .when-light { display: none; }
html:not([data-theme="dark"]) .icon-sun, html:not([data-theme="dark"]) .when-dark { display: none; }

/* Появление страницы: простая анимация на всех страницах */
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
/* backwards: после анимации на <main> не остаётся transform, иначе fixed-элементы внутри цепляются к странице */
.page-in { animation: page-in 0.5s var(--ease) backwards; }

/* Блоки, появляющиеся при прокрутке (включается только когда загружен GSAP) */
.motion-ready [data-reveal] { opacity: 0; transform: translateY(24px); }

.stub { padding-block: 72px; min-height: 50vh; }
.stub h1 { font-size: clamp(28px, 5vw, 48px); line-height: 1.15; margin-bottom: 16px; }
.stub p { color: var(--text-secondary); max-width: 60ch; }

/* Объявление */
.announce { background: var(--accent); color: var(--on-accent); font-size: 13px; font-weight: 600; text-align: center; padding: 9px var(--gutter); }
.announce a { text-decoration: underline; text-underline-offset: 3px; }

/* Шапка: тёмная закруглённая «таблетка», ниже закруглённая полоса с разделами */
.site-header { position: sticky; top: 0; z-index: 100; padding: 14px 0 10px; background: var(--bg-primary); transition: box-shadow var(--speed); }
.site-header.is-scrolled { box-shadow: 0 12px 24px -16px rgba(0, 0, 0, 0.4); }

.top-bar { display: flex; align-items: center; gap: 18px; padding: 10px 14px 10px 28px; border-radius: 50px; background: var(--header-bg); color: var(--header-text); }

.logo { display: flex; align-items: center; gap: 12px; flex: none; transition: transform 0.2s; }
.logo:hover { transform: scale(1.03); }
.logo-img { width: 44px; height: 44px; object-fit: contain; }
.logo-text { display: flex; flex-direction: column; line-height: 1; }
.logo-title { font-weight: 700; font-size: 19px; letter-spacing: 0.06em; text-transform: uppercase; }
.logo-sub { font-size: 11px; letter-spacing: 0.42em; text-transform: uppercase; color: var(--accent); margin-top: 4px; }

/* Рамка с красно-жёлтым градиентом, как на старом сайте */
.search input, .contact-btn {
    border: 2px solid transparent;
    background-image: linear-gradient(var(--header-bg), var(--header-bg)), linear-gradient(90deg, var(--accent-red), var(--accent));
    background-origin: border-box;
    background-clip: padding-box, border-box;
    color: var(--header-text);
}

.search { position: relative; flex: 1; min-width: 0; }
.search input { width: 100%; height: 46px; padding: 0 84px 0 22px; border-radius: 25px; font: inherit; font-size: 15px; outline: none; transition: box-shadow var(--speed); }
.search input::placeholder { color: #aaaaaa; }
.search input:focus { box-shadow: 0 0 15px rgba(251, 192, 45, 0.25); }
.search button { position: absolute; right: 6px; top: 6px; min-width: 34px; height: 34px; padding: 0 12px; display: grid; place-items: center; border: 0; border-radius: 999px; background: none; color: var(--accent); }

.header-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.contact-btn { display: inline-flex; align-items: center; height: 44px; padding: 0 25px; margin-right: 6px; border-radius: 25px; font-weight: 600; font-size: 14px; white-space: nowrap; transition: transform 0.2s, box-shadow var(--speed); }
.contact-btn:hover { transform: scale(1.05); box-shadow: 0 0 15px rgba(251, 192, 45, 0.25); }

.icon-btn { position: relative; min-width: 44px; height: 44px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 50%; background: transparent; color: inherit; transition: transform 0.2s; }
.icon-btn:hover { transform: scale(1.1); }
.badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent-red); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.badge[hidden], .badge-inline[hidden] { display: none; }
.badge-inline { display: inline-block; min-width: 20px; margin-left: 6px; padding: 0 6px; border-radius: 10px; background: var(--accent-red); color: #fff; font-size: 12px; line-height: 20px; text-align: center; vertical-align: 1px; }
.only-mobile { display: none; }

.main-nav { margin-top: 10px; }
.nav-inner { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 0 30px; border: 2px solid transparent; border-radius: 25px; background-image: var(--nav-bg-img); background-origin: border-box; background-clip: padding-box, border-box; font-weight: 700; font-size: 14px; color: var(--text-primary); }
[data-theme="dark"] .nav-inner { backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.nav-inner ul { display: flex; align-items: center; gap: 24px; margin: 0; padding: 0; list-style: none; overflow-x: auto; scrollbar-width: none; }
.nav-inner ul::-webkit-scrollbar { display: none; }
.nav-inner a { position: relative; display: block; padding: 13px 0; white-space: nowrap; transition: color 0.2s; }
.nav-inner ul a::after { content: ""; position: absolute; left: 0; bottom: 8px; width: 0; height: 2px; background: linear-gradient(90deg, var(--accent-red), var(--accent)); transition: width 0.3s ease; }
.nav-inner ul a:hover::after { width: 100%; }
.nav-inner ul a:hover { color: var(--accent-red); }
.nav-phone { flex: none; }

/* Выезжающее меню: плавающая закруглённая панель */
.menu-overlay { position: fixed; inset: 0; z-index: 1000; background: var(--overlay-bg); opacity: 0; visibility: hidden; transition: opacity var(--speed), visibility var(--speed); }
.menu-overlay.open { opacity: 1; visibility: visible; }

.side-menu { position: fixed; top: 12px; right: 12px; bottom: 12px; z-index: 1001; width: min(340px, calc(100vw - 24px)); display: flex; flex-direction: column; padding: 24px 28px calc(28px + env(safe-area-inset-bottom)); overflow-y: auto; border-radius: 28px; background: var(--bg-primary); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25); transform: translateX(calc(100% + 24px)); visibility: hidden; transition: transform 0.45s var(--ease), visibility 0.45s; }
[data-theme="dark"] .side-menu { background: rgba(14, 14, 20, 0.96); border: 1px solid var(--border-color); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); }
.side-menu.open { transform: none; visibility: visible; }

.side-close { align-self: flex-end; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; color: var(--text-primary); font-size: 24px; line-height: 1; transition: transform var(--speed); }
.side-close:hover { transform: rotate(90deg); }
.side-title { font-size: 22px; margin: 4px 0 18px; }
.side-menu hr { width: 100%; border: 0; border-top: 1px solid var(--border-color); margin: 22px 0; }

.side-links { display: flex; flex-direction: column; gap: 16px; margin: 0; padding: 0; list-style: none; font-weight: 600; font-size: 17px; }
.side-links-minor { font-size: 15px; gap: 14px; }
.side-links li { opacity: 0; transform: translateX(18px); transition: opacity 0.4s var(--ease), transform 0.4s var(--ease); }
.side-menu.open .side-links li { opacity: 1; transform: none; transition-delay: calc(var(--i, 1) * 45ms + 150ms); }
.side-links a { transition: color var(--speed); }
.side-links a:hover { color: var(--accent-orange); }

.side-theme { display: flex; align-items: center; gap: 12px; padding: 0; border: 0; background: none; color: var(--text-primary); font-weight: 600; font-size: 15px; }
.side-contacts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 28px; }
.pill { padding: 10px 16px; border: 0; font-family: inherit; cursor: pointer; border-radius: 12px; background: var(--header-bg); color: var(--header-text); font-size: 13px; font-weight: 600; transition: transform var(--speed); }
.pill:hover { transform: translateY(-2px); }
html.menu-open { overflow: hidden; }

/* Меню корзины и избранного */
.panel-overlay { position: fixed; inset: 0; z-index: 1100; background: transparent; visibility: hidden; transition: background-color var(--speed); }
.panel-overlay.open { visibility: visible; }

.cart-panel { position: fixed; top: 90px; right: 16px; z-index: 1101; width: min(400px, calc(100vw - 24px)); max-height: min(640px, calc(100vh - 110px)); display: flex; flex-direction: column; border-radius: 24px; background: var(--bg-primary); border: 1px solid var(--border-color); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28); opacity: 0; visibility: hidden; transform: translateY(-8px) scale(0.98); transform-origin: top right; transition: opacity var(--speed), transform 0.35s var(--ease), visibility var(--speed); }
[data-theme="dark"] .cart-panel { background: rgba(14, 14, 20, 0.97); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); }
.cart-panel.open { opacity: 1; visibility: visible; transform: none; }

.panel-tabs { display: flex; gap: 6px; padding: 14px 14px 0; }
.panel-tab { flex: 1; height: 42px; border: 0; border-radius: 21px; background: var(--bg-secondary); color: var(--text-primary); font-weight: 600; font-size: 14px; transition: background-color var(--speed), color var(--speed); }
.panel-tab[aria-selected="true"] { background: var(--accent); color: var(--on-accent); }
.panel-count:not(:empty) { margin-left: 4px; padding: 1px 7px; border-radius: 10px; background: rgba(0, 0, 0, 0.15); font-size: 12px; }

.panel-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; min-height: 120px; }
.panel-empty { margin: auto; padding: 24px 12px; text-align: center; color: var(--text-secondary); font-size: 14px; }
.pi { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: start; }
.pi-thumb { width: 56px; height: 72px; border-radius: 12px; background: var(--bg-secondary); overflow: hidden; }
.pi-thumb img { width: 100%; height: 100%; object-fit: contain; }
.pi-name { display: block; font-weight: 600; font-size: 14px; line-height: 1.3; }
a.pi-name:hover { color: var(--accent-orange); }
.pi-sub { margin-top: 2px; font-size: 12px; color: var(--text-muted); }
.pi-price { font-weight: 700; font-size: 14px; }
.pi-qty { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.pi-qty button { width: 28px; height: 28px; border: 1px solid var(--border-color); border-radius: 50%; background: var(--bg-secondary); color: var(--text-primary); font-size: 16px; line-height: 1; }
.pi-qty .pi-price { margin-left: auto; }
.pi-remove { width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: var(--text-muted); font-size: 15px; transition: color var(--speed), transform var(--speed); }
.pi-remove:hover { color: var(--accent-red); transform: rotate(90deg); }

.panel-foot { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-top: 1px solid var(--border-color); }
.panel-foot:empty { display: none; }
.panel-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.panel-total strong { font-size: 20px; }

/* Кнопка-ссылка (например, MAX копирует номер) и всплывающая подсказка */
.link-btn { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.link-btn:hover { color: var(--accent-orange); }
.toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 1300; max-width: calc(100vw - 32px); padding: 12px 20px; border-radius: 999px; background: var(--header-bg); color: var(--header-text); font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: opacity var(--speed), transform var(--speed) var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Подвал */
.site-footer { margin-top: 96px; padding: 56px 0 32px; background: var(--bg-secondary); border-top: 1px solid var(--border-color); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 36px; }
.footer-brand p { margin-top: 16px; max-width: 32ch; color: var(--text-secondary); font-size: 14px; }
.site-footer h3 { margin-bottom: 14px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; }
.site-footer ul { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; font-size: 14px; }
.site-footer a:hover { color: var(--accent-orange); }
.site-footer .muted { color: var(--text-muted); }
.footer-bottom { display: flex; flex-direction: column; gap: 6px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border-color); font-size: 12px; color: var(--text-muted); }

/* Нижняя панель (телефон) */
.bottom-nav { display: none; }

@media (max-width: 1024px) {
    .contact-btn { display: none; }
    .nav-inner .nav-phone { display: none; }
}

@media (max-width: 768px) {
    body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
    .site-header { position: static; padding-top: 10px; }
    .top-bar { flex-wrap: wrap; gap: 10px 8px; padding: 10px 12px 12px 16px; border-radius: 20px; }
    .logo { margin-right: auto; }
    .logo-img { width: 38px; height: 38px; }
    .only-desktop { display: none; }
    .only-mobile { display: inline-flex; }
    .search { order: 3; flex: 1 0 100%; }
    .nav-inner { padding: 0 16px; border-radius: 20px; }
    .nav-inner ul { gap: 20px; }
    .nav-inner a { padding: 12px 0; }
    .nav-inner ul a::after { bottom: 7px; }
    /* Ссылки подвала: удобная область нажатия на телефоне */
    .site-footer ul { gap: 0; }
    .site-footer li a { display: inline-block; padding: 9px 0; }

    .footer-grid { grid-template-columns: 1fr 1fr; gap: 28px 20px; }
    .footer-brand { grid-column: 1 / -1; }
    .site-footer { margin-top: 64px; padding-top: 40px; }

    .bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; display: grid; grid-template-columns: repeat(4, 1fr); padding-bottom: env(safe-area-inset-bottom); background: var(--bg-primary); border-top: 1px solid var(--border-color); border-radius: 20px 20px 0 0; box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.08); }
    [data-theme="dark"] .bottom-nav { background: rgba(14, 14, 20, 0.96); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
    .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 60px; border: 0; background: none; color: var(--text-primary); font-size: 11px; font-weight: 600; transition: transform var(--speed), color var(--speed); }
    .bottom-nav a:active, .bottom-nav button:active { transform: scale(0.92); }
    .bottom-nav .ico-wrap { position: relative; display: block; line-height: 0; }
    .bottom-nav .badge { top: -7px; right: -10px; }

    .panel-overlay.open { background: var(--overlay-bg); }
    .cart-panel { top: auto; right: 0; bottom: 0; left: 0; width: 100%; max-height: 82vh; border-radius: 24px 24px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); transform: translateY(100%); transform-origin: bottom; }
    .cart-panel.open { transform: none; }
}
