/* ============================================================
   Book Menu
   A parallel full-screen menu that mimics the .mobile menu, but is
   opened by the .book / .bookmobile buttons and populated by the
   "Book Menu" nav location.

   Behaviour mirrors the main menu:
     - Desktop (>=901px): full-screen panel with a background image;
       submenus reveal on HOVER (js/book-menu.js), laid out absolutely
       to the right so a parent's options all appear at once.
     - Mobile (<=900px): the same panel, submenus SLIDE in one level at
       a time (js/book-menu.js), centred on screen.

   IMPORTANT: desktop layout rules are scoped to (min-width: 901px) and
   mobile rules to (max-width: 900px) so the two never fight over
   specificity. All rules are namespaced under .bookmenu / #book-menu-nav
   so they cannot affect the existing .mobile menu.
   ============================================================ */

/* ---------- Shared (all widths) ---------- */
/* The header Book / Book a Table buttons act as the menu toggle. Scoped to
   .headerbuttons anchors so the `p.book` "book now" line in restaurant info
   sections is not affected. */
.headerbuttons a.book,
.headerbuttons a.bookmobile {
    cursor: pointer;
}

/* Lock the page behind the panel while it is open */
body.book-active-body {
    overflow: hidden;
}

.bookmenu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    background: rgba(0, 0, 0, 0.9); /* fallback if no image is set */
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    display: none;
}

.bookmenu.active {
    transform: translateX(0%);
    display: flex;
}

.bookmenu-main {
    display: flex;
    width: 100%;
    text-transform: uppercase;
}

.menu-book-container {
    width: 100%;
}

.bookmenu ul {
    list-style: none;
}

#book-menu-nav li a {
    color: #fff;
    text-decoration: none;
    display: block;
    font-family: 'GothicThirteenStd', sans-serif;
    position: relative;
    pointer-events: auto;
    z-index: 999;
    letter-spacing: 5%;
}

/* Close button (top-right) */
.bookmenu-close {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 10001;
    width: 44px;
    height: 44px;
    line-height: 40px;
    padding: 0;
    margin: 0;
    border: 2px solid #fff;
    border-radius: 0;
    background: none;
    color: #fff;
    font-size: 28px;
    font-family: 'gillsans', sans-serif;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease;
}

.bookmenu-close:hover {
    background: #fff;
    color: #000;
}

/* ============================================================
   DESKTOP ( >= 901px ) — hover reveals submenus, laid out in columns
   ============================================================ */
@media only screen and (min-width: 901px) {
    #book-menu-nav .menu {
        position: absolute;
        margin: 0;
        padding: 0;
        list-style: none;
        top: 20vh;
        left: 65px;
    }

    /* Main (top level) items */
    #book-menu-nav .menu > li {
        position: relative;
        top: 0;
        left: 0;
        list-style: none;
        margin: 0;
        padding: 0.125em 0;
    }

    /* First level submenu (e.g. London's restaurants) - hidden until the
       parent is hovered, then revealed as a multi-column grid offset to
       the right so every option is visible and nothing overlaps. */
    #book-menu-nav .menu > li > .sub-menu {
        position: absolute;
        top: 0;
        left: 21vw;
        columns: 2;
        column-gap: 0;
        width: 40vw;
        display: none;
        background-color: rgba(0, 0, 0, 0);
    }

    #book-menu-nav .menu > li > .sub-menu.show {
        display: block;
    }

    #book-menu-nav .menu > li > .sub-menu > li {
        left: 0;
        padding: 0;
        break-inside: avoid;
    }

    #book-menu-nav .menu > li > .sub-menu > li > a {
        font-family: 'gillsans', sans-serif;
        font-size: 0.75em;
        font-weight: 600;
        padding: 0 0 0.5em;
        text-wrap: nowrap;
        display: block;
        letter-spacing: 10%;
    }

    /* If a third level is ever added, keep it cascading further right */
    #book-menu-nav .menu > li > .sub-menu > li > .sub-menu {
        position: absolute;
        top: 0;
        left: 40vw;
        columns: 2;
        column-gap: 0;
        display: none;
        background-color: rgba(0, 0, 0, 0);
        width: 40vw;
    }

    #book-menu-nav .menu > li > .sub-menu > li > .sub-menu.show {
        display: block;
    }
}

@media only screen and (min-width: 901px) and (max-width: 1299px) {
    .bookmenu-main { font-size: calc(1.5em + 0.188vw); }
}

@media (min-width: 1300px) {
    .bookmenu-main { font-size: 1.9em; }
}

/* ============================================================
   MOBILE ( <= 900px ) — submenus slide in one level at a time,
   centred on the screen
   ============================================================ */
@media only screen and (max-width: 900px) {
    .bookmenu-main {
        font-size: 1.9em;
        justify-content: center;
    }

    .bookmenu.active {
        display: block !important;
    }

    /* Centre the menu vertically and horizontally */
    .menu-book-container {
        position: relative;
        height: 72vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        top: 12vh;
    }

    #book-menu-nav .menu {
        position: relative;
        top: 0;
        left: auto;
        margin: 0;
        padding: 0;
        width: 100%;
        max-width: 320px;
        text-align: center;
    }

    #book-menu-nav .menu > li {
        position: relative;
        left: auto;
        width: 100%;
        padding: 0;
    }

    #book-menu-nav a {
        display: block;
        text-align: center;
        font-weight: bold;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    /* Slide-in panels are fixed and full-width so they always fill and
       centre on screen, independent of the (collapsed) parent <li>.
       The slide script animates `left` from 100% (off-screen right) to 0. */
    #book-menu-nav .sub-menu {
        position: fixed;
        top: 12vh;
        left: 100%;
        width: 100%;
        height: 88vh;
        max-width: none;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        display: none;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        text-align: center;
        columns: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* When the slide script reveals it (sets inline display:block) */
    #book-menu-nav .sub-menu[style*="display: block"] {
        display: flex !important;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
    }

    #book-menu-nav .sub-menu li {
        position: relative;
        left: auto;
        width: 100%;
        margin-left: 0;
    }

    #book-menu-nav .sub-menu li a {
        font-family: 'GothicThirteenStd', sans-serif;
        text-align: center;
    }

    /* Neutralise the desktop caret on parent items */
    #book-menu-nav .menu-item-has-children > a::after {
        content: "";
        float: none;
        border: none;
        margin-left: 0;
    }

    /* Back button injected by book-menu.js */
    #book-menu-nav li.back-button-item {
        width: 280px;
        margin: 0 auto 16px;
    }

    .book-back-to-parent {
        display: block;
        text-align: center;
        text-transform: uppercase;
        letter-spacing: 1px;
        font-weight: bold;
    }

    .bookmenu-close {
        top: 20px;
        right: 16px;
    }
}
