/* ==========================================================================
   Er Pang – online menu (menu.html only)
   ========================================================================== */

.m-toolbar [hidden],
.m-menu [hidden] { display: none !important; }

/* Leave room for the sticky header + menu toolbar when jumping to a section */
html:has(.m-toolbar) { scroll-padding-top: 11rem; }

/* ============================== Toolbar =================================== */
.m-toolbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding-block: var(--space-3);
  background: oklch(from var(--color-bg) l c h / 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-divider);
  transition: top 0.35s var(--ease-out);
}
/* Sit below the site header while it is showing (it hides on scroll down) */
.header:not(.header--hidden) ~ main .m-toolbar { top: var(--header-h, 73px); }

.m-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
}
.m-search {
  position: relative;
  flex: 1 1 16rem;
  display: flex;
  align-items: center;
}
.m-search svg {
  position: absolute;
  left: 0.9rem;
  width: 18px;
  height: 18px;
  color: var(--color-text-muted);
  pointer-events: none;
}
.m-search input {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--space-4) 0 2.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 1rem; /* 16px stops iOS zooming into the field */
}
.m-search input::placeholder { color: var(--color-text-muted); opacity: 0.8; }
.m-search input:focus-visible { border-color: var(--color-primary); outline-offset: 1px; }

.m-filters { display: flex; gap: var(--space-2); }
.m-filter {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}
.m-filter svg { width: 16px; height: 16px; }
.m-filter:hover { border-color: var(--color-primary); color: var(--color-primary); }
.m-filter[aria-pressed='true'] {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-text-inverse);
}

.m-chips {
  position: relative;
  display: flex;
  gap: var(--space-1);
  overflow-x: auto;
  scrollbar-width: none;
  mask-image: linear-gradient(90deg, #000 calc(100% - 2rem), transparent);
}
.m-chips::-webkit-scrollbar { display: none; }
.m-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  white-space: nowrap;
}
.m-chip:hover { color: var(--color-primary); }
.m-chip[aria-current='true'] {
  background: var(--color-primary-highlight);
  border-color: oklch(from var(--color-primary) l c h / 0.3);
  color: var(--color-primary);
}
.m-chip.is-empty { opacity: 0.4; }

/* ============================== Status / empty ============================= */
.m-status {
  min-height: 1.5em;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.m-empty { text-align: center; padding-block: var(--space-12); }
.m-empty p { margin: 0 auto var(--space-4); color: var(--color-text); }

/* ============================== Hot pot + allergen callouts ================= */
.m-hotpot,
.m-allergens {
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: clamp(var(--space-5), 3vw, var(--space-8));
}
.m-hotpot {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--space-8);
  align-items: center;
  margin-bottom: var(--space-4);
}
.m-hotpot .frame { aspect-ratio: 1; }
.m-hotpot h2 { font-size: var(--text-xl); margin-block: var(--space-2); }
.m-allergens { margin-top: var(--space-12); }
.m-allergens h2 { font-size: var(--text-lg); margin-bottom: var(--space-2); }
.m-allergens p { max-width: 70ch; }
.m-allergens a:not(.btn) { color: var(--color-primary); font-weight: 600; }
.m-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  margin-block: var(--space-4);
  font-size: var(--text-sm);
}
.m-legend li { display: inline-flex; align-items: center; gap: var(--space-2); }

/* ============================== Sections ==================================== */
.m-section {
  padding-block: var(--space-10);
  border-top: 1px solid var(--color-divider);
}
.m-section:has(.m-feature) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15rem;
  column-gap: var(--space-10);
  align-items: start;
}
.m-section:has(.m-feature) > :not(.m-feature) { grid-column: 1; }
.m-feature {
  grid-column: 2;
  grid-row: 1 / span 6;
  position: sticky;
  top: 12rem;
}
.m-feature .frame { aspect-ratio: 3 / 4; }
.m-feature figcaption {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.m-section-head h2 { font-size: var(--text-xl); }
.m-section-head h2 .m-zh {
  font-size: 0.72em;
  font-weight: 500;
  color: var(--color-gold-hover);
  margin-inline-start: 0.25em;
}
[data-theme='dark'] .m-section-head h2 .m-zh { color: var(--color-gold); }
.m-section-head p {
  margin-top: var(--space-1);
  font-family: var(--font-display);
  font-style: italic;
  color: var(--color-text-muted);
}
.m-group {
  margin-top: var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.m-note {
  margin-top: var(--space-6);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
}
.m-note p { max-width: none; color: var(--color-text); }
.m-note p + p { margin-top: var(--space-2); }
.m-note .m-note-small { color: var(--color-text-muted); font-size: var(--text-xs); }
.m-note .pill { margin-inline: var(--space-1); }

/* ============================== Dishes ====================================== */
.m-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--space-10);
  margin-top: var(--space-4);
}
.m-dish {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) auto;
  gap: var(--space-1) var(--space-3);
  align-items: baseline;
  padding-block: var(--space-3);
  border-bottom: 1px dashed var(--color-divider);
}
.m-code {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}
.m-body {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--space-2);
}
.m-name { font-weight: 600; color: var(--color-text); }
.m-body .m-zh {
  flex-basis: 100%;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.m-dish-note {
  flex-basis: 100%;
  font-size: var(--text-xs);
  font-style: italic;
  color: var(--color-text-muted);
}
.m-price {
  max-width: 8.5rem;
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
}

.m-icons { display: inline-flex; align-items: center; gap: var(--space-1); }
.m-icon { display: inline-flex; align-items: center; }
.m-icon svg { width: 15px; height: 15px; }
.m-icon--spicy { color: var(--color-primary); }
.m-icon--spicy svg + svg { margin-left: -5px; }
.m-icon--v { color: var(--color-success); }
.m-icon--g { color: var(--color-gold-hover); }
.m-icon--sh { color: oklch(0.6 0.15 40); }
[data-theme='dark'] .m-icon--g { color: var(--color-gold); }

.m-filesize { font-weight: 400; opacity: 0.85; }

/* ============================== Say it in Mandarin ========================== */
.m-say {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: -6px 0 -6px var(--space-1);
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  vertical-align: middle;
}
.m-say svg { width: 16px; height: 16px; }
.m-say:hover, .m-say.is-speaking { color: var(--color-primary); background: var(--color-primary-highlight); }
.m-say-hint {
  margin: var(--space-3) auto 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.m-say-hint svg { display: inline; width: 14px; height: 14px; vertical-align: -2px; }

/* ============================== Feast planner =============================== */
.planner {
  width: min(44rem, calc(100% - 2rem));
  max-height: min(52rem, calc(100dvh - 2rem));
  margin: auto;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-bg);
  color: var(--color-text);
  box-shadow: var(--shadow-lg);
}
.planner { overflow: hidden; }
.planner:focus { outline: none; } /* focus goes to the controls inside, not the panel */
.planner::backdrop { background: oklch(0.1 0.02 40 / 0.6); backdrop-filter: blur(3px); }
.planner-inner {
  display: flex;
  flex-direction: column;
  max-height: min(52rem, calc(100dvh - 2rem));
  overflow-y: auto;
  overscroll-behavior: contain;
}
.planner-head {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  padding: var(--space-6) var(--space-6) var(--space-4);
}
.planner-head h2 { font-size: var(--text-xl); margin-block: var(--space-2) var(--space-1); }
.planner-head h2 .m-zh { font-size: 0.7em; font-weight: 500; color: var(--color-gold-hover); }
[data-theme='dark'] .planner-head h2 .m-zh { color: var(--color-gold); }
.planner-head p { font-size: var(--text-sm); }
.planner-close {
  flex: none;
  margin-left: auto;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}
.planner-close svg { width: 18px; height: 18px; }

.planner-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-6);
  padding: 0 var(--space-6) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}
.planner-field { border: 0; min-width: 0; }
.planner-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.planner-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
}
.planner-stepper button {
  width: 44px;
  height: 44px;
  font-size: 1.25rem;
  font-weight: 600;
  border-radius: var(--radius-full);
}
.planner-stepper button:disabled { opacity: 0.35; cursor: not-allowed; }
.planner-stepper output { min-width: 2.5ch; text-align: center; font-weight: 700; font-size: var(--text-lg); }
.planner-seg { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.planner-seg label { position: relative; }
.planner-seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.planner-seg span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  font-size: var(--text-sm);
  font-weight: 600;
}
.planner-seg input:checked + span { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-text-inverse); }
.planner-seg input:focus-visible + span { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.planner-check { display: inline-flex; align-items: center; gap: var(--space-2); align-self: flex-end; min-height: 44px; font-size: var(--text-sm); font-weight: 600; }
.planner-check input { width: 18px; height: 18px; accent-color: var(--color-primary); }

.planner-result { padding: var(--space-2) var(--space-6) var(--space-4); }
.planner-result h3 {
  margin-top: var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.planner-dish {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr) auto auto;
  gap: var(--space-1) var(--space-3);
  align-items: center;
  padding-block: var(--space-2);
  border-bottom: 1px dashed var(--color-divider);
}
.planner-dish .m-body .m-zh { flex-basis: 100%; font-size: var(--text-sm); color: var(--color-text-muted); }
.planner-swap {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
}
.planner-swap svg { width: 14px; height: 14px; }
.planner-swap:hover { border-color: var(--color-primary); color: var(--color-primary); }

.planner-foot {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-divider);
  background: var(--color-surface-offset);
}
.planner-total { font-size: var(--text-base); color: var(--color-text); max-width: none; }
.planner-total strong { color: var(--color-primary); }
.planner-over { display: block; margin-top: var(--space-1); font-size: var(--text-xs); color: var(--color-text-muted); }
.planner-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-block: var(--space-3); }
.planner-small { padding: 0 var(--space-6) var(--space-5); font-size: var(--text-xs); color: var(--color-text-muted); max-width: none; }
.planner-actions { margin-bottom: 0; }

@media (max-width: 600px) {
  .planner { width: 100%; max-width: 100%; max-height: 100dvh; height: 100dvh; border-radius: 0; border: 0; }
  .planner-inner { max-height: 100dvh; height: 100%; }
  .planner-head p { display: none; }
  .planner-head, .planner-form, .planner-result, .planner-foot, .planner-small { padding-inline: var(--space-4); }
  .planner-foot { padding-block: var(--space-3); }
  .planner-actions { margin-top: var(--space-2); }
  .planner-dish { grid-template-columns: 2.25rem minmax(0, 1fr) auto; }
  .planner-swap { grid-column: 2 / -1; justify-self: start; }
  .planner-swap span { display: inline; }
  .planner-actions .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: no-preference) {
  .planner[open] { animation: planner-in 360ms var(--ease-out) both; }
  .planner[open]::backdrop { animation: planner-fade 300ms ease both; }
  .m-say.is-speaking svg { animation: say-pulse 0.9s ease-in-out infinite; }
}
@keyframes planner-in { from { opacity: 0; transform: translateY(24px) scale(0.98); } }
@keyframes planner-fade { from { opacity: 0; } }
@keyframes say-pulse { 50% { transform: scale(1.18); } }

/* ============================== Responsive ================================== */
@media (max-width: 800px) {
  .m-list { grid-template-columns: 1fr; }
  .m-section:has(.m-feature) { display: block; }
  .m-feature { position: static; margin-block: var(--space-5) var(--space-2); }
  .m-feature .frame { aspect-ratio: 16 / 10; }
  .m-hotpot { grid-template-columns: 1fr; gap: var(--space-5); }
  .m-hotpot .frame { aspect-ratio: 16 / 10; }
}
@media (max-width: 480px) {
  .m-filters { width: 100%; }
  .m-filter { flex: 1; justify-content: center; }
  .m-dish { grid-template-columns: 2.25rem minmax(0, 1fr) auto; column-gap: var(--space-2); }
}

@media print {
  .m-toolbar, .m-feature, .m-hotpot .frame, .m-allergens .hero-actions, .page-hero .hero-actions { display: none !important; }
  .m-section { break-inside: avoid-page; }
}
