/* Allergen page: filter buttons and a table with a sticky header and a sticky dish column. */
.alg-title { font-size: var(--step-2); }
.alg-credit { margin: var(--space-1) 0 0; font-size: 0.75rem; color: var(--muted); }
.alg-legend { margin: var(--space-2) 0; color: var(--muted); font-size: var(--step--1); }
.alg-filter { margin: var(--space-2) 0 var(--space-1); }
.alg-filter h2 { margin: 0 0 var(--space-1); font-size: var(--step-0); }
.alg-filter .chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
/* Wide screens: all the buttons in one line; on narrower ones they wrap into rows */
@media (min-width: 75rem) {
  .alg-filter .chips { flex-wrap: nowrap; gap: 0.25rem; }
  .alg-filter .chip { flex: 0 1 auto; min-width: 0; padding: 0.3rem 0.5rem; font-size: calc(0.875rem + 2px); white-space: nowrap; }
}
.alg-filter .chips[hidden] { display: none; }
.alg-status { min-height: 1.2em; margin: 0.3rem 0 0; font-size: var(--step--1); font-weight: 700; color: var(--red-text); }
/* The title and buttons stay on screen, and so does the table header; the page itself scrolls (the footer shows after the table's end) */
.alg-top { position: sticky; top: var(--sticky-top); z-index: 90; margin-top: var(--top-gap); padding: 0.7rem 0 0.4rem; background: var(--cream); }
.alg-top::before { content: ""; position: absolute; left: 0; right: 0; top: calc(-1 * var(--top-gap)); height: var(--top-gap); background: var(--cream); }
.alg-top .alg-title { margin: 0 0 0.5rem; }
.alg-wrap { max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: 70vh; max-height: 70dvh; }
/* Wide screens: the table fits, so it does not need its own scroll box; its header sticks under the title block */
@media (min-width: 64rem) {
  .alg-wrap { overflow: visible; max-height: none; }
  .alg-wrap .alg thead th { top: calc(var(--sticky-top) + var(--alg-top-h, 11rem)); }
}
/* Narrower than a laptop window: the allergen buttons sit in one row that slides sideways */
@media (max-width: 63.99rem) {
  .alg-filter .chips { flex-wrap: nowrap; overflow-x: auto; gap: 0.35rem; padding-bottom: 0.3rem; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .alg-filter .chips::-webkit-scrollbar { display: none; }
  .alg-filter .chip { flex: none; }
}
@media (max-width: 40rem) { .alg-filter .chip { font-size: 0.875rem; padding: 0.3rem 0.7rem; } }
/* Small screens: the title block is not fixed (the buttons take too much room); the table scrolls inside its own frame */
@media (max-width: 63.99rem) {
  .alg-top { position: static; margin-top: 0; padding-top: 1rem; }
  .alg-top::before { display: none; }
}
table.alg { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--step--1); }
.alg th, .alg td { padding: 0.45rem 0.6rem; text-align: center; vertical-align: middle; background: var(--paper); border-bottom: 1px solid var(--line); }
.alg thead th { position: sticky; top: 0; z-index: 2; font-size: 0.75rem; background: var(--cream); border-bottom: 2px solid var(--graphite); }
.alg thead th span { display: block; font-weight: 600; color: var(--muted); white-space: nowrap; }
.alg-icon { display: block; width: 2.5rem; height: 2.5rem; margin: 0 auto 0.2rem; }
.alg thead th { vertical-align: bottom; }
.alg-code { display: inline-grid; place-items: center; min-width: 2rem; height: 2rem; margin-bottom: 0.2rem; font-weight: 800; text-decoration: none; color: #fff; background: var(--graphite); border-radius: 999px; }
.alg tbody th[scope="row"] { font-size: var(--fs-body); position: sticky; left: 0; z-index: 1; min-width: 11rem; max-width: 16rem; text-align: left; font-weight: 700; border-right: 2px solid var(--line); }
.alg thead th:first-child { position: sticky; left: 0; z-index: 3; text-align: left; }
.alg tr.alg-sec th { position: static; text-align: left; font-size: 0.8125rem; letter-spacing: 0.04em; text-transform: uppercase; color: #fff; background: var(--red-text); border: 0; }
.alg-dot { color: var(--red-text); font-size: 1.1rem; }
.alg-trace { color: var(--red-text); font-size: 1.05rem; opacity: 0.6; }
.alg-flag { display: block; font-size: 0.75rem; font-weight: 700; color: var(--red-text); }
.alg-note { margin-top: var(--space-2); padding: var(--space-2); }
