#menu {
    position: absolute;
    top: 1em;
    right: 1em;
    bottom: 6em;
    overflow: scroll;
}

#control-buttons {
    display: flex;
    align-items: start;
    gap: 1.5em;
}

#metric-buttons h3,
#model-buttons h3 {
    color: Black;
    z-index: 800;
    width: fit-content;
    text-align: center;
    margin: 0 auto 0.5em auto;
    text-align: center;
    font-weight: 300;
}

#model-buttons {
    display: flex;
    flex-direction: column;
    justify-content: end;
}

#model-buttons .always-visible,
#model-buttons #extra-model-tray {
    display: flex;
    flex-direction: column;
}

#model-buttons #model-tray-button {
    padding: 0.25em 0 0 0;
    background: transparent;
}

#model-buttons #model-tray-button svg {
    height: 1em;
    transition: all 0.5s ease;
}

#model-buttons #model-tray-button:hover svg path {
    stroke: black;
    stroke-width: 0.75;
    transition: all 0.5s ease;
}

#model-buttons:has(#extra-model-tray.expanded) #model-tray-button svg {
    transform: rotate(-180deg);
    transition: all 0.5s ease;
}

#extra-model-tray:not(.expanded):has(.model-button.active)+#model-tray-button {
    background-color: #0078A8;
    transition: all 0.5s ease;
}

#model-buttons .model-button[data-is-reference="true"] {
    order: -2;
}

#model-buttons #extra-model-tray {
    margin-top: 0;

    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out;
}

#model-buttons #extra-model-tray.expanded {
    max-height: 500px;
    margin-top: inherit;
    transition: all 0.5s ease-in;
}

.model-button,
.metric-button,
#delta-toggle {
    position: relative;
    max-width: 180px;
}

.model-button {
    transition: 0.3s ease-in-out;
}

.model-button.delta-mode-active {
    border: 2px solid #2591bc !important;
    margin-bottom: 2.5em !important;
    transition: all 0.3s ease-in-out;
}

.model-button[data-is-reference="true"]::after {
    content: 'Baseline';
    position: absolute;
    bottom: -1.9em;
    left: 50%;
    transform: translateX(-50%);
    background-color: #777;
    color: white;
    font-size: 1em;
    font-weight: 400;
    border-radius: 0 0 5px 5px;
    padding: 0.25em 2em;
    box-shadow: inset 0 4px 4px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.3s ease;
}

.model-button[data-is-reference="true"].delta-mode-active::after {
    opacity: 1;
    transform: translate(-50%, 0%);
    transition: all 0.3s ease 0.25s;
}

#model-buttons .model-button[data-is-default="true"] {
    order: -1;
}

#metric-buttons {
    display: flex;
    flex-direction: column;
}

#menu button,
#menu #delta-toggle {
    z-index: 900;
    border: none;
    border-radius: 5px;
    font-size: 0.75em;
    padding: 0.75em 1.5em;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    text-align: center;
    border: 2px solid transparent;
    margin-bottom: 1em;
}

.model-button:not(.active),
.metric-button:not(.active) {
    background-color: white;
}

.model-button.active,
.metric-button.active {
    background-color: #0078A8;
    color: white;
}

#delta-toggle {
    background: transparent;
    box-sizing: border-box;
    display: flex;

    box-shadow: none !important;
    padding: 0.125em !important;
    margin: 0;

    align-items: center;
    justify-content: space-between;
    cursor: unset;
}

#delta-toggle span {
    text-align: left;
}

#delta-toggle .switch {
    position: relative;
    margin-left: 2.5em;
    width: 45px;
    height: 24px;
}

#delta-toggle .switch input {
    opacity: 0;
}

#delta-toggle .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    right: 0;
    width: 45px;
    bottom: 0;
    transition: .4s;
    border-radius: 999px;

    background-color: #0078A833;
    border: 1px solid #0078A8;
}

#delta-toggle .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    top: 1px;
    background-color: #555;
    border: 1px solid #ddd;


    transition: .4s;
    border-radius: 50%;
}

#delta-toggle input:checked+.slider {
    background-color: #0078A8;
}

#delta-toggle input:checked+.slider:before {
    transform: translateX(22px);
}

#delta-toggle label:has(input:disabled) .slider {
    cursor: not-allowed;
    background-color: #e5e7eb;
}

#delta-toggle label:has(input:disabled) .slider::before {
    background: #cbd5e1;
}

.leaflet-control-zoom {
    margin: 0 0.5em !important;
    border: none !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.leaflet-touch .leaflet-bar a:first-child {
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
}

.leaflet-touch .leaflet-bar a:last-child {
    border-bottom-left-radius: 5px;
    border-bottom-right-radius: 5px;
}

.leaflet-control-zoom a {
    font-size: 1.677em !important;
    width: 2em !important;
    height: 2em !important;
    display: flex;
    justify-content: center;
    align-items: center;
}

#mobile-menu-toggle {
    all: unset;

    display: none;
    cursor: pointer;

    position: absolute;
    top: 1em;
    right: 1em;
    z-index: 1200;

    background: white;
    border-radius: 999px;
    border: 1px solid #ccc;
    padding: 0.5em;
    margin: auto;
    width: 1.5em;
    height: 1.5em;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

#mobile-menu-toggle svg {
    height: 1.5em;
    width: 1.5em;
    fill: #222;
}

body:not(:has(#menu.open)) #mobile-menu-toggle #hamburger,
body:has(#menu.open) #mobile-menu-toggle #close-x {
    display: inherit;
}

body:has(#menu.open) #mobile-menu-toggle #hamburger,
body:not(:has(#menu.open)) #mobile-menu-toggle #close-x {
    display: none;
}

@media (max-width: 950px) {
    #mobile-menu-toggle {
        display: inherit;
    }

    #menu {
        top: 0;
        bottom: 0;
        right: 0;
        max-width: 100%;
        background: #eee;
        box-shadow: -10px 0 15px -3px rgba(0, 0, 0, 0.3);
        z-index: 1100;
        padding: 3em 2em 2em 2em;
        transform: translateX(120%);
        transition: transform 0.5s ease;
    }

    #menu.open {
        transform: translateX(0%);
        transition: transform 0.5s ease;
    }

    .leaflet-control-zoom {
        display: none;
    }

    #model-buttons #model-tray-button {
        padding: 0.5em;
        background: #cccdd1;
    }

    #mobile-attribution {
        display: inherit;

    }
}

@media (max-width: 480px) {
    #menu {
        left: 0;
    }
}