/**
 * Нижняя навигация и шторка «Ещё» (≤820px).
 */
@media (max-width: 820px) {
  /* Отступ под fixed nav — у футера (тёмный), не у body (белая полоса) */
  html {
    scroll-padding-bottom: var(--mobile-bottom-reserve);
  }

  .footer {
    padding-bottom: calc(24px + var(--mobile-bottom-reserve));
  }

  .nav-bottom {
    --nav-bottom-inset-x: max(10px, env(safe-area-inset-left, 0px));
    display: flex;
    position: fixed;
    z-index: 150;
    left: var(--nav-bottom-inset-x);
    right: max(10px, env(safe-area-inset-right, 0px));
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
    min-height: var(--nav-bottom-height);
    padding: 6px 8px;
    align-items: stretch;
    justify-content: space-between;
    gap: 4px;
    background: linear-gradient(180deg, #141414 0%, var(--nav-bottom-bg) 100%);
    border: 1px solid var(--nav-bottom-border);
    border-radius: var(--nav-bottom-radius);
    box-shadow: var(--shadow-dock);
    -webkit-tap-highlight-color: transparent;
  }

  html.nav-sheet-lock .nav-bottom {
    right: calc(max(10px, env(safe-area-inset-right, 0px)) + var(--nav-scroll-lock, 0px));
  }

  html.dish-modal-lock .nav-bottom {
    right: calc(max(10px, env(safe-area-inset-right, 0px)) + var(--dish-scroll-lock, 0px));
  }

  .nav-bottom__item {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    max-width: 5.5rem;
    margin: 0 auto;
    padding: 4px 2px 2px;
    border: none;
    border-radius: 14px;
    background: transparent;
    font: inherit;
    color: var(--nav-bottom-text);
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition:
      color 0.2s ease,
      background 0.2s ease,
      transform 0.15s ease;
  }

  .nav-bottom__item:active {
    transform: scale(0.96);
  }

  .nav-bottom__item:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.55);
    outline-offset: 2px;
  }

  .nav-bottom__pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 32px;
    padding: 0 6px;
  }

  .nav-bottom__ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    color: inherit;
  }

  .nav-bottom__ico svg {
    display: block;
    width: 22px;
    height: 22px;
  }

  .nav-bottom__label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  /* Только текущий раздел — белый текст и иконка, без pill/фона */
  .nav-bottom__item.is-active,
  .nav-bottom__item.is-active .nav-bottom__label,
  .nav-bottom__item.is-active .nav-bottom__ico {
    color: var(--nav-bottom-text-active);
  }

  .nav-bottom__item--cart {
    appearance: none;
    -webkit-appearance: none;
  }

  .nav-bottom__cart-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .cart-count--bottom {
    position: absolute;
    top: -5px;
    right: -8px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--nav-bottom-badge);
    color: var(--nav-bottom-badge-text);
    font-size: 10px;
    font-weight: 800;
    line-height: 17px;
    letter-spacing: -0.02em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    border: 1.5px solid var(--nav-bottom-bg);
  }

  .cart-count--bottom:empty,
  .cart-count--bottom[data-empty="true"] {
    display: none;
  }

  .cart-count--bottom.bump {
    animation: bump 0.35s ease;
  }

  /* Шторка «Ещё» */
  .nav-sheet {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 160;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.24s ease, visibility 0.24s ease;
  }

  .nav-sheet.is-open {
    pointer-events: auto;
    visibility: visible;
    opacity: 1;
  }

  .nav-sheet__backdrop {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 0;
    border: none;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    cursor: pointer;
  }

  .nav-sheet__panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 8px 16px calc(var(--nav-bottom-height) + 24px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(180deg, #1a1a1a 0%, var(--nav-bottom-bg) 100%);
    border-radius: 24px 24px 0 0;
    border-top: 1px solid var(--nav-bottom-border);
    box-shadow: 0 -24px 64px rgba(0, 0, 0, 0.45);
    transform: translateY(105%);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .nav-sheet.is-open .nav-sheet__panel {
    transform: translateY(0);
  }

  .nav-sheet__panel::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    margin: 6px auto 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
  }

  .nav-sheet__title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--nav-bottom-text);
    margin: 0 4px 8px;
  }

  .nav-sheet__links {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .nav-sheet__link {
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 0 16px;
    font-size: 16px;
    font-weight: 600;
    color: var(--nav-bottom-text-active);
    text-decoration: none;
    border-radius: 14px;
    background: var(--nav-bottom-bg-elevated);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: background 0.18s ease, border-color 0.18s ease;
  }

  .nav-sheet__link:active {
    background: var(--nav-bottom-pill-active);
    border-color: rgba(255, 255, 255, 0.12);
  }

  .nav-sheet__link:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.45);
    outline-offset: 2px;
  }

  html.dish-modal-lock .nav-bottom {
    z-index: 140;
  }
}

@media (max-width: 380px) {
  .nav-bottom__label {
    font-size: 9px;
  }

  .nav-bottom__pill {
    min-width: 40px;
    height: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-bottom__item,
  .nav-bottom__pill,
  .nav-sheet,
  .nav-sheet__panel {
    transition: none;
  }
}
