/* ==========================================================================
   Страница меню
   ========================================================================== */

main {
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(154, 20, 20, 0.5), transparent 70%),
    var(--wine);
}

.menu-container {
  max-width: var(--container);
  margin: 0 auto;
  padding: clamp(48px, 7vw, 88px) var(--gutter) clamp(64px, 9vw, 112px);
}

/* ---------- Шапка меню ---------- */

.menu-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: clamp(40px, 6vw, 64px);
  text-align: center;
}

.menu-header h1 {
  margin: 6px 0 2px;
  font-size: clamp(44px, 7vw, 76px);
  line-height: 1.05;
  letter-spacing: 0.06em;
}

.menu-header p {
  font-size: 18px;
  font-style: italic;
  color: rgba(255, 255, 255, 0.85);
}

/* Строка про развес под подзаголовком */
.menu-header .menu-header-note {
  font-size: 15px;
  font-style: normal;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.6);
}

/* Только для скринридера: видно в доступном дереве, не видно на экране */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- Липкая полоса разделов ---------- */

.menu-container {
  --cats-h: 52px; /* высота полосы: нужна и для scroll-margin целей */
}

.menu-cats {
  position: sticky;
  /* --sticky-top выставляет menu.js по фактической высоте шапки; без JS - высота по умолчанию */
  top: var(--sticky-top, var(--header-h));
  z-index: 50; /* ниже шапки (100), панели связи (90) и окна чая (1000) */
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--cats-h);
  margin: 0 calc(var(--gutter) * -1) clamp(28px, 4vw, 44px);
  padding: 0 var(--gutter);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  background: var(--wine);
  border-bottom: 1px solid var(--gold-soft);
  /* затухание по краям - подсказка, что полосу можно прокрутить */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent);
}

.menu-cats::-webkit-scrollbar {
  display: none;
}

.menu-cats a {
  flex: none;
  scroll-snap-align: center;
  padding: 8px 14px;
  font-size: 14px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.8);
  border: 1px solid transparent;
  border-radius: 999px;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease),
    background 0.3s var(--ease);
}

.menu-cats a:hover {
  color: var(--white);
  border-color: var(--gold-soft);
}

.menu-cats a:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.menu-cats a.is-active,
.menu-cats a[aria-current='true'] {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(26, 5, 5, 0.25);
}

/* Цели переходов: шапку учитывает scroll-padding-top страницы, полосу - здесь */
.menu-container [id] {
  scroll-margin-top: calc(var(--cats-h) + 12px);
}

.description-note {
  font-size: 13px;
  font-style: normal;
  color: rgba(255, 255, 255, 0.6);
}

/* ---------- Сетки ---------- */

.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(18px, 2.5vw, 28px);
  margin-bottom: clamp(18px, 2.5vw, 28px);
}

.menu-grid-author {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(18px, 2.5vw, 28px);
  margin-bottom: clamp(56px, 8vw, 88px);
}

/* ---------- Карточка ---------- */

.menu-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.015));
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-l);
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease),
    border-color 0.5s var(--ease);
}

.menu-card[data-title] {
  cursor: pointer;
}

.menu-card:hover {
  transform: translateY(-4px);
  border-color: var(--white);
  box-shadow: var(--shadow);
}

.menu-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
  border-radius: var(--radius-l);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 18px 14px 20px;
  background: var(--white);
  color: var(--wine);
  font-family: var(--font-accent);
  font-size: 22px;
  line-height: 1.25;
}

/* Мини-фото сорта: декоративное, название рядом */
.card-thumb {
  flex: none;
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 50%;
  background: rgba(93, 11, 11, 0.08);
}

.card-title {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

/* Слово-настроение: первое слово описания сорта */
.card-mood {
  font-family: var(--font-sans);
  font-size: 12px;
  font-style: italic;
  letter-spacing: 0.08em;
  line-height: 1.3;
  color: rgba(93, 11, 11, 0.65);
}

/* Карточки без фото (авторские): отступ слева прежний */
.card-header > .card-title:first-child {
  padding-left: 6px;
}

/* Кнопка «подробнее»: три точки, нарисованные CSS */
.card-header .dots {
  position: relative;
  flex: none;
  width: 40px;
  height: 28px;
  font-size: 0;
  border-radius: 999px;
  background: rgba(93, 11, 11, 0.08);
  transition: background 0.35s var(--ease), transform 0.35s var(--ease);
  user-select: none;
}

.card-header .dots::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: -7px 0 0 currentColor, 7px 0 0 currentColor;
}

.menu-card:hover .dots {
  background: var(--wine);
  color: var(--white);
  transform: scale(1.06);
}

.card-body {
  flex-grow: 1;
  padding: 22px 26px 26px;
}

/* ---------- Позиции ---------- */

.tea-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  font-size: 16px;
}

.tea-item .tea-name {
  display: flex;
  flex: 1;
  align-items: baseline;
  min-width: 0;
}

/* Пунктирная «линия-указатель» между названием и ценой */
.tea-item .tea-name::after {
  content: '';
  flex: 1;
  min-width: 24px;
  margin-left: 12px;
  border-bottom: 1px dotted rgba(255, 255, 255, 0.3);
  transform: translateY(-4px);
}

.tea-name {
  font-style: italic;
}

/* Три цены в столбцах: «грамм · стакан · чаепитие». Ширина столбца общая для подписи и цен */
.card-body {
  --price-col: 56px;
}

.price-legend,
.tea-price-3 {
  display: grid;
  grid-template-columns: repeat(3, var(--price-col));
  justify-content: end;
}

.price-legend {
  padding-bottom: 4px;
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.02em;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  border-bottom: 1px solid var(--line);
}

.tea-price-3 {
  text-align: center;
}

/* У позиций со столбцами пунктир-указатель не нужен */
.tea-item-cols .tea-name::after {
  display: none;
}

.tea-price {
  font-family: var(--font-sans);
  font-size: 15px;
  white-space: nowrap;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.tea-item-author {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
  gap: 8px 20px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.tea-item-author:last-child {
  border-bottom: 0;
}

.tea-item-author .tea-name {
  font-size: 17px;
}

.tea-item-author .description-note {
  font-size: 14px;
  line-height: 1.5;
}

/* Подзаголовки внутри карточки («Холодные», «Горячие») */
.card-body h2 {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0 6px;
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
}

.card-body h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gold-soft);
}

.card-body h2:nth-of-type(2) {
  margin-top: 32px;
}

.card-note {
  margin-bottom: 4px;
  font-size: 13px;
  font-style: italic;
  color: rgba(255, 255, 255, 0.65);
}

/* ---------- Заголовки разделов ---------- */

.section-title {
  margin-bottom: clamp(28px, 4vw, 44px);
  font-family: var(--font-accent);
  font-size: clamp(28px, 3.6vw, 40px);
  letter-spacing: 0.04em;
}

/* ---------- Прочее и акция ---------- */

.other-services {
  max-width: 640px;
  margin: 0 auto;
}

.promo {
  position: relative;
  margin-top: 28px;
  padding: 36px 28px 32px;
  text-align: center;
  /* Переносы строк без <br>: строки выравниваются по длине на любой ширине */
  text-wrap: balance;
  font-size: 18px;
  font-style: italic;
  line-height: 1.6;
  border: 1px solid var(--gold-soft);
  border-radius: var(--radius-l);
  background:
    radial-gradient(ellipse at top, rgba(212, 168, 83, 0.16), transparent 70%),
    rgba(26, 5, 5, 0.2);
}

.promo strong {
  display: block;
  width: fit-content;
  margin: 0 auto 14px;
  padding: 4px 18px;
  font-family: var(--font-accent);
  font-size: 20px;
  font-style: normal;
  font-weight: normal;
  letter-spacing: 0.06em;
  color: var(--night);
  background: var(--gold);
  border-radius: 999px;
}

/* ==========================================================================
   Модальное окно
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(26, 5, 5, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s var(--ease), visibility 0.4s var(--ease);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-window {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  max-height: calc(100svh - 40px);
  overflow: auto;
  background: var(--wine);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-l);
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.8);
  text-align: center;
  transform: translateY(24px) scale(0.96);
  transition: transform 0.5s var(--ease);
}

.modal-overlay.active .modal-window {
  transform: none;
}

.modal-image {
  order: -1;
  flex: none;
  width: 100%;
  aspect-ratio: 16 / 10;
  background-color: var(--gray);
  background-size: cover;
  background-position: center;
  -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent);
  mask-image: linear-gradient(180deg, #000 70%, transparent);
}

.modal-image[hidden] {
  display: none;
}

.modal-window h3 {
  margin: 8px 32px 16px;
  padding-bottom: 16px;
  font-family: var(--font-accent);
  font-size: 30px;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--gold-soft);
}

.modal-image[hidden] + h3 {
  margin-top: 48px;
}

.modal-window p {
  margin: 0 32px 32px;
  font-size: 16px;
  font-style: italic;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.9);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  font-size: 26px;
  line-height: 1;
  color: var(--white);
  border-radius: 50%;
  background: rgba(26, 5, 5, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: color 0.3s ease, background 0.3s ease, transform 0.45s var(--ease);
}

.modal-close:hover {
  color: var(--night);
  background: var(--gold);
  transform: rotate(90deg);
}

/* ==========================================================================
   Адаптив
   ========================================================================== */

@media (max-width: 900px) {
  .menu-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .menu-container {
    --cats-h: 48px;
  }

  .menu-cats a {
    padding: 8px 12px;
    font-size: 13px;
  }

  .card-header {
    gap: 12px;
    padding: 12px 14px 12px 14px;
    font-size: 19px;
  }

  .card-body {
    --price-col: 46px;
  }

  .price-legend {
    font-size: 10px;
    letter-spacing: 0;
  }

  .card-body {
    padding: 18px 20px 22px;
  }

  .tea-item {
    font-size: 15px;
  }

  .tea-price {
    font-size: 14px;
  }

  /* Авторские: название и цена в строку, состав — под ними */
  .tea-item-author {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .tea-item-author .description-note {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .promo {
    font-size: 16px;
  }

  .modal-window h3 {
    margin: 4px 22px 14px;
    font-size: 24px;
  }

  .modal-window p {
    margin: 0 22px 26px;
    font-size: 15px;
  }
}
