/* Nightwall City mobile: keep the native controls usable before the enhanced
   category/sheet controllers have attached, or when running Engine p2.119. */
@media (max-width: 720px) {
    body.nightwall-engine-page .nwe-v3[data-route="city"][data-role="member"] .nwm.nwm--embedded:not([data-nwm-filters-ready="true"]) {
        --nwm-category-width: clamp(84px, 26vw, 108px);
        --nwm-edge-right: max(10px, env(safe-area-inset-right, 0px));
    }

    body.nightwall-engine-page .nwe-v3[data-route="city"][data-role="member"] .nwm.nwm--embedded:not([data-nwm-filters-ready="true"]) .nwm-floating-top {
        top: calc(12px + env(safe-area-inset-top, 0px));
        right: calc(var(--nwm-edge-right) + var(--nwm-category-width) + 6px);
        left: max(10px, env(safe-area-inset-left, 0px));
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        gap: 5px;
    }

    body.nightwall-engine-page .nwe-v3[data-route="city"][data-role="member"] .nwm.nwm--embedded:not([data-nwm-filters-ready="true"]) .nwm-category-strip {
        inset: calc(12px + env(safe-area-inset-top, 0px)) var(--nwm-edge-right) auto auto;
        z-index: 33;
        box-sizing: border-box;
        width: var(--nwm-category-width);
        max-width: none;
        height: 44px;
        min-height: 44px;
        margin: 0;
        padding: 0;
        border-radius: 16px;
    }

    /* Keep the original category opener. The demo lens shortcuts need not
       compete for space on the public map. */
    body.nightwall-engine-page .nwe-v3[data-route="city"][data-role="member"] .nwm.nwm--embedded:not([data-nwm-filters-ready="true"]) .nwm-category-strip > [data-city-lens],
    body.nightwall-engine-page .nwe-v3[data-route="city"][data-role="member"] .nwm.nwm--embedded:not([data-nwm-filters-ready="true"]) .nwm-category-entry > svg {
        display: none;
    }

    body.nightwall-engine-page .nwe-v3[data-route="city"][data-role="member"] .nwm.nwm--embedded:not([data-nwm-filters-ready="true"]) .nwm-category-strip > [data-nwm-categories]:not([hidden]) {
        position: static;
        display: flex;
        flex: 1 1 auto;
        justify-content: center;
        box-sizing: border-box;
        min-width: 0;
        height: 44px;
        margin: 0;
        padding-inline: 6px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* The original controller sets data-sheet and removes hidden/inert when
       it opens the list. The newer readiness attribute is not present there. */
    body.nightwall-engine-page .nwe-v3[data-route="city"][data-role="member"] .nwm.nwm--embedded:not([data-nwm-sheet-ready="true"])[data-sheet="peek"] {
        --nwm-sheet-height: min(280px, 46%);
    }

    body.nightwall-engine-page .nwe-v3[data-route="city"][data-role="member"] .nwm.nwm--embedded:not([data-nwm-sheet-ready="true"])[data-sheet="full"] {
        --nwm-sheet-height: calc(100% - min(124px, 33%) - env(safe-area-inset-top, 0px));
    }

    body.nightwall-engine-page .nwe-v3[data-route="city"][data-role="member"] .nwm.nwm--embedded:not([data-nwm-sheet-ready="true"]):is([data-sheet="peek"], [data-sheet="full"]) .nwm-sheet-content:not([hidden]):not([inert]) {
        display: flex;
        flex-direction: column;
    }

    body.nightwall-engine-page .nwe-v3[data-route="city"][data-role="member"] .nwm.nwm--embedded:not([data-nwm-sheet-ready="true"]) .nwm-sheet-content > * {
        flex: 0 0 auto;
    }

    body.nightwall-engine-page .nwe-v3[data-route="city"][data-role="member"] .nwm.nwm--embedded:not([data-nwm-sheet-ready="true"]) .nwm-content-switch {
        order: -2;
    }

    body.nightwall-engine-page .nwe-v3[data-route="city"][data-role="member"] .nwm.nwm--embedded:not([data-nwm-sheet-ready="true"]) .nwm-event-controls {
        order: -1;
    }

    /* Preserve the real privacy button's focus and 44px touch target. */
    body.nightwall-engine-page .nwe-v3[data-route="city"][data-role="member"] .nwe-v3-main > nav[data-nwe-legal-navigation] {
        flex: 0 0 auto;
        align-self: stretch;
        margin: 0;
        padding: 0 max(8px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px));
        border: 0;
        font-size: 12px;
        line-height: 1.25;
    }

    body.nightwall-engine-page .nwe-v3[data-route="city"][data-role="member"] .nwe-v3-main > nav[data-nwe-legal-navigation] button[data-nwe-cookie-open] {
        min-height: 44px;
        padding: 0 8px;
        font: inherit;
    }

    .nwm--embedded .nwm-filter-legal > nav[data-nwe-legal-navigation] {
        margin: 0;
        padding: 0;
        border: 0;
        color: inherit;
    }

    .nwm--embedded .nwm-filter-legal [data-nwe-legal-navigation] ul {
        justify-content: flex-start;
    }

    /* Keep the venue actions together when a save or follow request needs attention. */
    .nwm--embedded[data-nwm-minimal-sheet="true"] .nwm-card--minimal .nwm-card-actions :is(.nwm-save-status, .nvf-control-status) {
        order: 1;
    }
}
