/* Навигация по категориям: верхняя лента, плавающий бургер, боковое меню,
 * переключатель языков.
 *
 * Значения перенесены из самописного HTML-блока Битрикса без изменений,
 * чтобы вид совпал. Правки только там, где это чинит поведение:
 *   - .lang-emoji заменён на .lang-flag__img со вставным SVG: эмодзи-флаги
 *     не отрисовываются на Windows;
 *   - бургер и кнопки стали <button>, поэтому нужен сброс стилей браузера.
 */

:root {
    --menu-brand: #7e1329;
    --menu-brand-glow: rgba(126, 19, 41, 0.18);
    --menu-accent: #c0dd92;
    --menu-bg: #ffffff;
    --menu-bg-alpha: rgba(255, 255, 255, 0.92);
    --menu-glass: rgba(255, 255, 255, 0.88);
    --menu-glass-border: rgba(255, 255, 255, 0.5);
    --menu-text: #2c2c2c;
    --menu-text-soft: #888888;
    --menu-pill-border: rgba(126, 19, 41, 0.15);
    --menu-pill-bg: rgba(126, 19, 41, 0.04);
    --menu-pill-hover: rgba(126, 19, 41, 0.1);
    --menu-shadow: rgba(0, 0, 0, 0.08);
    --menu-fade: rgba(255, 255, 255, 0.95);
    --menu-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --menu-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ------------------------------------------------- верхняя лента вкладок */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10002;
    background: var(--menu-bg-alpha);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--menu-pill-border);
    box-shadow: 0 2px 20px var(--menu-shadow);
    transition: opacity 0.4s ease, transform 0.4s var(--menu-ease),
                background 0.4s ease, border-color 0.4s ease;
}

.top-bar.hidden {
    opacity: 0;
    transform: translateY(-100%);
    pointer-events: none;
}

.top-bar-inner {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.top-bar-inner::-webkit-scrollbar { display: none; }

.top-bar-link {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-family: "Nunito", sans-serif;
    font-weight: 700;
    font-size: 13px;
    color: var(--menu-brand);
    background: var(--menu-pill-bg);
    border: 1.5px solid var(--menu-pill-border);
    white-space: nowrap;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.25s ease;
    opacity: 0;
    animation: tabPillIn 0.45s var(--menu-ease) forwards;
}

.top-bar-link:hover {
    background: var(--menu-pill-hover);
    border-color: var(--menu-brand);
    transform: translateY(-1px);
}

.top-bar-link:active { transform: scale(0.96); }

.top-bar-link.active-section {
    background: var(--menu-brand);
    color: var(--menu-bg);
    border-color: var(--menu-brand);
    box-shadow: 0 3px 12px var(--menu-brand-glow);
}

.top-bar-hint {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    display: inline-flex;
    color: var(--menu-brand);
    opacity: 0;
    pointer-events: none;
    animation: hintPulse 1.8s ease-in-out 1.2s 3 forwards;
}

/* Затухание по краям ленты, чтобы было видно, что она прокручивается. */
.top-bar::before,
.top-bar::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 32px;
    z-index: 2;
    pointer-events: none;
    transition: background 0.4s ease;
}

.top-bar::before { left: 0; background: linear-gradient(to right, var(--menu-fade), transparent); }
.top-bar::after { right: 0; background: linear-gradient(to left, var(--menu-fade), transparent); }

@keyframes tabPillIn {
    0%   { opacity: 0; transform: translateY(-8px) scale(0.92); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes hintPulse {
    0%   { opacity: 0; transform: translateY(-50%) translateX(0); }
    20%  { opacity: 0.7; }
    50%  { opacity: 0.7; transform: translateY(-50%) translateX(-6px); }
    80%  { opacity: 0.7; transform: translateY(-50%) translateX(0); }
    100% { opacity: 0; }
}

/* ------------------------------------------------------ плавающий бургер */
.menu-toggle {
    position: fixed;
    top: 14px;
    left: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    z-index: 10002;
    background: var(--menu-bg);
    padding: 10px 16px;
    border: none;
    border-radius: 14px;
    box-shadow: 0 3px 14px var(--menu-shadow);
    transition: transform 0.35s var(--menu-spring), box-shadow 0.2s ease,
                opacity 0.35s ease, background 0.4s ease;
    -webkit-tap-highlight-color: transparent;
    animation: floatBob 3s ease-in-out infinite;
}

.menu-toggle.hidden {
    opacity: 0;
    transform: scale(0.5) translateY(10px);
    pointer-events: none;
    animation: none;
}

.menu-toggle.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
    animation: burgerAppear 0.5s var(--menu-spring) forwards,
               floatBob 3s ease-in-out 0.5s infinite;
}

.menu-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--menu-shadow);
    animation-play-state: paused;
}

.menu-toggle:active { transform: scale(0.95); }

.menu-toggle-lines {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 18px;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.menu-line {
    display: block;
    height: 2px;
    background: var(--menu-brand);
    border-radius: 2px;
    transition: all 0.3s var(--menu-spring);
    transform-origin: center;
}

.menu-line-1 { width: 18px; }
.menu-line-2 { width: 14px; }
.menu-line-3 { width: 10px; }

.menu-toggle.active .menu-toggle-lines {
    opacity: 0;
    transform: scale(0);
    width: 0;
    overflow: hidden;
    position: absolute;
}

.menu-plate {
    display: none;
    line-height: 1;
    color: var(--menu-brand);
    transition: transform 0.3s var(--menu-spring);
}

.menu-toggle.active .menu-plate {
    display: block;
    animation: plateAppear 0.4s var(--menu-spring);
}

.menu-text {
    font-family: "Nunito", sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--menu-brand);
    letter-spacing: 0.5px;
    transition: color 0.4s ease;
}

@keyframes floatBob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-5px); }
}

@keyframes burgerAppear {
    0%   { opacity: 0; transform: scale(0.3) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes plateAppear {
    0%   { transform: scale(0) rotate(-45deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* ---------------------------------------------------------- боковое меню */
.menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 9999;
}

.menu-overlay.active { opacity: 1; pointer-events: auto; }

.b24-food-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: var(--menu-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--menu-glass-border);
    display: flex;
    flex-direction: column;
    z-index: 10001;
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateX(-110%);
    transition: transform 0.35s var(--menu-ease), background 0.4s ease;
    box-shadow: 4px 0 24px var(--menu-shadow);
}

.b24-food-menu.active { transform: translateX(0); }
.b24-food-menu::-webkit-scrollbar { width: 3px; }
.b24-food-menu::-webkit-scrollbar-track { background: transparent; }
.b24-food-menu::-webkit-scrollbar-thumb { background: var(--menu-pill-border); border-radius: 3px; }

.menu-links {
    padding: 60px 12px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-links a {
    display: block;
    padding: 10px 14px;
    border-radius: 10px;
    text-decoration: none;
    font-family: "Nunito", sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--menu-brand);
    background: transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.2s ease, padding-left 0.2s ease, color 0.4s ease;
    opacity: 0;
    transform: translateX(-16px);
}

.b24-food-menu.active .menu-links a {
    animation: menuReveal 0.3s var(--menu-ease) forwards;
}

.menu-links a:hover { background: var(--menu-pill-hover); padding-left: 18px; }

@keyframes menuReveal {
    to { opacity: 1; transform: translateX(0); }
}

/* ------------------------------------------------ переключатель языков */
.right-controls {
    position: fixed;
    top: 10px;
    right: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 10003;
    align-items: center;
}

.lang-flag {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    text-decoration: none;
    padding: 3px 5px;
    border-radius: 8px;
    background: var(--menu-bg);
    box-shadow: 0 1px 6px var(--menu-shadow);
    transition: transform 0.2s ease, background 0.4s ease;
    -webkit-tap-highlight-color: transparent;
}

.lang-flag:hover { transform: translateY(-2px); }

/* Раньше здесь стоял эмодзи-флаг. На Windows он не рисуется - система
   показывает две буквы, и переключатель выглядит сломанным. SVG рисуется
   везде одинаково. */
.lang-flag__img {
    display: block;
    line-height: 0;
    border-radius: 2px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.lang-label {
    font-family: "Nunito", sans-serif;
    font-size: 9px;
    font-weight: 700;
    color: var(--menu-text-soft);
    letter-spacing: 0.5px;
    transition: color 0.4s ease;
}

.lang-flag.current {
    background: var(--menu-brand);
    box-shadow: 0 3px 12px var(--menu-brand-glow);
}

.lang-flag.current .lang-label { color: rgba(255, 255, 255, 0.9); }

/* ------------------------------------------------------------ мобильные */
@media (max-width: 420px) {
    .b24-food-menu { width: min(260px, 82vw); }
    .menu-toggle { padding: 8px 12px; }
    .lang-label { display: none; }
    .top-bar-link { padding: 7px 12px; font-size: 12px; }
}

/* Уважаем системную настройку «меньше движения»: постоянно покачивающийся
   бургер и подпрыгивающие вкладки в этом режиме неуместны. */
@media (prefers-reduced-motion: reduce) {
    .menu-toggle,
    .menu-toggle.visible,
    .top-bar-link,
    .top-bar-hint,
    .b24-food-menu.active .menu-links a { animation: none; opacity: 1; transform: none; }
}
