/* Thai Baan menu page and its item sheet: layout and sizes only. Every control is a ck- class from chockers.css.
   Loaded last on the menu page, so it wins ties with style.css and theme.css (both unlayered); the order page and
   the cart never load it. Spec: SPEC/design-system-chockers.md, "Menu page and item sheet".
   Type is three sizes from the system scale and nothing else: --text-h4 (headings, the sheet title), --text-body
   (names, prices, tabs, buttons), --text-min (descriptions, chips, captions). The one other size is the all-caps
   label (--text-label): badges and tags. Weights: 900 headings, prices and buttons; 600 names and row labels;
   300 muted lines. Lines are 1px, radius 0, no shadow, no blur. One breakpoint: 860px. */

:root { --bar-h: calc(var(--control-h-m) + 2 * var(--space-2) + var(--line-1) + env(safe-area-inset-bottom)); }   /* the bottom bar: pages and the footer end clear of it */
body { font-family: var(--font-sans); font-size: var(--text-body); line-height: var(--lh-small); }
/* One focus ring on this page, the cart's and the order-type sheet's: 2px of ink (not :root's cream --fg), 2px off its control, so it never reaches the control beside it
   or the edge of the screen. style.css draws it on anything that is not a ck- control, chockers.css on a ck- control, both from these tokens.
   Inside the control, where outside would be cut or land on a neighbour: a tab (its row scrolls and clips), a list row (rows touch), the sheet's close sign (in the corner). */
:root { --focus: var(--ink); --focus-ring-style: solid; --focus-ring-w: var(--line-2); --focus-ring-gap: var(--line-2); --focus-ring: var(--focus-ring-w) var(--focus-ring-style) var(--focus); --focus-offset: var(--focus-ring-gap); }
:is(.ck-tab, .menu-grid.list-view > .food-card, .menu-grid.list-view > .lunch-row > .food-card):focus-visible { outline-offset: calc(var(--focus-ring-w) * -1); }

/* ---- Header: one row. The logo, then the search, the view button and the language button. Under 860 the search is a round
   button that opens to a field in the logo's place; it closes when it is empty and loses the focus. ---- */
.hero {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1);
  padding: calc(var(--space-1) + env(safe-area-inset-top)) var(--gutter) var(--space-1);
  background: var(--bg); border: 0; backdrop-filter: none; -webkit-backdrop-filter: none;
}
.hero .brand { order: 1; min-inline-size: 0; margin-inline-end: auto; }
.hero :is(.hero-book, .hero-stamps) { order: 2; margin: 0; }
.hero .search-bar { order: 3; flex: 0 1 34rem; display: flex; gap: var(--space-1); min-inline-size: 0; max-inline-size: none; margin: 0; padding: 0; transition: none; }   /* the search field, then the view button */
.hero .lang-select { order: 5; }
.search-bar .ck-input { flex: 1 1 0; min-inline-size: 0; padding-inline-start: var(--target); }   /* room for the glass, drawn by .search-bar::before */
.search-bar::before { background: var(--primary-ink); }
/* Clear search: a system icon button in the field's end, there only while the field holds text. */
#menu-search::-webkit-search-cancel-button { display: none; }
#search-clear { flex: none; margin-inline-start: calc((var(--target) + var(--space-1)) * -1); }
#search-clear[hidden] { display: none; }
.view-toggle > svg { inline-size: var(--space-3); block-size: var(--space-3); fill: currentColor; stroke: none; }
@media (max-width: 859px) {
  .hero .search-bar { flex: 0 0 auto; }
  .search-bar .ck-input { flex: 0 0 var(--target); inline-size: var(--target); padding-inline: calc(var(--target) - 2 * var(--line-1)) 0; cursor: pointer; }   /* closed: a round button, only the glass */
  .search-bar .ck-input::placeholder { color: transparent; }
  .hero:has(#menu-search:is(:focus, :not(:placeholder-shown))) .search-bar { flex: 1 1 0; }
  .hero:has(#menu-search:is(:focus, :not(:placeholder-shown))) .ck-input { flex: 1 1 0; padding-inline: var(--target) var(--space-2); cursor: text; }
  .hero:has(#menu-search:focus) .ck-input::placeholder { color: var(--ink-muted); }
  .hero:has(#menu-search:is(:focus, :not(:placeholder-shown))) .brand { display: none; }
}
.search-bar:has(#search-clear:not([hidden])) .ck-input { padding-inline-end: var(--target); }

/* ---- Category tabs: system tabs in one scrolling row. Their colours and lines are the venue's tokens (theme.css) ---- */
.tabs-bar { padding: env(safe-area-inset-top) 0 0; }
.tabs-bar > .ck-tabs { flex: 1 1 auto; min-inline-size: 0; flex-wrap: nowrap; gap: var(--space-1); overflow-x: auto; padding: 0 var(--gutter) 0 0; scrollbar-width: none; background: var(--bg); }
.tabs-bar > .ck-tabs::-webkit-scrollbar { display: none; }
.ck-tab { flex: none; white-space: nowrap; }
.ck-tab[aria-selected="true"] { color: var(--primary-ink); }   /* the other tabs are quiet gold, the selected one is full gold over its gold line */

/* ---- Menu: headings and cards ---- */
/* A card is as high as its content: no minimum height on the page, a card or a row of cards, and the rows never share out spare height. */
.menu-grid { --card-bg: var(--surface-2); min-block-size: 0; align-content: start; }   /* a card has no edge: the stronger ground shows where it ends */
/* Search filters the menu where it stands: the strips that repeat dishes step aside, an empty section goes. */
.menu-grid.is-searching > :not(.category-heading, .food-card, .lunch-row, .express-section, .search-empty),
.menu-grid .lunch-row:not(:has(.food-card:not([hidden]))),
.express-section:has(> .category-heading[hidden]) { display: none; }
/* The Thai name under the English one: on every dish or on none (the page sets th-partial when a dish has no Thai name). Small cards and list rows show one name. */
html.th-partial .menu-grid .name:not(:empty) ~ .name-th, html.th-partial .product-sheet .name-th,
.menu-grid .faves .food-card .name:not(:empty) ~ .name-th { display: none; }
.category-heading {
  margin: var(--space-3) var(--gutter) var(--space-1); scroll-margin-top: calc(var(--target) + var(--line-1) + var(--space-1));
  font: var(--weight-loud) var(--text-h4)/var(--lh-h4) var(--font-sans); letter-spacing: var(--track-body);
}
.menu-grid .food-card {
  inline-size: calc(100% - 2 * var(--gutter)); margin: 0 var(--gutter) var(--space-2); padding: 0; gap: 0; align-items: stretch;
  background: var(--card-bg); color: var(--ink); border: 0; border-radius: 0; box-shadow: none;
  font: inherit; text-align: start;
}
.menu-grid .food-card:hover { background: var(--card-bg-hover); }   /* hover: the ground changes, never a ring */
.menu-grid .food-card:active { background: var(--card-bg-pressed); color: var(--card-ink-pressed); }
.menu-grid .food-card:active :is(.name-th, .desc) { color: inherit; }   /* pressed fills ink: the muted lines take the pressed colour too */
.menu-grid .food-card img, .menu-grid .food-card .ph { inline-size: calc(var(--space-6) * 2); block-size: auto; aspect-ratio: auto; align-self: stretch; flex: none; object-fit: cover; border-radius: 0; background: var(--surface-2); }
.menu-grid .food-card .info, .menu-grid .food-card > .info:first-child { flex: 1; min-inline-size: 0; gap: var(--space-half); padding: var(--card-pad); }
.menu-grid .food-card .name { font: var(--weight-strong) var(--text-body)/var(--lh-small) var(--font-sans); letter-spacing: var(--track-body); }
.menu-grid .food-card .name-th { font: var(--weight-body) var(--text-min)/var(--lh-small) var(--font-sans); color: var(--ink-muted); }
.menu-grid .food-card .desc { margin: 0; font-size: var(--text-min); line-height: var(--lh-small); color: var(--ink-muted); }
.menu-grid .food-card .row { padding-top: var(--space-1); gap: var(--space-2); }
.menu-grid .food-card .price { font: var(--weight-loud) var(--text-body)/var(--lh-small) var(--font-sans); color: var(--primary-ink); }
.menu-grid .food-card .allergen-flag { font-size: var(--text-min); }
/* How many of it are in the cart: a round 24px mark on the card's top-right corner, where it was before 15 Nov. The cart button's count is the same mark. */
.cart-bar .count-badge,
.menu-grid .food-card .qty-pill {
  position: absolute; top: calc(var(--space-1) * -1); right: calc(var(--space-1) * -1); z-index: 1; outline: var(--line-1) solid var(--bg); display: inline-flex; align-items: center; justify-content: center; inline-size: auto; min-inline-size: var(--space-3); block-size: var(--space-3); padding: 0 var(--space-half); border-radius: 50%;
  background: var(--primary); color: var(--on-primary); font: var(--weight-loud) var(--text-label)/1 var(--font-sans);
}
.cart-bar .count-badge { background: var(--ink); color: var(--bg); }   /* on the gold button the mark takes the page ink, so it reads */
.cart-bar .count-badge[hidden] { display: none; }
#cart-bar-inner { position: relative; overflow: visible; }
.menu-grid .food-card.sold-out { background: var(--card-bg-disabled); border-color: var(--ink-muted); border-style: var(--control-line-style-disabled); }
.menu-grid .food-card.sold-out :is(.name, .price) { color: var(--ink-muted); filter: none; text-decoration: line-through var(--control-strike-w); }
.menu-grid .food-card.sold-out img { filter: grayscale(1); }
.menu-grid .food-card .sold-out-badge, .ai-mark {
  padding: var(--badge-pad-y) var(--badge-pad-x); border-radius: 0; background: var(--ink); color: var(--bg);
  font: var(--weight-loud) var(--text-label)/var(--lh-label) var(--font-sans); letter-spacing: var(--track-label); text-transform: uppercase;
}
.menu-grid .food-card:is(.popular, .featured) .name::before { font: var(--weight-loud) var(--text-label)/var(--lh-label) var(--font-sans); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--primary-ink); }
.menu-grid .food-card .opt-badge { justify-self: start; inline-size: fit-content; padding: 0 var(--space-1); border-radius: 0; background: var(--surface-2); color: var(--ink); font-size: var(--text-min); font-weight: var(--weight-strong); }
.search-empty { margin: 0; padding: var(--space-3) var(--gutter); font-size: var(--text-body); color: var(--ink-muted); }
.prep-note, .allergen-status, .express-notice, .express-meta { font-size: var(--text-min); color: var(--ink-muted); }
.faves-label { font-size: var(--text-min); color: var(--ink-muted); }
.category-heading .heading-until { margin-inline-start: var(--space-2); font-size: var(--text-min); font-weight: var(--weight-body); color: var(--ink-muted); }   /* "until 23:59" right of Lunch specials */

/* Your usual, Popular and the lunch and express rows: small cards, a photo over the name. */
.faves { gap: var(--space-1); padding: var(--space-1) var(--gutter) 0; }
.menu-grid .lunch-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* Popular on <weekday> and Best sellers: the same small cards, one row of three on a phone. Wide: all five fit one row. */
@media (max-width: 859px) { .menu-grid:not(.list-view) > .popular-row > .food-card:nth-child(n+4) { display: none; } }
.menu-grid .faves .food-card { flex-direction: column; margin: 0; inline-size: auto; padding: 0; }
.menu-grid .faves .food-card img { inline-size: 100%; aspect-ratio: 4 / 3; }
.menu-grid .faves .food-card .info { padding: var(--space-1); }
.menu-grid .faves .food-card .name { font-size: var(--text-min); }
/* Express: a band of the venue's golden yellow (--band, theme.json) across the whole viewport, dark text on it (--on-band, 10:1). The content stays on the page's
   own gutters; the shadow paints the band past them and the clip keeps it to the section's height. */
.express-section { grid-column: 1 / -1; margin: var(--space-3) 0 0; padding: var(--space-2) 0; background: var(--band); box-shadow: 0 0 0 100vmax var(--band); clip-path: inset(0 -100vmax); color: var(--on-band); border: 0; border-radius: 0; }
.express-section :is(.heading-until, .express-notice) { color: inherit; }
.menu-grid .express-section .category-heading { margin: 0 var(--gutter) var(--space-1); padding: 0; }
.menu-grid .faves .opt-badge { white-space: normal; }
.express-section .faves.lunch-row { padding: var(--space-1) var(--gutter) 0; }
/* Keep the corner badge clear: its bottom is 16px; the flame starts at 24px. */
.express-section .express-flame { position: absolute; inset-block-start: var(--space-3); inset-inline-end: var(--space-half); inline-size: var(--space-3); block-size: var(--space-4); color: var(--c-orange); pointer-events: none; transform-origin: top right; animation: express-flicker 1.8s ease-in-out infinite alternate; }
.express-section .food-card:nth-child(3n + 2) .express-flame { animation-delay: -.6s; }
.express-section .food-card:nth-child(3n) .express-flame { animation-delay: -1.2s; }
@keyframes express-flicker { from { transform: rotate(-3deg) scale(.96, 1); opacity: .88; } to { transform: rotate(2deg) scale(1, .94); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .express-section .express-flame { animation: none; } }
.express-notice { margin: var(--space-1) var(--gutter) 0; }

/* List view: one line a dish, in every category, Lunch specials too. The row is the photo, then the name and the price over a 1px rule
   that starts where the name starts. One name: the Thai name shows only when the dish has no other; the item sheet shows both. */
:is(.menu-grid.list-view, .menu-grid.list-view > .lunch-row) > .food-card { flex-direction: row; align-items: stretch; inline-size: calc(100% - 2 * var(--gutter)); margin: 0 var(--gutter); padding: 0; gap: var(--space-2); background: transparent; border: 0; }
:is(.menu-grid.list-view, .menu-grid.list-view > .lunch-row) > .food-card:hover { background: var(--row-bg-hover); box-shadow: none; }
:is(.menu-grid.list-view, .menu-grid.list-view > .lunch-row) > .food-card img { flex: none; inline-size: var(--target); block-size: var(--target); aspect-ratio: 1; align-self: center; border-radius: 0; }
:is(.menu-grid.list-view, .menu-grid.list-view > .lunch-row) > .food-card .info { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; align-content: center; gap: 0 var(--space-2); padding: calc(var(--space-1) + var(--space-half)) 0; border-bottom: var(--line-1) solid var(--rule); }   /* the name and its price on one line */
:is(.menu-grid.list-view, .menu-grid.list-view > .lunch-row) > .food-card .info > * { grid-column: 1; }
:is(.menu-grid.list-view, .menu-grid.list-view > .lunch-row) > .food-card .name { display: block; min-inline-size: 0; font-size: var(--text-body); overflow-wrap: anywhere; }
:is(.menu-grid.list-view, .menu-grid.list-view > .lunch-row) > .food-card .name:not(:empty) ~ .name-th,
:is(.menu-grid.list-view, .menu-grid.list-view > .lunch-row) > .food-card .desc { display: none; }
:is(.menu-grid.list-view, .menu-grid.list-view > .lunch-row) > .food-card .row { grid-column: 2; grid-row: 1; margin: 0; padding: 0; }
/* The count sits on the photo's top corner, out of flow: adding a dish moves nothing and the price ends at the row's end. With no photo it is the card's mark, on the row's top-right corner, out of flow too. */
:is(.menu-grid.list-view, .menu-grid.list-view > .lunch-row) > .food-card .qty-pill { top: 50%; right: auto; left: calc(var(--target) - var(--space-2)); margin-block-start: calc(var(--target) / -2 - var(--space-half)); }
:is(.menu-grid.list-view, .menu-grid.list-view > .lunch-row) > .food-card:not(:has(img)) .qty-pill { top: calc(var(--space-1) * -1); right: calc(var(--space-1) * -1); left: auto; margin: 0; }
/* Lunch specials, Express and Popular in the list: the rows of every other category, on the same edges, with no ground or inset of their own. */
.menu-grid.list-view > .lunch-row { display: block; margin: 0 var(--gutter); padding: 0; }
.menu-grid.list-view > .lunch-row > .food-card { inline-size: 100%; margin: 0; }

/* Wide: the cards fill the width, a photo over the text. The list fills it too, in columns. */
@media (min-width: 860px) {
  .menu-grid:not(.list-view) { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: var(--space-2); max-inline-size: none; padding-inline: var(--gutter); }
  .menu-grid:not(.list-view) > .category-heading { grid-column: 1 / -1; margin: var(--space-3) 0 0; }
  .menu-grid:not(.list-view) .food-card { flex-direction: column; margin: 0; inline-size: auto; }
  .menu-grid:not(.list-view) > .food-card img, .menu-grid:not(.list-view) > .food-card .ph { inline-size: 100%; aspect-ratio: 4 / 3; }
  .faves:not(.lunch-row) { display: none; }
  .menu-grid .lunch-row { grid-column: 1 / -1; grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr)); gap: var(--space-2); padding: 0; }
  .express-section .faves.lunch-row { padding: var(--space-1) 0 0; }
  .menu-grid .express-section .category-heading, .search-empty { margin-inline: 0; }
  .search-empty { padding-inline: 0; }
  .express-notice { margin-inline: 0; }
  .menu-grid.list-view, .menu-grid.list-view > .lunch-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); column-gap: var(--space-4); }
  .menu-grid.list-view { max-inline-size: none; padding-inline: var(--gutter); }
  .menu-grid.list-view > :not(.food-card) { grid-column: 1 / -1; }
  .menu-grid.list-view > .category-heading { margin: var(--space-3) 0 var(--space-2); }   /* the heading of the cards: on the page edge, one gap over its dishes */
  .menu-grid.list-view > .lunch-row { margin: 0; }
  :is(.menu-grid.list-view, .menu-grid.list-view > .lunch-row) > .food-card { inline-size: auto; margin: 0; }
}

/* ---- Bottom bar: the order type and the cart, two system buttons the same height, one 2px line above ---- */
.cart-bar { padding: var(--space-2) var(--gutter) calc(var(--space-2) + env(safe-area-inset-bottom)); background: var(--bg); border-top: var(--line-1) solid var(--primary-ink); }
.cart-bar-row { max-inline-size: var(--sheet-max); gap: var(--space-2); }
/* Two buttons of one height, each one line, never wrapped. Wide: the two are the same width (Tamm, 7 Nov). At phone width the
   order type is as wide as its word and the cart takes the rest, in the system's small text (--btn-text-s, 16px) with the small
   padding and gap: at 19px and equal widths "View cart · $216.00" does not fit beside the order type at 390. */
.cart-bar-row > .ck-btn { --b-pad-x: var(--space-2); min-inline-size: var(--target); }
.cart-bar-row > #order-type-bar-btn { flex: 0 0 auto; }
.cart-bar-row > #cart-bar-inner { flex: 1 1 auto; }
@media (max-width: 480px) {
  .cart-bar-row { gap: var(--space-1); }
  .cart-bar-row > .ck-btn { --b-text: var(--btn-text-s); --b-pad-x: var(--space-1); }
}
@media (min-width: 481px) { .cart-bar-row > .ck-btn:is(#order-type-bar-btn, #cart-bar-inner) { flex: 1 1 0; } }
.cart-bar [aria-disabled="true"] { pointer-events: none; }

/* ---- Sheets: the handle (48 wide, 4px, the sheet's edge colour, one gap under the top edge) and the close are shared/dialog.css ---- */
.product-sheet .grabber, .cart-sheet .grabber { cursor: grab; }
/* The close control, the edge and the scrim of every sheet: shared/dialog.css. */

/* The item sheet: shared/item-sheet.css (this page and the staff Take screen). */

/* The announcement bar (when staff turn it on) */
.announce-wrap { font-size: var(--text-min); border-bottom: 0; }
