/* ============================================================
   Theme v2 — только главная (меню). Корзину и попапы не трогаем.
   Визуал как pizzilia.ru/3, отступы карточек как pizzilia.ru/2.
   ============================================================ */

body {
  background:
    radial-gradient(1100px 480px at 8% -12%, #FFE0C8 0%, transparent 55%),
    radial-gradient(900px 420px at 100% 0%, #FFD2B8 0%, transparent 48%),
    var(--bg);
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 300;
}

.topbar__cafe-name {
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.topbar__actions {
  margin-left: auto;
}

.topbar__menu-btn {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
}

.delivery-strip { display: none !important; }

.active-order-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 10px 0;
  padding: 12px 14px;
  border-radius: 16px;
  text-decoration: none;
  color: #fffaf6;
  background: linear-gradient(135deg, #E4572E 0%, #F07146 55%, #F4A261 100%);
  box-shadow: 0 8px 20px rgba(228, 87, 46, 0.18);
}

.active-order-banner[hidden] {
  display: none !important;
}

.active-order-banner__text {
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 14px;
}

.active-order-banner__action {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 250, 246, 0.2);
}

/* Контент главной: небольшой боковой отступ, карточки не касаются края */
.menu-list {
  padding: 0 10px;
  box-sizing: border-box;
}

.menu-hero {
  margin: 14px 0 8px;
  padding: 20px 20px 18px;
  border-radius: 28px;
  background: linear-gradient(135deg, #E4572E 0%, #F07146 55%, #F4A261 100%);
  color: #fffaf6;
  position: relative;
  overflow: hidden;
  will-change: transform;
  transform: translate3d(0, calc(var(--hero-shift, 0px) * -0.12), 0);
}

.menu-hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: #FFD6A5;
  opacity: 0.28;
  transform: translate3d(0, calc(var(--hero-shift, 0px) * 0.22), 0);
}

.menu-hero__title {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: clamp(24px, 6vw, 34px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: inherit;
}

.menu-hero__text {
  position: relative;
  z-index: 1;
  margin: 8px 0 0;
  opacity: 0.92;
  font-size: 14px;
  max-width: 36ch;
}

.category-nav {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 0;
  border-bottom: 1px solid var(--border-light);
  gap: 8px;
  padding: 10px 10px;
}

.category-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  color: var(--text);
  font-weight: 700;
}

.category-btn.active {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
  box-shadow: none;
}

.category-btn:not(.active):hover {
  background: #fff;
  color: var(--text);
}

.menu-section {
  padding: 8px 0 4px;
  scroll-margin-top: 64px;
}

.menu-section__head {
  margin: 0 0 12px;
  padding: 0;
  align-items: baseline;
}

.menu-section__title {
  margin: 0;
  padding: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.menu-section__more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
}

.menu-section__more-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(31, 26, 23, 0.08);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.menu-section__title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.menu-section__title--hits {
  color: var(--brand);
}

.menu-section__sub {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.menu-item__sold {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  max-width: calc(100% - 16px);
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(20, 16, 14, 0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.menu-item__sold-text {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: -0.01em;
}

.menu-item--in-cart .menu-item__sold-text {
  color: #ffd7c2;
}

.dish-modal__sold {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
}

/* Полки внутри отступа menu-list — карточки не касаются края экрана */
.menu-section__items {
  display: grid !important;
  grid-auto-flow: column;
  grid-auto-columns: minmax(148px, 170px);
  gap: 12px;
  overflow-x: auto;
  padding: 0 0 6px;
  margin: 0;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.menu-section__items::-webkit-scrollbar { height: 0; }

.menu-item {
  display: grid !important;
  grid-template-rows: auto 1fr;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 0;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 260px;
  background: #fff;
  border: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  scroll-snap-align: start;
  box-shadow: none;
  transition:
    background 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.38s ease,
    box-shadow 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

.menu-item--pop {
  animation: menuItemPop 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes menuItemPop {
  0% { transform: scale(1); }
  32% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.menu-item__visual {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1;
  position: relative;
  border: 0;
  padding: 0;
  background: var(--bg-subtle);
  cursor: pointer;
}

.menu-item__image,
.menu-item__placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0 !important;
  box-shadow: none;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  transform-origin: center center;
}

.menu-item__visual:active .menu-item__image,
.menu-item__visual:active .menu-item__placeholder {
  transform: scale(1.07);
}

.menu-item__placeholder {
  display: grid;
  place-items: center;
  background: var(--bg-subtle);
  font-size: 42px;
}

.menu-item__body {
  padding: 10px 12px 12px !important;
  display: grid;
  gap: 6px;
  align-content: start;
  cursor: default;
}

.menu-item__title {
  font-size: 14px !important;
  font-weight: 700;
  line-height: 1.25;
  min-height: 2.5em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  cursor: pointer;
  transition: color 0.3s ease;
}

.menu-item__desc {
  display: none !important;
}

.menu-item__price {
  font-size: 17px !important;
  font-weight: 800;
  color: var(--text) !important;
  margin-top: 0;
}

.menu-item__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  min-height: 42px;
}

.menu-item__foot--qty .menu-item__price {
  display: none !important;
}

.menu-item__foot--qty .menu-item__control {
  width: 100%;
  justify-content: stretch;
}

.menu-item--in-cart {
  border-color: transparent;
  background:
    linear-gradient(145deg, #E4572E 0%, #F07146 52%, #F4A261 100%);
  box-shadow: 0 10px 24px rgba(228, 87, 46, 0.22);
}

.menu-item--in-cart .menu-item__visual {
  background: rgba(255, 250, 246, 0.18);
}

.menu-item--in-cart .menu-item__body {
  color: #fffaf6;
}

.menu-item--in-cart .menu-item__title {
  color: #fffaf6;
}

.menu-item--in-cart .item-qty {
  background: rgba(255, 250, 246, 0.96);
  border-color: rgba(255, 250, 246, 0.96);
  color: var(--text);
}

.menu-item--in-cart .item-qty__btn,
.menu-item--in-cart .item-qty__count {
  color: var(--text);
}

.menu-item--in-cart .item-qty__btn:active {
  background: rgba(31, 26, 23, 0.08);
}

.menu-item__control {
  width: auto;
  height: 42px;
  position: static !important;
  inset: auto !important;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-shrink: 0;
}

.item-add,
.item-add--brand {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px;
  border-radius: 12px !important;
  background: var(--accent) !important;
  box-shadow: none !important;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  transition: transform 0.15s cubic-bezier(0.22, 1, 0.36, 1);
}

.item-add:active,
.item-add--brand:active {
  transform: scale(0.9);
}

.item-qty {
  width: 100% !important;
  min-width: 0;
  max-width: none;
  height: 42px;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  border: 2.5px solid var(--text);
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
}

.item-qty__btn {
  width: 44px;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 22px;
  font-weight: 800;
}

.item-qty__btn:active {
  background: rgba(31, 26, 23, 0.08);
}

.item-qty__count {
  min-width: 22px;
  text-align: center;
  font-weight: 800;
  color: var(--text);
  font-size: 15px;
}

.menu-item--gift-next::before {
  top: 10px;
  bottom: auto;
  height: 4px;
  border-radius: 0 0 4px 4px;
}

/* Плавающая корзина справа + наверх слева */
.cart-bar {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  padding: 0;
  left: auto;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}

.cart-bar__btn {
  background: var(--brand) !important;
  border-radius: 18px !important;
  min-height: 60px;
  box-shadow: var(--shadow-md);
  transform-origin: center bottom;
}

.cart-bar__btn--spring {
  animation: cartFabSpring 0.48s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes cartFabSpring {
  0% { transform: scale(1); }
  28% { transform: scale(1.09); }
  55% { transform: scale(0.96); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .menu-item {
    transition: none;
  }
  .menu-item--pop,
  .cart-bar__btn--spring {
    animation: none;
  }
  .menu-hero,
  .menu-hero::after,
  .menu-item__image,
  .menu-item__placeholder {
    transform: none !important;
    transition: none !important;
  }
}

.cart-bar__count {
  background: var(--accent-2) !important;
  color: var(--brand) !important;
  border-radius: 10px;
  font-weight: 800;
}

.scroll-top-btn {
  color: var(--brand);
  border-color: var(--border);
}

.category-sheet__grid .menu-item {
  min-height: 240px;
}

.menu-foot {
  margin: 18px 0 8px;
  padding: 8px 2px 10px;
  text-align: center;
}

.menu-foot__link {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.menu-foot__link:active {
  color: var(--brand);
}

@media (min-width: 1024px) {
  .menu-section__items {
    grid-auto-flow: row !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    grid-auto-columns: unset !important;
    overflow: visible !important;
    padding: 0 0 20px;
    gap: 12px;
  }

  .menu-item {
    min-height: 300px;
  }
}
