/* Shared download disclosure; native details also works without JavaScript. */
.download-menu {
    position: relative;
}

.download-menu > summary.nav-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 20px;
    border: 1px solid #eee;
    border-radius: 8px;
    background: #eee;
    color: #0a0a0a;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    font-family: inherit;
    cursor: pointer;
    list-style: none;
}

.download-menu > summary::-webkit-details-marker {
    display: none;
}

.download-menu > summary svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 1.5;
}

.download-menu > summary:hover,
.download-menu[open] > summary {
    background: #fff;
}

.download-menu > summary:focus-visible {
    outline: 2px solid #aaa;
    outline-offset: 4px;
}

.download-menu__panel {
    position: absolute;
    z-index: 50;
    top: calc(100% + 12px);
    right: 0;
    width: min(340px, calc(100vw - 32px));
    margin: 0;
    padding: 8px;
    list-style: none;
    border: 1px solid #333;
    border-radius: 14px;
    background: #171717;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .4);
    color: #eee;
}

/* Make the gap traversable when moving from the button to the menu. */
.download-menu__panel::before {
    position: absolute;
    content: '';
    top: -13px;
    left: 0;
    right: 0;
    height: 13px;
}

.download-menu__panel a {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    padding: 12px;
    border-radius: 8px;
    color: #eee;
    text-decoration: none;
    text-align: left;
}

.download-menu__panel a:hover,
.download-menu__panel a:focus-visible {
    background: #262626;
    color: #fff;
    outline: none;
}

.download-menu__panel strong {
    display: block;
}

.download-menu__panel strong {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
}

.download-menu__icon svg,
.download-menu__icon img {
    display: block;
    width: 28px;
    height: 28px;
    max-height: none;
    object-fit: contain;
    opacity: .8;
}

.download-menu__icon svg {
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.download-menu__panel > li:first-child {
    border-bottom: 1px solid #333;
    padding-bottom: 6px;
    margin-bottom: 6px;
}

/* On phones the anchored panel overflows the left edge; drop it full width
   under the header, like the navigation menu. */
@media (max-width: 640px) {
    .download-menu {
        position: static;
    }

    .download-menu__panel {
        left: 0;
        right: 0;
        top: 100%;
        width: auto;
        padding: 8px var(--gutter, 16px);
        border-width: 0 0 1px;
        border-radius: 0;
        background: var(--bg, #171717);
        box-shadow: 0 12px 24px rgba(0, 0, 0, .4);
    }

    .download-menu__panel::before {
        content: none;
    }
}
