/* ── Tasty & Lean — shared interactive components ───────────────────────────
   Meal tiles, spice badges, the persistent cart bar, the meal detail sheet,
   and the cart drawer. Linked by index.html and menu.html. Relies on the
   design-system custom properties (--burgundy, --cream, …) defined per page.
   Loaded AFTER each page's inline <style> so it governs the shared widgets.   */

/* ── Meal tile ──────────────────────────────────────────────────────────── */
.meal-card {
  background: var(--white);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(233, 225, 213, 0.6);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.meal-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 56px rgba(42, 35, 33, 0.08);
}

.meal-card-img {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: linear-gradient(160deg, var(--stone), #D8D0C4);
}
.meal-img,
.meal-img-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.meal-img { object-fit: cover; }
.meal-img-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  background: linear-gradient(160deg, var(--stone) 0%, #D8D0C4 100%);
}

.spice-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  background: var(--cream);
  color: var(--espresso);
  padding: 5px 10px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(42, 35, 33, 0.15);
}

.meal-tag {
  position: absolute;
  top: 12px;
  left: auto;
  right: 12px;
  z-index: 2;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: rgba(253, 251, 249, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--burgundy);
  padding: 5px 12px;
  border-radius: 20px;
}

.meal-card-body { position: relative; padding: 24px; }
.meal-card-body h3 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--espresso);
  margin: 0 56px 6px 0;            /* clears the add button */
}
.meal-tagline {
  font-size: 14px;
  color: var(--light-text);
  line-height: 1.5;
  margin-bottom: 10px;
}

.meal-allergens-line {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.4px;
  color: var(--soft-text);
  text-transform: uppercase;
  margin-bottom: 16px;
  line-height: 1.4;
}

.meal-add-btn {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: var(--burgundy);
  color: var(--white);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
}
.meal-add-btn:hover { background: var(--espresso); transform: translateY(-1px); }
.meal-add-btn.is-added { background: #3F7D4F; font-size: 17px; }

.meal-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.macros { display: flex; gap: 8px; flex-wrap: wrap; }
.macros span {
  font-size: 12px;
  font-weight: 500;
  color: var(--soft-text);
  background: var(--cream);
  padding: 4px 10px;
  border-radius: 20px;
}
.meal-card-footer .price {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--burgundy);
}

.menu-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--light-text);
  font-size: 16px;
  padding: 48px 0;
}

/* ── Persistent cart bar ────────────────────────────────────────────────── */
.tl-cart-bar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  width: calc(100% - 32px);
  max-width: 720px;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--burgundy);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 16px 22px;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 12px 40px rgba(42, 35, 33, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(140%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}
.tl-cart-bar.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.tl-bar-left { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.tl-bar-dot { opacity: 0.6; }
.tl-bar-cta { font-size: 14px; font-weight: 600; letter-spacing: 0.3px; }
body.tl-bar-open { padding-bottom: 92px; }

/* ── Overlay shared by sheet + drawer ───────────────────────────────────── */
.tl-overlay { position: fixed; inset: 0; z-index: 400; visibility: hidden; }
.tl-overlay.is-open { visibility: visible; }
.tl-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(42, 35, 33, 0.5);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.tl-overlay.is-open .tl-backdrop { opacity: 1; }
body.tl-noscroll { overflow: hidden; }

/* ── Meal detail sheet (mobile: slide up · desktop: modal) ──────────────── */
.tl-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  background: var(--cream);
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.tl-overlay.is-open .tl-sheet { transform: translateY(0); }

.tl-sheet-close,
.tl-drawer-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(253, 251, 249, 0.92);
  color: var(--espresso);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(42, 35, 33, 0.15);
}
.tl-drawer-close { position: static; box-shadow: none; background: var(--white); }

.tl-sheet-body { overflow-y: auto; padding: 0 24px 24px; -webkit-overflow-scrolling: touch; }

.detail-img {
  position: relative;
  aspect-ratio: 4 / 3;
  margin: 0 -24px 20px;
  overflow: hidden;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(160deg, var(--stone), #D8D0C4);
}
.detail-gallery-track {
  position: absolute;
  inset: 0;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.detail-gallery-track::-webkit-scrollbar { display: none; }
.detail-gallery-slide {
  position: relative;
  flex: 0 0 100%;
  min-width: 100%;
  height: 100%;
  scroll-snap-align: start;
}
.detail-gallery-arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(253, 251, 249, 0.92);
  color: var(--espresso);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(42, 35, 33, 0.16);
  transform: translateY(-50%);
}
.detail-gallery-prev { left: 14px; }
.detail-gallery-next { right: 14px; }
.detail-gallery-count {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  padding: 6px 10px;
  border-radius: 18px;
  background: rgba(253, 251, 249, 0.92);
  color: var(--espresso);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(42, 35, 33, 0.12);
}
.detail-gallery-dots {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 2;
  display: flex;
  gap: 7px;
  transform: translateX(-50%);
}
.detail-gallery-dot {
  width: 8px;
  height: 8px;
  border: none;
  border-radius: 50%;
  background: rgba(253, 251, 249, 0.62);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(42, 35, 33, 0.18);
}
.detail-gallery-dot.is-active {
  width: 20px;
  border-radius: 999px;
  background: var(--white);
}
.detail-name {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--espresso);
  margin-bottom: 6px;
}
.detail-tagline { font-size: 15px; color: var(--light-text); margin-bottom: 16px; }

.detail-spice { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.spice-icons { letter-spacing: 2px; }
.spice-dot { opacity: 0.25; }
.spice-dot.on { opacity: 1; }
.spice-word { font-size: 13px; font-weight: 600; color: var(--soft-text); }

.detail-chefnote {
  background: rgba(110, 18, 32, 0.06);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}
.detail-chefnote p { font-style: italic; color: var(--burgundy); font-size: 15px; line-height: 1.5; }

.macro-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 22px;
}
.macro-card {
  background: var(--white);
  border: 1px solid rgba(233, 225, 213, 0.7);
  border-radius: 12px;
  padding: 14px 8px;
  text-align: center;
}
.macro-num {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--burgundy);
  line-height: 1;
}
.macro-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--light-text);
  margin-top: 6px;
}

.detail-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 600;
  color: var(--burgundy);
  margin-bottom: 8px;
}
.detail-ingredients { font-size: 14px; color: var(--soft-text); line-height: 1.7; margin-bottom: 18px; }

.detail-allergens {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--soft-text);
}
.allergen-prefix { font-weight: 600; color: var(--espresso); }
.allergen-pill {
  background: var(--burgundy);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}
.detail-portion { font-size: 13px; color: var(--light-text); margin-bottom: 18px; }
.detail-label-line {
  font-size: 13px;
  color: var(--soft-text);
  line-height: 1.6;
  margin-bottom: 6px;
}
.detail-label-line:last-child { margin-bottom: 0; }

.tl-sheet-footer {
  padding: 16px 24px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--stone);
  background: var(--cream);
}
.tl-sheet-footer .tl-btn { width: 100%; }

/* ── Buttons (overlay context) ──────────────────────────────────────────── */
.tl-btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  border: none;
  border-radius: 12px;
  padding: 15px 22px;
  cursor: pointer;
}
.tl-btn-primary { background: var(--burgundy); color: #fff; transition: background 0.2s ease; }
.tl-btn-primary:hover { background: var(--espresso); }
.tl-btn-block { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; }
.tl-btn:disabled,
.tl-btn.is-disabled { background: var(--stone); color: var(--light-text); cursor: not-allowed; }

/* ── Cart drawer (desktop: right · mobile: full-screen) ─────────────────── */
.tl-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.tl-drawer-overlay.is-open .tl-drawer { transform: translateX(0); }
@media (max-width: 480px) { .tl-drawer { width: 100%; } }

.tl-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 14px;
}
.tl-drawer-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--espresso);
}

.tl-drawer-items { flex: 1; overflow-y: auto; padding: 0 24px; }
.tl-drawer-empty { color: var(--light-text); font-size: 15px; padding: 24px 0; text-align: center; }

.tl-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--stone);
}
.tl-line-name { font-weight: 600; color: var(--espresso); font-size: 15px; }
.tl-line-price { font-size: 13px; color: var(--burgundy); font-weight: 600; margin-top: 2px; }

.tl-stepper { display: flex; align-items: center; gap: 10px; }
.qty-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--stone);
  border-radius: 8px;
  background: var(--white);
  color: var(--espresso);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.qty-btn:hover { border-color: var(--burgundy); color: var(--burgundy); }
.tl-qty { min-width: 18px; text-align: center; font-weight: 600; }

.tl-drawer-summary { padding: 8px 24px 0; }
.tl-subtotal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--espresso);
}
.tl-subtotal-val { font-family: 'Playfair Display', serif; font-size: 20px; color: var(--burgundy); }
.tl-picker-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--light-text);
  margin: 6px 0 10px;
}
.tl-segmented { display: flex; gap: 8px; }
.tl-seg {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--stone);
  border-radius: 10px;
  background: var(--white);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--soft-text);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.tl-seg.is-active { background: var(--burgundy); color: #fff; border-color: var(--burgundy); }
.tl-cutoff { font-size: 12px; color: var(--light-text); line-height: 1.5; margin-top: 12px; }
.tl-zones { font-size: 12px; color: var(--soft-text); line-height: 1.5; margin-top: 8px; }

.footer-business {
  width: 100%;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--stone);
}
.footer-business:empty { display: none; }
.footer-business-line {
  font-size: 11px;
  color: var(--light-text);
  line-height: 1.6;
  letter-spacing: 0.3px;
  margin: 0;
}

.tl-drawer-footer {
  padding: 16px 24px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--stone);
}
.tl-drawer-footer .tl-btn { width: 100%; }
.tl-min-note { font-size: 13px; color: var(--light-text); text-align: center; margin-bottom: 12px; }
.tl-direct-link {
  display: block;
  text-align: center;
  margin-top: 14px;
  font-size: 13px;
  color: var(--burgundy);
  text-decoration: none;
}
.tl-direct-link:hover { text-decoration: underline; }

/* Desktop: detail sheet becomes a centred modal that fades in. */
@media (min-width: 640px) {
  .tl-detail .tl-sheet {
    left: 50%;
    right: auto;
    top: 50%;
    bottom: auto;
    width: 520px;
    max-width: calc(100vw - 48px);
    max-height: 88vh;
    border-radius: 20px;
    opacity: 0;
    transform: translate(-50%, -48%);
    transition: opacity 0.3s ease, transform 0.3s ease;
  }
  .tl-detail.is-open .tl-sheet { opacity: 1; transform: translate(-50%, -50%); }
  .detail-img { border-radius: 20px 20px 0 0; }
}

@media (max-width: 420px) {
  .macro-row { grid-template-columns: repeat(2, 1fr); }
}
