/* RomansCode — Global mobile navigation (hamburger + drop-down panel).
 *
 * Paired with assets/site-nav.js, which injects the button and panel using the
 * shared header hooks (.site-header, .site-header-inner, .site-nav). Relies only
 * on those shared class names, so it works on any theme using them — no
 * per-theme markup. Desktop is untouched; mobile rules are gated to <= 768px.
 *
 * Colours come from the active theme's variables (--ink, --paper, --bg, --line)
 * with safe fallbacks, so the menu matches whichever theme is active.
 */

/* Hamburger button: hidden on desktop, shown at the mobile breakpoint. It is
   also the close control — tapping it again closes the panel. */
.rc-mnav-toggle { display: none; }

@media (max-width: 768px) {
    /* Keep logo left / button right even on themes that stack the header. */
    .site-header-inner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    .site-header-inner .site-nav { display: none; }

    .rc-mnav-toggle {
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 40px;
        height: 40px;
        padding: 0;
        border: 0;
        background: transparent;
        color: var(--ink, #1a1a1a);
        cursor: pointer;
    }
    .rc-mnav-toggle span {
        display: block;
        width: 24px;
        height: 2px;
        margin: 0 auto;
        background: currentColor;
    }

    /* Open state: the bars become an X. The button box is unchanged and the
       bars only transform (no reflow), so nothing shifts. Driven by the same
       aria-expanded the JS toggles — no extra class, no animation. */
    .rc-mnav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .rc-mnav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
    .rc-mnav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* Panel: starts directly under the header (--rc-header-h, set by JS) and covers
   the rest of the screen. No animation — it is shown/hidden instantly. */
.rc-mnav {
    position: fixed;
    top: var(--rc-header-h, 0px);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    background: var(--paper, var(--bg, #ffffff));
}
.rc-mnav.is-open { display: flex; }

.rc-mnav-links {
    display: flex;
    flex-direction: column;
    padding: 12px 24px 24px;
}
.rc-mnav-links a {
    padding: 16px 0;
    border-bottom: 1px solid var(--line, #eeeeee);
    color: var(--ink, #1a1a1a);
    font-size: 22px;
    text-decoration: none;
}

/* Lock the page behind the panel while it's open. */
body.rc-mnav-open { overflow: hidden; }
