/*
 * BPC Meniu – frontend.
 * Also loaded in the admin editor, so the preview is the real thing.
 * Columns follow the width of each course (container queries), not the viewport,
 * which keeps the admin preview and the site in step.
 */

.bpcm-menu {
    --bpcm-green: var(--bachusGreen, #093321);
    --bpcm-cactus: var(--cactus, #519664);
    --bpcm-ink: #17241d;
    --bpcm-muted: #5d6a62;
    --bpcm-line: #e3e7e2;
    --bpcm-stone: #f4f5f2;
    --bpcm-radius: 14px;
    --bpcm-sticky-top: 110px;
    --bpcm-head-font: var(--wp--preset--font-family--aboreto, inherit);
    --bpcm-body-font: var(--wp--preset--font-family--anek-latin, inherit);
    font-family: var(--bpcm-body-font);
    color: var(--bpcm-ink);
}

:where(.bpcm-menu button) {
    font: inherit;
    color: inherit;
    line-height: inherit;
    letter-spacing: inherit;
    text-transform: none;
    margin: 0;
}

:where(.bpcm-menu) :focus-visible {
    outline: 2px solid var(--bpcm-cactus);
    outline-offset: 3px;
}

/* ── Filter nav ─────────────────────────────────────────────────────────── */
.bpcm-nav {
    position: sticky;
    top: var(--bpcm-sticky-top);
    z-index: 101;
    background: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--bpcm-line);
}

.bpcm-nav__tabs,
.bpcm-nav__pills {
    display: flex;
    gap: 6px;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 clamp(16px, 4vw, 48px);
    overflow-x: auto;
    scrollbar-width: none;
}

.bpcm-nav__tabs::-webkit-scrollbar,
.bpcm-nav__pills::-webkit-scrollbar {
    display: none;
}

.bpcm-nav__tab {
    flex: none;
    padding: 16px 18px 13px;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: none;
    color: var(--bpcm-muted);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.bpcm-nav__tab:hover {
    color: var(--bpcm-green);
}

.bpcm-nav__tab.is-active {
    color: var(--bpcm-green);
    border-bottom-color: var(--bpcm-green);
}

.bpcm-nav__pills {
    padding-top: 10px;
    padding-bottom: 12px;
    border-top: 1px solid var(--bpcm-line);
}

.bpcm-nav__pills[hidden] {
    display: none !important;
}

.bpcm-nav__pill {
    flex: none;
    padding: 7px 16px;
    border: 1px solid var(--bpcm-line);
    border-radius: 999px;
    background: #fff;
    color: var(--bpcm-ink);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.bpcm-nav__pill:hover {
    border-color: var(--bpcm-cactus);
    color: var(--bpcm-green);
}

.bpcm-nav__pill.is-active {
    border-color: var(--bpcm-green);
    background: var(--bpcm-green);
    color: #fff;
}

/* ── Courses ───────────────────────────────────────────────────────────── */
.bpcm-courses,
.bpcm-canvas {
    box-sizing: border-box;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 clamp(16px, 4vw, 48px);
}

.bpcm-course {
    container-type: inline-size;
    padding: clamp(36px, 5vw, 64px) 0 0;
    scroll-margin-top: calc(var(--bpcm-sticky-top) + 120px);
}

.bpcm-course:last-child {
    padding-bottom: clamp(36px, 5vw, 64px);
}

.bpcm-course[hidden] {
    display: none !important;
}

/* The title runs into a hairline, like a section heading on a printed menu. */
.bpcm-menu .bpcm-course__title {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 0 0 clamp(20px, 3vw, 32px);
    padding: 0;
    font-family: var(--bpcm-head-font);
    font-size: clamp(26px, 3.2vw, 38px);
    font-weight: 400;
    line-height: 1.15;
    color: var(--bpcm-green);
    text-align: left;
}

.bpcm-course__title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--bpcm-line);
}

/* ── Dish grid ─────────────────────────────────────────────────────────── */
.bpcm-dishes {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

@container (min-width: 560px) {
    .bpcm-dishes {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 36px 24px;
    }
}

@container (min-width: 820px) {
    .bpcm-dishes {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@container (min-width: 1080px) {
    .bpcm-dishes {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 44px 28px;
    }
}

/* ── Dish ──────────────────────────────────────────────────────────────── */
.bpcm-dish {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.bpcm-dish__media {
    overflow: hidden;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: var(--bpcm-radius);
    background: var(--bpcm-stone);
}

/* !important: theme/core rules like img { height: auto } must never stretch menu photos. */
.bpcm-dish__media img {
    display: block;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    margin: 0;
    object-fit: cover !important;
    object-position: center;
    contain-intrinsic-size: auto !important;
    transition: transform 0.5s ease;
}

.bpcm-dish.is-openable:hover .bpcm-dish__media img {
    transform: scale(1.03);
}

.bpcm-dish__body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.bpcm-dish__head {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.bpcm-menu .bpcm-dish__name {
    flex: 0 1 auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    font-family: var(--bpcm-head-font);
    font-size: 18px;
    font-weight: 400;
    line-height: 1.3;
    color: var(--bpcm-green);
    text-align: left;
    overflow-wrap: anywhere;
}

.bpcm-dish__open {
    display: inline;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    text-align: left;
    cursor: default;
}

button.bpcm-dish__open {
    cursor: pointer;
}

/* Whole card is the click target. */
button.bpcm-dish__open::after {
    content: "";
    position: absolute;
    inset: -8px;
    z-index: 1;
    border-radius: calc(var(--bpcm-radius) + 6px);
}

button.bpcm-dish__open:focus-visible {
    outline: none;
}

button.bpcm-dish__open:focus-visible::after {
    outline: 2px solid var(--bpcm-cactus);
    outline-offset: 0;
}

.bpcm-dish__leader {
    flex: 1 1 24px;
    min-width: 24px;
    border-bottom: 2px dotted #c9d0ca;
    transform: translateY(-4px);
}

.bpcm-dish__price {
    flex: none;
    font-size: 17px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--bpcm-green);
    white-space: nowrap;
}

.bpcm-dish__facts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.bpcm-dish__facts li {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
    color: var(--bpcm-muted);
}

.bpcm-dish__tag {
    padding: 0 8px;
    border-radius: 999px;
    background: var(--bpcm-stone);
}

.bpcm-dish__qty + .bpcm-dish__tag {
    margin-left: 2px;
}

.bpcm-dish__desc {
    display: -webkit-box;
    overflow: hidden;
    margin: 2px 0 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--bpcm-muted);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.bpcm-dish__more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0 0;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--bpcm-cactus);
}

.bpcm-dish__more::before {
    content: "i";
    display: inline-grid;
    place-items: center;
    width: 16px;
    height: 16px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    font-size: 11px;
    font-style: italic;
    font-weight: 700;
    line-height: 1;
}

.bpcm-dish__extra[hidden] {
    display: none !important;
}

/* Narrow courses (phones): list rows, text left, thumbnail right. */
@container (max-width: 559px) {
    .bpcm-dish {
        flex-direction: row-reverse;
        align-items: flex-start;
        gap: 16px;
        padding: 18px 0;
        border-bottom: 1px solid var(--bpcm-line);
    }
    .bpcm-dish:first-child {
        padding-top: 0;
    }
    .bpcm-dish:last-child {
        border-bottom: 0;
    }
    .bpcm-dish__media {
        flex: none;
        width: 96px;
        aspect-ratio: 1;
        border-radius: 12px;
    }
    .bpcm-dish__body {
        flex: 1;
    }
    .bpcm-menu .bpcm-dish__name {
        font-size: 16px;
    }
    .bpcm-dish__price {
        font-size: 16px;
    }
    .bpcm-dish__desc {
        font-size: 14px;
    }
    button.bpcm-dish__open::after {
        inset: 0;
        border-radius: 0;
    }
}

@media (max-width: 800px) {
    .bpcm-menu {
        --bpcm-sticky-top: 0px;
    }
    .bpcm-nav__tab {
        padding: 13px 14px 11px;
        font-size: 15px;
    }
    .bpcm-nav__pill {
        padding: 6px 14px;
        font-size: 13.5px;
    }
}

.bpcm-menu-empty {
    padding: 40px 20px;
    text-align: center;
    color: #777;
}

/* ── Detail sheet ──────────────────────────────────────────────────────── */
body.bpcm-sheet-open {
    overflow: hidden;
}

.bpcm-sheet {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    font-family: var(--wp--preset--font-family--anek-latin, inherit);
    color: #17241d;
}

.bpcm-sheet[hidden] {
    display: none;
}

.bpcm-sheet__scrim {
    position: absolute;
    inset: 0;
    background: rgba(9, 25, 17, 0.5);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.bpcm-sheet__panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 30px 80px rgba(9, 25, 17, 0.35);
    opacity: 0;
    transform: translateY(16px) scale(0.98);
    transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.bpcm-sheet.is-open .bpcm-sheet__scrim {
    opacity: 1;
}

.bpcm-sheet.is-open .bpcm-sheet__panel {
    opacity: 1;
    transform: none;
}

.bpcm-sheet__close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: #093321;
    font-size: 22px;
    line-height: 1;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

.bpcm-sheet__media {
    flex: none;
    aspect-ratio: 4 / 3;
    background: #f4f5f2;
}

.bpcm-sheet__media img {
    display: block;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    margin: 0;
    object-fit: cover !important;
}

.bpcm-sheet__body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 24px 28px 28px;
}

.bpcm-sheet--text .bpcm-sheet__body {
    padding-top: 56px;
}

.bpcm-sheet .bpcm-dish__head {
    padding-right: 0;
}

.bpcm-sheet .bpcm-dish__name {
    margin: 0;
    font-family: var(--wp--preset--font-family--aboreto, inherit);
    font-size: 24px;
    font-weight: 400;
    line-height: 1.25;
    color: #093321;
}

.bpcm-sheet .bpcm-dish__price {
    font-size: 20px;
}

.bpcm-sheet .bpcm-dish__desc {
    display: block;
    font-size: 16px;
    -webkit-line-clamp: unset;
    line-clamp: unset;
}

.bpcm-sheet__extra {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 10px;
    padding-top: 18px;
    border-top: 1px solid #e3e7e2;
}

.bpcm-sheet__extra h4 {
    margin: 0 0 4px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    color: #093321;
}

.bpcm-sheet__extra p {
    margin: 0;
    font-size: 15px;
    line-height: 1.55;
    color: #3e4a43;
}

/* Phones: a bottom sheet. */
@media (max-width: 600px) {
    .bpcm-sheet {
        align-items: flex-end;
        padding: 0;
    }
    .bpcm-sheet__panel {
        max-width: none;
        max-height: 90vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(40px);
    }
    .bpcm-sheet__body {
        padding: 20px 20px calc(28px + env(safe-area-inset-bottom));
    }
}

@media (prefers-reduced-motion: reduce) {
    .bpcm-sheet__scrim,
    .bpcm-sheet__panel,
    .bpcm-dish__media img {
        transition: none;
    }
    .bpcm-dish.is-openable:hover .bpcm-dish__media img {
        transform: none;
    }
}

/* ── Block editor preview ──────────────────────────────────────────────── */
.bpcm-editor-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: #093321;
    color: #fff;
    font-size: 13px;
}

.bpcm-editor-bar a {
    color: #fff;
    font-weight: 600;
}

.bpcm-editor-preview {
    pointer-events: none;
}

.bpcm-editor-preview .bpcm-nav {
    position: relative;
    top: 0;
}
