/* mods.css — этап 8 (спека §4.5): лист выбора модификаторов блюда, строки корзины/чата с опциями.
   «Тёплый минимал»: токены warm-theme.css (в тёмной теме их переопределяет style.css), лист снизу r24
   с ручкой, чипы-пилюли (выбранный — олива), primary — терракота 48px, цели ≥ 48px, prefers-reduced-motion. */

.gmd-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(43, 38, 32, 0.45);
  opacity: 0;
  transition: opacity var(--dur, 220ms) var(--ease, ease-out);
}
.gmd-overlay.open { opacity: 1; }

.gmd-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-sizing: border-box;
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius-sheet, 24px) var(--radius-sheet, 24px) 0 0;
  box-shadow: var(--shadow-lg);
  padding: 8px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  font-family: var(--font-ui);
  transform: translateY(24px);
  transition: transform var(--dur, 220ms) var(--ease, ease-out);
}
.gmd-overlay.open .gmd-sheet { transform: translateY(0); }

.gmd-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 4px auto 12px;
}
.gmd-title {
  font-family: var(--font-head);
  font-size: 26px;
  line-height: 1.2;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--text);
  overflow-wrap: anywhere;
}
.gmd-desc {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text2);
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}

/* ── Группа ── */
.gmd-group {
  padding: 14px 0 6px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.gmd-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin-bottom: 10px;
}
.gmd-group-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}
.gmd-group-hint { font-size: 13px; color: var(--text2); }
.gmd-required {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent2);
  color: var(--accent-hi, var(--accent));
}
.gmd-required.is-missing {
  background: rgba(178, 59, 46, 0.12);
  color: var(--danger);
}

/* ── Чипы опций ── */
.gmd-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.gmd-chip {
  min-height: 48px;
  max-width: 100%;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  transition: background var(--dur, 220ms) var(--ease, ease-out), border-color var(--dur, 220ms) var(--ease, ease-out),
    transform var(--dur, 220ms) var(--ease, ease-out);
}
.gmd-chip-name { overflow-wrap: anywhere; }
.gmd-chip-delta {
  font-size: 12px;
  color: var(--text2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.gmd-chip.is-on {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #fff;
}
.gmd-chip.is-on .gmd-chip-delta { color: #fff; opacity: 0.9; }
.gmd-chip:disabled { opacity: 0.45; cursor: not-allowed; }
.gmd-chip:not(:disabled):active { transform: scale(0.97); }

/* ── Количество ── */
.gmd-qty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}
.gmd-qty-label { font-size: 15px; color: var(--text); }
.gmd-qty-ctrl { display: flex; align-items: center; gap: 6px; }
.gmd-qty-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-btn, 12px);
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  font: inherit;
  font-size: 22px;
  cursor: pointer;
}
.gmd-qty-btn:disabled { opacity: 0.4; cursor: default; }
.gmd-qty-val {
  min-width: 32px;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ── Кнопки ── */
.gmd-add {
  display: block;
  width: 100%;
  min-height: 52px;
  border: none;
  border-radius: var(--radius-btn, 12px);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  padding: 8px 16px;
  font-variant-numeric: tabular-nums;
  transition: background var(--dur, 220ms) var(--ease, ease-out), transform var(--dur, 220ms) var(--ease, ease-out);
}
.gmd-add:not(:disabled):active { transform: scale(0.98); }
.gmd-add:not(:disabled):hover { background: var(--accent-hi, var(--accent)); }
.gmd-add:disabled {
  background: var(--bg2);
  color: var(--text2);
  cursor: not-allowed;
}
/* Тёплая тёмная тема: --accent там синий (старая система style.css) — призыв к действию остаётся терракотой */
html[data-theme="dark"]:not([data-skin="figma"]) .gmd-add:not(:disabled) { background: var(--terra, #B34E30); }
html[data-theme="dark"]:not([data-skin="figma"]) .gmd-add:not(:disabled):hover { background: var(--terra-hi, #993E25); }
html[data-theme="dark"]:not([data-skin="figma"]) .gmd-required:not(.is-missing) { background: color-mix(in srgb, var(--terra, #B34E30) 30%, transparent); color: var(--text); }
.gmd-cancel {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 4px;
  border: none;
  background: transparent;
  color: var(--text2);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.gmd-chip:focus-visible,
.gmd-qty-btn:focus-visible,
.gmd-add:focus-visible,
.gmd-cancel:focus-visible,
.gmd-fix-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Меню: «уже в списке» у блюда с опциями ── */
.add-btn.gmd-open-btn { position: relative; }
.gmd-incart {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  box-sizing: border-box;
  border-radius: 10px;
  background: var(--secondary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.item-price .gmd-from { font-weight: 500; }

/* ── Корзина: опции строки, отказ сервера ── */
.cart-item-mods,
.msg-order-mods,
.px-round-mods,
.repeat-item-mods {
  display: block;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text2);
  overflow-wrap: anywhere;
  font-family: var(--font-ui);
  font-weight: 400;
}
html:not([data-theme="dark"]) .cart-item-mods,
html:not([data-theme="dark"]) .px-round-mods,
html:not([data-theme="dark"]) .repeat-item-mods { color: #6F6455; } /* ≥ 4.7:1 на креме, как .cart-item-price */
.msg-order-mods { opacity: 0.8; font-size: 12px; color: inherit; }
.cart-item-mods { margin-bottom: 4px; }

.cart-item.gmd-rejected { border-color: var(--danger) !important; }
.gmd-reject {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
}
.gmd-fix-btn {
  min-height: 44px;
  margin-top: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.gmd-banner {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: var(--radius-btn, 12px);
  background: rgba(178, 59, 46, 0.10);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}
.gmd-banner[hidden] { display: none; }
.gmd-banner strong { color: var(--danger); }


@media (prefers-reduced-motion: reduce) {
  .gmd-overlay,
  .gmd-sheet,
  .gmd-chip,
  .gmd-add { transition: none; }
  .gmd-sheet { transform: none; }
}

/* ── Скин figma (спека 2026-10-01-guest-figma §5 п.4, волна 2): лист модификаторов — центр-попап макета,
   токены --g-* из guest-figma.css; при warm ни одно правило ниже не применяется. ── */
html[data-skin="figma"] .gmd-overlay {
  align-items: center;
  padding: calc(16px + env(safe-area-inset-top, 0px)) var(--g-pad, 16px) calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--g-scrim);
}
html[data-skin="figma"] .gmd-sheet {
  width: min(343px, 100%);
  max-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  padding: var(--g-pad-pop, 24px);
  border-radius: var(--g-r-card, 20px);
  background: var(--g-surface);
  color: var(--g-text);
  box-shadow: none;
  font-family: var(--g-font);
  transform: translateY(8px) scale(0.98);
}
html[data-skin="figma"] .gmd-overlay.open .gmd-sheet { transform: none; }
html[data-skin="figma"] .gmd-sheet * { font-family: var(--g-font) !important; letter-spacing: 0; }
html[data-skin="figma"] .gmd-handle { display: none; }
html[data-skin="figma"] .gmd-title { margin: 0 0 8px; font-size: 24px; font-weight: 500; color: var(--g-text); }
html[data-skin="figma"] .gmd-desc { font-size: 14px; color: var(--g-sub); }
html[data-skin="figma"] .gmd-group { margin-top: 4px; padding: 12px 0 4px; border-top: 0; }
html[data-skin="figma"] .gmd-group-name { font-size: 16px; font-weight: 500; color: var(--g-text); }
html[data-skin="figma"] .gmd-group-hint { font-size: 12px; color: var(--g-sub); }
html[data-skin="figma"] .gmd-required { background: var(--g-surface-2); color: var(--g-text); font-weight: 500; }
html[data-skin="figma"] .gmd-required.is-missing { background: var(--g-danger-bg); color: var(--g-danger); }
html[data-skin="figma"] .gmd-chip {
  min-height: 44px; padding: 6px 16px; border: 0; border-radius: var(--g-r-pill, 999px);
  background: var(--g-surface-2); color: var(--g-text); font-size: 14px; font-weight: 500;
}
html[data-skin="figma"] .gmd-chip-delta { color: var(--g-sub); }
html[data-skin="figma"] .gmd-chip.is-on { background: var(--g-primary); color: var(--g-on-primary); }
html[data-skin="figma"] .gmd-chip.is-on .gmd-chip-delta { color: var(--g-on-primary); opacity: 1; }
html[data-skin="figma"] .gmd-qty { border-top: 1px solid var(--g-line); }
html[data-skin="figma"] .gmd-qty-label { font-size: 14px; font-weight: 500; color: var(--g-sub); }
html[data-skin="figma"] .gmd-qty-btn {
  width: 44px; height: 44px; border: 0; border-radius: var(--g-r-pill, 999px);
  background: transparent; color: var(--g-text); font-size: 24px;
}
html[data-skin="figma"] .gmd-qty-val { font-size: 16px; font-weight: 500; }
html[data-skin="figma"] .gmd-add {
  min-height: 48px; border-radius: var(--g-r-pill, 999px);
  background: var(--g-primary); color: var(--g-on-primary); font-weight: 500;
}
html[data-skin="figma"] .gmd-add:not(:disabled):hover { background: var(--g-primary); }
html[data-skin="figma"] .gmd-add:disabled { background: var(--g-surface-2); color: var(--g-sub); }
html[data-skin="figma"] .gmd-cancel { min-height: 44px; color: var(--g-text); text-decoration: underline; text-underline-offset: 3px; }
html[data-skin="figma"] :is(.gmd-chip, .gmd-qty-btn, .gmd-add, .gmd-cancel, .gmd-fix-btn):focus-visible {
  outline: 2px solid var(--g-focus); outline-offset: 2px;
}
/* «уже в списке» на белой карточке меню (белая в обеих темах) */
html[data-skin="figma"] .gmd-incart { background: var(--g-on-menu-card); color: var(--g-menu-card); font-weight: 500; }
/* Корзина: опции строки и отказ сервера */
html[data-skin="figma"] .gmd-reject { color: var(--g-danger); font-weight: 500; }
html[data-skin="figma"] .gmd-fix-btn {
  border: 0; border-radius: var(--g-r-pill, 999px); background: var(--g-surface-2); color: var(--g-text); font-weight: 500;
}
html[data-skin="figma"] .gmd-banner {
  border-radius: 16px; background: var(--g-danger-bg); color: var(--g-text); font-family: var(--g-font);
}
html[data-skin="figma"] .gmd-banner strong { color: var(--g-danger); font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
  html[data-skin="figma"] .gmd-sheet { transform: none; }
}
