/* DishMenus — Customer-facing site (Phase 6) */

/* ---------- Header ---------- */
.dm-navbar-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0 1rem;
}
.dm-header-search { max-width: 480px; min-width: 180px; }
.dm-live-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--dm-surface);
  border: 1px solid var(--dm-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  z-index: 1050;
  max-height: 320px;
  overflow-y: auto;
}
.dm-live-search-item {
  display: block;
  padding: 0.5rem 0.75rem;
  color: var(--dm-text);
  text-decoration: none;
  border-bottom: 1px solid var(--dm-border);
}
.dm-live-search-item:last-child { border-bottom: none; }
.dm-live-search-item:hover { background: #FFF3E8; }

/* ---------- Category tiles ---------- */
.dm-category-scroll {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}
.dm-category-tile {
  flex: 0 0 auto;
  background: var(--dm-surface);
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius);
  padding: 0.75rem 1.25rem;
  text-decoration: none;
  color: var(--dm-text);
  font-weight: 600;
  white-space: nowrap;
}
.dm-category-tile:hover { border-color: var(--dm-primary-strong); color: var(--dm-primary-strong); }

/* ---------- Restaurant / dish cards ---------- */
.dm-rest-card, .dm-dish-card {
  background: var(--dm-surface);
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius);
  overflow: hidden;
  height: 100%;
  text-decoration: none;
  color: var(--dm-text);
  display: block;
  transition: box-shadow .15s ease;
}
.dm-rest-card:hover, .dm-dish-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,0.08); color: var(--dm-text); }
.dm-card-image {
  width: 100%;
  height: 140px;
  background: linear-gradient(135deg, #FFE8D6, #FFD9B8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dm-primary);
  font-size: 2rem;
  position: relative;
  overflow: hidden;            /* a photo can never spill out of its box and cover the text below it */
}
/* The photo fills its box and is cropped to fit (object-fit), instead of showing at its own natural size.
   The <picture> wrapper needs a size too — without one the percentage heights on the <img> did nothing,
   which is why tall phone photos used to run over the page. */
.dm-card-image picture,
.dm-card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The big photo on a dish's own page: a fixed shape (not a fixed height), so it looks right on a phone and
   on a desktop, whatever shape the uploaded photo is. */
.dm-card-image-hero {
  height: auto;
  aspect-ratio: 4 / 3;
  max-height: 440px;
  border-radius: 14px;
  border: 1px solid var(--dm-border);
}
.dm-card-image-hero picture,
.dm-card-image-hero img {
  position: absolute;
  inset: 0;
}
.dm-card-image-hero > i { font-size: 3.5rem; }
@media (max-width: 575.98px) {
  .dm-card-image-hero { aspect-ratio: 16 / 11; border-radius: 12px; }
}
.dm-card-body { padding: 0.9rem; }
.dm-card-title { font-weight: 700; margin-bottom: 0.15rem; }
.dm-card-meta { color: var(--dm-muted); font-size: 0.85rem; }
.dm-rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: #FFF3E8;
  color: var(--dm-primary-strong);
  border-radius: 6px;
  padding: 0.1rem 0.45rem;
  font-weight: 700;
  font-size: 0.85rem;
}

/* ---------- Filter panel ---------- */
.dm-filter-panel {
  background: var(--dm-surface);
  border: 1px solid var(--dm-border);
  border-radius: var(--dm-radius);
  padding: 1rem;
}
.dm-filter-panel h6 { text-transform: uppercase; font-size: 0.75rem; color: var(--dm-muted); letter-spacing: .04em; }

/* ---------- Footer ---------- */
.dm-footer h6 { font-weight: 700; margin-bottom: 0.75rem; }
.dm-footer-links li { margin-bottom: 0.4rem; }
.dm-footer-links a { color: var(--dm-muted); text-decoration: none; font-size: 0.9rem; }
.dm-footer-links a:hover { color: var(--dm-primary-strong); }

/* ---------- Mobile bottom nav ---------- */
.dm-mobile-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--dm-surface);
  border-top: 1px solid var(--dm-border);
  display: flex;
  z-index: 1000;
}
.dm-mobile-nav-link {
  flex: 1;
  text-align: center;
  padding: 0.5rem 0 0.4rem;
  color: var(--dm-muted);
  text-decoration: none;
  font-size: 0.7rem;
}
.dm-mobile-nav-link i { display: block; font-size: 1.2rem; margin-bottom: 2px; }
.dm-mobile-nav-link:hover { color: var(--dm-primary-strong); }

@media (max-width: 991.98px) {
  body.dm-has-mobile-nav { padding-bottom: 60px; }
}

/* ---------- Hero (home) ---------- */
.dm-section-title { font-weight: 800; margin-bottom: 1rem; }

/* Phones: one restaurant per row - picture on the left, name and details on the right. */
@media (max-width: 767.98px) {
  .dm-rest-card {
    display: flex;
    align-items: stretch;
  }
  .dm-rest-card .dm-card-image {
    width: 112px;
    min-height: 96px;
    height: auto;
    flex-shrink: 0;
    font-size: 1.6rem;
  }
  .dm-rest-card .dm-card-body {
    flex: 1;
    min-width: 0;              /* lets a long name wrap instead of pushing the card wider */
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

/* Picture for restaurants/dishes without a photo yet (see placeholder_art()): calm tones + serif type. */
.dm-ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.75rem;
  overflow: hidden;
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
}
.dm-ph::before {               /* a fine inner frame, like a printed menu */
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid currentColor;
  opacity: 0.18;
  border-radius: 6px;
  pointer-events: none;
}
.dm-ph-mark {                  /* restaurant initials */
  font-size: 2.1rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  line-height: 1;
  padding-left: 0.12em;        /* balances the letter-spacing */
}
.dm-ph-sub {                   /* cuisine, small caps under the initials */
  font-family: var(--dm-font, system-ui, sans-serif);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.7;
}
.dm-ph-sub::before {           /* short rule between initials and cuisine */
  content: "";
  display: block;
  width: 22px;
  height: 1px;
  margin: 0 auto 0.45rem;
  background: currentColor;
  opacity: 0.6;
}
.dm-ph-name {                  /* dish name */
  font-size: 1.15rem;
  font-style: italic;
  line-height: 1.25;
  max-width: 90%;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dm-ph-v1 { background: linear-gradient(160deg, #2B2724 0%, #1C1A18 100%); color: #EADCCB; }  /* charcoal */
.dm-ph-v2 { background: linear-gradient(160deg, #F8F3EC 0%, #EFE6DA 100%); color: #3B302A; }  /* cream */
.dm-ph-v3 { background: linear-gradient(160deg, #E9DCCB 0%, #DCC9B2 100%); color: #33281F; }  /* sand */

/* bigger on a restaurant's own page and a dish's own page */
.dm-restaurant-cover { position: relative; overflow: hidden; }
.dm-restaurant-cover .dm-ph-mark { font-size: 3.4rem; }
.dm-restaurant-cover .dm-ph-sub { font-size: 0.78rem; }
.dm-restaurant-cover .dm-ph::before, .dm-card-image-hero .dm-ph::before { inset: 14px; }
.dm-card-image-hero .dm-ph-name { font-size: 1.9rem; }

/* phones: the small picture beside a restaurant's name */
@media (max-width: 767.98px) {
  .dm-rest-card .dm-ph { gap: 0.25rem; padding: 0.4rem; }
  .dm-rest-card .dm-ph::before { inset: 5px; }
  .dm-rest-card .dm-ph-mark { font-size: 1.35rem; }
  .dm-rest-card .dm-ph-sub { display: none; }
}

/* ---------- Restaurant menu: sticky category bar + dish rows (restaurants/show.php, js/menu-nav.js) ---------- */
.dm-menu-nav {
  position: sticky;
  top: var(--dm-nav-h, 0px);              /* set by menu-nav.js = height of the site header */
  z-index: 1010;                           /* under the header (1020), over the menu */
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 56px;                            /* one fixed height: the page never jumps when it sticks */
  margin: 0.75rem -0.75rem 0;
  padding: 0 0.75rem;
  background: var(--dm-background);
  border-bottom: 1px solid transparent;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.dm-menu-nav.is-stuck {
  border-bottom-color: var(--dm-border);
  box-shadow: 0 6px 12px -8px rgba(0, 0, 0, 0.18);
}
.dm-menu-nav-name {                         /* restaurant name, on the same line, once the bar is stuck */
  display: none;
  flex: 0 0 auto;                          /* never squeezed by the tabs ... */
  max-width: min(260px, 38%);              /* ... but a long name still leaves room for them */
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 0.75rem;
  border-right: 1px solid var(--dm-border);
}
.dm-menu-nav.is-stuck .dm-menu-nav-name { display: block; }
.dm-menu-tabs {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  user-select: none;
}
.dm-menu-tabs::-webkit-scrollbar { display: none; }
.dm-menu-tabs.is-dragging { cursor: grabbing; }
.dm-menu-tabs.is-dragging .dm-menu-tab { pointer-events: none; }
.dm-menu-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--dm-border);
  background: var(--dm-surface);
  color: var(--dm-text);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.dm-menu-tab:hover { border-color: var(--dm-primary); color: var(--dm-primary-strong, #A84300); }
.dm-menu-tab.active,
.dm-menu-tab.active:hover {
  background: var(--dm-primary-dark);
  border-color: var(--dm-primary-dark);
  color: #fff;
}
.dm-menu-arrow {                            /* desktop: scroll the categories with a click */
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--dm-border);
  background: var(--dm-surface);
  color: var(--dm-text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.dm-menu-arrow:hover { border-color: var(--dm-primary); color: var(--dm-primary-strong, #A84300); }
.dm-menu-arrow[hidden] { display: none; }
@media (hover: none) { .dm-menu-arrow { display: none !important; } }   /* phones: swipe instead */
.dm-menu-cat { scroll-margin-top: var(--dm-menu-offset, 140px); }

/* dish rows: one column on phones, two side by side on big screens; every other row very light grey */
.dm-menu-list .list-group-item { padding-top: 0.85rem; padding-bottom: 0.85rem; }
.dm-menu-list .list-group-item:nth-child(even) { background: #F7F7F8; }
.dm-menu-list .list-group-item:hover { background: #F0F0F2; }
@media (min-width: 992px) {
  .dm-menu-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }
  .dm-menu-list .list-group-item {
    border: 1px solid var(--dm-border) !important;   /* each dish its own card */
    border-radius: 10px !important;
    margin: 0 !important;
  }
  /* stripe whole rows (two dishes) instead of single items */
  .dm-menu-list .list-group-item:nth-child(even) { background: var(--dm-surface); }
  .dm-menu-list .list-group-item:nth-child(4n+3),
  .dm-menu-list .list-group-item:nth-child(4n+4) { background: #F7F7F8; }
  .dm-menu-list .list-group-item:hover { background: #F0F0F2; }
}

/* Dish page without a photo yet (photo_coming_soon()): an empty frame, not a blank page */
.dm-photo-soon {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: #F4F4F5;
  color: #8A8F98;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}
.dm-photo-soon::before {                    /* fine dashed inner frame */
  content: "";
  position: absolute;
  inset: 14px;
  border: 1.5px dashed #D4D6DB;
  border-radius: 10px;
}
.dm-photo-soon i { font-size: 2.6rem; line-height: 1; color: #B3B7BF; }
