.catalog, .product-page { padding: 80px 0; }
.catalog h1, .product-page h1 { font-size: 38px; margin-bottom: 28px; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
}

.product-card {
  display: block;
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(145deg, #161616, #0b0b0b);
  border: 1px solid rgba(212, 175, 55, 0.3);
  text-decoration: none;
  color: inherit;
}

.product-card-photo { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; }
.product-card-name { margin-top: 14px; font-size: 18px; }
.product-card-price { margin-top: 6px; color: #d4af37; font-weight: 700; }

.btn-cart {
  display: inline-block;
  margin-top: 14px;
  padding: 10px 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(145deg, #f0d67a, #d4af37);
  color: #111;
  font-weight: 700;
  cursor: pointer;
}

/* Шапка свёрстана гридом, поэтому обёртка кнопок должна занять его ячейку
   "button" — иначе она раскладывается сама по себе. align-items: stretch даёт
   корзине ровно ту же высоту, что у «Заказать чай», а градиент — тот же цвет. */
.header-actions {
  grid-area: button;
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-left: 120px;
}

.header-button { margin-left: 0; }

.cart-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 22px;
  border: 0;
  border-radius: 28px;
  background: linear-gradient(135deg, #f6dc79, #d4af37 45%, #8f6b18);
  color: #090909;
  font-size: 26px;
  cursor: pointer;
}

.cart-count { font-size: 16px; font-weight: 700; }

.empty-note { color: #b9ae9a; font-size: 18px; }
.back-link { color: #d4af37; text-decoration: none; }
.product-gallery img { width: 100%; border-radius: 18px; }
.gallery-photo:not(.active) { display: none; }
.product-price { margin: 14px 0; color: #d4af37; font-size: 24px; font-weight: 700; }
.product-description { color: #bfb5a3; line-height: 1.7; }

/* ---------- Корзина ---------- */
.cart-modal { position: fixed; inset: 0; display: none; z-index: 60; }
.cart-modal.show { display: block; }
.cart-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.72); }

.cart-box {
  position: relative;
  max-width: 520px;
  margin: 8vh auto;
  padding: 32px;
  border-radius: 28px;
  background: linear-gradient(145deg, #161616, #0b0b0b);
  border: 1px solid rgba(212, 175, 55, 0.3);
  max-height: 84vh;
  overflow-y: auto;
}

.cart-close {
  position: absolute; top: 16px; right: 20px;
  background: none; border: 0; color: #b9ae9a; font-size: 26px; cursor: pointer;
}

.cart-item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid rgba(212, 175, 55, 0.16); }
.cart-item img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; }
.cart-item-text { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.cart-item-text a { color: #fff; text-decoration: none; }
.cart-item-text span { color: #d4af37; font-weight: 700; }
.cart-item-remove { background: none; border: 0; color: #b9ae9a; font-size: 22px; cursor: pointer; }

.cart-empty { color: #b9ae9a; padding: 18px 0; }

.cart-form { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.cart-form input {
  padding: 14px 18px; border-radius: 14px;
  border: 1px solid rgba(212, 175, 55, 0.35);
  background: #0d0d0d; color: #fff; font-size: 16px;
}
.cart-form button {
  padding: 14px 18px; border: 0; border-radius: 14px;
  background: linear-gradient(145deg, #f0d67a, #d4af37);
  color: #111; font-weight: 700; font-size: 16px; cursor: pointer;
}

.cart-note { margin-top: 14px; color: #d4af37; }

/* ---------- Модалка товара ---------- */
.product-modal { position: fixed; inset: 0; display: none; z-index: 70; }
.product-modal.show { display: block; }
.product-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.78); }

.product-box {
  position: relative;
  max-width: 640px;
  margin: 6vh auto;
  padding: 28px;
  border-radius: 28px;
  background: linear-gradient(145deg, #161616, #0b0b0b);
  border: 1px solid rgba(212, 175, 55, 0.3);
  max-height: 88vh;
  overflow-y: auto;
}

.product-close {
  position: absolute; top: 16px; right: 20px;
  background: none; border: 0; color: #b9ae9a; font-size: 26px; cursor: pointer; z-index: 2;
}

.pm-gallery { position: relative; }
.pm-photos img { width: 100%; border-radius: 18px; display: none; }
.pm-photos img.active { display: block; }

.pm-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, 0.55); color: #f0d67a; font-size: 26px; cursor: pointer;
}
.pm-prev { left: 10px; }
.pm-next { right: 10px; }

.pm-dots { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }
.pm-dots span { width: 8px; height: 8px; border-radius: 50%; background: rgba(212, 175, 55, 0.3); }
.pm-dots span.active { background: #d4af37; }

/* ---------- Узкий экран ---------- */
.nav-toggle { display: none; }

@media (max-width: 900px) {
  /* Исходная шапка — грид с min-height 220px и логотипом в 70px: на телефоне
     это вытесняет кнопки за экран. Перестраиваем сетку и ужимаем логотип. */
  .header-inner {
    min-height: 0;
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "logo actions"
      "nav  nav";
    gap: 10px 12px;
    padding: 14px 0;
  }

  .logo-wrap { gap: 12px; }
  .logo-img { width: 56px; height: 56px; border-radius: 14px; }
  .logo-text { font-size: 24px; line-height: 1; }
  .logo-text small { margin-top: 6px; font-size: 10px; letter-spacing: 3px; }

  .header-actions { grid-area: actions; margin-left: 0; justify-content: flex-end; }
  .header-button { padding: 0 14px; font-size: 14px; border-radius: 14px; }
  .cart-button { padding: 0 14px; font-size: 18px; border-radius: 14px; }

  .nav-toggle {
    display: block;
    padding: 0 14px;
    border: 1px solid rgba(212, 175, 55, 0.5);
    border-radius: 14px;
    background: transparent;
    color: #f0d67a;
    font-size: 18px;
    cursor: pointer;
  }

  /* Разделы прячем за кнопкой: иначе они не помещаются в строку. */
  .main-nav {
    display: none;
    grid-area: nav;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    margin-top: 0;
    padding: 10px 0;
    font-size: 17px;
  }
  .main-nav.show { display: flex; }

  .product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .catalog h1, .product-page h1 { font-size: 26px; }
  .catalog, .product-page { padding: 40px 0; }
  .cart-box, .product-box { margin: 4vh 12px; padding: 20px; }
}

@media (max-width: 600px) {
  /* Логотип и три кнопки не помещаются в одну строку на телефоне, поэтому
     отдаём логотипу свою строку, а кнопкам — следующую. Так ничего не
     обрезается и не теряется название магазина. */
  .header-inner {
    grid-template-columns: 1fr;
    grid-template-areas:
      "logo"
      "actions"
      "nav";
  }

  .header-actions { justify-content: flex-start; flex-wrap: wrap; }
  .logo-text { font-size: 22px; }
  .logo-text small { letter-spacing: 2px; }
}
