/* =========================================================
   SORREL · menu pop-up
   A native <dialog> (focus trap, Esc to close, top layer).
   Screens are all in the markup; [data-screen] on the dialog
   decides which one shows. Same tokens and shape rule as the page.
   ========================================================= */

.mm {
  width: min(1400px, calc(100vw - 48px)); height: calc(100dvh - 48px);
  max-width: none; max-height: none; margin: auto; padding: 0;
  border: 0; border-radius: 10px; overflow: hidden;
  background: var(--bg); color: var(--ink);
  display: none; flex-direction: column;
  box-shadow: 0 40px 120px oklch(0 0 0 / 0.6);
}
.mm[open] { display: flex; animation: mm-in 520ms var(--ease-out) both; }
.mm::backdrop { background: oklch(0.12 0.015 40 / 0.62); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: fade 400ms var(--ease-out) both; }
.mm.is-closing { animation: mm-out 260ms var(--ease-out) both; }
.mm.is-closing::backdrop { animation: fade 260ms var(--ease-out) reverse both; }
@keyframes mm-in { from { opacity: 0; transform: translateY(24px) scale(0.985); clip-path: inset(6% 0 0 0 round 10px); } to { opacity: 1; transform: none; clip-path: inset(0 round 10px); } }
@keyframes mm-out { to { opacity: 0; transform: translateY(16px) scale(0.99); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Top bar ---------- */
.mm-top { display: flex; align-items: center; gap: 14px; height: 76px; padding: 0 28px; border-bottom: 1px solid var(--line); flex: none; }
.mm-crumb { font-size: 0.9375rem; color: var(--muted); }
.mm-crumb b { color: var(--ink); font-weight: 600; }
.mm-icon {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: transparent; color: var(--ink); border: 1px solid color-mix(in oklch, var(--ink) 25%, transparent);
  transition: background-color 200ms var(--ease-out), border-color 200ms;
}
.mm-icon:hover { background: color-mix(in oklch, var(--ink) 8%, transparent); border-color: var(--ink); }
.mm-icon svg { width: 16px; height: 16px; }
.mm-icon[hidden] { display: none; }
.mm-close { margin-left: auto; }

/* ---------- Body and screens ---------- */
.mm-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 40px clamp(20px, 3.4vw, 48px) 48px; }
.mm-screen { display: none; }
.mm[data-screen="picker"] [data-id="picker"],
.mm[data-screen="dinner"] [data-id="dinner"],
.mm[data-screen="sunday"] [data-id="sunday"],
.mm[data-screen="christmas"] [data-id="christmas"],
.mm[data-screen="drinks"] [data-id="drinks"],
.mm[data-screen="reserve"] [data-id="reserve"],
.mm[data-screen="success"] [data-id="success"] { display: block; animation: rise 460ms var(--ease-out) both; }

.mm-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px 40px; margin-bottom: 32px; }
.mm-title { font: 400 clamp(2.2rem, 4.4vw, 4rem)/1 var(--display); letter-spacing: -0.02em; }
.mm-lede { color: var(--muted); max-width: 40ch; }

/* ---------- Picker ---------- */
.mm-pick {
  display: grid; gap: 14px;
  grid-template-columns: 1.3fr 1fr 1fr; grid-template-rows: repeat(2, clamp(200px, 28vh, 280px));
  grid-template-areas: "x d s" "x w w";
}
.mm-pcard { position: relative; overflow: hidden; isolation: isolate; border: 0; padding: 0; border-radius: var(--r); cursor: pointer; text-align: left; color: var(--ink); background: var(--surface); font: inherit; }
.mm-pcard--christmas { grid-area: x; }
.mm-pcard[data-go="dinner"] { grid-area: d; }
.mm-pcard[data-go="sunday"] { grid-area: s; }
.mm-pcard--wide { grid-area: w; }
.mm-pcard img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; transition: transform 900ms var(--ease-out); }
.mm-pcard::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, color-mix(in oklch, var(--bg) 92%, transparent), transparent 62%); }
.mm-pcard:hover img { transform: scale(1.05); }
.mm-pcard-text { position: absolute; left: 22px; right: 80px; bottom: 20px; display: grid; gap: 6px; }
.mm-pcard-name { font: 400 clamp(1.5rem, 2.2vw, 2.1rem)/1 var(--display); }
.mm-pcard--christmas .mm-pcard-name { font-size: clamp(2rem, 3.2vw, 3rem); }
.mm-pcard-meta { color: var(--muted); font-size: 0.9375rem; }
.mm-arrow, .m-card-arrow { pointer-events: none; }
.mm-arrow {
  position: absolute; right: 20px; bottom: 20px; width: 44px; height: 44px; border-radius: 50%;
  background: var(--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M4 10H16M11 5L16 10L11 15' fill='none' stroke='%231d100b' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 20px;
  transition: transform 300ms var(--ease-out);
}
.mm-pcard:hover .mm-arrow { transform: translateX(4px); }
.mm-pcard .m-card-seal { z-index: 1; }
@media (max-width: 760px) {
  .mm-pick { grid-template-columns: 1fr 1fr; grid-template-rows: 240px 170px 170px; grid-template-areas: "x x" "d s" "w w"; }
  /* Half width cards: arrow to the top corner so the name gets the full width */
  :is(.mm-pcard[data-go="dinner"], .mm-pcard[data-go="sunday"]) .mm-pcard-text { left: 16px; right: 14px; bottom: 16px; }
  :is(.mm-pcard[data-go="dinner"], .mm-pcard[data-go="sunday"]) .mm-arrow { top: 12px; right: 12px; bottom: auto; width: 36px; height: 36px; background-size: 17px; }
  .mm-pcard-name { font-size: 1.5rem; }
  .mm-pcard-meta { font-size: 0.875rem; line-height: 1.35; }
}

/* ---------- Filters ---------- */
.mm-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 36px; }
.mm-filter-label { font-size: 0.875rem; font-weight: 600; color: var(--muted); margin-right: 6px; }
.mm-chip {
  min-height: 44px; padding: 0 16px; border-radius: 999px; cursor: pointer;
  background: transparent; color: var(--ink); border: 1px solid color-mix(in oklch, var(--ink) 30%, transparent);
  font: 600 0.875rem/1 var(--body);
  transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out), border-color 200ms;
}
.mm-chip:hover { border-color: var(--ink); }
.mm-chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- Dish lists ---------- */
.mm-split { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 80px); }
.mm-courses { display: grid; gap: 44px; align-content: start; }
.mm-course h3 { font: 700 0.8125rem/1 var(--body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 18px; }
.mm-dish {
  display: flex; align-items: baseline; gap: 16px; padding: 14px 0;
  border-top: 1px solid color-mix(in oklch, var(--line) 70%, transparent);
  transition: opacity 250ms var(--ease-out);
}
.mm-dish p { flex: 1; font: 400 clamp(1.1rem, 1.5vw, 1.3rem)/1.35 var(--display); }
.mm-dish > span { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.mm-dish.is-out { display: none; }
.mm-empty { color: var(--muted); }
.mm-price { font: 400 clamp(1.4rem, 2.2vw, 1.8rem)/1.2 var(--display); color: var(--accent-text); }
.mm-photos { display: grid; gap: 14px; align-content: start; position: sticky; top: 0; }
.mm-photos img { width: 100%; border-radius: var(--r); object-fit: cover; }
.mm-photos img:first-child { aspect-ratio: 7 / 8.2; }
.mm-photos img:last-child { aspect-ratio: 7 / 5.6; }
@media (max-width: 860px) { .mm-split { grid-template-columns: 1fr; } .mm-photos { display: none; } }

/* ---------- Christmas card ---------- */
.mm-xgrid { display: grid; grid-template-columns: minmax(0, 640px) minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); align-items: start; }
.xcard {
  position: relative; padding: clamp(32px, 4vw, 52px) clamp(24px, 4vw, 56px);
  background: var(--paper); color: oklch(0.24 0.03 165); border-radius: 4px;
  display: grid; gap: 22px; text-align: center;
  box-shadow: 0 24px 60px oklch(0 0 0 / 0.35);
}
.xcard::before { content: ""; position: absolute; inset: 10px; border: 1px solid oklch(0.24 0.03 165 / 0.18); border-radius: 2px; pointer-events: none; }
.xcard-holly { position: absolute; width: 74px; height: auto; pointer-events: none; }
.xcard-holly--a { left: -16px; top: -18px; transform: rotate(18deg); }
.xcard-holly--b { right: -16px; bottom: -16px; transform: rotate(200deg); }
.xcard-head h2 { font: 400 clamp(1.9rem, 3vw, 2.6rem)/1.05 var(--display); }
.xcard-head p { margin-top: 8px; color: oklch(0.4 0.03 165); font-size: 0.9375rem; }
.xcard-course { display: grid; gap: 8px; justify-items: center; }
.xcard-course h3 { font: 700 0.8125rem/1 var(--body); letter-spacing: 0.16em; text-transform: uppercase; color: oklch(0.48 0.16 28); margin-bottom: 6px; }
.xcard-course p { font: 400 clamp(1.05rem, 1.5vw, 1.2rem)/1.4 var(--display); max-width: 32ch; }
.xcard .or { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: oklch(0.48 0.16 28); }
.xcard abbr { color: oklch(0.42 0.12 150); text-decoration: none; font-size: 0.75em; font-weight: 700; }
.xcard-rule { width: 120px; height: auto; justify-self: center; }
.mm-xside { display: grid; gap: 20px; position: sticky; top: 0; }
.mm-xphotos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mm-xphotos img { width: 100%; aspect-ratio: 7 / 6.2; object-fit: cover; border-radius: var(--r); }
.mm-xnote { padding: 26px; border-radius: var(--r); background: var(--surface); display: grid; gap: 10px; }
.mm-xnote h3 { font: 400 1.5rem/1.2 var(--display); }
.mm-xnote p { color: var(--muted); }
@media (max-width: 960px) { .mm-xgrid { grid-template-columns: 1fr; } }

/* ---------- Wine list ---------- */
.mm-wines { display: grid; margin-bottom: 52px; }
.mm-wine-head, .mm-wine { display: grid; grid-template-columns: minmax(0, 1fr) 72px 72px; gap: 16px; align-items: baseline; }
.mm-wine-head { padding-bottom: 12px; font: 700 0.8125rem/1 var(--body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-text); }
.mm-wine-head span:not(:first-child), .mm-wine > span { text-align: right; font-variant-numeric: tabular-nums; }
.mm-wine { padding: 16px 0; border-top: 1px solid color-mix(in oklch, var(--line) 70%, transparent); }
.mm-wine p strong { display: block; font: 400 clamp(1.1rem, 1.5vw, 1.3rem)/1.3 var(--display); }
.mm-wine p span { color: var(--muted); font-size: 0.9375rem; }
.mm-wine > span { color: var(--muted); font-weight: 600; }
.mm-wine.is-out { display: none; }
.mm-course--drinks { max-width: 760px; }

/* ---------- Reserve ---------- */
.mm-reserve { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(32px, 5vw, 72px); align-items: start; }
.mm-reserve-media img { width: 100%; aspect-ratio: 9 / 11; object-fit: cover; border-radius: var(--r); position: sticky; top: 0; }
.mm-form { display: grid; gap: 26px; }
.mm-field { display: grid; gap: 10px; border: 0; margin: 0; padding: 0; min-width: 0; }
.mm-field legend, .mm-field label, .mm-label { font-weight: 600; font-size: 0.9375rem; padding: 0; margin-bottom: 10px; }
.mm-field label, .mm-label { margin-bottom: 0; }
.mm-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mm-days { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.mm-days::-webkit-scrollbar { display: none; }
.mm-day, .mm-time {
  flex: none; cursor: pointer; border-radius: var(--r);
  background: transparent; color: var(--ink); border: 1px solid color-mix(in oklch, var(--ink) 28%, transparent);
  font: 600 0.9375rem/1.2 var(--body);
  transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out), border-color 200ms;
}
.mm-day { width: 74px; height: 70px; display: grid; place-content: center; text-align: center; }
.mm-day small { display: block; font-weight: 500; font-size: 0.75rem; color: var(--muted); }
.mm-day:hover, .mm-time:hover:not(:disabled) { border-color: var(--ink); }
.mm-day[aria-pressed="true"], .mm-time[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.mm-day[aria-pressed="true"] small { color: inherit; opacity: 0.75; }
.mm-day:disabled { opacity: 0.35; cursor: not-allowed; }
.mm-times { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.mm-time { height: 46px; font-variant-numeric: tabular-nums; }
.mm-time:disabled { opacity: 0.3; cursor: not-allowed; text-decoration: line-through; }
.mm-stepper { display: inline-flex; align-items: center; justify-content: space-between; width: 180px; min-height: 50px; border: 1px solid color-mix(in oklch, var(--ink) 30%, transparent); border-radius: var(--r); }
.mm-stepper button { appearance: none; border: 0; background: none; color: var(--ink); cursor: pointer; width: 52px; height: 48px; font-size: 1.25rem; }
.mm-stepper button:disabled { opacity: 0.3; cursor: not-allowed; }
.mm-stepper output { font-weight: 700; font-variant-numeric: tabular-nums; }
.mm-field input {
  min-height: 52px; padding: 0 14px; border-radius: var(--r);
  background: var(--surface); color: var(--ink); border: 1px solid color-mix(in oklch, var(--ink) 30%, transparent);
  font: 500 1rem var(--body);
}
.mm-field input::placeholder { color: color-mix(in oklch, var(--ink) 62%, transparent); }
.mm-field input:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 1px; }
.mm-field input[aria-invalid="true"] { border-color: oklch(0.72 0.17 25); }
.mm-err { color: oklch(0.82 0.12 30); font-size: 0.875rem; }
@media (max-width: 860px) { .mm-reserve { grid-template-columns: 1fr; } .mm-reserve-media { display: none; } .mm-row { grid-template-columns: 1fr; } }

/* ---------- Success ---------- */
.mm-success { min-height: 50vh; display: grid; align-content: center; justify-items: start; gap: 22px; max-width: 640px; }
.mm-success p { color: var(--muted); font-size: 1.125rem; }
.mm-success-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

/* ---------- CTA strip ---------- */
.mm-cta { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 28px; border-top: 1px solid var(--line); background: var(--surface); }
.mm-cta p { color: var(--muted); }
.mm[data-screen="reserve"] .mm-cta, .mm[data-screen="success"] .mm-cta { display: none; }

@media (max-width: 760px) {
  .mm { width: 100vw; height: 100dvh; border-radius: 0; }
  /* Full screen on phones: the top bar clears the status bar and island */
  .mm-top { height: calc(64px + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 14px 0; }
  .mm-body { padding: 24px 16px 32px; }
  .mm-cta { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .mm-cta p { display: none; }
  .mm-cta .btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .mm[open], .mm::backdrop { animation: none; } }
