:root {
  --bg-dark: #071022;
  --card-dark: #0b1220;
  --text-dark: #e6eef8;
  --muted-dark: #9fb0c9;
  --accent-dark: #ff7a18;

  --bg-light: #f7fafc;
  --card-light: #ffffff;
  --text-light: #0b1220;
  --muted-light: #607089;
  --accent-light: #ff6b35;


  .dark {
  --btn-bg: rgba(255,255,255,0.08);
  }

.light {
  --btn-bg: rgba(0,0,0,0.08);
  }
}

/* запрет двойного зума / базовое поведение тача */
html, body {
  touch-action: manipulation;
  -ms-touch-action: manipulation;
}

html { transition: background 0.2s linear, color 0.2s linear; }

body {
  margin: 0;
  font-family: Inter, system-ui, Arial, sans-serif;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  transition: background 0.25s linear, color 0.25s linear;
}

/* темы */
.light {
  --bg: var(--bg-light);
  --card: var(--card-light);
  --text: var(--text-light);
  --muted: var(--muted-light);
  --accent: var(--accent-light);
}
.dark {
  --bg: var(--bg-dark);
  --card: var(--card-dark);
  --text: var(--text-dark);
  --muted: var(--muted-dark);
  --accent: var(--accent-dark);
}

/* блокировка прокрутки страницы при открытой модалке */
body.modal-open {
  overflow: hidden;
}

/* header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  background: linear-gradient(90deg, rgba(255,255,255,0.02), transparent);
  backdrop-filter: blur(6px);
  flex-wrap: wrap;
  position: fixed;
  box-sizing: border-box; /* 🔥 ВАЖНО */
  top: 0;
  width: 100%;
  z-index: 1000;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo-img {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  object-fit: cover;
  background: linear-gradient(180deg, var(--accent), #ffb28b);
  padding: 6px;
}
.title h1 { margin: 0; font-size: 18px; }
.title p { margin: 0; font-size: 13px; color: var(--muted); }

/* кнопка переключения темы — более заметная обводка и центрирование текста */
.theme-toggle {
  border: 2px solid rgba(255,255,255,0.12);
  padding: 8px 12px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  background: linear-gradient(90deg, rgba(255,255,255,0.02), transparent);
}

/* гамбургер-кнопка */
.cart-btn {
  position: relative;
  font-weight: 800;
}

/* главный контейнер */
main.container {
  max-width: 1100px;
  margin: 28px auto;
  padding: 0 18px;
  margin-top: 100px;
}

/* сетка: одна карточка на строку (герой-карточки) */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: stretch;
}

/* карточка-герой */
.hero-card {
  background: var(--card);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 6px 26px rgba(2,6,23,0.5);
  display: flex;
  gap: 0;
  align-items: stretch;
  transition: transform 0.28s cubic-bezier(.2,.9,.3,1), box-shadow 0.28s, filter 0.28s;
  cursor: pointer;
}

/* hover-анимация для карточки */
.hero-card:hover {
  transform: translateY(-10px) scale(1.01);
  box-shadow: 0 30px 60px rgba(2,6,23,0.55);
  filter: saturate(1.05);
}

/* два блока внутри карточки */
.card-media, .card-content {
  width: 50%;
  padding: 18px;
  box-sizing: border-box;
}

/* изображение — занимает весь блок медиа */
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  box-shadow: none;
}

/* контент */
.card-content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.card-content .meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  font-size: 30px;
}
.card-content .price { font-weight: 800; margin-left: 8px; }

.price {
  display: none;
}

.card-content p { color: var(--muted); margin-top: 8px; }

/* кнопки внутри карточки */
.card-actions {
  display:flex;
  gap:10px;
  margin-top: 12px;
  align-items:center;
}

/* для чередования — реверс (ПК) */
.menu-grid .hero-card:nth-child(even) {
  flex-direction: row-reverse;
}

/* поддерживаем те же ширины — row-reverse решает порядок */
/*.menu-grid .hero-card:nth-child(even) .card-media,
.menu-grid .hero-card:nth-child(even) .card-content {
  /* intentionally left non-empty on purpose (keeps symmetry) */
  /* widths are handled above; no extra rules needed here */
/*}



/* стили кнопок */
button.btn {
  padding: 8px 12px;
  border-radius: 10px;
  border: 0;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.12s ease, box-shadow 0.12s;
  background: transparent;
}
button.btn-primary {
  background: linear-gradient(90deg, var(--accent), #ffb28b);
  color: #071022;
}
button.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--muted);
}

/* модалка: центр, 2 колонки */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(1,2,6,0.6), rgba(1,2,6,0.85));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  animation: pop 0.18s ease;
  padding: 16px;
}
.modal-panel {
  width: min(980px, 95%);
  
  /* ❌ УБИРАЕМ ЭТО */
  /* aspect-ratio: 1 / 1; */

  max-height: 85vh;

  background: var(--card);
  border-radius: 14px;
  padding: 18px;

  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;

  overflow-y: auto; /* ✅ ВКЛЮЧАЕМ СКРОЛЛ */
  -webkit-overflow-scrolling: touch;
}

/* увеличим модалку на больших экранах */
@media (min-width: 1200px) {
  .modal-panel {
    width: min(1100px, 95%);
    max-height: 80vh; /* чуть меньше высоты экрана */
    grid-template-columns: 420px 1fr;
  }

  .modal-preview .dish-img,
  .modal-preview model-viewer {
    height: calc(100vw * 0.25); /* адаптивная высота — примерно четверть ширины окна */
    max-height: 400px;
  }
}

/* preview и info внутри модалки */
.modal-preview {
  position: relative; /* 🔥 обязательно */
  display: block;     /* ❌ убираем flex */
  overflow: hidden;
}

.modal-preview .dish-img {
  display: none;
  width: 100%;
  height: 500px;
  object-fit: cover;
  border-radius: 10px;
}

.modal-preview model-viewer {
  width: 100%;
  height: 500px;
  border-radius: 10px;
}

/* когда модель загрузилась — добавляем класс .model-loaded к .modal-panel */
.modal-panel.model-loaded {
  /* меняем сетку: модель (preview) справа, info слева */
  grid-template-columns: 1fr 360px;
}
.modal-panel.model-loaded .dish-img { display: none; }
.modal-panel.model-loaded model-viewer { display: block; }

/* изначально model-viewer скрыт (будет показан JS при загрузке) */
model-viewer { visibility: hidden; }

/* заголовок, описание */
.dish-title { margin: 0; font-size: 20px; }
.dish-desc { color: var(--muted); margin-top: 8px; }

/* заметки */
.note { color: var(--muted); margin-top: 10px; }

/* responsive: на мобильных карточки стекаются: сначала фото, потом контент */
@media (max-width: 820px) {
  .menu-grid { gap: 16px; }

  /* отменяем чередование на мобиле — все карточки вертикально */
  .menu-grid .hero-card {
    flex-direction: column !important;
  }

  .card-media, .card-content {
    width: 100%;
    padding: 14px;
  }

  .modal-backdrop {
    align-items: start;
    justify-content: center;
    overflow: auto;
    padding: 10px;
  }

  .modal-panel {
    grid-template-columns: 1fr;
    width: 92%;
    height: auto;
    max-width: 600px;
    max-height: 88vh;
    margin: 20px auto;
    border-radius: 12px;
    padding: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-panel.model-loaded {
    grid-template-columns: 1fr;
  }

  /* немного уменьшаем высоту превью */
  .modal-preview .dish-img,
  .modal-preview model-viewer {
    display: none;
    height: calc(100vw * 0.65); /* 65% ширины экрана */
  }
}

/* запрет зума двойным тапом */
@media (pointer: coarse) {
  html, body {
    touch-action: manipulation;
  }
}

/* небольшая анимация появления */
@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

/* --- loader + controls styles --- */
.mv-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.mv-loader .spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 6px solid rgba(255,255,255,0.08);
  border-top-color: rgba(255,255,255,0.95);
  animation: mv-spin 1s linear infinite;
  box-shadow: 0 6px 18px rgba(2,6,23,0.6);
}
@keyframes mv-spin { to { transform: rotate(360deg); } }
.mv-overlay { position: relative; }
.mv-controls { margin-top: 10px; display:flex; gap:8px; align-items:center; }
.mv-btn {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  background: var(--btn-bg); /* 👈 теперь адаптивно */
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s ease;
}
.mv-btn.active { background: linear-gradient(90deg,var(--accent),#ffb28b); color:#071022; }
.mv-retry { padding:6px 8px; border-radius:8px; background: rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.06); cursor:pointer; }

#modalImg {
  display: block;
}

.modal-panel.model-loaded #modalImg {
  display: none;
}


/* =========================
   ВСПЛЫВАЮЩЕЕ МЕНЮ САЙТА
   ========================= */

.site-menu {
  position: fixed;
  inset: 0;
  background: rgba(2,6,23,0.75);
  backdrop-filter: blur(8px);
  display: none;
  z-index: 2000;
}

.site-menu.open {
  display: block;
}

/* панель меню */
.menu-panel {
  position: absolute;
  right: 0;
  top: 0;
  width: 500px;
  max-width: 90%;
  height: 100%;
  background: var(--card);
  box-shadow: -20px 0 40px rgba(2,6,23,0.6);
  padding: 24px;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.25s ease;
}

/* на телефоне — на весь экран */
@media (max-width: 640px) {
  .menu-panel {
    width: 100%;
  }
}

@keyframes slideIn {
  from {
    transform: translateX(40px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

/* кнопка закрытия */
.menu-close {
  align-self: flex-end;
  font-size: 22px;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 20px;
}

/* навигация */
.menu-nav {
  display: flex;
  flex-direction: column; /* элементы сверху вниз */
  gap: 16px;
  height: 100%;           /* занимает всю высоту меню */
}

.menu-nav footer {
  margin-top: auto;       /* толкает footer вниз */
  padding-top: 12px;
  font-size: 14px;
  color: var(--muted);
}

.menu-link {
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(255,255,255,0.02), transparent);
  transition: background 0.2s, transform 0.15s;
}

.menu-link:hover {
  background: linear-gradient(90deg, var(--accent), #ffb28b);
  color: #071022;
  transform: translateX(4px);
}

#model-viewer {
  height: 500px;
}

/* Телефоны */
@media (orientation: portrait) {
  #model-viewer {
    height: 320px;
  }
}

footer{
        margin-top:auto;
        padding:30px;
        color:#607089;
        font-size:14px;
        text-align: center;
    }


.theme-toggle,
.cart-btn {
  font-size: 22px;
  padding: 12px 16px;
  white-space: nowrap;
}

/* для портретной ориентации (высота больше ширины) */
@media (orientation: portrait) {
  main.container {
    margin-top: 180px;
  }
}

.header-controls {
  display:flex;
  align-items:center;
  gap:10px;
}
/* для телефонов или портретной ориентации */
@media (max-width: 820px), (orientation: portrait) {
  .header-controls {
    display: flex;            /* гарантируем flex */
    justify-content: flex-end; /* сдвигаем кнопки вправо */
    width: 100%;              /* блок занимает всю ширину */
    gap: 10px;                /* расстояние между кнопками */
  }
}

.big-btn {
  display: inline-block;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-size: 22px;      /* текст больше */
  padding: 16px 28px;   /* сама кнопка больше */
  
}

.big-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 20px rgba(255, 140, 0, 0.4);
}

.site-menu {
  z-index: 2000; /* больше чем у header */
}

.modal-backdrop {
  z-index: 2000; /* тоже выше header */
}

.modal-actions .btn {
  font-size: 20px;
  padding: 14px 6px;
}

#close-modal-btn {
  background: #ff3236;
  color: white;
  border: none;
}

#close-modal-btn:hover {
  background: #ff1f1f;
}

@media (orientation: portrait) {
  .modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .modal-actions button,
  .modal-actions a {
    width: 100%;
  }
}