/* Shared phone behaviour for the CW apps.

   The apps are built for a desktop console layout. Rather than reflowing them
   for phones, sections that are secondary on a small screen can be folded away:
   a `.mobile-fold-toggle` button is placed in front of a run of sibling
   elements carrying `data-fold-item="<group>"`, and shared/mobile.js hides that
   run on phones until the operator taps the toggle.

   No wrapper element is introduced, and above the breakpoint the toggle is
   display:none and no element carries a fold attribute — so the desktop layout
   is exactly the markup as it was before folding existed. The breakpoint is the
   640px the apps already use for their stacked layout. */

.mobile-fold-toggle {
    display: none;
}

@media (max-width: 640px) {
    .mobile-fold-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        width: 100%;
        min-height: 44px;
        margin: 0;
        padding: 4px 2px;
        background: none;
        border: 0;
        border-top: 1px solid currentColor;
        border-color: color-mix(in srgb, currentColor 22%, transparent);
        color: inherit;
        cursor: pointer;
        font: 700 0.72rem/1.2 ui-monospace, Consolas, monospace;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        opacity: 0.85;
        text-align: left;
    }

    .mobile-fold-toggle::after {
        content: "▾";
        font-size: 0.9rem;
        transform: rotate(-90deg);
    }

    .mobile-fold-toggle[aria-expanded="true"]::after {
        transform: none;
    }

    [data-fold-hidden] {
        display: none !important;
    }

    /* Touch targets. The console controls are deliberately compact in the
       desktop layout; on a phone they have to be reachable with a thumb. */
    .box-dock button,
    .box-dock select,
    .arcade-btn,
    .arcade-toggle,
    .arcade-primary,
    .gear-btn,
    .close-btn {
        min-height: 44px;
    }

    .arcade-btn,
    .gear-btn,
    .close-btn {
        min-width: 44px;
    }
}
