@import url('https://fonts.googleapis.com/css2?family=Overpass:ital,wght@0,100..900;1,100..900&display=swap');

:root {
    interpolate-size: allow-keywords;
    --header-bg-color: #000;
    --header-color: #FFF;
    --primary-bg-color: #FFF;
    --primary-color: #000;
    --accent-color: #ff941d;
    --accent-color-2: #00aeff;
}

body {
    width: 100vw;
    height: 100vh;
    padding: 0;
    margin: 0;
    font-family: Overpass, sans-serif;
    min-width: 350px;
}

a {
    color: inherit;
    text-decoration: 1px dotted underline;
}

a:hover, a:active {
    color: var(--accent-color-2);
    text-decoration: 2px underline;
}

#map {
    width: 100%;
    height: 100%;
}

.maplibregl-popup {
    z-index: 10;
}

.maplibregl-popup-content {
    backdrop-filter: blur(2px);
    background-color: rgb(255 255 255 / 50%);
    border: 1px solid #dbd4d4;
    box-shadow: 3px 3px 4px #00000045;
}

.maplibregl-ctrl-top-right,
.maplibregl-ctrl-bottom-right {
    right: calc(clamp(250px, 25vw, 500px));
}

#map:fullscreen .maplibregl-ctrl-top-right,
#map:fullscreen .maplibregl-ctrl-bottom-right {
    right: 0;
}

.mobile_header {
    display: none;
}

.sidebar {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 25vw;
    max-width: 500px;
    min-width: 250px;
    background-color: #ffffffc4;
    z-index: 1;
    backdrop-filter: blur(3px);
    box-shadow: -2px 0 3px 2px #00000036;
    overflow: auto;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-content: space-around;
    justify-content: flex-start;
}

.sidebar .info {
    margin: 0 10px;
    font-size: 0.9em;
}

.sidebar h1 {
    background-color: var(--header-bg-color);
    color: var(--accent-color);
    padding: 10px;
    margin: 0;
    text-align: center;
}

.sidebar .disclaimer {
    font-size: 0.8em;
    color: #555;
}

.sidebar input[type="checkbox"] {
    accent-color: var(--accent-color);
}

.sidebar .legend {
    margin: 10px;
    flex-grow: 1;
}

.legend_main_layers:empty {
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.legend_main_layers:empty:after {
    content: "";
    width: 48px;
    height: 48px;
    border: 5px solid var(--accent-color);
    border-bottom-color: transparent;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: spinner_rotation 1s linear infinite;
}

@keyframes spinner_rotation {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.sidebar .legend ul {
    margin: 0;
    padding: 0;
    list-style-image: none;
    list-style: none;
}

.legend .icons li {
    display: flex;
    flex-direction: row;
    align-content: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 5px;
    /* line-height: 1.2; */
    /* background-color: #e6e6e6; */
    align-items: center;
    font-size: 0.9em;

}

.icons li .iconwrapper {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
}

.icons li .iconwrapper img,
.icons li .iconwrapper svg {
    /* max-height: 100%; */
    /* max-width: 100%; */
    object-fit: contain;
    width: 100%;
    height: 100%;
    user-select: none;
}

.legend .icons li:nth-child(odd) {
    background-color: #00000017;
}

.legend .layer {
    border: 1px solid #0000004d;
    border-radius: 5px;
    margin: 10px 0;
    /* padding: 5px 0; */
    background-color: #00000012;
}

.layerInfo {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    /* gap: 10px; */
    /* font-size: 1.3em; */
    padding: 5px;
    background-color: #333;
    color: #eee;
}

.layerInfo input {
    flex-shrink: 0;
    margin: 0 8px;
    width: 20px;
    height: 20px;
}

.layerTitle {
    font-weight: bold;
    /* font-size: 1.2em; */
    /* text-align: center; */
    flex-grow: 1;
    cursor: pointer;
    user-select: none;
}

.layer .icons {
    height: auto;
    overflow: hidden;
    transition: height 0.5s;
}

.layer:has(.layerInfo > input:not(:checked)) .icons,
.icons.hide-icons {
    height: 0px;
}

.pdx_reporter_popup .maplibregl-popup-tip {
    pointer-events: auto;
}

.pdx_reporter_popup .maplibregl-popup-content {
    backdrop-filter: blur(8px);
    padding: 0;
    padding-top: 15px;
}

.pdx_reporter_popup .maplibregl-popup-content > div {
    max-height: 40vh;
    overflow: auto;
    padding: 5px;
}

.pdx_reporter_popup h2,
.pdx_reporter_popup p {
    margin: 0;
    margin-bottom: 3px;
}

.hamburger {
    display: none;
}

.mode-draw_polygon .maplibregl-canvas-container,
.mode-draw_line_string .maplibregl-canvas-container {
    cursor: crosshair;
}

@media screen and (max-width: 700px) {

    body {
        display: flex;
        flex-direction: column;
    }

    #map {
        height: auto;
        flex-grow: 1;
    }


    .hamburger {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        top: 10px;
        left: 10px;
        z-index: 1001;
        width: 44px;
        height: 44px;
        padding: 8px;
        border: none;
        border-radius: 6px;
        background-color: #ffffffdd;
        box-shadow: 0 1px 4px #00000040;
        cursor: pointer;
    }

    .hamburger span {
        display: block;
        height: 3px;
        background-color: var(--header-bg-color);
        border-radius: 2px;
        transition: transform 0.3s, opacity 0.3s;
    }

    body:has(.sidebar.open) .hamburger span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    body:has(.sidebar.open) .hamburger span:nth-child(2) {
        opacity: 0;
    }
    body:has(.sidebar.open) .hamburger span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .sidebar {
        width: 100%;
        inset: 0;
        background-color: var(--primary-bg-color);
        z-index: 1000;
        height: 0%;
        transition: 0.3s;
        order: 2;
        position: relative;
        max-width: unset;
        min-width: unset;
    }

    .sidebar.open {
        height: 70%;
        box-shadow: 0 -2px 3px 2px #00000036;
    }

    .maplibregl-ctrl-top-right, .maplibregl-ctrl-bottom-right {
        right: 0;
    }

    .mobile_header {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 10px;
        background-color: var(--header-bg-color);
        color: var(--accent-color);
    }

    .mobile_header h1 {
        margin: 0;
    }

    body:has(.sidebar.open) .maplibregl-control-container {
        display: none;
    }

    .sidebar h1 {
        display: none;
    }
}
