/* Food & Drink Menu — scoped under .scm-mod-Menu
 *
 * Laid out like a printed menu rather than a product grid: name, leader dots, price. That reads
 * as a menu at a glance, which a card grid does not, and it degrades cleanly when an item has no
 * photo (most will not).
 *
 * W4-4: a chip per section, two columns of items from tablet width up, one on a phone. Every color is
 * a theme token (--default-color, --heading-color, --accent-color, --accent-contrast-color) or the
 * text color itself, so a light site and a dark one, and a dark section inside a light site, each get
 * a menu that holds its contrast. The accent only ever draws lines and fills behind its own contrast
 * color: a yellow accent on a white page would be unreadable as text.
 */

.scm-mod-Menu {
    display: block;
}

/* The site theme styles EVERY <section> as a page band: its own background and text color, 60px of padding and
   overflow: clip. Each menu category is a <section>, so every category carried 60px of padding above and below.
   Reset them here. :where() keeps this at one class of specificity: it beats the theme's bare element rule and loses
   to every .scm-mod-Menu .x rule that styles a section. */
.scm-mod-Menu :where(section) {
    color: inherit;
    background-color: transparent;
    padding: 0;
    overflow: visible;
    scroll-margin-top: 0;
}

/* The theme's Section Spacing presets and its sidebar pane pad every section again with one class and one element
   (.spacing-relaxed section), which outranks the reset above. This matches them at two classes, so it stays above
   every rule that pads a section: those tie with it and win by coming later. */
:is(.spacing-compact, .spacing-relaxed, .spacing-spacious, .pane-sidebar) .scm-mod-Menu :where(section) {
    padding-top: 0;
    padding-bottom: 0;
}

/* ---- Menu switcher (only rendered when a venue publishes more than one) ---- */

.scm-mod-Menu .menu-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 2rem;
}

/* The tabs are links since 3.99.73 (the module renders statically), so the theme's link underline and hover color
   are reset here: a tab looks and behaves as the button it was. */
.scm-mod-Menu .menu-tab {
    display: inline-block;
    padding: 0.5rem 1.1rem;
    border: 1px solid rgba(127, 127, 127, 0.35);
    border-color: color-mix(in srgb, var(--default-color, currentColor) 28%, transparent);
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}

.scm-mod-Menu .menu-tab:hover,
.scm-mod-Menu .menu-tab:focus-visible {
    border-color: var(--accent-color, #e10600);
    color: inherit;
    text-decoration: none;
}

.scm-mod-Menu .menu-tab--active,
.scm-mod-Menu .menu-tab--active:hover,
.scm-mod-Menu .menu-tab--active:focus-visible {
    background: var(--accent-color, #e10600);
    border-color: var(--accent-color, #e10600);
    color: var(--accent-contrast-color, var(--contrast-color, #fff));
}

/* ---- The menu ---- */

.scm-mod-Menu .menu {
    max-width: 1120px;
    margin: 0 auto;
}

.scm-mod-Menu .menu__intro {
    max-width: 60ch;
    margin: 0 auto 2rem;
    text-align: center;
}

/* ---- Section chips: wrapped and centered at every width ----
   Wave 6: on a phone they used to run in one row that scrolled sideways, and the last chips sat off the screen with
   nothing to say they were there. A few rows of chips is a menu's table of contents; every section stays one tap away. */

.scm-mod-Menu .menu-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin: 0 0 2.25rem;
    padding: 0.25rem 0.125rem 0.5rem;
}

.scm-mod-Menu .menu-chip {
    flex: 0 1 auto;
    max-width: 100%;
    padding: 0.45rem 1rem;
    border: 1px solid rgba(127, 127, 127, 0.35);
    border-color: color-mix(in srgb, var(--default-color, currentColor) 28%, transparent);
    border-radius: 999px;
    color: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    overflow-wrap: anywhere;
    text-align: center;
    text-decoration: none;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.scm-mod-Menu .menu-chip:hover {
    border-color: var(--accent-color, #e10600);
    color: inherit;
    text-decoration: none;
}

.scm-mod-Menu .menu-chip:focus-visible {
    outline: 2px solid var(--accent-color, #e10600);
    outline-offset: 2px;
    color: inherit;
    text-decoration: none;
}

/* ---- Sections ---- */

/* The theme's header is sticky (88px tall on a desktop, 66px below 1200px): a chip's jump lands the section's
   title just under it rather than behind it. */
.scm-mod-Menu .menu-section {
    margin-bottom: 3rem;
    scroll-margin-top: 104px;
}

@media (max-width: 1199px) {
    .scm-mod-Menu .menu-section {
        scroll-margin-top: 82px;
    }
}

.scm-mod-Menu .menu-section__title {
    margin: 0 0 0.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent-color, #e10600);
    color: var(--heading-color, inherit);
    font-family: var(--heading-font, inherit);
    font-size: clamp(1.35rem, 1.1rem + 0.9vw, 1.75rem);
    line-height: 1.2;
}

.scm-mod-Menu .menu-section__desc {
    max-width: 70ch;
    margin: 0.6rem 0 0.5rem;
    opacity: 0.85;
}

/* ---- Items: one column on a phone, two from tablet width up ---- */

.scm-mod-Menu .menu-items {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    column-gap: 3rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

@media (min-width: 768px) {
    .scm-mod-Menu .menu-items {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.scm-mod-Menu .menu-item {
    display: flex;
    gap: 1rem;
    padding: 0.9rem 0;
    border-bottom: 1px solid rgba(127, 127, 127, 0.25);
    border-bottom-color: color-mix(in srgb, var(--default-color, currentColor) 16%, transparent);
    break-inside: avoid;
}

.scm-mod-Menu .menu-item__img {
    width: 84px;
    height: 84px;
    object-fit: cover;
    border-radius: var(--border-radius, 0.5rem);
    flex-shrink: 0;
}

.scm-mod-Menu .menu-item__body {
    flex: 1;
    min-width: 0;
}

/* Leader dots: the middle span expands to fill whatever the name and price leave behind, so the price sits flush
   right on the name's line however long the name is. */
.scm-mod-Menu .menu-item__head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.scm-mod-Menu .menu-item__name {
    min-width: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.scm-mod-Menu .menu-item__dots {
    flex: 1;
    min-width: 1.5rem;
    border-bottom: 1px dotted rgba(127, 127, 127, 0.5);
    border-bottom-color: color-mix(in srgb, var(--default-color, currentColor) 35%, transparent);
    transform: translateY(-0.25rem);
}

/* The heading color, not the accent: the theme guarantees the heading color reads on its background. */
.scm-mod-Menu .menu-item__price {
    flex-shrink: 0;
    color: var(--heading-color, inherit);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.scm-mod-Menu .menu-item__desc {
    margin: 0.3rem 0 0;
    font-size: 0.95em;
    line-height: 1.45;
    opacity: 0.82;
}

/* ---- Tags and allergens ---- */

.scm-mod-Menu .menu-item__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.scm-mod-Menu .menu-tag {
    padding: 0.15rem 0.55rem;
    border: 1px solid rgba(127, 127, 127, 0.3);
    border-color: color-mix(in srgb, var(--default-color, currentColor) 22%, transparent);
    border-radius: 999px;
    background: rgba(127, 127, 127, 0.08);
    background: color-mix(in srgb, var(--default-color, currentColor) 7%, transparent);
    color: inherit;
    font-size: 0.75rem;
    line-height: 1.4;
}

.scm-mod-Menu .menu-tag--new,
.scm-mod-Menu .menu-tag--popular,
.scm-mod-Menu .menu-tag--featured {
    background: var(--accent-color, #e10600);
    border-color: var(--accent-color, #e10600);
    color: var(--accent-contrast-color, var(--contrast-color, #fff));
}

.scm-mod-Menu .menu-tag--muted {
    opacity: 0.75;
}

/* Allergens are a safety notice. Kept as sentence text so it is read, not scanned past. */
.scm-mod-Menu .menu-item__allergens {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
    opacity: 0.85;
}

.scm-mod-Menu .menu-empty {
    text-align: center;
    padding: 3rem 1rem;
}

.scm-mod-Menu .menu-empty p {
    margin: 0 0 1rem;
    opacity: 0.85;
}

/* Where their menu is while this page has none of its own: a button, in the theme's own accent pair. */
.scm-mod-Menu .menu-empty__link {
    display: inline-block;
    padding: 0.7rem 1.5rem;
    border-radius: var(--border-radius, 0.5rem);
    background: var(--accent-color, #e10600);
    color: var(--accent-contrast-color, var(--contrast-color, #fff));
    font-weight: 600;
    text-decoration: none;
}

.scm-mod-Menu .menu-empty__link:hover,
.scm-mod-Menu .menu-empty__link:focus-visible {
    color: var(--accent-contrast-color, var(--contrast-color, #fff));
    text-decoration: underline;
}

.scm-mod-Menu .menu-empty__link:focus-visible {
    outline: 2px solid var(--accent-color, #e10600);
    outline-offset: 3px;
}

@media (max-width: 480px) {
    .scm-mod-Menu .menu-item__img {
        width: 60px;
        height: 60px;
    }

    .scm-mod-Menu .menu-section {
        margin-bottom: 2.25rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .scm-mod-Menu .menu-chip {
        transition: none;
    }
}

/* ============================================================
   The look (wave 6): MenuDisplaySettings.Look, set by a website import from how the venue's old menu page presented its
   menu, or by the operator in the display's settings. Every rule hangs off a .menu-look--* class the module adds only
   when the setting is set, so a menu without it is untouched by everything below. Colors arrive as custom properties on
   the module's root (--menu-title-color, --menu-price-color, --menu-card-bg, --menu-card-ink, --menu-card-line,
   --menu-card-radius), already checked to read on the card they sit on.
   ============================================================ */

/* ---- Colors ---- */

.scm-mod-Menu.menu-look--title .menu-section__title {
    color: var(--menu-title-color);
    border-bottom-color: var(--menu-title-color);
}

.scm-mod-Menu.menu-look--price .menu-item__price {
    color: var(--menu-price-color);
}

/* Section titles in the site's display heading style: the same brand tokens the theme sets for its display headings. */
.scm-mod-Menu.menu-look--display-titles .menu-section__title {
    font-weight: var(--heading-weight, 800);
    font-style: var(--heading-style, normal);
    text-transform: var(--heading-transform, none);
    letter-spacing: var(--heading-letter-spacing, normal);
    overflow-wrap: anywhere;
}

/* ---- Columns of items in the list look ---- */

.scm-mod-Menu.menu-look--list.menu-look--cols-1 .menu-items {
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 992px) {
    .scm-mod-Menu.menu-look--list.menu-look--cols-3 .menu-items {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ---- Cards: each section its own card, the cards in columns, filled top to bottom like a printed menu ---- */

.scm-mod-Menu.menu-look--cards .menu-sections {
    column-count: 1;
    column-gap: 1.5rem;
}

@media (min-width: 992px) {
    .scm-mod-Menu.menu-look--cards:not(.menu-look--cols-1) .menu-sections {
        column-count: 2;
    }
}

@media (min-width: 1200px) {
    .scm-mod-Menu.menu-look--cards.menu-look--cols-3 .menu-sections {
        column-count: 3;
    }
}

/* Two classes and an element's worth of specificity: above the theme's section reset and its spacing presets. */
.scm-mod-Menu.menu-look--cards .menu-sections > .menu-section {
    display: inline-block;
    width: 100%;
    break-inside: avoid;
    margin: 0 0 1.5rem;
    padding: 1.25rem 1.5rem 1.5rem;
    border: 1px solid var(--menu-card-line, rgba(127, 127, 127, 0.3));
    border-radius: var(--menu-card-radius, var(--border-radius, 0.5rem));
    background-color: var(--menu-card-bg, transparent);
    vertical-align: top;
}

/* A filled card draws its edge only when the source drew one, and its words take the card's own color: the theme's text
   and heading tokens are re-pointed inside it, so every rule above that reads them follows. */
.scm-mod-Menu.menu-look--cards.menu-look--filled .menu-sections > .menu-section {
    --default-color: var(--menu-card-ink);
    --heading-color: var(--menu-card-ink);
    border-color: var(--menu-card-line, transparent);
    color: var(--menu-card-ink);
}

/* One column of rows inside a card, at every width (three classes: above the list look's two columns). */
.scm-mod-Menu.menu-look--cards .menu-items {
    grid-template-columns: minmax(0, 1fr);
}

/* A card's rows: name and price on one line with no leader dots, a hairline in the card's own text color between them. */
.scm-mod-Menu.menu-look--cards .menu-item__dots {
    border-bottom-color: transparent;
}

.scm-mod-Menu.menu-look--cards .menu-item {
    border-bottom-color: rgba(127, 127, 127, 0.25);
    border-bottom-color: color-mix(in srgb, currentColor 14%, transparent);
}

.scm-mod-Menu.menu-look--cards .menu-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

/* ---- Compact ---- */

.scm-mod-Menu.menu-look--compact .menu-item {
    padding: 0.45rem 0;
}

.scm-mod-Menu.menu-look--compact .menu-section {
    margin-bottom: 2rem;
}

.scm-mod-Menu.menu-look--cards.menu-look--compact .menu-sections > .menu-section {
    margin-bottom: 1.25rem;
    padding: 1rem 1.25rem 1.25rem;
}

@media (max-width: 480px) {
    .scm-mod-Menu.menu-look--cards .menu-sections > .menu-section {
        padding: 1rem 1rem 1.25rem;
    }
}
