/* **************************************** */
/* * LOCATION TOOL LAYOUT */
/* **************************************** */
#locationTool {
    margin: 0 auto;
    max-width: 1180px;
    padding: 18px 20px 54px;
}

#locationTool [hidden] {
    display: none !important;
}

#locationTool .content-card,
#locationTool .map-card,
#locationTool .source-panel {
    margin-top: 22px;
}

#locationTool .tool-hero {
    align-items: start;
}

#locationTool .tool-hero h1 {
    font-size: clamp(30px, 4.2vw, 48px);
    line-height: 1.08;
}

/* **************************************** */
/* * SEARCH AND AUTOCOMPLETE */
/* **************************************** */
#locationSearchForm {
    background: #f5f8fb;
    border: 1px solid #dbe3ec;
    border-radius: 9px;
    padding: 20px;
    position: relative;
}

#locationSearchForm > label {
    color: #172033;
    display: block;
    font-size: 17px;
    font-weight: 800;
    margin-bottom: 9px;
}

.location-search-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
}

#locationSearch {
    appearance: none;
    background: #ffffff;
    border: 2px solid #c5d1df;
    border-radius: 6px 0 0 6px;
    color: #172033;
    font: inherit;
    min-width: 0;
    padding: 13px 14px;
}

#locationSearch:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
    outline: 0;
    position: relative;
    z-index: 2;
}

#locationSearchButton,
.primary-cta {
    background: #2563eb;
    border: 0;
    border-radius: 0 6px 6px 0;
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    padding: 13px 18px;
    text-decoration: none;
}

#locationSearchButton:hover,
#locationSearchButton:focus,
.primary-cta:hover,
.primary-cta:focus {
    background: #1d4ed8;
    color: #ffffff;
}

#locationSearchButton:disabled {
    cursor: wait;
    opacity: .7;
}

.location-suggestions {
    background: #ffffff;
    border: 1px solid #c5d1df;
    border-radius: 7px;
    box-shadow: 0 12px 28px rgba(23, 32, 51, .14);
    left: 20px;
    list-style: none;
    margin: 4px 20px 0 0;
    max-height: 310px;
    overflow-y: auto;
    padding: 5px;
    position: absolute;
    right: 20px;
    z-index: 1050;
}

.location-suggestions button {
    background: transparent;
    border: 0;
    border-radius: 5px;
    color: #172033;
    cursor: pointer;
    display: block;
    font: inherit;
    padding: 10px 12px;
    text-align: left;
    width: 100%;
}

.location-suggestions button:hover,
.location-suggestions button:focus,
.location-suggestions button.is-active {
    background: #edf4ff;
    outline: 0;
}

.location-suggestions strong,
.location-suggestions span {
    display: block;
}

.location-suggestions span {
    color: #5f6b7a;
    font-size: 13px;
    margin-top: 2px;
}

/* **************************************** */
/* * LOADING AND ANSWER STATES */
/* **************************************** */
.location-loading {
    align-items: center;
    background: #ffffff;
    border: 1px solid #dbe3ec;
    border-radius: 8px;
    color: #2f466b;
    display: flex;
    font-weight: 700;
    gap: 11px;
    margin-top: 18px;
    padding: 14px 18px;
}

.location-loading[hidden] {
    display: none;
}

.location-loading > span,
#mapLoading > span {
    animation: location-spin .8s linear infinite;
    border: 3px solid #cbd5e1;
    border-radius: 50%;
    border-top-color: #2563eb;
    height: 22px;
    width: 22px;
}

@keyframes location-spin {
    to { transform: rotate(360deg); }
}

.location-answer {
    background: linear-gradient(135deg, #eff6ff, #ffffff);
    border: 1px solid #93b8f3;
    border-left: 5px solid #2563eb;
    border-radius: 9px;
    margin-top: 22px;
    padding: 24px 26px;
}

.location-answer h2 {
    color: #172033;
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.2;
    margin: 5px 0 9px;
}

.location-answer > p:last-child {
    color: #465468;
    margin: 0;
    max-width: 850px;
}

.ambiguous-results {
    padding: 26px;
}

.ambiguous-list {
    display: grid;
    gap: 9px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 18px;
}

.ambiguous-list a {
    border: 1px solid #dbe3ec;
    border-radius: 7px;
    color: #172033;
    padding: 12px 14px;
    text-decoration: none;
}

.ambiguous-list a:hover,
.ambiguous-list a:focus {
    background: #f5f8fb;
    border-color: #2563eb;
}

.ambiguous-list strong,
.ambiguous-list span {
    display: block;
}

.ambiguous-list span {
    color: #5f6b7a;
    font-size: 14px;
}

/* **************************************** */
/* * LEAFLET MAP */
/* **************************************** */
.location-map-stage {
    min-height: 500px;
    position: relative;
}

#locationMap {
    border-radius: 7px;
    height: 500px;
    min-height: 500px;
    width: 100%;
}

#mapLoading {
    align-items: center;
    background: rgba(255, 255, 255, .94);
    border-radius: 7px;
    color: #2f466b;
    display: flex;
    font-weight: 700;
    gap: 10px;
    inset: 0;
    justify-content: center;
    position: absolute;
    z-index: 500;
}

.place-marker {
    align-items: center;
    border: 3px solid #ffffff;
    border-radius: 50% 50% 50% 6px;
    box-shadow: 0 2px 7px rgba(23, 32, 51, .35);
    color: #ffffff;
    display: flex;
    font-size: 11px;
    font-weight: 900;
    height: 30px;
    justify-content: center;
    transform: rotate(-45deg);
    width: 30px;
}

.place-marker > span {
    transform: rotate(45deg);
}

.place-marker.is-search {
    background: #172033;
    height: 36px;
    width: 36px;
}

.place-marker.is-city {
    background: #8b2fc9;
}

.place-marker.is-town {
    background: #2563eb;
}

.place-marker.is-village {
    background: #2f7d57;
}

.place-marker.is-hamlet,
.place-marker.is-other-settlement,
.place-marker.is-suburban-area {
    background: #d97706;
}

.place-swatch {
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px #94a3b8;
    display: inline-block;
    height: 14px;
    width: 14px;
}

.searched-place-swatch { background: #172033; }
.city-swatch { background: #8b2fc9; }
.town-swatch { background: #2563eb; }
.village-swatch { background: #2f7d57; }

.location-popup strong,
.location-popup span,
.location-popup a {
    display: block;
}

.location-popup span {
    margin: 3px 0 8px;
}

.location-popup a + a {
    margin-top: 5px;
}

/* **************************************** */
/* * FACTS AND PRODUCT */
/* **************************************** */
.location-facts,
.nearby-places,
.explanation-card {
    padding: 27px;
}

.location-facts > h2,
.nearby-places h2,
.explanation-card > h2 {
    margin: 0;
}

#locationFactsList {
    display: grid;
    gap: 1px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 20px 0 0;
    overflow: hidden;
}

#locationFactsList div {
    background: #f5f8fb;
    min-width: 0;
    padding: 13px 15px;
}

#locationFactsList dt {
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

#locationFactsList dd {
    color: #172033;
    font-weight: 750;
    margin: 3px 0 0;
    overflow-wrap: anywhere;
}

.location-product {
    align-items: center;
    border-color: #9fcab3 !important;
    display: grid;
    gap: 26px;
    grid-template-columns: minmax(160px, 260px) minmax(0, 1fr);
    padding: 27px;
}

.product-image {
    align-items: center;
    background: #f5f8fb;
    border-radius: 7px;
    display: flex;
    justify-content: center;
    min-height: 150px;
    overflow: hidden;
}

.product-image:empty::before {
    color: #64748b;
    content: "GB Maps product";
    font-weight: 800;
}

.product-image img {
    display: block;
    height: auto;
    max-height: 230px;
    max-width: 100%;
    object-fit: contain;
}

.product-copy h2 {
    font-size: 29px;
    margin: 0 0 8px;
}

.product-copy > p {
    color: #5f6b7a;
    margin: 5px 0;
}

.product-copy .product-price {
    color: #172033;
    font-size: 21px;
    font-weight: 850;
    margin: 13px 0 17px;
}

.primary-cta {
    border-radius: 6px;
    display: inline-block;
}

/* **************************************** */
/* * NEARBY PLACE CONTROLS AND CARDS */
/* **************************************** */
.nearby-header {
    align-items: end;
    display: flex;
    gap: 22px;
    justify-content: space-between;
}

.nearby-header > label {
    color: #475569;
    font-size: 13px;
    font-weight: 800;
}

#nearbyRadius {
    background: #ffffff;
    border: 1px solid #c5d1df;
    border-radius: 5px;
    color: #172033;
    display: block;
    font: inherit;
    margin-top: 5px;
    min-width: 125px;
    padding: 9px 30px 9px 10px;
}

#nearbyTypes {
    border: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 17px;
    margin: 18px 0;
    padding: 0;
}

#nearbyTypes legend {
    color: #475569;
    float: left;
    font-size: 13px;
    font-weight: 800;
    margin-right: 8px;
}

#nearbyTypes label {
    align-items: center;
    color: #334155;
    display: flex;
    font-size: 14px;
    gap: 5px;
}

.nearby-list {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.nearby-card {
    align-items: center;
    border: 1px solid #dbe3ec;
    border-radius: 8px;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    min-width: 0;
    padding: 15px;
}

.nearby-card h3,
.nearby-card p {
    margin: 0;
}

.nearby-card h3 {
    font-size: 19px;
}

.nearby-card h3 a {
    color: #172033;
    text-decoration: none;
}

.nearby-card h3 a:hover,
.nearby-card h3 a:focus {
    color: #1d4ed8;
    text-decoration: underline;
}

.nearby-card p:not(.nearby-type) {
    color: #64748b;
    font-size: 13px;
    margin-top: 3px;
}

.nearby-type {
    color: #2563eb;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.nearby-actions {
    flex: 0 0 auto;
    text-align: right;
}

.nearby-actions a {
    display: block;
    font-size: 13px;
    font-weight: 750;
    text-decoration: none;
}

.nearby-actions .map-available {
    color: #2f7d57;
    margin-top: 5px;
}

.empty-message {
    background: #f5f8fb;
    border-radius: 7px;
    color: #5f6b7a;
    margin: 14px 0 0;
    padding: 15px;
    text-align: center;
}

/* **************************************** */
/* * TABLET AND MOBILE */
/* **************************************** */
@media (max-width: 820px) {
    #locationTool .tool-hero {
        grid-template-columns: 1fr;
    }

    #locationFactsList {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nearby-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    #locationTool {
        padding: 10px 12px 38px;
    }

    #locationTool .tool-hero,
    #locationTool .content-card,
    #locationTool .map-card,
    #locationTool .source-panel {
        border-radius: 7px;
        padding: 20px;
    }

    .location-search-controls {
        grid-template-columns: 1fr;
    }

    #locationSearch {
        border-radius: 6px 6px 0 0;
    }

    #locationSearchButton {
        border-radius: 0 0 6px 6px;
        width: 100%;
    }

    .location-suggestions {
        left: 20px;
        margin-right: 0;
        right: 20px;
    }

    .ambiguous-list,
    #locationFactsList {
        grid-template-columns: 1fr;
    }

    .location-map-stage,
    #locationMap {
        height: 390px;
        min-height: 390px;
    }

    .location-product {
        grid-template-columns: 1fr;
    }

    .product-image {
        min-height: 130px;
    }

    .nearby-header {
        align-items: stretch;
        flex-direction: column;
    }

    #nearbyRadius {
        width: 100%;
    }

    #nearbyTypes legend {
        float: none;
        width: 100%;
    }

    .nearby-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .nearby-actions {
        display: flex;
        gap: 16px;
        text-align: left;
    }

    .nearby-actions .map-available {
        margin-top: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .location-loading > span,
    #mapLoading > span {
        animation: none;
    }
}
