@font-face {
  font-family: Menu Sans;
  src: url("assets/body-thai.ttf") format("truetype");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: Menu Serif;
  src: url("assets/display-thai.ttf") format("truetype");
  font-weight: 600; font-display: swap;
}
:root {
  color-scheme: dark;
  --gutter: #90000b;
  --wine: #4e101e;
  --gold: #c99a60;
  --ink-gold: #ffe4a6;
  --paper: #f3c3a4;
  --serif: "Menu Serif", Georgia, serif;
  --sans: "Menu Sans", "Leelawadee UI", Tahoma, sans-serif;
  --chinese: "Songti TC", PMingLiU, "Noto Serif TC", SimSun, Georgia, serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--gutter); }
body {
  margin: 0; min-height: 100vh; padding: 18px 0 30px;
  color: #fce8ca; background: var(--gutter);
  font: 400 1rem/1.64 var(--sans);
}
button, a { color: inherit; font: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; border: 0; }
button:focus-visible, a:focus-visible { outline: 2px solid #fff4ce; outline-offset: 3px; }
a { text-decoration: none; }
p, h1, h2 { margin: 0; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.symbols, .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.icon { flex: none; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.page {
  width: min(100%,606px); margin: 0 auto; overflow: hidden; container-type: inline-size;
  background: var(--wine); border: 1px solid #b18153;
}
.navigation {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  min-height: 39px; padding: 0 20px; border-bottom: 1px solid #ce9a65;
  background: #781b2b; color: #ffe7bf;
}
.navigation > * {
  display: inline-flex; gap: 6px; align-items: center; min-height: 38px; padding: 2px;
  background: transparent; font: 400 .875rem/1.5 var(--sans);
}
.navigation a:hover, .navigation button:hover { color: #fff7e9; text-decoration: underline; text-underline-offset: 4px; }
#saved-count { padding: 0 5px; color: #4c1120; background: #ffdbac; font: 600 .85rem/1.4 Georgia, serif; }
.menu-heading {
  position: relative; isolation: isolate; overflow: hidden; text-align: center;
  padding: clamp(23px, 5cqw, 34px) 16px clamp(20px, 4.4cqw, 28px);
  background: radial-gradient(ellipse at 44% 8%, #ca4251, transparent 66%), linear-gradient(110deg,#a71932,#be2442 48%,#9a2338);
  border-bottom: 4px double #e6b779;
}
.menu-heading::before, .menu-heading::after {
  content: ""; position: absolute; z-index: -1; top: 50%; width: 33%; height: 109%;
  border: 1px solid #edba7952; border-radius: 50%;
  background: repeating-radial-gradient(ellipse at 50% 50%,transparent 0 12%,#e6a87738 12.4% 12.8%,transparent 13.3% 17%);
  opacity: .8; pointer-events: none;
}
.menu-heading::before { left: -21%; transform: translateY(-49%) rotate(-28deg); }
.menu-heading::after { right: -21%; transform: translateY(-49%) rotate(28deg); }
.brand { display: flex; align-items: center; justify-content: center; gap: 12px; color: #ffdfb0; font-size: .91rem; }
.brand span { position: relative; width: clamp(22px, 8cqw, 50px); height: 1px; background: #e5b67f; }
.brand span::after { content: ""; position: absolute; top: -2px; width: 5px; height: 5px; border: 1px solid #f6cf94; transform: rotate(45deg); }
.brand span:first-child::after { right: 1px; }
.brand span:last-child::after { left: 1px; }
.menu-heading h1 {
  margin: 5px 0 -1px; color: #ffe5a8;
  font: 600 clamp(2.72rem, 10.2cqw, 3.9rem)/1.42 var(--serif);
  text-shadow: 0 1px #853021, 1px 2px #91371c, 0 4px 3px #68142588;
}
.menu-chinese {
  color: #ffdc9d; font: 500 .93rem/1.5 var(--chinese); letter-spacing: .39em; text-indent: .39em;
}
.dishes {
  position: relative; margin: 0 14px; padding: 4px 0 9px;
  border-bottom: 3px double #aa7647;
}
.page main { padding-bottom: 13px; }
.dish-card {
  position: relative; display: grid; grid-template-columns: minmax(0,1.04fr) minmax(0,1fr);
  align-items: center; gap: clamp(12px, 4cqw, 28px); min-width: 0;
  padding: clamp(20px, 4.5cqw, 31px) clamp(5px, 2cqw, 13px);
}
.dish-card + .dish-card { border-top: 1px solid #b88060; }
.dish-card + .dish-card::before {
  content: ""; position: absolute; top: -4px; left: calc(50% - 3px);
  width: 7px; height: 7px; border: 1px solid #d5a36c;
  background: var(--wine); transform: rotate(45deg);
}
.dish-figure {
  position: relative; min-width: 0; width: 100%; align-self: stretch;
  display: grid; place-items: center;
}
.dish-figure::before {
  content: ""; position: absolute; left: 8%; right: 8%; bottom: 13%; height: 26%;
  pointer-events: none; background: radial-gradient(ellipse,#22030e91,transparent 72%);
}
.dish-photo { position: relative; width: 100%; height: auto; object-fit: contain; }
.dish-card:nth-child(even) .dish-figure { grid-column: 2; grid-row: 1; }
.dish-card:nth-child(even) .dish-copy { grid-column: 1; grid-row: 1; padding-left: 4px; }
.dish-copy { min-width: 0; }
.chinese {
  color: #edc582; font: 500 clamp(.87rem, 3cqw, 1rem)/1.5 var(--chinese); letter-spacing: .12em;
}
.dish-name {
  margin: 4px 0 3px; color: var(--ink-gold);
  font: 600 clamp(1.25rem, 5.75cqw, 2rem)/1.52 var(--serif);
  text-shadow: 0 1px #682a1d, 0 2px 1px #230715;
}
.note { color: #f2d0bd; font-size: clamp(.875rem, 2.7cqw, 1rem); line-height: 1.65; }
.dish-actions { display: flex; align-items: center; gap: 7px; margin-top: 11px; }
.dish-open, .detail-save, .browse-menu {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 34px; padding: 4px 13px; border: 1px solid #efc69e; border-radius: 0;
  background: var(--paper); color: #571929; font-size: .89rem;
}
.dish-open::after { content: ""; position: absolute; inset: 0; }
.dish-open:hover, .detail-save:hover, .browse-menu:hover { background: #ffdcc0; }
.save-dish, .close-dialog {
  position: relative; z-index: 1; display: grid; place-items: center; flex: none;
  width: 37px; height: 36px; padding: 6px; background: transparent; border: 1px solid #b88064; color: #ffd2aa;
}
.save-dish:hover, .close-dialog:hover { background: #7c2635; }
.save-dish[aria-pressed="true"] { background: #f5c198; color: #591c28; border-color: #f5c198; }
[aria-pressed="true"] .icon { fill: currentColor; }
#popup {
  width: min(445px, calc(100% - 32px)); max-height: 88vh; max-height: 88dvh;
  margin: auto; padding: 0; overflow: auto; border: 3px double #d7a56c;
  border-radius: 0; background: var(--wine); color: #f9e2c9; box-shadow: 0 20px 50px #23081177;
}
#popup::backdrop { background: #21070fbd; backdrop-filter: blur(2px); }
body:has(#popup[open]) { overflow: hidden; }
.dialog-shell { position: relative; }
.close-dialog {
  position: absolute; top: 12px; right: 12px; width: 40px; height: 39px;
  color: #ffe0b4; background: #5b1728;
}
.detail-photo {
  width: 100%; height: auto; max-height: min(38dvh,285px); object-fit: contain;
  padding: 17px 26px 13px; border-bottom: 1px solid #d2a06c;
  background: radial-gradient(ellipse at center 80%,#bf4a43,#962637 64%,#7f2031);
}
.detail-text, .saved-list { padding: clamp(18px, 5vw, 28px); }
#popup-title {
  margin: 4px 0 8px; color: var(--ink-gold);
  font: 600 clamp(1.58rem, 5vw, 2rem)/1.54 var(--serif);
}
.detail-text > p, .empty-saved > p { font-size: 1rem; line-height: 1.82; }
.detail-save, .browse-menu { margin-top: 17px; min-height: 40px; }
.detail-save[aria-pressed="true"] { background: #f5d39c; }
.saved-list { min-height: 195px; }
.saved-list h2 { padding-right: 35px; }
.saved-items { list-style: none; padding: 0; margin: 14px 0 0; }
.saved-items li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-top: 1px solid #ac805b; padding: 9px 0; }
.saved-item {
  display: flex; align-items: center; flex: 1 1 140px; gap: 12px; min-width: 0;
  padding: 0; text-align: left; background: transparent; color: #ffdfac;
}
.saved-item img { width: 64px; height: 49px; object-fit: contain; }
.remove-saved, .back-to-saved { min-height: 40px; padding: 6px; color: #efc39c; background: transparent; text-decoration: underline; text-underline-offset: 4px; }
.back-to-saved { margin: 7px 3px 0 6px; }
.empty-saved { padding-top: 13px; }
@media (max-width: 606px) {
  body { padding: 0; }
  .page { border-inline: none; }
}
@media (max-width: 420px) {
  .navigation { padding-inline: 13px; }
  .dishes { margin-inline: 9px; }
  .dish-card { grid-template-columns: minmax(0,.93fr) minmax(0,1.07fr); gap: 9px; }
  .dish-card:nth-child(even) { grid-template-columns: minmax(0,1.07fr) minmax(0,.93fr); }
  .dish-card:nth-child(even) .dish-copy { padding-left: 0; }
  .dish-open { padding-inline: 9px; }
  .dish-actions { gap: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto; }
}

/* On a wide screen the three plates share one menu spread. */
@media (min-width: 607px) {
  body { padding: 0 3vw clamp(24px, 3vw, 44px); }
  .page { width: min(100%, 1440px); }
}
@media (min-width: 768px) {
  .navigation { min-height: 62px; padding-inline: clamp(20px, 3.1vw, 48px); }
  .navigation > * { gap: 9px; min-height: 44px; font-size: 1rem; }
  .navigation .icon { width: 20px; height: 20px; }
  .menu-heading { padding: clamp(18px, 2.2vw, 34px) 20px clamp(18px, 2vw, 31px); }
  .brand { font-size: 1rem; }
  .menu-heading h1 { font-size: clamp(3.3rem, 4.4vw, 4.4rem); }
  .menu-chinese { font-size: 1rem; }
  .dishes {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0 clamp(12px, 2.8vw, 44px);
    padding: clamp(25px, 3.5vw, 54px) 0 clamp(22px, 3.2vw, 49px);
  }
  .dish-card {
    display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr;
    align-items: stretch; gap: clamp(16px, 2.1vw, 30px);
    padding: 0 clamp(13px, 1.75vw, 28px);
  }
  .dish-card + .dish-card { border-left: 1px solid #ae795b; border-top: 0; }
  .dish-card + .dish-card::before { top: 1px; left: -4px; }
  .dish-card:nth-child(even) .dish-figure, .dish-card:nth-child(even) .dish-copy {
    grid-column: auto; grid-row: auto; padding-left: 0;
  }
  .dish-figure { aspect-ratio: 1.44; align-self: start; }
  .dish-photo { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
  .dish-copy { display: flex; flex-direction: column; align-items: center; text-align: center; }
  .dish-copy .chinese { display: flex; align-items: center; gap: 8px; font-size: .95rem; }
  .dish-copy .chinese::before, .dish-copy .chinese::after {
    content: ""; width: clamp(14px, 1.6vw, 25px); height: 1px; background: #c38b5d;
  }
  .dish-name { margin: 7px 0 4px; font-size: clamp(1.4rem, 2.15vw, 2.15rem); }
  .note { max-width: 36ch; font-size: clamp(.94rem, 1.2vw, 1.06rem); line-height: 1.75; }
  .dish-actions { margin-top: auto; padding-top: clamp(14px, 1.5vw, 22px); gap: 9px; }
  .dish-open { min-height: 41px; padding: 7px 18px; font-size: .98rem; }
  .save-dish { width: 42px; height: 41px; }
  .page main { padding-bottom: clamp(19px, 2.1vw, 32px); }
  #popup { width: min(720px, calc(100% - 50px)); }
  #popup:has(.saved-list) { width: min(510px, calc(100% - 50px)); }
  #popup-content:has(.detail-photo) { display: grid; grid-template-columns: minmax(0, 1.03fr) minmax(0, 1fr); }
  .detail-photo {
    align-self: stretch; width: 100%; height: 100%; min-height: 270px; max-height: none; padding: 24px 16px;
    border-bottom: 0; border-right: 1px solid #d2a06c;
  }
  .detail-text { align-self: center; padding: 45px 26px 28px; }
}
