/* Hamburger button */

    :root {
        --hamburger-bg: #999999;
        --hamburger-text: #ffffff;
        --hamburger-active-bg: #bae2f4;
        --hamburger-active-text: #000000;
        --hamburger-shadow: rgba(0, 0, 0, 0.4);
        --hamburger-overlay-bg: rgba(255, 255, 255, 0.7);
    }
    .menu-btn {
        width: 40px;
        height: 40px;
        cursor: pointer;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 6px;
        position: relative;
        z-index: 1100;
        padding: 10px;
        border-radius: 4px;
        background: transparent;
        transition: background 0.3s ease;
        box-sizing: content-box;
    }

    .basket-btn {
        width: 40px;
        height: 40px;
        cursor: pointer;
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;
        z-index: 1100;
        padding: 10px;
        border-radius: 4px;
        background: transparent;
        transition: background 0.3s ease;
        box-sizing: content-box;
        text-decoration: none;
    }

    .basket-btn img {
        width: 25px;
        height: 25px;
        display: block;
        object-fit: contain;
    }

    .basket-btn:hover {
        background: rgba(255, 255, 255, 0.9);
    }

    .menu-btn span {
        display: block;
        width: 25px;
        height: 4px;
        background: var(--hamburger-bg);
        transition: 0.4s;
        border-radius: 2px;
    }

    /* Animate into close icon */
    .menu-btn.active span {
        background: #000;
    }

    .menu-btn.active {
        background: #fff;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    }

    .menu-btn.active span:nth-child(1) {
        transform: translateY(10px) rotate(45deg);
    }

    .menu-btn.active span:nth-child(2) {
        opacity: 0;
    }

    .menu-btn.active span:nth-child(3) {
        transform: translateY(-10px) rotate(-45deg);
    }

    /* Hamburger menu container */
    /* Off-canvas via transform (not right-offset) so it can never partially leak into view regardless of window size */
    #hamburgerMenu {
        font-family: 'Quattrocento Sans', sans-serif;
        position: fixed;
        top: 0;
        right: 0;
        width: 280px;
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100);
        background: transparent;
        box-shadow: none;
        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 9999;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    #hamburgerMenu.show {
        transform: translateX(0);
    }

    /* Fixed header with clickable logo and close button */
    .hamburger-header {
        flex-shrink: 0;
        padding: 12px 16px;
        border-bottom: 1px solid #eee;
        background: #fff;
        display: flex;
        justify-content: space-between;
        align-items: center;
        box-shadow: -2px 0 8px rgba(0,0,0,0.2);
    }

    .menu-logo-img {
        max-width: 150px;
        height: auto;
        cursor: pointer;
        transition: opacity 0.2s ease;
    }

    .menu-logo-img:hover {
        opacity: 0.7;
    }

    /* Close button (X) inside header */
    .close-btn {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 32px;
        height: 32px;
        cursor: pointer;
        position: relative;
    }

    .close-btn span {
        position: absolute;
        width: 24px;
        height: 3px;
        background: #333;
        border-radius: 2px;
    }

    .close-btn span:nth-child(1) {
        transform: rotate(45deg);
    }

    .close-btn span:nth-child(2) {
        transform: rotate(-45deg);
    }

    .close-btn:hover span {
        background: #000;
    }

    /* Scrollable menu content */
    .hamburger-content {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        background: transparent;
        font-family: 'Quattrocento Sans', sans-serif;
    }

    #hamburgerMenu ul {
        list-style: none;
        margin: 0;
        padding: 0;
        background: #fff;
        width: 100%;
    }

    /* Only top-level ul gets the background */
    #hamburgerMenu > .hamburger-content > ul {
        background: #fff;
        box-shadow: -2px 0 8px rgba(0,0,0,0.2);
    }

    #hamburgerMenu li {
        border-bottom: 1px solid #eee;
        background: #fff;
    }

    /* Last menu item - no bottom border */
    #hamburgerMenu li:last-child {
        border-bottom: none;
    }

    #hamburgerMenu a {
        display: block;
        padding: 12px 16px;
        text-decoration: none;
        color: #333;
        background: #fff;
        font-size: 16px;
        line-height: 1.3;
    }

    #hamburgerMenu a:hover {
        background: #f5f5f5;
    }

    /* Submenu styling */
    #hamburgerMenu li.has-submenu > ul.submenu {
        display: none;
        background: #f9f9f9;
    }

    #hamburgerMenu li.has-submenu.open > ul.submenu {
        display: block;
    }

    #hamburgerMenu li.has-submenu > ul.submenu a {
        padding-left: 32px;
    }

    /* Arrow indicator */
    #hamburgerMenu .arrow {
        float: right;
        transition: transform 0.2s ease;
    }

    #hamburgerMenu li.has-submenu.open > a .arrow {
        transform: rotate(90deg);
    }

    /* Overlay */
    #menuOverlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100);
        background: rgba(0,0,0,0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
        z-index: 9999;
    }

    #menuOverlay.show {
        opacity: 1;
        visibility: visible;
    }

    /* Stop the page scrolling behind the open menu so the overlay can't drift out of sync with the viewport */
    body.menu-open {
        overflow: hidden;
    }

    /* Landscape phone adjustments */
    @media (max-height: 500px) and (orientation: landscape) {
        #hamburgerMenu {
            width: 240px;
        }

        .hamburger-header {
            padding: 8px 12px;
        }

        .menu-logo-img {
            max-width: 80px;
        }

        #hamburgerMenu a {
            padding: 8px 12px;
            font-size: 14px;
        }

        #hamburgerMenu li.has-submenu > ul.submenu a {
            padding-left: 24px;
        }
    }

    /* Small phones - full width menu */
    @media (max-width: 360px) {
        #hamburgerMenu {
            width: 100%;
        }
    }

    /* Improve readability for touch devices (iPhone/iPad menu text). */
    @media (hover: none) and (pointer: coarse) {
        #hamburgerMenu a {
            font-size: 18px;
            line-height: 1.35;
            padding: 14px 18px;
        }

        #hamburgerMenu li.has-submenu > ul.submenu a {
            padding-left: 34px;
        }
    }
