/**
 * HLI Locations Map
 * Google Map with logo pins + click-to-open location card.
 */

.hli-locations {
    background-color: #f6f8fb;
    position: relative;
}

.hli-locations__head {
    margin-bottom: 35px;
    max-width: 820px;
}

.hli-locations__head .heading-title {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.hli-locations__intro p {
    font-size: 15px;
    color: #333;
    margin-bottom: 0;
}

/* ---------- Map shell ---------- */

.hli-locations__map {
    position: relative;
    width: 100%;
    height: 560px;
    border-radius: 14px;
    overflow: hidden;
    background-color: #e8ecf2;
    box-shadow: 0 18px 40px rgba(24, 64, 139, 0.12);
}

.hli-locations__canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    /* Own stacking context, so map chrome (attribution, controls, pins)
       can never paint over the popup card. */
    z-index: 1;
}

.hli-locations__map .gm-style img {
    max-width: none;
}

/* Loader */
.hli-locations__loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #eef1f6;
    z-index: 2;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.hli-locations__loader span {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid rgba(24, 64, 139, 0.2);
    border-top-color: var(--primary-color);
    animation: hli-map-spin 0.8s linear infinite;
}

.hli-locations__map.is-loaded .hli-locations__loader {
    opacity: 0;
    visibility: hidden;
}

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

.hli-locations__sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ---------- Logo pin ---------- */

.hli-pin {
    position: absolute;
    /* --hli-dx / --hli-dy are set by the collision solver when two pins
       would otherwise sit on top of each other. */
    transform: translate(calc(-50% + var(--hli-dx, 0px)), calc(-100% + var(--hli-dy, 0px)));
    padding: 0;
    margin: 0;
    border: 0;
    background: none;
    cursor: pointer;
    line-height: 0;
    will-change: transform;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.22));
    transition: transform 0.18s ease;
    transform-origin: 50% 100%;
}

.hli-pin:focus-visible {
    outline: 3px solid #faa62e;
    outline-offset: 3px;
    border-radius: 50%;
}

.hli-pin__inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 66px;
    height: 66px;
    border-radius: 50%;
    background-color: #fff;
    border: 3px solid var(--primary-color);
    overflow: hidden;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
    transition: border-color 0.18s ease;
}

.hli-pin__inner img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 7px;
    display: block;
}

.hli-pin__tip {
    display: block;
    width: 0;
    height: 0;
    margin: -2px auto 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid var(--primary-color);
}

.hli-pin:hover,
.hli-pin.is-active {
    transform: translate(calc(-50% + var(--hli-dx, 0px)), calc(-100% + var(--hli-dy, 0px))) scale(1.08);
    z-index: 5;
}

/* Leader line back to the exact location when a pin has been nudged aside */
.hli-pin__leader {
    position: absolute;
    left: 50%;
    bottom: 1px;
    width: 0;
    height: 2px;
    border-radius: 2px;
    background-color: rgba(24, 64, 139, 0.55);
    transform-origin: 0 50%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.hli-pin.is-offset .hli-pin__leader {
    opacity: 1;
}

.hli-pin__leader::after {
    content: '';
    position: absolute;
    right: -3px;
    top: 50%;
    width: 7px;
    height: 7px;
    margin-top: -3.5px;
    border-radius: 50%;
    background-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.hli-pin.is-active .hli-pin__leader {
    background-color: rgba(250, 166, 46, 0.9);
}

.hli-pin.is-active .hli-pin__leader::after {
    background-color: #faa62e;
}

.hli-pin.is-active .hli-pin__inner {
    border-color: #faa62e;
}

.hli-pin.is-active .hli-pin__tip {
    border-top-color: #faa62e;
}

/* ---------- Pin card (popup) ---------- */

.hli-pin-card {
    position: absolute;
    z-index: 20;
    width: 320px;
    max-width: calc(100% - 20px);
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 14px 38px rgba(16, 32, 64, 0.25);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

.hli-pin-card.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.hli-pin-card__close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.92);
    color: #333;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.hli-pin-card__close:hover {
    background-color: var(--primary-color);
    color: #fff;
}

.hli-pin-card__media {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 140px;
    padding: 14px 20px;
    background-color: #f2f5fa;
    border-bottom: 1px solid #e4e9f1;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
}

.hli-pin-card__body {
    border-radius: 0 0 12px 12px;
}

.hli-pin-card__media img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.hli-pin-card__body {
    padding: 16px 18px 18px;
    max-height: 230px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.hli-pin-card__title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 6px;
    line-height: 1.3;
}

.hli-pin-card__address {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    margin: 0 0 8px;
}

.hli-pin-card__text,
.hli-pin-card__text p {
    font-size: 14px;
    line-height: 21px;
    color: #333;
}

.hli-pin-card__text p:last-child {
    margin-bottom: 0;
}

.hli-pin-card__link {
    display: inline-block;
    margin-top: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
    border-bottom: 1px solid currentColor;
}

.hli-pin-card__link:hover {
    color: #faa62e;
}

/* Arrow pointing at the pin */
.hli-pin-card__arrow {
    position: absolute;
    left: var(--hli-arrow-x, 50%);
    bottom: -9px;
    width: 18px;
    height: 18px;
    margin-left: -9px;
    background-color: #fff;
    transform: rotate(45deg);
    box-shadow: 3px 3px 8px rgba(16, 32, 64, 0.12);
    pointer-events: none;
}

.hli-pin-card.is-below .hli-pin-card__arrow {
    bottom: auto;
    top: -9px;
    background-color: #f2f5fa;
    box-shadow: -3px -3px 8px rgba(16, 32, 64, 0.1);
}

/* ---------- Preview renderer (no API key, admins only) ---------- */

.hli-map-preview {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background-color: #dfe4ea;
    cursor: grab;
}

.hli-locations__map.is-dragging .hli-map-preview {
    cursor: grabbing;
}

.hli-map-preview__tiles,
.hli-map-preview__pins {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    will-change: transform;
}

.hli-map-preview__pins {
    z-index: 3;
}

.hli-map-preview__tile {
    position: absolute;
    width: 256px;
    height: 256px;
    max-width: none;
    user-select: none;
    -webkit-user-drag: none;
}

/* Preview stand-ins for the Map Style choices.
   Mono: the grey basemap has land at ~#e8e8e8 and water at ~#d0c8d0, so a
   steep curve pushes land to white and water down to mid grey. */
.hli-map-style-mono .hli-map-preview__tile {
    filter: grayscale(1) brightness(0.63) contrast(6.4);
}

.hli-map-style-mono .hli-map-preview {
    background-color: #f5f5f5;
}

.hli-map-style-light .hli-map-preview__tile {
    filter: saturate(0.3) brightness(1.14) contrast(0.92);
}

.hli-map-style-light .hli-map-preview {
    background-color: #eef1f5;
}

.hli-map-style-grayscale .hli-map-preview__tile {
    filter: grayscale(1) contrast(1.06);
}

.hli-map-style-grayscale .hli-map-preview {
    background-color: #e3e3e3;
}

.hli-map-style-default .hli-map-preview {
    background-color: #d9e6e4;
}

.hli-map-preview__badge {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 6;
    background-color: rgba(24, 64, 139, 0.92);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    padding: 7px 12px;
    border-radius: 6px;
    max-width: calc(100% - 24px);
}

.hli-map-preview__attr {
    position: absolute;
    right: 0;
    bottom: 0;
    z-index: 6;
    background-color: rgba(255, 255, 255, 0.82);
    font-size: 11px;
    color: #555;
    padding: 2px 7px;
    border-radius: 4px 0 0 0;
}

.hli-map-preview__attr a {
    color: #18408b;
}

.hli-map-preview__zoom {
    position: absolute;
    right: 12px;
    bottom: 28px;
    z-index: 6;
    display: flex;
    flex-direction: column;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.hli-map-preview__zoom button {
    width: 36px;
    height: 36px;
    border: 0;
    background-color: #fff;
    color: #333;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.hli-map-preview__zoom button + button {
    border-top: 1px solid #e2e5ea;
}

.hli-map-preview__zoom button:hover {
    background-color: #f1f4f9;
}

/* ---------- Fallback cards (no API key) ---------- */

.hli-locations__notice {
    background-color: #fff6e5;
    border: 1px solid #f3d7a1;
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 14px;
    color: #6b4b12;
    margin-bottom: 28px;
}

.hli-locations__card {
    height: 100%;
    background-color: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 26px rgba(16, 32, 64, 0.1);
}

.hli-locations__card-media {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 150px;
    padding: 18px;
    background-color: #f2f5fa;
}

.hli-locations__card-media img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.hli-locations__card-body {
    padding: 18px 20px 22px;
}

.hli-locations__card-body h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 6px;
}

.hli-locations__card-body p {
    font-size: 14px;
    line-height: 21px;
}

.hli-locations__address {
    font-weight: 600;
    color: #6b7280;
}

.hli-locations__link {
    font-weight: 600;
    color: var(--primary-color);
    border-bottom: 1px solid currentColor;
}

/* ---------- Responsive ---------- */

@media only screen and (max-width: 1199px) {
    .hli-locations__map {
        height: 500px;
    }

    /* Keep the floating card short enough that panning it into view
       does not push the pins off the map. */
    .hli-pin-card__media {
        height: 120px;
    }

    .hli-pin-card__body {
        max-height: 185px;
    }
}

@media only screen and (max-width: 991px) {
    .hli-locations__map {
        height: 460px;
    }

    .hli-pin__inner {
        width: 58px;
        height: 58px;
        border-width: 3px;
    }

    /* Below this width the floating card is taller than the map can
       comfortably show, so it docks to the bottom instead. */
    .hli-pin-card.is-docked {
        left: 0 !important;
        right: 0;
        top: auto !important;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 12px 12px 0 0;
        transform: translateY(100%);
        display: flex;
        align-items: stretch;
    }

    .hli-pin-card.is-docked.is-open {
        transform: translateY(0);
    }

    .hli-pin-card.is-docked .hli-pin-card__arrow {
        display: none;
    }

    .hli-pin-card.is-docked .hli-pin-card__media {
        width: 34%;
        max-width: 230px;
        height: auto;
        min-height: 130px;
        border-bottom: 0;
        border-right: 1px solid #e4e9f1;
        border-radius: 12px 0 0 0;
        padding: 12px;
        flex: 0 0 34%;
    }

    .hli-pin-card.is-docked .hli-pin-card__media img {
        max-height: 150px;
    }

    .hli-pin-card.is-docked .hli-pin-card__body {
        flex: 1 1 auto;
        border-radius: 0;
        max-height: 190px;
        padding: 16px 18px 18px;
    }

    .hli-pin-card__title {
        padding-right: 30px;
    }
}

@media only screen and (max-width: 767px) {
    .hli-locations {
        padding-top: 60px;
        padding-bottom: 50px;
    }

    .hli-locations__head {
        margin-bottom: 25px;
    }

    .hli-locations__map {
        height: 420px;
        border-radius: 10px;
    }

    .hli-pin__inner {
        width: 50px;
        height: 50px;
        border-width: 2px;
    }

    .hli-pin__inner img {
        padding: 5px;
    }

    .hli-pin__tip {
        border-left-width: 6px;
        border-right-width: 6px;
        border-top-width: 10px;
    }

    .hli-pin-card.is-docked .hli-pin-card__body {
        max-height: 200px;
        padding: 14px 16px 16px;
    }

    .hli-pin-card.is-docked .hli-pin-card__media {
        min-height: 120px;
    }

    .hli-pin-card__title {
        font-size: 16px;
        padding-right: 26px;
    }

    .hli-pin-card__text,
    .hli-pin-card__text p {
        font-size: 13px;
        line-height: 19px;
    }
}

@media only screen and (max-width: 479px) {
    .hli-locations__map {
        height: 380px;
    }

    .hli-pin-card.is-docked .hli-pin-card__media {
        width: 34%;
        flex: 0 0 34%;
        min-height: 120px;
    }

    .hli-pin-card.is-docked .hli-pin-card__body {
        max-height: 160px;
    }
}
