.portal-menu-layout {
    position: relative;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    column-gap: 16px;
    padding-block: 10px;
}

.portal-menu-links {
    display: flex;
    gap: 4px;
}

.portal-menu-links a,
.portal-menu-sections summary {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 5px 13px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--ink);
    font-weight: 700;
    line-height: 1.2;
}

.portal-menu-links a:hover,
.portal-menu-sections summary:hover,
.portal-menu-panel a:hover {
    background: var(--sage);
}

.portal-menu-links a[aria-current],
.portal-menu-panel a[aria-current] {
    border-color: var(--ink);
    background: var(--ink);
    color: white;
}

.portal-menu-sections summary {
    justify-content: space-between;
    gap: 12px;
    border-color: var(--line);
    background: white;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.portal-menu-sections summary::-webkit-details-marker { display: none; }

.portal-menu-sections summary::after {
    width: 7px;
    height: 7px;
    margin: -4px 1px 0 0;
    transform: rotate(45deg);
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    content: "";
}

.portal-menu-sections[open] summary {
    border-color: var(--green);
    background: var(--sage);
}

.portal-menu-sections[open] summary::after {
    margin-top: 4px;
    transform: rotate(225deg);
}

.portal-menu-panel {
    position: absolute;
    z-index: 5;
    inset-inline: 0;
    top: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
    gap: 18px 22px;
    max-height: 65vh;
    max-height: 65dvh;
    padding: 16px;
    overflow: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--line);
    border-top: 3px solid var(--gold);
    border-radius: 0 0 10px 10px;
    background: var(--paper);
    box-shadow: 0 14px 32px rgb(37 56 47 / 15%);
}

.portal-menu-sections:not([open]) .portal-menu-panel { display: none; }

.portal-menu-group p {
    margin: 0 8px 4px;
    color: var(--green);
    font-weight: 750;
}

.portal-menu-group ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.portal-menu-group a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 7px 8px;
    border: 1px solid transparent;
    border-radius: 5px;
    font-size: .94rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.portal-menu .site-search {
    justify-self: end;
    width: min(100%, 350px);
}

.portal-menu .site-search input,
.portal-menu .site-search button {
    min-height: 44px;
    border-radius: 6px;
}

.portal-menu .site-search button { flex-shrink: 0; }

.portal-menu :is(a, summary, input, button):focus-visible {
    outline: 2px solid var(--green);
    outline-offset: 2px;
}

@media (max-width: 760px) {
    .portal-menu-layout {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 8px 10px;
    }

    .portal-menu-links {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: 1.25fr 1fr 1fr;
    }

    .portal-menu-links a {
        justify-content: center;
        padding-inline: 5px;
        text-align: center;
        font-size: .9rem;
    }

    .portal-menu-sections summary { padding-inline: 9px; }
    .portal-menu .site-search { width: 100%; }
    .portal-menu .site-search input { padding-inline: 8px; }
    .portal-menu .site-search button { padding-inline: 9px; }
}
