/*
 * Celular e tablet (até 991px), no padrão do Caliope: o botão do cardápio sempre à mão no topo,
 * o cardápio em lista compacta e o pedido a um toque (sacola flutuante + gaveta de js/pedido.js).
 * Carregado por último; o comportamento do topo fica em js/mobile-nav.js.
 */

/* Botão "Cardápio" do topo: só existe no celular. */
.m-menu-cta {
  display: none;
}

@media (max-width: 991.98px) {
  :root {
    --m-header: 64px;
  }

  /* ================= topo fixo ================= */
  .header_section {
    position: fixed;
    z-index: 1030;
    top: 0;
    right: 0;
    left: 0;
    padding: 10px 0;
    transition: background-color 0.25s ease, box-shadow 0.25s ease;
  }

  .header_section.is-scrolled,
  .m-nav-open .header_section {
    background: rgba(22, 25, 30, 0.94);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }

  .hero_area {
    padding-top: var(--m-header);
  }

  .custom_nav-container.navbar {
    flex-wrap: nowrap;
    padding: 0;
  }

  .custom_nav-container .navbar-brand {
    margin-right: auto;
    padding: 0;
  }

  .custom_nav-container .navbar-brand span {
    font-size: 30px;
    line-height: 1;
  }

  .m-menu-cta {
    display: inline-flex;
    align-items: center;
    height: 44px;
    margin-right: 8px;
    padding: 0 18px;
    border-radius: 999px;
    background: var(--fanes-yellow);
    color: var(--fanes-dark);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: 0 6px 16px rgba(255, 190, 51, 0.28);
    transition: background-color 0.2s ease, scale 0.15s ease;
  }

  .m-menu-cta:hover,
  .m-menu-cta:focus {
    background: var(--fanes-yellow-hover);
    color: var(--fanes-dark);
    text-decoration: none;
  }

  .m-menu-cta:active {
    scale: 0.96;
  }

  /* Já no cardápio: o botão fica claro, como "você está aqui". */
  .m-menu-cta[aria-current='page'] {
    background: #ffffff;
    box-shadow: none;
  }

  /* Hambúrguer redondo com duas linhas que viram um X. */
  .custom_nav-container .navbar-toggler {
    position: relative;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    transition: background-color 0.2s ease;
  }

  .custom_nav-container .navbar-toggler[aria-expanded='true'] {
    transform: none;
    background: #ffffff;
  }

  .custom_nav-container .navbar-toggler span {
    display: none;
  }

  .custom_nav-container .navbar-toggler::before,
  .custom_nav-container .navbar-toggler::after {
    content: '';
    grid-area: 1 / 1;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: #ffffff;
    transition: translate 0.25s ease, rotate 0.25s ease, background-color 0.2s ease;
  }

  .custom_nav-container .navbar-toggler::before { translate: 0 -3px; }
  .custom_nav-container .navbar-toggler::after { translate: 0 3px; }

  .custom_nav-container .navbar-toggler[aria-expanded='true']::before,
  .custom_nav-container .navbar-toggler[aria-expanded='true']::after {
    translate: 0;
    background: var(--fanes-dark);
  }

  .custom_nav-container .navbar-toggler[aria-expanded='true']::before { rotate: 45deg; }
  .custom_nav-container .navbar-toggler[aria-expanded='true']::after { rotate: -45deg; }

  /* ================= painel do menu ================= */
  /* Sem a animação de altura do Bootstrap: o painel aparece como um cartão flutuante. */
  .custom_nav-container .navbar-collapse.collapsing {
    transition: none !important;
  }

  .custom_nav-container .navbar-collapse {
    position: fixed;
    z-index: 2;
    top: calc(var(--m-header) + 8px);
    right: 12px;
    left: 12px;
    max-height: calc(100dvh - var(--m-header) - 24px);
    overflow-y: auto;
    padding: 18px 20px 20px;
    border-radius: 24px;
    background: #ffffff;
    color: var(--fanes-ink);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  }

  .custom_nav-container .navbar-collapse.show {
    animation: m-panel-in 0.22s cubic-bezier(0.32, 0.72, 0, 1) both;
  }

  .custom_nav-container .navbar-nav {
    margin: 0 !important;
    padding: 0;
    align-items: stretch;
  }

  .custom_nav-container .navbar-nav::before {
    content: 'Navegação';
    padding-bottom: 12px;
    color: var(--fanes-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  .custom_nav-container .navbar-nav .nav-item {
    border-top: 1px solid var(--fanes-line);
  }

  .custom_nav-container .navbar-nav .nav-item .nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0;
    padding: 14px 2px;
    color: var(--fanes-ink);
    font-size: 1.05rem;
    font-weight: 600;
  }

  .custom_nav-container .navbar-nav .nav-item .nav-link::after {
    content: '';
    width: 8px;
    height: 8px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    rotate: 45deg;
    opacity: 0.45;
    transition: translate 0.2s ease;
  }

  .custom_nav-container .navbar-nav .nav-item .nav-link:active::after {
    translate: 3px 0;
  }

  .custom_nav-container .navbar-nav .nav-item.active .nav-link,
  .custom_nav-container .navbar-nav .nav-item .nav-link:hover {
    color: var(--fanes-yellow-ink);
  }

  .custom_nav-container .user_option {
    display: block;
    margin: 6px 0 0;
  }

  /* A sacola já aparece no botão abaixo e no balão flutuante. */
  .custom_nav-container .user_option .cart_link {
    display: none;
  }

  .custom_nav-container .user_option .order_online {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 50px;
    margin: 12px 0 0;
    border-radius: 999px;
  }

  body.m-nav-open::before {
    content: '';
    position: fixed;
    z-index: 1029;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    animation: m-fade-in 0.2s ease both;
  }

  .m-nav-open .pd-floating {
    display: none;
  }

  /* ================= cardápio ================= */
  .sub_page .food_section.layout_padding {
    padding-top: 36px;
  }

  /* Categorias numa fileira que rola para o lado e gruda embaixo do topo. */
  .food_section .filters_menu {
    position: -webkit-sticky;
    position: sticky;
    z-index: 5;
    top: var(--m-header);
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 8px;
    margin: 24px -15px 4px;
    padding: 10px 15px;
    overflow-x: auto;
    border-bottom: 1px solid var(--fanes-line);
    background: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .food_section .filters_menu::-webkit-scrollbar {
    display: none;
  }

  .food_section .filters_menu li {
    flex: none;
    margin: 0;
    padding: 9px 18px;
    border: 1px solid var(--fanes-line);
    white-space: nowrap;
    font-size: 0.9rem;
  }

  .food_section .filters_menu li.active {
    border-color: var(--fanes-dark);
  }
}

/* Celular: cada prato numa linha — foto, nome, descrição curta, preço e o botão do pedido. */
@media (max-width: 575.98px) {
  .food_section .box {
    margin-top: 12px;
    border: 1px solid var(--fanes-line);
    border-radius: 22px;
    background: #ffffff;
    color: var(--fanes-ink);
    box-shadow: 0 1px 2px rgba(34, 40, 49, 0.05);
  }

  .food_section .box > div {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    grid-template-areas:
      'img title'
      'img desc'
      'img price'
      'add add';
    align-items: start;
    column-gap: 14px;
    padding: 12px;
  }

  .food_section .box .img-box {
    grid-area: img;
    width: 104px;
    height: 104px;
    border-radius: 16px;
  }

  .food_section .box .img-box img {
    max-width: 92px;
    max-height: 92px;
  }

  .food_section .box:hover .img-box img {
    transform: none;
  }

  .food_section .box .detail-box {
    display: contents;
  }

  .food_section .box .detail-box h5 {
    grid-area: title;
    margin: 2px 0 4px;
    color: var(--fanes-ink);
    font-size: 1.05rem;
    line-height: 1.2;
  }

  .food_section .box .detail-box p {
    grid-area: desc;
    display: -webkit-box;
    min-height: 0;
    margin: 0;
    overflow: hidden;
    color: var(--fanes-muted);
    font-size: 0.82rem;
    line-height: 1.4;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .food_section .box .options {
    grid-area: price;
    margin-top: 8px;
  }

  .food_section .box .detail-box h6 {
    color: var(--fanes-yellow-ink);
    font-size: 1rem;
    font-weight: 600;
  }

  /* O botão "Adicionar ao pedido" logo abaixo já faz o papel do carrinho redondo. */
  .food_section .box .options a {
    display: none;
  }

  .food_section .box .pd-add {
    grid-area: add;
    margin-top: 12px;
    --pd-background: #ffffff;
    --pd-foreground: var(--fanes-dark);
    --pd-border: rgba(34, 40, 49, 0.18);
    --pd-muted: #f1f2f3;
  }

  .food_section .box .pd-add__stepper {
    height: 44px;
  }
}

/* Na sacola, nomes longos quebram em duas linhas em vez de virar "Smash Burger …". */
@media (max-width: 575.98px) {
  .pd-sheet .pd-row__name {
    display: -webkit-box;
    white-space: normal;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}

@keyframes m-panel-in {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
}

@keyframes m-fade-in {
  from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .custom_nav-container .navbar-collapse.show,
  body.m-nav-open::before {
    animation: none;
  }
}
