/*
 * Distribution section
 */

.animal-distribution {
    margin: 40px 0;
}

.animal-distribution h2 {
    margin-bottom: 20px;
}


/*
 * Legend
 */

.animal-distribution-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin-bottom: 25px;
}

.animal-distribution-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.animal-distribution-legend i {
    width: 14px;
    height: 14px;
    display: inline-block;
    flex: 0 0 14px;
    border-radius: 3px;
}


/*
 * Legend colors
 */

.animal-distribution-legend .range-native {
    background: #4caf50;
}

.animal-distribution-legend .range-extinct {
    background: #d9534f;
}

.animal-distribution-legend .range-introduced {
    background: #f0ad4e;
}


/*
 * Map container
 */

.animal-distribution-map {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
}


/*
 * SVG
 */

.animal-distribution-map svg {
    width: 100%;
    height: auto;
    display: block;
}


/*
 * Default countries
 */

.animal-distribution-map svg path {
    fill: #e5e5e5;
    stroke: #ffffff;
    stroke-width: 0.5;
    transition:
        fill 0.2s ease,
        filter 0.2s ease;
}


/*
 * Native range
 */

.animal-distribution-map svg path.range-native {
    fill: #4caf50;
}


/*
 * Former / Extinct range
 */

.animal-distribution-map svg path.range-extinct {
    fill: #d9534f;
}


/*
 * Introduced range
 */

.animal-distribution-map svg path.range-introduced {
    fill: #f0ad4e;
}


/*
 * Clickable countries
 */

.animal-distribution-map
svg path.range-native,
.animal-distribution-map
svg path.range-extinct,
.animal-distribution-map
svg path.range-introduced {
    cursor: pointer;
}


/*
 * Hover effect
 */

.animal-distribution-map
svg path.range-native:hover,
.animal-distribution-map
svg path.range-extinct:hover,
.animal-distribution-map
svg path.range-introduced:hover {
    filter: brightness(0.85);
}


/*
 * Tooltip
 */

.animal-distribution-tooltip {
    position: fixed !important;

    z-index: 999999 !important;

    display: none;

    max-width: 220px;

    padding: 10px 14px;

    background: #222;
    color: #fff;

    border-radius: 6px;

    font-family: inherit;

    font-size: 14px;
    line-height: 1.4;

    white-space: nowrap;

    pointer-events: none;

    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.2);
}


/*
 * Tooltip title
 */

.animal-distribution-tooltip strong {
    display: block;

    font-size: 15px;
    font-weight: 600;
}


/*
 * Tooltip range
 */

.animal-distribution-tooltip span {
    display: block;

    margin-top: 2px;

    font-size: 13px;

    opacity: 0.85;
}


/*
 * Small screens
 */

@media (max-width: 767px) {

    .animal-distribution {
        margin: 30px 0;
    }

    .animal-distribution h2 {
        margin-bottom: 15px;
    }

    .animal-distribution-legend {
        gap: 10px 15px;
        margin-bottom: 20px;
        font-size: 13px;
    }

    .animal-distribution-legend i {
        width: 12px;
        height: 12px;
        flex-basis: 12px;
    }

    .animal-distribution-map {
        width: 100%;
        overflow: visible;
    }

    .animal-distribution-map svg {
        width: 100%;
        height: auto;
    }

    .animal-distribution-tooltip {
        max-width: 180px;

        padding: 8px 11px;

        font-size: 13px;
    }

    .animal-distribution-tooltip strong {
        font-size: 14px;
    }

    .animal-distribution-tooltip span {
        font-size: 12px;
    }

}


/*
 * Very small screens
 */

@media (max-width: 480px) {

    .animal-distribution-legend {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

}