#highlight-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -2; /* Ensure it appears below area titles */
}

.highlight-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 0; /* Default to 0, to be dynamically resized */
    height: 0; /* Default to 0, to be dynamically resized */
    pointer-events: none;
    opacity: 0; /* Start hidden */
    transition: opacity 0.2s ease; /* Smooth fade effect */
    background-size: cover;
    background-position: center;
}

/* Style for active highlight layers */
.highlight-layer.active {
    opacity: 1 !important; /* Ensure active layers stay visible */
    transition: opacity 0.2s ease;
}

.highlight-layer.detroit {
    z-index: -1 !important;
    background-color: #fff;
}

/* Shading effect applied to all highlight layers */
#highlight-overlay .highlight-layer.shaded::before {
    content: '';
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background-color: black; /* Default shading color */
    opacity: 0.2; /* Control the amount of shading */
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 1; /* Above the highlight image but below text */
}

/* Styles for area titles */
.map-wrapper .area-title {
    transition: all 0.2s ease;
    position: absolute;
    font-weight: bold;
    color: #0e71af;
    pointer-events: none; /* Ensure the text is not interactive */
    line-height: 1;
    font-size: 12px;
    text-shadow: 0px 0px 2px rgba(0, 0, 0, 0);
}

.map-wrapper .area-title.highlighted {
    color: #fff; /* Change text color on highlight */
    text-shadow: 0px 0px 2px rgba(0, 0, 0, 0.5);
}

.map-wrapper {
    display: flex;
    position: relative; /* Added to ensure proper positioning of titles */
}

/* Styles for area titles that will appear over the image areas */
.map-wrapper .area-title {
    transition: all 0.2s ease;
    position: absolute;
    font-weight: bold;
    color: #0e71af;
    pointer-events: none; /* Ensure the text is not interactive */
    line-height: 1;
    font-size: 12px;
    text-shadow: 0px 0px 2px rgba(0,0,0,0);
}

.map-wrapper .area-title.highlighted {
    color: #fff; /* Change text color */
    text-shadow: 0px 0px 2px rgba(0,0,0,0.5);
}

.map-wrapper .area-title.detroit.highlighted::before {
    background-color: #fff !important; /* Change ::before element color */
}

.map-wrapper .area-title.detroit {
    margin-top: .3%;
    margin-left: .3%;
    text-shadow: none;
}

.map-wrapper .area-title.detroit::before {
    transition: all 0.2s ease;
    display: block;
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    top: 14px;
    left: 17px;
    background-color: #0e71af;
    border-radius: 4px;
}

.map-wrapper .area-title.genesee {
    margin-top: .8%;
}

.map-wrapper .area-title.lapeer {
    margin-top: 1.6%;
}

.map-wrapper .area-title.lenawee {
    margin-top: 1.1%;
}

.map-wrapper .area-title.livingston {
    margin-top: 1%;
}

.map-wrapper .area-title.macomb {
    margin-top: -.2px;
}

.map-wrapper .area-title.monroe {
    margin-top: 1%;
    margin-left: -1.4%;
}

.map-wrapper .area-title.oakland {
    margin-top: 1%;
}

.map-wrapper .area-title.shiawassee {
    margin-top: 1%;
}

.map-wrapper .area-title.st-clair {
    margin-top: -2%;
}

.map-wrapper .area-title.washtenaw {
    margin-top: 1.2%;
}

.map-wrapper .area-title.wayne {
    margin-top: 1.1%;
    margin-left: -2.6%;
}

.map-wrapper .map {
    width: calc(40% - 15px);
    margin-right: 15px;
    margin-bottom: 30px;
    position: relative; /* Added to position the text over the map */
    background-size: 100%;
    background-repeat: no-repeat;
    background-position-y: 15px;
}

.map-wrapper .map img {
    margin: 15px 0;
    width: 100%; /* Ensure the image is responsive */
    height: auto;
    opacity: 0;
}

.map-wrapper .map .map-helper {
    font-size: 18px;
    text-align: center;
    margin-bottom: 10px;
}

.map-wrapper .map .map-helper span.area-hovered {
    font-weight: 700;
    color: #0e71af;
}

.map-wrapper .map .reset {
    transition: all 0.2s ease;
    font-size: 18px;
    text-align: center;
    font-weight: 700;
    color: #0e71af;
    opacity: 0;
}

.map-wrapper .map .reset:hover {
    color: #f58245;
}

.map-wrapper .map .reset.revealed {
    opacity: 1;
    cursor: pointer;
}

.map-wrapper .content {
    width: calc(60% - 15px);
    margin-left: 15px;
}

.map-wrapper .content .subhead {
    margin-bottom: 30px;
    line-height: 1.2;
}

.map-wrapper .content .subhead a {
    transition: all 0.4s ease;
    color: #0e71af;
}

.map-wrapper .content .subhead a:hover {
    color: #f58245;
}

.map-wrapper .content .header-divider {
    width: 150px;
    height: 2px;
    background-color: #4d4d4f;
    margin: 4px 0 12px;
}

.map-wrapper .content .stat-bucket {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
    width: calc(100% + 30px);
    justify-content: center;
}

.map-wrapper .content .stat-bucket .stat {
    width: calc((100% / 3) - 30px);
    margin: 0 15px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.map-wrapper .content .stat-bucket .stat img {
    margin-bottom: 10px;
    max-width: 80%;
}

.map-wrapper .content .stat-bucket .stat .stat-header {
    text-align: center;
}

.map-wrapper .content .stat-bucket .stat .stat-divider {
    width: 80px;
    height: 1px;
    background-color: #4d4d4f;
    margin-bottom: 7px;
}

.map-wrapper .content .stat-bucket .stat .stat-subheader {
    font-size: 18px;
    margin-bottom: 5px;
    text-align: center;
}

.map-wrapper .content .stat-bucket .stat .stat-text {
    text-align: center;
    font-size: 14px;
    color: #0e71af;
    line-height: 1.3;
}

@media only screen and (max-width: 1200px) {
    .highlight-layer::after {
        display: block;
    }

    .map-wrapper .area-title {
        display: none;
    }
}

@media only screen and (max-width: 979px) {
    #highlight-overlay {
        max-width: 400px;
        left: 50%;
        transform: translateX(-50%);
    }

    .map-wrapper {
        flex-direction: column;
    }

    .map-wrapper .map {
        width: auto;
        max-width: 400px;
        margin-left: auto;
        margin-right: auto;
    }

    .map-wrapper .map .map-helper {
        display: none;
    }

    .map-wrapper .content {
        width: 100%;
        margin-left: 0;
    }

    .map-wrapper .content .header {
        text-align: center;
    }

    .map-wrapper .content .header-divider {
        margin-left:  auto;
        margin-right:  auto;
    }

    .map-wrapper .content .subhead {
        text-align: center;
    }

    
}

@media only screen and (max-width: 550px) {
    .map-wrapper .content .stat-bucket .stat {
        width: calc(50% - 30px);
    }
}

@media only screen and (max-width: 400px) {
    .map-wrapper .content .stat-bucket .stat {
        width: calc(100% - 30px);
    }
}