/* =====================================================================
   New Bistrò — menu page styling (visual only)
   Rewritten for an elegant "paper menu" look consistent with the main
   site (Playfair Display + EdwardianScript, cream / espresso / deep red).
   NOTE: this is presentation only. The data layer (menu.js, MENU_URL,
   the JSON contract) is untouched. Class names + the language drum's
   64px row height are preserved exactly because menu.js depends on them.
   ===================================================================== */

@font-face {
    font-family: 'Times';
    src: url('assets/times.ttf') format('truetype');
}

@font-face {
    font-family: 'EdwardianScript';
    src: url('assets/edwardianscriptitc.ttf') format('truetype');
}

/* ─── Tokens ──────────────────────────────────────────────────────── */
:root {
    --paper: #f6efe2;          /* warm cream */
    --paper-2: #efe5d2;
    --ink: #2c2620;            /* espresso */
    --muted: #8a7c69;          /* warm grey-brown */
    --accent: #b3201a;         /* deep menu red */
    --hair: rgba(44, 38, 32, 0.14);
    --logo-filter: none;
    --overlay: rgba(28, 20, 12, 0.62);
    --loading-bg: rgba(246, 239, 226, 0.78);
}

[data-theme="dark"] {
    --paper: #17120d;
    --paper-2: #1f1811;
    --ink: #ece2d2;
    --muted: #a99a85;
    --accent: #e26159;         /* brighter red for dark backgrounds */
    --hair: rgba(255, 255, 255, 0.13);
    /* logo-cool-small is black script art on transparent → invert to white on dark */
    --logo-filter: brightness(0) invert(1);
    --overlay: rgba(0, 0, 0, 0.7);
    --loading-bg: rgba(23, 18, 13, 0.82);
}

/* ─── Base ────────────────────────────────────────────────────────── */
body {
    margin: 0;
    padding: 1.5rem;
    min-height: 100vh;
    background: var(--paper);
    color: var(--ink);
    font-family: "Playfair Display", "Times", Georgia, serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.background-img {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.09;
    z-index: -1;
    filter: sepia(0.45) brightness(1.05);
    mix-blend-mode: multiply;
}

[data-theme="dark"] .background-img {
    opacity: 0.05;
    filter: none;
    mix-blend-mode: screen;
}

/* ─── Logo + Title ────────────────────────────────────────────────── */
.logo {
    display: block;
    max-width: 230px;
    height: auto;
    margin: 0.5rem auto 1.25rem;
    filter: var(--logo-filter);
}

.title {
    text-align: center;
    font-family: 'EdwardianScript', cursive;
    font-size: 54px;
    font-weight: 400;
    line-height: 1;
    color: var(--ink);
    margin: 0 0 2.5rem;
}

.title::after {
    content: '';
    display: block;
    width: 64px;
    height: 5px;
    margin: 1.1rem auto 0;
    border-top: 1px solid var(--accent);
    border-bottom: 1px solid var(--accent);
}

/* ─── Menu Layout ─────────────────────────────────────────────────── */
.menu {
    max-width: 760px;
    margin: 0 auto;
}

.section {
    margin-bottom: 3rem;
}

.section-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.section-title {
    font-family: "Playfair Display", serif;
    font-weight: 700;
    font-size: 32px;
    letter-spacing: 0.01em;
    color: var(--ink);
    margin: 0;
}

.section-title::after {
    content: '';
    display: block;
    width: 46px;
    height: 2px;
    background: var(--accent);
    margin: 0.85rem auto 0;
}

.section-subtitle {
    font-family: "Playfair Display", serif;
    font-style: italic;
    font-weight: 400;
    font-size: 18px;
    color: var(--muted);
    margin: 0.7rem 0 0;
}
.section-subtitle:empty { display: none; }

.section-items {
    margin-top: 1.5rem;
}

/* Items laid out as a CSS grid (name / price on one row, description below).
   This re-uses the existing markup — no JS/markup change. */
.item {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
        "name price"
        "desc desc";
    column-gap: 1.5rem;
    row-gap: 0.25rem;
    padding: 0.95rem 0;
    border-bottom: 1px solid var(--hair);
}
.item:last-child { border-bottom: none; }

.item .item-name {
    grid-area: name;
    font-family: "Times", Georgia, serif;
    font-weight: 700;
    font-size: 19px;
    color: var(--ink);
}

.item .item-price {
    grid-area: price;
    align-self: start;
    font-family: "Playfair Display", serif;
    font-weight: 600;
    font-size: 18px;
    color: var(--accent);
    white-space: nowrap;
}

.item .item-description {
    grid-area: desc;
    font-family: "Times", Georgia, serif;
    font-style: italic;
    font-size: 15px;
    line-height: 1.5;
    color: var(--muted);
    margin-top: 0.1rem;
}
.item .item-description:empty { display: none; }

/* ─── Desktop ─────────────────────────────────────────────────────── */
@media (min-width: 640px) {
    body { padding: 3rem; }

    .logo { max-width: 360px; margin-bottom: 1.5rem; }

    .title { font-size: 78px; margin-bottom: 3.5rem; }
    .title::after { width: 90px; margin-top: 1.5rem; }

    .section { margin-bottom: 4.5rem; }

    .section-header { margin-bottom: 2.5rem; }
    .section-title { font-size: 50px; }
    .section-title::after { width: 60px; margin-top: 1.1rem; }
    .section-subtitle { font-size: 26px; }

    .section-items { margin-top: 2rem; }

    .item { padding: 1.25rem 0; column-gap: 2.5rem; }
    .item .item-name { font-size: 25px; }
    .item .item-price { font-size: 24px; }
    .item .item-description { font-size: 18px; margin-top: 0.35rem; }
}

/* ─── Language Picker Button ──────────────────────────────────────── */
.lang-picker-btn {
    position: fixed;
    top: 1.4rem;
    left: 1.4rem;
    z-index: 100;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--paper-2);
    border: 1px solid var(--hair);
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
    transition: opacity 0.3s, transform 0.15s, background 0.2s;
}

.lang-picker-btn:hover { transform: translateY(-1px); }
.lang-picker-btn:active { transform: scale(0.93); }

/* ─── Language Picker Overlay ─────────────────────────────────────── */
.lang-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: var(--overlay);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.45s ease;
}

.lang-overlay.closing {
    opacity: 0;
    pointer-events: none;
}

.lang-card {
    background: var(--paper);
    width: min(340px, 88vw);
    overflow: hidden;
    border-radius: 5px;
    box-shadow: 0 32px 90px rgba(0, 0, 0, 0.5);
    animation: cardRise 0.6s cubic-bezier(0.34, 1.22, 0.64, 1) both;
}

@keyframes cardRise {
    from { transform: translateY(48px) scale(0.95); opacity: 0; }
    to   { transform: translateY(0) scale(1); opacity: 1; }
}

.lang-card-title {
    font-family: 'EdwardianScript', cursive;
    font-size: 52px;
    text-align: center;
    color: var(--ink);
    margin: 1.6rem 0 0;
    line-height: 1;
}

.lang-card-sub {
    font-family: "Playfair Display", serif;
    font-style: italic;
    font-size: 11px;
    text-align: center;
    color: var(--muted);
    margin: 0.55rem 0 0;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

/* ─── Drum Picker (64px rows — must match ITEM_H in menu.js) ───────── */
.lang-drum-wrap {
    position: relative;
    height: 192px;
    margin-top: 1.5rem;
    overflow: hidden;
}

.lang-drum {
    height: 192px;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.lang-drum::-webkit-scrollbar { display: none; }

.drum-sentinel {
    height: 64px;
    flex-shrink: 0;
}

.lang-drum-item {
    height: 64px;
    scroll-snap-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    cursor: pointer;
    user-select: none;
    opacity: 0.3;
    transition: opacity 0.25s ease;
}

.lang-drum-item.is-selected { opacity: 1; }

.lang-drum-item .item-flag {
    font-size: 22px;
    line-height: 1;
}

.lang-drum-item .item-name {
    font-family: "Playfair Display", serif;
    font-size: 21px;
    color: var(--ink);
    letter-spacing: 0.02em;
}

.drum-selector {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 2rem;
    right: 2rem;
    height: 64px;
    border-top: 1px solid var(--hair);
    border-bottom: 1px solid var(--hair);
    pointer-events: none;
    z-index: 2;
}

.drum-gradient {
    position: absolute;
    left: 0;
    right: 0;
    height: 76px;
    pointer-events: none;
    z-index: 1;
}

.drum-gradient--top {
    top: 0;
    background: linear-gradient(to bottom, var(--paper) 20%, transparent);
}

.drum-gradient--bottom {
    bottom: 0;
    background: linear-gradient(to top, var(--paper) 20%, transparent);
}

/* ─── Confirm Button ──────────────────────────────────────────────── */
.lang-confirm-btn {
    display: block;
    width: calc(100% - 3rem);
    margin: 1.5rem 1.5rem 1.6rem;
    padding: 0.95rem 0;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 2px;
    font-family: "Playfair Display", serif;
    font-size: 13px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    cursor: pointer;
    transition: filter 0.2s, transform 0.15s;
}

.lang-confirm-btn:hover { filter: brightness(1.08); }
.lang-confirm-btn:active { transform: scale(0.98); }

/* ─── Loading Overlay ─────────────────────────────────────────────── */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 998;
    background: var(--loading-bg);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s;
}

.loading-overlay.hidden { display: none; }

.loading-spinner {
    width: 34px;
    height: 34px;
    border: 2px solid var(--hair);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── Back-to-home link (top-right, mirrors the language button) ───── */
.menu-home-link {
    position: fixed;
    top: 1.55rem;
    right: 1.4rem;
    z-index: 100;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    height: 44px;
    padding: 0 1rem;
    border-radius: 22px;
    background: var(--paper-2);
    border: 1px solid var(--hair);
    color: var(--ink);
    text-decoration: none;
    font-family: "Playfair Display", serif;
    font-size: 14px;
    letter-spacing: 0.04em;
    line-height: 1;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
    transition: transform 0.15s, background 0.2s, color 0.2s;
}

.menu-home-link:hover { transform: translateY(-1px); color: var(--accent); }
.menu-home-link:active { transform: scale(0.97); }

.lang-picker-btn:focus-visible,
.menu-home-link:focus-visible,
.lang-confirm-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

@media (min-width: 640px) {
    .menu-home-link { font-size: 15px; padding: 0 1.2rem; }
}

/* ─── Respect reduced-motion preferences ──────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
    .lang-card { animation: none !important; }
}
