html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;
    font-family: "Arial", sans-serif;
}

body {
    --header-height: 3em;
    --footer-height: 2em;
}

header, footer {
    position: fixed;
    left: 0;
    width: 100%;
    color: white;
    text-align: center;
    z-index: 10;
    font-size: 1em;
    background-color: #333;
}

header {
    display: flex;
    top: 0;
    height: var(--header-height);
    line-height: var(--header-height);
    align-items: center;
    justify-content: center;
    border-bottom: 3px solid white;
}

footer {
    display: flex;
    bottom: 0;
    border-top: 3px solid white;
    height: var(--footer-height);
    line-height: var(--footer-height);
    justify-content: space-evenly;
    align-items: center;
}

main {
    position: absolute;
    top: var(--header-height);
    bottom: var(--footer-height);
    left: 0;
    right: 0;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
    position: relative;
}
#map .leaflet-control-zoom {
    transform: scale(1.2);
    top: 33px;
}

#map-infobox {
    position: absolute;
    top: 10px;
    right: 10px;
    width: clamp(150px, 25vw, 600px);
    bottom: 25px;
    word-wrap: break-word;
    background: white;
    padding: 10px;
    border: 1px solid #333;
    z-index: 1000;
    overflow-y: auto;
    box-sizing: border-box;
    box-shadow: 2px 2px 5px;
}

thead {
    background-color: black;
    color: white;
}
tbody {
    background-color: lightgray;
}
td, th {
    padding: 8px;
}
tr.democrat {
    background-color: cornflowerblue;
}
tr.republican {
    background-color: lightcoral;
}
tr.green {
    background-color: lightgreen;
}
tr.libertarian {
    background-color: lightyellow;
}

#descriptor-info {
    position: absolute;
    right: 320px;
    width: 475px;
    height: 300px;
    bottom: 25px;
    word-wrap: break-word;
    background: white;
    padding: 10px;
    border: 1px solid #333;
    z-index: 1000;
    overflow-y: auto;
    box-sizing: border-box;
    box-shadow: 2px 2px 5px;
    visibility: hidden;
}

.race-and-ethnicity {
    background-color: palevioletred;
}
.age-and-sex {
    background-color: lightsalmon;
}
.household-types {
    background-color: palegoldenrod;
}
.marital-status {
    background-color: palegreen;
}
.ancestry {
    background-color: paleturquoise;
}
.employment-status {
    background-color: skyblue;
}
.industries {
    background-color: lavender;
}
.educational-attainment {
    background-color: pink;
}

.vertical {
    display: flex;
    flex-direction: column;
}

#profile:link, #profile:visited {
    color: white;
}

#controls {
    position: absolute;
    top: 10px;
    left: 50px;
    display: flex;
    border-radius: 4px;
    gap: 10px;
    z-index: 1000;
    align-items: center;
}

#controls form {
    display: flex;
}

#reset-view {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #333 !important;
    color: white;
    cursor: pointer;
    transition: background 0.1s ease;
}
#reset-view:hover {
    background: #555 !important;
}
#reset-view:active {
    background: white !important;
    color: black;
}

#feature-search {
    display: flex;
    flex-direction: column;
}

#feature-search input {
    height: 2.5em;
}

@media (max-width: 1200px) {
    #controls {
        flex-direction: column;
        left: 10px;
        right: 10px;
        top: 10px;
        gap: 6px;
    }

    #controls select,
    #controls button,
    #controls form {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
    }

    .leaflet-control-zoom {
        top: 210px;
        left: 0;
    }

    #map {
        width: 100%;
        height: 80%;
        position: relative;
    }


    #map-infobox {
        position: absolute;
        top: 80%;
        left: 0;
        right: 0;
        margin: 0;
        height: 1400px;
        margin: 0;
        border-top: 1px solid #333;
        border-left: none;
        border-right: none;
        box-shadow: 0 -2px 5px rgba(0,0,0,0.2);
        width: 100%;
        padding: 15px 20px;
        overflow-y: auto;

        column-count: 2;
        column-gap: 20px;

        column-fill: auto;
        white-space: normal;
        box-sizing: border-box;
    }

    #search-suggestions {
        border: 1px solid #ccc;
        max-height: 200px;
        overflow-y: auto;
        display: none;
        z-index: 1100;
    }

    main {
        top: var(--header-height);
        bottom: var(--footer-height);
        overflow-y: auto;
    }

    #feature-search {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        position: relative;
    }
    #feature-search-input {
        width: 100%;
        height: 3vh;
        box-sizing: border-box;
        text-align: center;
    }
    #feature-search-input:focus {
        text-align: left;
    }
    #feature-search button {
        align-self: center;
    }
}

@media (max-width: 480px) {
    body {
        --header-height: 60px;
        --footer-height: 60px;
    }
    header h1 {
        font-size: 1rem;
    }
}


#controls select, #controls button, #controls form {
    background-color: white;
    padding: 6px 12px;
    border: 1px solid black;
    border-radius: 4px;
    font-size: clamp(0.8rem, 2vw, 1rem);
    box-shadow: 2px 2px 5px;
}
#controls>button {
    background-color: black;
}

#search-suggestions { 
    background: white;
    border: 1px solid #ccc;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}
#search-suggestions > * {
    border: 1px solid #ccc;
    cursor: pointer;
}

.info.legend {
    width: 13em;
    height: fit-content;
    padding: 6px 8px;
    font: 14px/16px Arial, Helvetica, sans-serif;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 15px rgba(0,0,0,0.2);
    border-radius: 5px;
    line-height: 18px;
    color: #333;
    z-index: 1100; /* above infobox/buttons */
}

.info.legend p {
    margin: 0.5em 0;
}

.info.legend i {
    border: 2px solid black;
    border-radius: 0.37em;
    width: 18px;
    height: 18px;
    float: left;
    margin-right: 8px;
    opacity: 0.7;
}