/* ── Custom fonts from menu-assets ── */
@font-face {
    font-family: 'menu-heading';
    src: url('/menu-assets/fonts/heading.otf') format('opentype');
    font-display: swap;
}

@font-face {
    font-family: 'menu-body';
    src: url('/menu-assets/fonts/body.otf') format('opentype');
    font-display: swap;
}

@font-face {
    font-family: 'menu-body-light';
    src: url('/menu-assets/fonts/body-light.otf') format('opentype');
    font-display: swap;
}

@font-face {
    font-family: 'menu-body-light-italic';
    src: url('/menu-assets/fonts/body-light-italic.otf') format('opentype');
    font-display: swap;
}

/* ── Theme variables (defaults — overridden by inline style when customized) ── */
:root {
    --font-heading: 'menu-heading', 'Montserrat', sans-serif;
    --font-body: 'menu-body', 'Playfair Display', serif;
    --font-body-light: 'menu-body-light', 'Playfair Display', serif;
    --font-body-light-italic: 'menu-body-light-italic', 'Playfair Display', serif;
    --color-bg: #FAF6F1;
    --color-text: #1a1a1a;
    --color-muted: rgba(0,0,0,0.45);
    --color-tab-bg: rgba(250,246,241,0.92);
    --color-accent: #8B7355;
}

/* ── Menu page body ── */
.menu-body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-user-select: none;
    user-select: none;
}

.menu-wrapper {
    min-height: 100vh;
    background-color: var(--color-bg);
    background-image: radial-gradient(circle, var(--color-accent) 0.5px, transparent 0.5px);
    background-size: 20px 20px;
    background-repeat: repeat;
    padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px));
}

/* Custom background image (set via inline style on .menu-wrapper) */
.menu-wrapper[style*="background-image"] {
    background-size: calc(100vw - 2rem) auto;
    background-repeat: repeat-y;
    background-position: center top;
}

/* ── Sticky tab navigation ── */
.tab-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    background: var(--color-tab-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border-radius: 0 0 6px 6px;
    min-height: 3em;
    padding: 0.5rem 1rem;
}

.tab-nav-btn {
    font-family: var(--font-body-light-italic);
    font-size: 0.95rem;
    color: var(--color-muted);
    background: none;
    border: none;
    padding: 0.4rem 1rem;
    cursor: pointer;
    transition: color 0.2s;
    white-space: nowrap;
}

.tab-nav-btn:hover {
    color: var(--color-text);
}

.tab-nav-btn.active {
    font-family: var(--font-body);
    color: var(--color-accent);
}

/* ── Tab nav layout for currency toggle ── */
.tab-nav-tabs {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.tab-nav-tabs::before,
.tab-nav-tabs::after {
    content: '';
    flex: 1 0 0px;
}

.tab-nav-tabs::-webkit-scrollbar {
    height: 0;
}

.tab-nav-tabs.scrolling {
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.15) transparent;
}

.tab-nav-tabs.scrolling::-webkit-scrollbar {
    height: 2px;
}

.tab-nav-tabs.scrolling::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 2px;
}

/* ── Tab scroll affordances (wrapper + chevron overlays) ── */
.tab-nav-scroll {
    position: relative;
    width: 100%;
    min-width: 0;
}

.tab-scroll-btn {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2.5rem;
    display: flex;
    align-items: center;
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    color: var(--color-accent);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
    z-index: 2;
}

.tab-scroll-left {
    left: 0;
    justify-content: flex-start;
}

.tab-scroll-right {
    right: 0;
    justify-content: flex-end;
}

.tab-nav-scroll.can-scroll-left .tab-scroll-left,
.tab-nav-scroll.can-scroll-right .tab-scroll-right {
    opacity: 1;
    pointer-events: auto;
}

/* ── PINNED: edge fade gradients — delete this whole block to drop the
      fade effect; the chevrons above keep working without it ── */
.tab-scroll-left {
    background: linear-gradient(to right, var(--color-tab-bg) 40%, transparent);
}

.tab-scroll-right {
    background: linear-gradient(to left, var(--color-tab-bg) 40%, transparent);
}
/* ── END PINNED fade block ── */

/* ── Toggles row (language + currency) ── */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.4rem 0.5rem 0;
    margin-top: 0.3rem;
}

.language-toggle {
    display: flex;
    align-items: center;
    gap: 0.3em;
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--color-accent);
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 0.15em 0.5em;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s, background 0.2s;
    font-weight: 500;
    flex-shrink: 0;
}

.language-toggle-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.language-toggle:hover {
    color: var(--color-text);
    background: rgba(0, 0, 0, 0.08);
}

.currency-toggle {
    display: flex;
    align-items: center;
    gap: 0.3em;
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: var(--color-accent);
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 0.15em 0.5em;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s, background 0.2s;
    font-weight: 500;
    flex-shrink: 0;
    margin-inline-start: auto;
}

.currency-toggle-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.currency-toggle:hover {
    color: var(--color-text);
    background: rgba(0, 0, 0, 0.08);
}

/* ── Logo ── */
.logo-area {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 0 1.5rem;
}

.logo-img {
    width: 8rem;
    height: 8rem;
    object-fit: contain;
}

/* ── Menu content ── */
.menu-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ── Category ── */
.category {
    text-align: center;
    margin: 2rem 0 1rem;
}

.category-name {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--color-accent);
}

.category-price {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    margin-inline-start: 0.5rem;
    color: var(--color-muted);
}

.category-description {
    font-family: var(--font-body-light-italic);
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-top: 0.25rem;
}

/* ── Menu item ── */
.menu-item {
    margin-bottom: 0.6rem;
}

.item-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 0.5rem;
}

.item-name {
    font-family: var(--font-body);
    font-size: 1.05rem;
    display: block;
    flex: 0 0 65%;
    min-width: 0;
    white-space: nowrap;
    overflow-x: auto;
}

.item-price {
    font-family: var(--font-body);
    font-size: 0.92rem;
    display: block;
    flex: 0 0 35%;
    min-width: 0;
    white-space: nowrap;
    text-align: end;
    overflow-x: auto;
}

/* With servings: name 6/12, servings 6/12 */
.item-row.has-servings .item-name {
    flex: 0 0 40%;
}

.item-description {
    font-family: var(--font-body-light);
    font-size: 0.88rem;
    color: var(--color-muted);
    line-height: 1.3;
    text-align: justify;
}

/* ── Serving sizes (inline) ── */
.servings {
    display: flex;
    gap: 0.4rem;
    flex: 0 0 60%;
    min-width: 0;
    overflow-x: auto;
    flex-wrap: nowrap;
}

.serving {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    flex-shrink: 0;
}

.serving:first-child {
    margin-inline-start: auto;
}

.serving-name {
    font-family: var(--font-body-light-italic);
    font-size: 0.78rem;
    color: var(--color-muted);
    white-space: nowrap;
}

.serving-price {
    font-family: var(--font-body);
    font-size: 0.82rem;
    white-space: nowrap;
}

/* ── Scrollbar: hidden by default, visible while scrolling ── */
.item-name,
.item-price,
.servings {
    scrollbar-width: none;
}

.item-name::-webkit-scrollbar,
.item-price::-webkit-scrollbar,
.servings::-webkit-scrollbar {
    height: 0;
}

.item-name.scrolling,
.item-price.scrolling,
.servings.scrolling {
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.15) transparent;
}

.item-name.scrolling::-webkit-scrollbar,
.item-price.scrolling::-webkit-scrollbar,
.servings.scrolling::-webkit-scrollbar {
    height: 2px;
}

.item-name.scrolling::-webkit-scrollbar-thumb,
.item-price.scrolling::-webkit-scrollbar-thumb,
.servings.scrolling::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 2px;
}

/* ── RTL support ── */
[dir="rtl"] .item-name {
    text-align: right;
}

[dir="rtl"] .item-description {
    text-align: right;
}

/* ── Page content toggle ── */
.page-content {
    display: none;
}

.page-content.active {
    display: block;
}

/* ── No pages fallback ── */
.no-pages {
    text-align: center;
    padding: 3rem 1rem;
    font-family: var(--font-body-light-italic);
    color: var(--color-muted);
}

/* ── Responsive: tablet ── */
@media (min-width: 768px) {
    .menu-content {
        max-width: 700px;
    }

    .category-name {
        font-size: 1.3rem;
        letter-spacing: 4px;
    }

    .item-row {
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .item-name {
        font-size: 1.15rem;
        flex: 0 1 auto;
        overflow-x: visible;
    }

    .item-price {
        font-size: 1.15rem;
        flex: 0 1 auto;
        margin-inline-start: auto;
        text-align: start;
        overflow-x: visible;
    }

    .item-row.has-servings .item-name {
        flex: 0 1 auto;
    }

    .servings {
        flex: 0 1 auto;
        margin-inline-start: auto;
        overflow-x: visible;
        flex-wrap: wrap;
    }

    .logo-img {
        width: 10rem;
        height: 10rem;
    }

    .tab-nav-btn {
        font-size: 1.05rem;
        padding: 0.5rem 1.5rem;
    }

    .currency-toggle {
        font-size: 0.85rem;
        padding: 0.2em 0.6em;
    }

    .language-toggle {
        font-size: 0.85rem;
        padding: 0.2em 0.6em;
    }

    .menu-wrapper[style*="background-image"] {
        background-size: calc(100vw - 4rem) auto;
    }
}

/* ── Responsive: desktop ── */
@media (min-width: 1024px) {
    .menu-content {
        max-width: 800px;
        padding: 0 2rem;
    }

    .menu-wrapper[style*="background-image"] {
        background-size: calc(100vw - 6rem) auto;
    }
}
