/* BAUSTK Cafeteria — "chili and rice", one light theme for everyone.
   A rice-cream page and tamarind-brown text; a chili-red band for the header
   and the home page's opening field, with cream type on it; chili for the main
   buttons and links. Turmeric is only a filled mark with tamarind text on it
   ("Ready", the tray count); curry-leaf green and mint are the second voices
   (the "ready" stamps, quiet panels). Inspired by the restaurant site Délice
   (a red field, cream type, a light high-contrast serif and round stamps with a
   double ring), set in this cafeteria's own spice colours.

   The order token is the signature: a round stamp with a double ring and the
   number in the serif, on the home page ("Now serving"), on My reservations,
   on the token board and in the times strip.

   Order: tokens, base, layout, components, states, pages, motion, reduced motion.
   Colours are hex only (build/check_hex_colors) and checked for contrast
   (build/contrast_check); the static rules are build/check_pages. No external
   assets: the server's CSP is default-src 'self'. */

@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/CAFETERIA-PRE-ORDER-SYSTEM/fonts/CormorantGaramond-600-latin.woff2") format("woff2");
}

/* ==== tokens ================================================================ */
:root {
  color-scheme: light;  /* form controls stay light on devices set to dark mode */

  /* ratios are WCAG 2.2, checked by build/contrast_check */
  --page: #FBF1E4;         /* rice cream: the page */
  --panel: #FFFAF3;        /* cards, dish tiles, tray, tables */
  --bar: #B42318;          /* chili: header band and home field (cream on it 5.9:1) */
  --bar-ink: #FBF1E4;      /* cream text, links and the focus ring on the band */
  --field: #FFFAF3;        /* fields, outline buttons */
  --card: #9ED7C3;         /* mint: quiet panels; tamarind text only (10.8:1) */
  --line: #EAD9C6;         /* pale lines: decoration only (grid, rows, card edges) */
  --edge: #8C6A5C;         /* edges that must be seen: fields, selects, the leader (4.3:1 on cream) */
  --well: #F6E6D2;         /* inset areas, empty states, hover on outline buttons */
  --ink: #2A1410;          /* tamarind text (15.6:1 on cream) */
  --ink-soft: #6A4237;     /* secondary text (7.7:1 on cream) */
  --accent: #B42318;       /* chili: main buttons, selected tab, tray bar */
  --accent-ink: #FBF1E4;   /* text on chili */
  --accent-hover: #8A1810; /* deep chili (cream on it 8.5:1) */
  --accent-text: #B42318;  /* chili text and links (5.9:1 on cream) */
  --tint: #FBE3C8;         /* pale saffron: ready rows, selection */
  --mark: #F2B531;         /* turmeric: filled marks only, tamarind text on them (9.5:1) */
  --leaf: #2F6B3C;         /* curry leaf: ready stamps (cream on it 5.7:1) */
  --danger: #9B1C1C;
  --danger-tint: #F8DCD5;
  --focus: #2A1410;        /* tamarind ring; cream on the chili band (--bar-ink) */
  --spotlight: var(--well); /* behind dish pictures */

  --font-head: "Cormorant Garamond", Garamond, "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Bengali", sans-serif;

  /* type scale: 14, 16, 20, 26, 35, the page title up to 58, the home field up to 92 */
  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.625rem;
  --step-3: 2.1875rem;
  --step-4: clamp(1.875rem, 1.2rem + 3vw, 3.625rem);  /* 30px at 360 wide: a page title stays on two lines */
  --step-5: clamp(2.75rem, 1.4rem + 5vw, 5.75rem);     /* the home field’s headline and token numbers */

  /* spacing: 4, 8, 12, 16, 24, 32, 48, 64 */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --gutter: clamp(var(--space-4), 4vw, var(--space-6));

  --radius: 0;                      /* every box has square corners */
  --round: 50%;                     /* stamps are circles: the only round shape */
  --rule: 3px solid var(--accent);  /* the lead-surface rule */
  --control: 44px;                  /* smallest tap target */
  --content: 1180px;

  /* motion: colour changes ease; things that enter ease out, strongly */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --dur-fast: 120ms;  /* hover, press */
  --dur-pulse: 100ms; /* each half of the tray-count change (200 ms in all) */
  --dur: 150ms;       /* messages */
  --dur-enter: 180ms; /* a new tray line */
  --dur-slow: 300ms;  /* a status tint, a token arriving on the board */
}

/* ==== base =================================================================== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }  /* component display rules must not override the hidden attribute */
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--edge) var(--well); }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 400 var(--step-0)/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; display: block; }
::selection { background: var(--tint); color: var(--ink); }
input, select, textarea { caret-color: var(--accent); accent-color: var(--accent); }
a, button, input, select, label, summary { touch-action: manipulation; -webkit-tap-highlight-color: #FBE3C899; }
/* anchors land with room above them; on phones the fixed tray bar never covers a focused field */
[id] { scroll-margin-top: var(--space-4); }
html:has(.tray-bar:not([hidden])) { scroll-padding-bottom: 72px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip-link {
  position: absolute; left: -999px; top: var(--space-2); z-index: 10;
  background: var(--panel); color: var(--ink); padding: var(--space-3) var(--space-4);
}
.skip-link:focus { left: var(--space-2); }
.skip-link:focus-visible { outline-offset: -5px; }  /* the ring sits on the link's cream, whatever bar is behind */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

h1, h2, h3, .brand, .dish__name, .figure, .stamp__num {
  font-family: var(--font-head); font-weight: 600; letter-spacing: -0.01em; line-height: 1.08; text-wrap: balance;
  font-variant-numeric: lining-nums;
}
h1 { font-size: var(--step-4); margin: 0 0 var(--space-3); }
h2 { font-size: var(--step-3); margin: var(--space-7) 0 var(--space-3); }
h3 { font-size: var(--step-2); margin: 0 0 var(--space-2); }
p { margin: 0 0 var(--space-3); text-wrap: pretty; }
.lead { color: var(--ink-soft); font-size: var(--step-1); line-height: 1.45; max-width: 60ch; }
.hint { display: block; color: var(--ink-soft); font: 400 var(--step--1)/1.45 var(--font-body); margin-top: var(--space-1); }
.num, .price, .figure, time, table { font-variant-numeric: lining-nums tabular-nums; }

/* ==== layout ================================================================== */
.announce {
  margin: 0; background: var(--ink); color: var(--bar-ink); text-align: center;  /* tamarind, so it reads apart from the chili band */
  padding: var(--space-2) var(--gutter); font: 500 var(--step--1)/1.4 var(--font-body);
}
.announce:empty { display: none; }

.topbar { background: var(--bar); color: var(--bar-ink); }
.topbar :focus-visible { outline-color: var(--bar-ink); }  /* a tamarind ring on chili is too dark to see */
.topbar__inner {
  max-width: var(--content); margin: 0 auto; padding: var(--space-1) var(--gutter);
  display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-4);
}
.brand {
  color: inherit; text-decoration: none; font-size: var(--step-2); margin-right: auto;
  min-height: var(--control); display: flex; flex-direction: column; justify-content: center;
}
.brand small { display: block; font: 500 var(--step--1)/1.2 var(--font-body); color: var(--bar-ink); letter-spacing: 0; }
.topbar nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-4); }
.topbar nav a, .topbar .linkbtn {
  color: var(--bar-ink); font: 600 var(--step--1)/1.2 var(--font-body);
  min-height: var(--control); display: inline-flex; align-items: center; gap: var(--space-2);
}
.topbar nav a[aria-current="page"] { text-decoration-thickness: 2px; text-decoration-color: var(--bar-ink); }
.topbar .who { color: var(--bar-ink); font: 400 var(--step--1)/1.2 var(--font-body); }

main { max-width: var(--content); margin: 0 auto; padding: var(--space-5) var(--gutter) var(--space-7); }
.narrow { max-width: 30rem; margin: var(--space-6) auto var(--space-7); padding-top: 0; }
.footer {
  max-width: var(--content); margin: 0 auto; padding: var(--space-6) var(--gutter);
  color: var(--ink-soft); font-size: var(--step--1); border-top: 1px solid var(--line);
}
.footer p { margin: 0 0 var(--space-1); }
.split { display: grid; gap: var(--space-6); grid-template-columns: minmax(0, 1fr); }
/* form grids: every cell sits on the row's bottom line, so the boxes and the
   button in a row line up whether or not a field has a hint above its box */
.grid { display: grid; gap: var(--space-5) var(--space-4); align-items: end;
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
.grid > .field { margin-bottom: 0; }
.row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: end; }
.row > .field { margin-bottom: 0; flex: 1 1 8rem; }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-5); }

/* the staff portal: a sticky section column on desktop, a tab row below that */
.portal { display: grid; gap: var(--space-5); grid-template-columns: minmax(0, 1fr); }
.portal__nav {
  display: flex; gap: var(--space-2); overflow-x: auto; scrollbar-width: thin;
  margin: 0; padding: var(--space-1) var(--space-1) var(--space-1);  /* inside the page margins, with room for the focus ring */
  border-bottom: 1px solid var(--line);
}
.portal__nav a {
  flex: none; min-height: var(--control); display: inline-flex; align-items: center;
  padding: 0 var(--space-2); color: var(--ink); font: 600 var(--step--1)/1.2 var(--font-body);
  text-decoration: none; border-bottom: 3px solid var(--page);
}
.portal__nav a[aria-current="true"] { border-bottom-color: var(--accent); }
.portal__main > section:first-child > h2:first-child { margin-top: 0; }

/* ==== components ============================================================= */
/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--control); padding: var(--space-2) var(--space-4);
  font: 600 var(--step--1)/1.2 var(--font-body); text-decoration: none; cursor: pointer;
  border: 1px solid var(--accent); border-radius: var(--radius); background: var(--field); color: var(--accent-text);
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease,
              color var(--dur-fast) ease, transform var(--dur-fast) var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--danger { border-color: var(--danger); color: var(--danger); }
.btn--block { width: 100%; }
/* on the chili band: a cream button with chili text, as on a restaurant awning */
.btn--cream { background: var(--bar-ink); border-color: var(--bar-ink); color: var(--accent-text); }
.btn--ghost { background: var(--bar); border-color: var(--bar-ink); color: var(--bar-ink); }
.btn[disabled], .btn[aria-disabled="true"] { cursor: not-allowed; border-color: var(--edge); background: var(--well); color: var(--ink-soft); transform: none; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--well); }
  .btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
  .btn--danger:hover { background: var(--danger-tint); }
  .btn--cream:hover { background: var(--tint); border-color: var(--tint); }
  .btn--ghost:hover { background: var(--accent-hover); }
  .btn[disabled]:hover { background: var(--well); }
}
.linkbtn {
  background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer;
  text-decoration: underline; text-underline-offset: 0.2em;
  min-height: var(--control); display: inline-flex; align-items: center;  /* a full-size tap target */
}

/* fields */
.field { margin-bottom: var(--space-4); }
label { display: block; font-weight: 600; margin-bottom: var(--space-1); }
input, select, textarea {
  width: 100%; min-height: var(--control); padding: var(--space-2) var(--space-3);
  font: inherit; color: var(--ink); background: var(--field);
  border: 1px solid var(--edge); border-radius: var(--radius);
  transition: border-color var(--dur-fast) ease;
}
input::placeholder { color: var(--ink-soft); }
input[type="checkbox"] { width: 24px; height: 24px; min-height: 24px; margin: 0; }
/* a checkbox's whole 44px label toggles it */
.check { display: inline-flex; align-items: center; justify-content: center; min-width: var(--control); min-height: var(--control); margin: 0; cursor: pointer; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--focus); }
input[disabled], select[disabled] { background: var(--well); color: var(--ink-soft); cursor: not-allowed; }
.field--invalid input, .field--invalid select, input[aria-invalid="true"] { border-color: var(--danger); }
.field__error { display: block; color: var(--danger); font: 600 var(--step--1)/1.4 var(--font-body); margin-top: var(--space-1); }
.field__error:empty { display: none; }

/* tabs */
.tabs {
  display: flex; flex-wrap: nowrap; gap: var(--space-2); margin: 0; padding: var(--space-1); list-style: none;  /* room for the focus ring */
  overflow-x: auto; scrollbar-width: thin; scroll-snap-type: x proximity;
}
.tabs li { flex: none; scroll-snap-align: start; }
.tab {
  min-height: var(--control); padding: var(--space-2) var(--space-4); cursor: pointer;
  border: 1px solid var(--accent); border-radius: var(--radius); background: var(--field); color: var(--accent-text);
  font: 600 var(--step--1)/1.2 var(--font-body);
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.tab[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
@media (hover: hover) and (pointer: fine) { .tab:hover { background: var(--well); } .tab[aria-pressed="true"]:hover { background: var(--accent-hover); } }

/* surfaces */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-5); }
.panel--lead, .tray, .kpi { border-top: var(--rule); }
.card + .card, section.card + form.card { margin-top: var(--space-4); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; font-size: var(--step-2); }

/* the token stamp: a circle with a double ring (the border and an inner outline),
   a small word above and the number in the serif; --ink-on is its text and ring colour */
.stamp {
  --size: 9.5rem;
  --ink-on: var(--accent-text);
  width: var(--size); height: var(--size); flex: none;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-1);
  border: 3px solid var(--ink-on); border-radius: var(--round);
  outline: 1px solid var(--ink-on); outline-offset: -11px;
  background: var(--panel); color: var(--ink-on); text-align: center; padding: var(--space-4);
}
.stamp__label { font: 600 var(--step--1)/1.2 var(--font-body); }
.stamp__num { font-size: var(--step-3); line-height: 1; }
.stamp__note { font: 400 var(--step--1)/1.25 var(--font-body); color: var(--ink-soft); max-width: 9ch; }
.stamp--big { --size: clamp(11rem, 8rem + 12vw, 17rem); }
.stamp--big .stamp__num { font-size: var(--step-5); }
.stamp--big .stamp__note { max-width: 14ch; }
.stamp--small { --size: 7.75rem; padding: var(--space-3); gap: 0; outline-offset: -8px; }
.stamp--small .stamp__note { max-width: 7ch; line-height: 1.15; }
.stamp--small .stamp__num { font-size: var(--step-2); }
.stamp--ready { background: var(--leaf); --ink-on: var(--accent-ink); }      /* cream on curry leaf, 5.7:1 */
.stamp--cream { background: var(--bar-ink); --ink-on: var(--accent-text); }  /* on the chili field */
.stamp--mint { background: var(--card); --ink-on: var(--ink); }
.stamp--turmeric { background: var(--mark); --ink-on: var(--ink); }
.stamp--ink { background: var(--ink); --ink-on: var(--bar-ink); }
.stamp--ready .stamp__note, .stamp--ink .stamp__note, .stamp--mint .stamp__note, .stamp--turmeric .stamp__note { color: inherit; }
.stamp--muted { background: var(--well); --ink-on: var(--ink-soft); border-style: dashed; outline-style: dashed; }

/* messages and banners */
.msg { margin: var(--space-3) 0; font-weight: 600; min-height: 1.5rem; }
.msg:empty { margin: 0; min-height: 0; }
.msg--ok { color: var(--leaf); }
.msg--error { color: var(--danger); }
.msg--info { color: var(--ink); }
.banner {
  background: var(--panel); border: 1px solid var(--line); border-top: var(--rule);
  padding: var(--space-3) var(--space-4); margin: 0 0 var(--space-4);
}
.banner:empty { display: none; }
.banner--closed { background: var(--danger-tint); border-color: var(--danger-tint); border-top-color: var(--danger); }

/* list states: loading, empty, error */
.state { margin: 0; padding: var(--space-5); background: var(--well); color: var(--ink-soft); grid-column: 1 / -1; }
.state--empty { color: var(--ink); }
.state--error { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-top: 3px solid var(--danger); }
.state .btn { margin-top: var(--space-3); }
.state p { margin: 0; }

/* register: the two steps as one line in two parts */
.progress { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); list-style: none; margin: 0 0 var(--space-4); padding: 0; }
.progress li { border-top: 3px solid var(--line); padding-top: var(--space-2); color: var(--ink-soft); font: 600 var(--step--1)/1.3 var(--font-body); }
.progress li.is-done, .progress li[aria-current="step"] { border-top-color: var(--accent); color: var(--ink); }

/* status chips: a word and a style, never colour alone */
.chip {
  display: inline-block; padding: 0 var(--space-2); border: 1px solid var(--ink); color: var(--ink);
  font: 600 var(--step--1)/1.6 var(--font-body); white-space: nowrap;
}
.chip--Reserved { background: var(--well); }
.chip--Ready { color: var(--ink); border-color: var(--ink); background: var(--mark); }
.chip--Collected { color: var(--ink-soft); border-color: var(--ink-soft); }
.chip--Cancelled { color: var(--ink-soft); border-color: var(--ink-soft); text-decoration: line-through; }
.chip--Expired { color: var(--danger); border-color: var(--danger); background: var(--danger-tint); }
.token-tag { font: 700 var(--step--1)/1.6 var(--font-body); color: var(--accent-text); white-space: nowrap; }

.role-badge { padding: 0 var(--space-2); background: var(--accent); color: var(--accent-ink); font: 600 var(--step--1)/1.6 var(--font-body); }
.details { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-5); margin: 0; }
.details dt { color: var(--ink-soft); }
.details dd { margin: 0; overflow-wrap: anywhere; }

/* tables */
.table-wrap { overflow-x: auto; }
.card.table-wrap { padding: var(--space-2) var(--space-4); }
table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
caption { text-align: left; font-weight: 600; padding: var(--space-2) 0; }
th, td { text-align: left; padding: var(--space-3) var(--space-2); border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child > * { border-bottom: 0; }
thead th { font-weight: 600; color: var(--ink-soft); }
tbody th { font-weight: 700; }
td.num, th.num { text-align: right; }
tr.is-ready > * { background: var(--tint); }
tr.is-muted > * { color: var(--ink-soft); }
/* staff order list: the token in the serif, the dishes one per line */
.order-token { font: 600 var(--step-3)/1 var(--font-head); font-variant-numeric: tabular-nums; }
.order-dishes { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); }
.order-dishes li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-2); }
.thumb { width: 64px; height: 44px; object-fit: contain; background: var(--spotlight); }
.day-group + .day-group { margin-top: var(--space-5); }
.day-group > h3 { font-size: var(--step-1); font-family: var(--font-body); font-weight: 700; letter-spacing: 0; margin-bottom: var(--space-2); }

/* ==== pages ================================================================== */
/* home: the chili field continues the header band. A large cream headline set on
   stepped lines, and the "Now serving" stamp beside it. */
.hero { background: var(--bar); color: var(--bar-ink); overflow: hidden; }
.hero :focus-visible { outline-color: var(--bar-ink); }
.hero__inner {
  max-width: var(--content); margin: 0 auto; padding: var(--space-6) var(--gutter) var(--space-8);
  display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); align-items: center;
}
.hero h1 { font-size: var(--step-5); line-height: 0.95; margin: 0 0 var(--space-5); text-wrap: initial; }
.hero h1 span { display: block; }
.hero h1 span:nth-child(2) { padding-left: 0.6em; }
.hero h1 span:nth-child(3) { padding-left: 1.2em; }
.hero__lead { font-size: var(--step-1); line-height: 1.45; max-width: 36ch; }
.hero__status { font-weight: 600; }
.hero__side { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); }
.hero__side a { color: var(--bar-ink); font-weight: 600; }

/* how it works: three short steps in order (the <ol> carries the order, no numbers shown) */
.steps { display: grid; gap: var(--space-5); grid-template-columns: minmax(0, 1fr); list-style: none; padding: 0; margin: 0; }
.step { background: var(--panel); padding: var(--space-5); border-top: var(--rule); }
.step:nth-child(2) { border-top-color: var(--mark); }
.step:nth-child(3) { border-top-color: var(--leaf); }
.step p { max-width: 42ch; margin: 0; }
.how { display: grid; gap: var(--space-6); grid-template-columns: minmax(0, 1fr); align-items: center; }
.how__art { width: 100%; max-width: 26rem; margin: 0 auto; }

/* today's times as a row of stamps */
.info-strip { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: var(--space-4); margin: var(--space-6) 0 0; padding: 0; }
.info-strip .stamp { --size: 9rem; }
.info-strip dt { font: 600 var(--step--1)/1.2 var(--font-body); }
.info-strip dd { margin: 0; font: 600 var(--step-2)/1.05 var(--font-head); font-variant-numeric: lining-nums tabular-nums; }

/* token board: the screen at the counter */
.board-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0 var(--space-4); margin-bottom: var(--space-4); }
.board-head h1, .board-head p { margin: 0; }
.board { display: grid; gap: var(--space-6); grid-template-columns: minmax(0, 1fr); margin-top: var(--space-5); }
.board section > h2 { margin-top: 0; }
.board__ready { display: flex; flex-wrap: wrap; gap: var(--space-4); list-style: none; margin: 0; padding: 0; }
.board__cooking { display: flex; flex-wrap: wrap; gap: var(--space-3); list-style: none; margin: 0; padding: 0; }
.board__cooking li {
  min-width: 5.5rem; padding: var(--space-2) var(--space-3); background: var(--panel); border: 1px solid var(--line);
  border-top: 3px solid var(--mark); text-align: center;
}
.board__cooking .figure { display: block; font-size: var(--step-2); }
.board__cooking small { color: var(--ink-soft); font-size: var(--step--1); }
.board .is-new { animation: stamp-in var(--dur-slow) var(--ease-out); }

/* My reservations: today's tokens */
.token-strip { display: flex; flex-wrap: wrap; gap: var(--space-4); margin: var(--space-3) 0 var(--space-5); }

/* menu */
.profile { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); align-items: baseline; margin-bottom: var(--space-3); }
.toolbar { display: grid; gap: var(--space-3); grid-template-columns: minmax(0, 1fr); margin: var(--space-4) 0 var(--space-5); }
.toolbar .field { margin: 0; }
.toolbar__fields { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); }
.menu-layout { display: grid; gap: var(--space-5); grid-template-columns: minmax(0, 1fr); }
.menu-layout > * { min-width: 0; }

/* dish tiles: a line grid, no gaps (the grid draws left/top, tiles right/bottom) */
.dish-grid {
  display: grid; gap: 0; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  border-left: 1px solid var(--line); border-top: 1px solid var(--line);
}
.dish { background: var(--panel); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.dish__img { aspect-ratio: 3 / 2; background: var(--spotlight); object-fit: contain; width: 100%; }
.dish__body { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); flex: 1; }
/* name, dotted leader, price on one line when they fit; when they do not, the
   leader and price move under the name, so a name never breaks inside a word */
.dish__top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--space-2); }
.dish__name { font-size: var(--step-2); margin: 0; flex: 0 1 auto; min-width: 0; overflow-wrap: break-word; }
.leader { flex: 1 1 var(--space-5); min-width: var(--space-5); border-bottom: 2px dotted var(--edge); transform: translateY(-0.3em); }
.price { flex: none; margin-left: auto; font: 700 var(--step-1)/1.2 var(--font-body); white-space: nowrap; }
.price--ask { font: 600 var(--step--1)/1.2 var(--font-body); color: var(--ink-soft); }  /* "Price at counter" is a note, not a price */
.dish__meta { color: var(--ink-soft); font: 400 var(--step--1)/1.45 var(--font-body); margin: 0; }
.dish__left { color: var(--accent-text); font-weight: 600; }
.dish__flag { margin: 0; font: 600 var(--step--1)/1.45 var(--font-body); color: var(--ink); }
.dish .row { margin-top: auto; }
.meter { height: 6px; background: var(--well); overflow: hidden; }
.meter > span { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; }
.dish.is-few .dish__left { color: var(--ink); }
.dish--soldout .dish__img { filter: grayscale(1); opacity: 0.6; }
.dish--soldout .dish__left { color: var(--ink-soft); }
.waitlist { border-top: 1px dashed var(--line); padding-top: var(--space-3); display: grid; gap: var(--space-2); }
.out { color: var(--ink-soft); }

/* tray */
.tray { background: var(--panel); border: 1px solid var(--line); border-top: var(--rule); padding: var(--space-5); }
.tray h2 { margin-top: 0; font-size: var(--step-2); }
.tray ul { list-style: none; padding: 0; margin: 0 0 var(--space-3); }
.tray li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--space-2); align-items: center; padding: var(--space-2) 0; border-bottom: 1px dashed var(--line); }
.tray li select { width: auto; }
.tray__total { display: flex; justify-content: space-between; gap: var(--space-3); font: 700 var(--step-1)/1.3 var(--font-body); margin: var(--space-2) 0 var(--space-4); }
.tray__token { display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-4); }
.tray__token p { margin: 0; }
.tray__coupon { border-top: 1px dashed var(--line); padding-top: var(--space-3); margin-bottom: var(--space-3); }
.tray__offers-h { font: 600 var(--step--1)/1.45 var(--font-body); color: var(--ink-soft); margin: var(--space-2) 0 0; }
.tray .offers li { grid-template-columns: minmax(0, 1fr) auto; font-size: var(--step--1); }
.tray__sub { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2) var(--space-3); align-items: center; color: var(--ink-soft); }
.tray__sub .btn { margin-left: var(--space-2); }
/* a teachers' special: curry-leaf tag with cream type (5.7:1) */
.special-tag { align-self: flex-start; margin: 0; padding: 0 var(--space-2); background: var(--leaf); color: var(--bar-ink); font: 600 var(--step--1)/1.6 var(--font-body); }
th .special-tag { display: inline-block; margin-top: var(--space-1); white-space: nowrap; }
.who-select { min-width: 9rem; }
.tray-count {
  display: inline-block; min-width: 1.5em; padding: 0 var(--space-1); text-align: center;
  background: var(--mark); color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums;
  transition: transform var(--dur-pulse) var(--ease-out);
}
.tray-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: var(--space-4);
  min-height: 56px; padding: var(--space-2) var(--gutter) calc(var(--space-2) + env(safe-area-inset-bottom, 0px));
  background: var(--accent); color: var(--accent-ink); text-decoration: none;
  font: 600 var(--step-0)/1.3 var(--font-body);
}
.tray-bar:focus-visible { outline: 3px solid var(--accent-ink); outline-offset: -5px; }
body:has(.tray-bar:not([hidden])) .footer { padding-bottom: calc(var(--space-6) + 64px); }

/* staff portal */
.kpis { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-top: var(--rule); padding: var(--space-4) var(--space-5); }
.kpi h3 { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); }
.kpi .figure { font-size: var(--step-3); }
.kpi form + form { margin-top: var(--space-4); }  /* "Mark ready" and "Daily limit" read as two separate actions */
.kpi--idle { border-top-color: var(--line); }
.food__meta { color: var(--ink-soft); font-size: var(--step--1); margin: 0 0 var(--space-2); }
.stack-list { list-style: none; padding: 0; margin: var(--space-3) 0; }
.stack-list li { padding: var(--space-2) var(--space-3); border: 1px solid var(--line); background: var(--panel); font-size: var(--step--1); }
.stack-list li + li { border-top: 0; }
.stack-list li:first-child { border-color: var(--accent); background: var(--tint); }
.stack-list .when { display: block; color: var(--ink-soft); font-size: var(--step--1); }
.stack-list .top { display: block; color: var(--accent-text); font-weight: 700; }
.counter-tokens { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); list-style: none; margin: var(--space-4) 0 0; padding: 0; }
.counter-tokens li { display: flex; align-items: center; gap: var(--space-3); background: var(--panel); border: 1px solid var(--line); padding: var(--space-3); }
.counter-tokens li > div:not(.stamp) { flex: 1; min-width: 0; }
.counter-tokens p { margin: 0; overflow-wrap: anywhere; font-size: var(--step--1); color: var(--ink-soft); }

/* ==== widths: tablet (641px and up) and desktop (1001px and up) =================== */
@media (min-width: 641px) {
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .toolbar { grid-template-columns: minmax(0, 1fr) minmax(0, 22rem); align-items: end; }
  .tabs { flex-wrap: wrap; overflow: visible; }
  .hero__inner { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); padding-block: var(--space-7) var(--space-8); }
}
@media (min-width: 1001px) {
  .topbar__inner { padding-block: var(--space-2); gap: 0 var(--space-5); }
  .topbar nav { gap: 0 var(--space-5); }
  .how { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .board { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .menu-layout { grid-template-columns: minmax(0, 1fr) 20rem; }
  /* a grid item stretches to the dish column; start keeps it its own height, so it can stick */
  .tray { position: sticky; top: var(--space-4); align-self: start; max-height: calc(100vh - 2rem); overflow-y: auto; }
  .tray-bar { display: none !important; }
  .split { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .portal { grid-template-columns: 12rem minmax(0, 1fr); gap: var(--space-6); }
  .portal__nav {
    position: sticky; top: var(--space-4); align-self: start; flex-direction: column; gap: 0;
    margin: 0; padding: 0; overflow: visible; border-bottom: 0; border-left: 1px solid var(--line);
  }
  .portal__nav a { padding: 0 var(--space-4); border-bottom: 0; border-left: 3px solid var(--page); margin-left: -1px; }
  .portal__nav a[aria-current="true"] { border-left-color: var(--accent); }
}

/* phones: table rows become labelled cards (labels come from labelTableCells in api.js) */
@media (max-width: 640px) {
  .table-wrap { overflow-x: visible; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr { display: block; width: 100%; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .table-wrap tr { padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
  .table-wrap tr:last-child { border-bottom: 0; }
  .table-wrap th, .table-wrap td { display: block; position: relative; border: 0; padding: var(--space-1) 0; text-align: left; min-height: 2rem; }
  .table-wrap td.num, .table-wrap th.num { text-align: left; }
  .table-wrap [data-label] { padding-left: calc(35% + var(--space-3)); }
  .table-wrap [data-label]::before {
    content: attr(data-label); position: absolute; left: 0; top: var(--space-2); width: 35%;
    color: var(--ink-soft); font: 600 var(--step--1)/1.3 var(--font-body); overflow-wrap: anywhere;
  }
  .table-wrap td .btn { width: 100%; }
  tr.is-ready { background: var(--tint); }
  .brand { font-size: var(--step-1); }
  .topbar nav { gap: 0 var(--space-3); }  /* the five student links fit one row at 360 wide */
  .info-strip .stamp { --size: 8rem; }
  .hero h1 span:nth-child(2) { padding-left: 0.3em; }
  .hero h1 span:nth-child(3) { padding-left: 0.6em; }
}

/* ==== motion ================================================================== */
/* Feedback only: nothing moves on page load and nothing loops. */
@keyframes fade-in { from { opacity: 0; } }
@keyframes line-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes tint-in { from { background-color: var(--panel); } }
@keyframes stamp-in { from { opacity: 0; transform: scale(0.9) rotate(-6deg); } }  /* a token called on the board */
.msg.is-new, .state.is-new { animation: fade-in var(--dur) var(--ease-out); }
.tray li.is-new { animation: line-in var(--dur-enter) var(--ease-out); }
.tray li.is-leaving { opacity: 0; transition: opacity var(--dur-fast) var(--ease-out); }
.tray-count.is-pulse { transform: scale(1.15); }
tr.is-changed > * { animation: tint-in var(--dur-slow) var(--ease-out); }

/* ==== forced colours (Windows contrast themes): the selected tab is not a colour only */
@media (forced-colors: active) {
  .tab[aria-pressed="true"] { border-width: 3px; text-decoration: underline; }
  .portal__nav a[aria-current="true"] { text-decoration: underline; }  /* its border is already 3px */
}

/* ==== reduced motion: every change is instant ==================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .btn:active, .tray-count.is-pulse { transform: none; }
}
