/*
 * Map Locator element.
 * Colors follow the Utah Design System variables when present, with fallbacks for other sites.
 * Override any --gml-* variable on .gml-locator to restyle.
 */
.gml-locator {
    color-scheme: light;
    --gml-bg: var(--gray-light-color, #f5f5f5);
    --gml-surface: var(--text-on-primary-color, #ffffff);
    --gml-text: var(--gray-dark-color, #2c2c2c);
    --gml-muted: var(--gray-medium-color, #6b6b6b);
    --gml-line: var(--gray-medium-light-color, #d9d9d9);
    --gml-line-strong: var(--gray-medium-color, #9a9a9a);
    --gml-accent: var(--primary-color, #1d8478);
    /* Shades are derived from the accent, so an Accent Color set in the builder recolors all of them */
    --gml-accent-dark: color-mix(in srgb, var(--gml-accent) 80%, #000);
    --gml-accent-soft: color-mix(in srgb, var(--gml-accent) 10%, var(--gml-surface));
    --gml-accent-ring: color-mix(in srgb, var(--gml-accent) 28%, transparent);
    --gml-user: var(--secondary-color, #2f6bd8);
    --gml-hover: var(--hover-gray-color, rgba(0, 0, 0, 0.04));
    --gml-hover-opaque: var(--hover-gray-color-opaque, #ebebeb);
    --gml-disabled: var(--gray-medium-light-color, #d9d9d9);
    --gml-shadow: var(--elevation-medium, 0 4px 14px rgba(0, 0, 0, 0.16));
    --gml-shadow-small: var(--elevation-small, 0 1px 4px rgba(0, 0, 0, 0.2));
    --gml-drop-shadow: var(--drop-shadow-color, rgba(0, 0, 0, 0.25));
    --gml-panel-glass-strong: color-mix(in srgb, var(--gml-bg) 86%, transparent);
    --gml-panel-glass-medium: color-mix(in srgb, var(--gml-bg) 76%, transparent);
    --gml-panel-glass-soft: color-mix(in srgb, var(--gml-bg) 48%, transparent);
    --gml-panel-glass-fade: color-mix(in srgb, var(--gml-bg) 34%, transparent);
    --gml-panel-glass-clear: color-mix(in srgb, var(--gml-bg) 0%, transparent);
    --gml-actions-glass-start: color-mix(in srgb, var(--gml-bg) 38%, transparent);
    --gml-actions-glass-end: color-mix(in srgb, var(--gml-bg) 16%, transparent);
    --gml-map-status-bg: color-mix(in srgb, var(--gml-surface) 96%, transparent);
    position: relative;
    width: 100%;
    container-type: inline-size;
}

.gml-locator .gml-locator-shell {
    display: grid;
    grid-template-areas: "map panel";
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    height: var(--gml-height, 100svh);
    min-height: var(--gml-min-height, 620px);
    overflow: hidden;
    background: var(--gml-bg);
}

.gml-locator--map-right .gml-locator-shell {
    grid-template-areas: "panel map";
}

.gml-locator * {
    box-sizing: border-box;
}

.gml-locator button,
.gml-locator input {
    font: inherit;
}

.gml-locator .gml-locator-panel {
    grid-area: panel;
    position: relative;
    display: block;
    min-width: 0;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    border-left: 1px solid var(--gml-line);
    background: var(--gml-bg);
}

.gml-locator--map-right .gml-locator-panel {
    border-right: 1px solid var(--gml-line);
    border-left: 0;
}

.gml-locator .gml-locator-controls {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(
        to bottom,
        var(--gml-panel-glass-strong) 0%,
        var(--gml-panel-glass-medium) 72%,
        var(--gml-panel-glass-soft) 100%
    );
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.gml-locator .gml-locator-controls::after {
    position: absolute;
    right: 0;
    bottom: -68px;
    left: 0;
    height: 68px;
    background: linear-gradient(to bottom, var(--gml-panel-glass-fade), var(--gml-panel-glass-clear));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    content: "";
    pointer-events: none;
}

.gml-locator .gml-locator-header {
    padding: 48px 56px 22px;
}

.gml-locator .gml-heading {
    max-width: 820px;
    margin: 0 0 10px;
}

.gml-locator .gml-result-count {
    min-height: 1.25rem;
    margin: 0;
}

.gml-locator .gml-locator-search {
    margin: 0;
    padding: 0 56px 12px;
}

.gml-locator .gml-search-control {
    position: relative;
}

.gml-locator .gml-search-control input {
    width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 11px 46px 11px 14px;
    border: 1px solid var(--gml-line-strong);
    border-radius: 8px;
    background: var(--gml-surface);
    color: var(--gml-text);
    box-shadow: none;
    outline: none;
}

.gml-locator .gml-search-control input:focus {
    border-color: var(--gml-accent);
    box-shadow: 0 0 0 3px var(--gml-accent-ring);
}

.gml-locator .gml-icon-button {
    position: absolute;
    top: 50%;
    right: 7px;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--gml-muted);
    cursor: pointer;
    transform: translateY(-50%);
}

.gml-locator .gml-icon-button[hidden] {
    display: none;
}

.gml-locator .gml-icon-button:hover,
.gml-locator .gml-icon-button:focus-visible {
    background: var(--gml-hover-opaque);
    color: var(--gml-text);
    outline: none;
}

.gml-locator .gml-location-actions {
    display: grid;
    gap: 8px;
    padding: 0 56px 24px;
    background: linear-gradient(to bottom, var(--gml-actions-glass-start), var(--gml-actions-glass-end));
}

.gml-locator .gml-location-button {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    border: 1px solid var(--gml-accent);
    border-radius: 8px;
    background: var(--gml-accent);
    color: var(--gml-surface);
    font-weight: 700;
    cursor: pointer;
}

.gml-locator .gml-location-button:hover,
.gml-locator .gml-location-button:focus-visible {
    border-color: var(--gml-accent-dark);
    background: var(--gml-accent-dark);
    outline: none;
}

.gml-locator .gml-location-button:disabled {
    border-color: var(--gml-line-strong);
    background: var(--gml-disabled);
    color: var(--gml-text);
    cursor: progress;
}

.gml-locator .gml-location-status {
    min-height: 1.15rem;
    margin: 0;
}

.gml-locator .gml-location-list {
    display: grid;
    margin: 0;
    padding: 22px 48px 44px;
    gap: 18px;
    list-style: none;
}

.gml-locator .gml-location-item {
    min-width: 0;
    margin: 0;
}

.gml-locator .gml-location-card {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    width: 100%;
    min-width: 0;
    align-items: flex-start;
    gap: 22px;
    padding: 12px 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    text-align: left;
    box-shadow: none;
    cursor: pointer;
}

.gml-locator .gml-location-card:hover,
.gml-locator .gml-location-card:focus-visible {
    border-color: var(--gml-accent-ring);
    background: var(--gml-hover);
    box-shadow: none;
    outline: none;
}

.gml-locator .gml-location-card.gml-is-selected {
    border-color: var(--gml-accent-ring);
    background: var(--gml-accent-soft);
    box-shadow: none;
}

.gml-locator .gml-location-card.gml-is-selected .gml-location-icon {
    animation: gml-selected-icon-bounce 650ms cubic-bezier(0.28, 0.84, 0.42, 1);
}

.gml-locator .gml-location-icon {
    display: block;
    width: 50px;
    height: 61px;
    margin-top: 2px;
    object-fit: contain;
}

.gml-locator .gml-location-content {
    display: grid;
    min-width: 0;
    gap: 8px;
}

.gml-locator .gml-location-title {
    margin: 0;
}

.gml-locator .gml-location-meta {
    display: grid;
    gap: 6px;
    margin: 0;
}

/* Details HTML: block flow (not grid) so mixed text, links and <br> stay on their lines */
.gml-locator .gml-location-details :is(p, ul, ol) {
    margin: 0 0 6px;
}

.gml-locator .gml-location-details > :last-child {
    margin-bottom: 0;
}

.gml-locator .gml-distance-line {
    color: var(--gml-accent-dark);
    font-weight: 700;
}

.gml-locator .gml-empty-state {
    margin: 0;
    padding: 22px 10px;
    text-align: center;
}

.gml-locator .gml-map-panel {
    grid-area: map;
    position: relative;
    min-width: 0;
    min-height: 0;
}

.gml-locator .gml-map {
    width: 100%;
    height: 100%;
}

.gml-locator .gml-map-status {
    position: absolute;
    inset: 18px auto auto 18px;
    max-width: min(340px, calc(100% - 36px));
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--gml-map-status-bg);
    box-shadow: var(--gml-shadow);
}

.gml-locator .gml-map-status:empty {
    display: none;
}

.gml-locator .gml-custom-marker {
    position: relative;
    display: grid;
    width: 42px;
    height: 51px;
    place-items: center;
    filter: drop-shadow(0 6px 10px var(--gml-drop-shadow));
    transform-origin: center bottom;
    transition: transform 160ms ease, filter 160ms ease;
}

.gml-locator .gml-custom-marker img {
    display: block;
    width: 42px;
    height: 51px;
    object-fit: contain;
}

.gml-locator .gml-pin {
    display: block;
    color: var(--gml-pin-color, var(--gml-accent));
}

.gml-locator .gml-pin svg {
    display: block;
    width: 100%;
    height: 100%;
}

.gml-locator .gml-custom-marker .gml-pin {
    width: 34px;
    height: 45px;
}

.gml-locator .gml-location-icon.gml-pin {
    width: 40px;
    height: 53px;
    margin: 4px auto 0;
}

.gml-locator .gml-custom-marker.gml-is-search-match {
    transform: scale(1.08);
    filter: drop-shadow(0 8px 14px var(--gml-accent-ring));
}

.gml-locator .gml-custom-marker.gml-is-selected {
    transform: scale(1.22);
    filter: drop-shadow(0 10px 16px var(--gml-accent-ring));
}

.gml-locator .gml-custom-marker.gml-is-selected .gml-marker-icon {
    animation: gml-selected-icon-bounce 650ms cubic-bezier(0.28, 0.84, 0.42, 1);
}

/* No focus outline on pins: the selected pin is shown by its size, the info window and the list card */
.gml-locator gmp-advanced-marker:focus,
.gml-locator gmp-advanced-marker:focus-visible {
    outline: none;
}

.gml-locator .gml-user-marker {
    position: relative;
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border: 3px solid var(--gml-surface);
    border-radius: 999px;
    background: var(--gml-user);
    box-shadow: 0 0 0 7px var(--gml-accent-ring), var(--gml-shadow-small);
}

.gml-locator .gml-user-marker::after {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--gml-surface);
    content: "";
}

/* Google's info window frame: 20px around the content; the close button keeps its own row at the top */
.gml-locator .gm-style .gm-style-iw-c {
    padding: 0;
}

.gml-locator .gm-style .gm-style-iw-d {
    padding: 0 20px 20px;
    /* Google sets overflow: scroll inline, which reserves empty scrollbar space on the right and bottom */
    overflow: auto !important;
}

.gml-locator .gml-info-window {
    max-width: 280px;
}

.gml-locator .gml-info-window h3 {
    margin: 0 0 8px;
}

.gml-locator .gml-info-window :is(p, ul, ol) {
    margin: 5px 0;
}

.gml-locator .gml-info-window a {
    color: var(--gml-accent-dark);
    font-weight: 600;
}

.gml-locator .gml-info-image {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 90px;
    margin: 0 0 10px;
    object-fit: contain;
}

.gml-locator .gml-info-window .gml-info-cta {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 12px;
    border: 1px solid var(--gml-accent);
    border-radius: 6px;
    background: var(--gml-accent);
    color: var(--gml-surface);
    font-size: 0.9rem;
    line-height: 1.2;
    text-decoration: none;
}

.gml-locator .gml-info-window .gml-info-cta:hover,
.gml-locator .gml-info-window .gml-info-cta:focus-visible {
    border-color: var(--gml-accent-dark);
    background: var(--gml-accent-dark);
    color: var(--gml-surface);
}

.gml-locator .gml-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    white-space: nowrap;
}

@keyframes gml-selected-icon-bounce {
    0% {
        transform: translateY(0);
    }

    28% {
        transform: translateY(-16px);
    }

    48% {
        transform: translateY(0);
    }

    64% {
        transform: translateY(-7px);
    }

    80%,
    100% {
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .gml-locator .gml-location-card.gml-is-selected .gml-location-icon,
    .gml-locator .gml-custom-marker.gml-is-selected .gml-marker-icon {
        animation: none;
    }
}

/* Breakpoints follow the element width, so the layout also adapts inside narrow columns */
@container (max-width: 820px) {
    .gml-locator .gml-locator-shell {
        display: flex;
        min-height: var(--gml-height, 100svh);
        flex-direction: column;
    }

    .gml-locator .gml-map-panel {
        order: 1;
        flex: 0 0 42svh;
        min-height: 320px;
    }

    .gml-locator .gml-locator-panel,
    .gml-locator--map-right .gml-locator-panel {
        order: 2;
        flex: 1 1 auto;
        min-height: 0;
        border-top: 1px solid var(--gml-line);
        border-left: 0;
        border-right: 0;
    }

    .gml-locator .gml-locator-header {
        padding: 28px 22px 16px;
    }

    .gml-locator .gml-locator-search {
        padding: 0 22px 10px;
    }

    .gml-locator .gml-location-actions {
        padding: 0 22px 14px;
    }

    .gml-locator .gml-location-list {
        padding: 2px 14px 24px;
        gap: 12px;
    }

    .gml-locator .gml-location-card {
        grid-template-columns: 46px minmax(0, 1fr);
        gap: 16px;
        padding: 10px 8px;
    }

    .gml-locator .gml-location-icon {
        width: 42px;
        height: 51px;
    }
}

@container (max-width: 480px) {
    .gml-locator .gml-search-control input {
        min-height: 44px;
    }

    .gml-locator .gml-location-card {
        padding: 13px 14px;
    }
}
