/* legend buttons */
.hazard-legend-panel {
    width: max-content;
    color: var(--text);
}

.hazard-legend-body {
    max-height: min(60vh, 520px);
    overflow-y: auto;
    padding: 0.45rem 0.75rem 0.65rem;
    font-size: 1rem;
    line-height: 1.3;
}

.hazard-legend-panel ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.map-layer-options {
    margin: 0;
    padding: 0;
    list-style: none;
}

.map-layer-row {
    display: flex;
    gap: 0.55rem;
    align-items: center;
    padding: 0.25rem;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
}

.map-layer-row:hover {
    background: var(--hover);
}

.map-layer-row input {
    flex: 0 0 auto;
    margin: 0;
    accent-color: var(--focus);
}

.map-layer-separator {
    margin: 0.45rem 0;
    border-top: 1px solid var(--border-soft);
}

.map-layers-control {
    position: relative;
}

.map-layers-details {
    position: relative;
}

.map-layers-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 29px;
    height: 29px;
    color: var(--text);
    list-style: none;
    cursor: pointer;
}

.map-layers-toggle::marker {
    content: "";
}

.map-layers-toggle::-webkit-details-marker {
    display: none;
}

.map-layers-toggle:hover {
    background: var(--hover);
}

.map-layers-toggle:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: -2px;
}

.map-layers-toggle svg {
    width: 18px;
    height: 18px;
}

.map-layers-details.has-active-layer .map-layers-toggle {
    color: var(--primary-text);
}

.map-layers-menu {
    position: absolute;
    top: 0;
    right: calc(100% + 8px);
    z-index: 20;
    width: min(220px, calc(100vw - 80px));
    padding: 0.5rem 0.7rem 0.6rem;
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 0 0 1px var(--border-soft), 0 4px 16px var(--shadow);
}

.map-layers-details:not([open]) .map-layers-menu {
    display: none;
}

.hazard-legend-categories span {
    line-height: 1.2;
}
