/* ============================================================================
   Modal — Bottom-sheet menu
   Default: hidden (aria-hidden="true" + display:none via .is-open toggle)
   ============================================================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  visibility: hidden;
  pointer-events: none;
}

.modal.is-open {
  visibility: visible;
  pointer-events: auto;
}

/* --- Overlay (scrim) --- */
.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease-out;
}
.modal.is-open .modal__overlay {
  opacity: 1;
}

/* --- Sheet container --- */
.modal__sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 88vh;
  background: var(--sand-cream);
  border-radius: 20px 20px 0 0;
  padding: var(--s-sm) var(--s-md) 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  max-width: 720px;
  margin: 0 auto;
  touch-action: pan-y;
}
.modal.is-open .modal__sheet {
  transform: translateY(0);
}

/* --- Drag handle --- */
.modal__handle {
  width: 40px;
  height: 4px;
  background: var(--sunset-deep);
  border-radius: 2px;
  opacity: 0.3;
  margin: 4px auto var(--s-sm);
  flex-shrink: 0;
}

/* --- Header --- */
.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s-sm);
  flex-shrink: 0;
}
.modal__title {
  font-size: 1.5rem;
  color: var(--ink-deep);
}
.modal__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ink-deep);
  color: var(--sand-cream);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: transform 0.2s ease;
}
.modal__close:hover,
.modal__close:focus-visible {
  transform: scale(1.1);
}

/* --- Tabs --- */
.modal__tabs {
  display: flex;
  gap: var(--s-xs);
  margin-bottom: var(--s-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
  padding-bottom: 4px;
}
.modal__tabs::-webkit-scrollbar { display: none; }
/* Override the default flex display so the `hidden` attribute (set by
   modal.js when a menu has a single category) actually hides the row. */
.modal__tabs[hidden] { display: none; }

.modal__tab {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--ink-deep);
  color: var(--ink-deep);
  border-radius: 20px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.modal__tab.is-active {
  background: var(--sunset-orange);
  color: var(--ink-deep);
  border-color: var(--sunset-orange);
}

/* --- Scrollable body --- */
.modal__body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--s-lg);
}

.modal__list {
  display: flex;
  flex-direction: column;
}

.modal__item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(26, 10, 21, 0.2);
  font-family: var(--font-display);
}
.modal__item:last-child {
  border-bottom: none;
}
.modal__item-name {
  color: var(--ink-deep);
  font-size: 0.95rem;
  font-weight: 400;
}
.modal__item-price {
  color: var(--sunset-deep);
  font-weight: 700;
  font-size: 0.95rem;
  margin-left: var(--s-sm);
  white-space: nowrap;
}

/* --- Rich food row: name + badges + price + ingredients + allergens --- */
.modal__item--rich {
  display: block;
  padding: 14px 0;
}
.modal__item-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-sm);
}
.modal__item-name-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.modal__item--rich .modal__item-name {
  font-weight: 500;
}
.modal__item-badge {
  display: inline-block;
  vertical-align: middle;
  position: relative;
  top: -1px;               /* optical lift to land on the Fraunces x-height */
  font-family: var(--font-body);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(193, 74, 74, 0.10);
  color: var(--sunset-deep);
  font-weight: 600;
  white-space: nowrap;
  line-height: 1;
}
.modal__item-desc {
  margin: 6px 0 0 0;
  color: rgba(26, 10, 21, 0.68);
  font-size: 0.85rem;
  line-height: 1.45;
  font-family: var(--font-body);
  font-weight: 400;
}
.modal__item-allergens {
  margin: 4px 0 0 0;
  color: rgba(26, 10, 21, 0.42);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  font-family: var(--font-body);
}
.modal__note {
  list-style: none;
  margin-top: var(--s-md);
  padding-top: var(--s-md);
  border-top: 1px dashed rgba(26, 10, 21, 0.2);
  color: rgba(26, 10, 21, 0.5);
  font-size: 0.72rem;
  line-height: 1.5;
  font-family: var(--font-body);
}

/* --- Scroll lock helper (set on body) --- */
body.modal-open {
  overflow: hidden;
}
