/* Shared layout from /assets/js/site.js: desktop sidebar + phone bar.
   Sidebar, menu and label looks (.sidebar, .menu, .category) are in common.css. */

/* Pinned top-left on every page (without top/left a fixed box sits where it would flow) */
.sidebar {
    top: 0;
    left: 0;
}

.site-home {
    color: inherit;
    text-decoration: none;
}

/* "Hal Xing" at the top of the sidebar */
.sidebar header > div {
    font-size: large;
    margin: 0;
    font-weight: 400;
    display: inline-block;
    background-color: var(--almost-white);
    padding: 5px 8px;
}

/* ===== Phone bar (bottom) ===== */
.mobile-menu {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(44px + env(safe-area-inset-bottom));
    background: var(--almost-white);
    border-top: 1px solid var(--border-color);
    z-index: 1000;
}

.mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    height: 44px;
    box-sizing: border-box;
    font-size: 14px;
}

.mobile-header > div:last-child {
    line-height: 44px;
}

.menu-toggle {
    background: none;
    border: none;
    font: inherit;
    font-size: 14px;
    color: var(--text-color);
    cursor: pointer;
    padding: 0;
    margin: 0;
    height: 44px;
    line-height: 44px;
    text-transform: uppercase;
}

.menu-toggle .menu-arrow {
    display: inline-block;
    transition: transform 0.2s ease;
    margin-right: 2px;
    line-height: 1;
}

.page-path {
    margin-left: 4px;
}

.mobile-content {
    display: none;
    position: fixed;
    bottom: calc(44px + env(safe-area-inset-bottom));
    left: 0;
    width: 100%;
    box-sizing: border-box;
    background: var(--almost-white);
    border-top: 1px solid var(--border-color);
    padding: 10px;
    z-index: 999;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.mobile-menu.expanded .menu-arrow {
    transform: rotate(90deg);
}

.mobile-menu.expanded .mobile-content {
    display: block;
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .mobile-menu {
        display: block;
    }

    /* Leave room for the bar: pages that fill the screen end above it, pages that grow get space at the end */
    body.has-site-nav {
        box-sizing: border-box;
        padding-bottom: calc(44px + env(safe-area-inset-bottom));
    }
}
