/* ============================================================
   Product popup — shared by index.html & menu.html
   Desktop: centered dialog. Mobile: bottom sheet that slides up
   to a bit above the vertical center. Uses the site's CSS vars.
   ============================================================ */

/* Clickable menu items (both pages) */
.pm-clickable { cursor: pointer; outline-offset: 3px; }
.pm-clickable .name,
.pm-clickable .menu-item__name { transition: color 0.15s ease; }
.menu__item.pm-clickable:hover .name,
.menu-item.pm-clickable:hover .menu-item__name { color: var(--gold, #6c903d); }
.pm-clickable:focus-visible { outline: 2px solid var(--gold, #6c903d); border-radius: 6px; }

.pm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0);
  visibility: hidden;
  pointer-events: none;
  transition: background 0.28s ease, visibility 0s linear 0.28s;
  -webkit-tap-highlight-color: transparent;
}
.pm-overlay.pm-open {
  visibility: visible;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.45);
  transition: background 0.28s ease;
}

.pm-sheet {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface, #ffffff);
  color: var(--text, #1c1c18);
  border: 1px solid var(--line, #d0cfc6);
  border-radius: var(--radius, 14px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  transform: translateY(16px) scale(0.98);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
}
.pm-overlay.pm-open .pm-sheet {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Drag handle — only visible on mobile */
.pm-handle {
  display: none;
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--line, #e0dfd8);
  margin: 0.6rem auto 0.1rem;
  flex: none;
}

.pm-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 2;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.2s ease, transform 0.2s ease;
}
.pm-close::before,
.pm-close::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 2px;
  background: var(--text, #1c1c18);
  border-radius: 1px;
}
.pm-close::before { transform: rotate(45deg); }
.pm-close::after { transform: rotate(-45deg); }
.pm-close:hover { background: rgba(0, 0, 0, 0.1); transform: rotate(90deg); }
.pm-close:hover::before,
.pm-close:hover::after { background: var(--text, #1c1c18); }

.pm-media {
  flex: none;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--bg-2, #f0efe8) center/cover no-repeat;
  overflow: hidden;
}
.pm-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pm-sheet.pm-no-media .pm-media { display: none; }

.pm-body {
  padding: 1.15rem 1.35rem 1.5rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.pm-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.pm-title {
  font-family: var(--font-display, "Playfair Display", serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--gold, #6c903d);
  margin: 0;
  line-height: 1.2;
}
.pm-price {
  font-family: var(--font-alt, var(--font-body, sans-serif));
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold, #6c903d);
  white-space: nowrap;
}
.pm-price::before { content: "\20AC\00A0"; font-size: 0.85em; }
.pm-price:empty { display: none; }

.pm-desc {
  margin-top: 0.7rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--muted, #5c5c56);
}
.pm-desc:empty { display: none; }

/* ---------- Mobile: bottom sheet ---------- */
@media (max-width: 699px) {
  .pm-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .pm-sheet {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    /* slide up from the bottom of the screen */
    transform: translateY(100%);
    opacity: 1;
    transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
    touch-action: pan-y;
  }
  .pm-overlay.pm-open .pm-sheet { transform: translateY(0); }
  .pm-handle {
    display: block;
    position: absolute;
    top: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    margin: 0;
  }
  .pm-media {
    /* keeps the resting top edge a bit above centre on a phone */
    aspect-ratio: auto;
    height: 40vh;
    max-height: 46vh;
  }
  .pm-close {
    top: 0.5rem;
    right: 0.5rem;
  }
  .pm-title { font-size: 1.5rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .pm-sheet,
  .pm-overlay { transition: opacity 0.15s ease, visibility 0s !important; }
  .pm-sheet { transform: none !important; }
  .pm-overlay .pm-sheet { opacity: 0; }
  .pm-overlay.pm-open .pm-sheet { opacity: 1; transform: none !important; }
}
