/*
 * Versioned disclosure navigation and focus-scroll hardening. This file is
 * intentionally separate from app.css so an immutable cached app.css URL
 * never changes underneath clients.
 */

:where(a, button, input, select, textarea, summary):focus-visible {
    scroll-margin-block: 1rem;
}

.mobile-nav {
    position: relative;
}

.mobile-nav summary {
    display: flex;
    min-height: 2.75rem;
    align-items: center;
    gap: var(--space-2);
    padding: 0.55rem 0.75rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--color-ink);
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 750;
    list-style: none;
}

.mobile-nav summary::-webkit-details-marker {
    display: none;
}

.mobile-nav summary:focus-visible,
.language-menu summary:focus-visible {
    border-radius: var(--radius-sm);
    outline: 2px solid var(--color-focus);
    outline-offset: 3px;
    box-shadow: var(--shadow-focus);
}

.mobile-nav[open] summary {
    border-color: var(--color-border);
    background: var(--color-surface);
}

.mobile-nav__panel {
    position: absolute;
    inset: calc(100% + 0.5rem) 0 auto auto;
    display: grid;
    min-width: min(17rem, calc(100vw - 2rem));
    padding: var(--space-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
}

.mobile-nav__panel a {
    padding: 0.7rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-weight: 650;
    text-decoration: none;
}

.mobile-nav__panel a:hover {
    background: var(--color-primary-soft);
}

@media (min-width: 72rem) {
    .mobile-nav {
        display: none;
    }
}

@media (max-width: 30rem) {
    .mobile-nav__label {
        display: none;
    }
}

/* On compact headers the trigger is not the visual edge of the shell. Anchor
   the open panel to the header itself so it reads as one deliberate full-width
   menu with stable 16px viewport gutters at 390px and below. */
@media (max-width: 47.99rem) {
    .mobile-nav {
        position: static;
    }

    .mobile-nav__panel {
        inset: calc(100% + 0.5rem) 1rem auto;
        min-width: 0;
        max-height: calc(100vh - 6rem);
        max-height: calc(100dvh - 6rem);
        overflow-y: auto;
        overscroll-behavior: contain;
    }
}
