/* The site map (site-map.js, TACOM's offline map): sea, borders and labels, status pins, legend, the map page and the site form. */

.site-map {
    position: relative;
    width: 100%;
    height: 520px;
    overflow: hidden;
    background: #D6E6F5;
    border: 1px solid var(--ft-line);
    border-radius: var(--ft-radius);
    z-index: 0;
}

.site-map .leaflet-container,
.site-map.leaflet-container {
    background: #D6E6F5;
    font-family: var(--ft-font-body);
}

.site-map--page {
    height: min(68vh, 640px);
}

.site-map--picker {
    height: 260px;
    cursor: crosshair;
}

/* Place names: plain text over the map, never catching a click. */
.leaflet-div-icon.sm-label-icon {
    background: transparent;
    border: none;
    white-space: nowrap;
    pointer-events: none;
}

.sm-label {
    display: inline-block;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #1E3A63;
    text-shadow: 0 0 2px #FFFFFF, 0 0 3px #FFFFFF;
}

.sm-label--province {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0;
    color: #475569;
}

/* A site's pin: a round dot in its status accent (msb--* sets --msb-accent) with its main system count; grounded pulses. */
.leaflet-div-icon.sm-pin-icon {
    background: transparent;
    border: none;
}

.sm-pin {
    position: relative;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sm-pin__dot {
    position: relative;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--msb-accent, var(--ft-altimeter));
    border: 2.5px solid #FFFFFF;
    box-shadow: 0 2px 6px rgba(15, 42, 92, 0.4);
    color: #FFFFFF;
    font: 700 11px/1 var(--ft-font-display);
}

.sm-pin--pulse::before {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: var(--msb-accent);
    opacity: 0.35;
    animation: sm-pin-pulse 1.6s ease-out infinite;
}

@keyframes sm-pin-pulse {
    0% { transform: scale(0.85); opacity: 0.6; }
    70% { transform: scale(1.7); opacity: 0; }
    100% { transform: scale(1.7); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .sm-pin--pulse::before {
        animation: none;
    }
}

.sm-pin--empty { --msb-accent: #9AA5B4; }
.sm-pin--picked { --msb-accent: var(--ft-sky); }

.sm-tip {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sm-tip__status {
    color: var(--ft-stencil-soft);
    font-size: 12px;
}

.sm-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
    font-size: 12.5px;
    color: var(--ft-stencil-soft);
}

.sm-legend li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sm-legend__dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--msb-accent);
    box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 3px var(--ft-line);
}

/* The map page: the map and, beside it, the sites or the chosen site's main systems; stacked on narrow screens. */
.sm-note {
    margin-bottom: 14px;
}

.sm-note a {
    margin-left: 4px;
    font-weight: 600;
}

.sm-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
    align-items: start;
}

.sm-panel {
    max-height: min(68vh, 640px);
    overflow: auto;
    padding: 16px;
    background: #FFFFFF;
    border: 1px solid var(--ft-line);
    border-radius: var(--ft-radius);
    box-shadow: var(--ft-shadow-soft);
}

.sm-panel__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.sm-panel__title {
    margin: 0;
    font: 600 17px/1.3 var(--ft-font-display);
    color: var(--ft-apron);
}

.sm-panel__sub,
.sm-panel__empty {
    color: var(--ft-stencil-soft);
    font-size: 13px;
}

.sm-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sm-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "name badge" "sub badge";
    align-items: center;
    gap: 2px 10px;
    width: 100%;
    padding: 10px 12px;
    background: var(--ft-chalk);
    border: 1px solid transparent;
    border-radius: var(--ft-radius-sm);
    color: inherit;
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 140ms ease, background 140ms ease;
}

.sm-row:hover,
.sm-row:focus-visible {
    background: #FFFFFF;
    border-color: var(--ft-altimeter);
}

.sm-row__name {
    grid-area: name;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sm-row__sub {
    grid-area: sub;
    color: var(--ft-stencil-soft);
    font-size: 12.5px;
}

.sm-row > .badge {
    grid-area: badge;
}

@media (max-width: 960px) {
    .sm-page {
        grid-template-columns: minmax(0, 1fr);
    }

    .sm-panel {
        max-height: none;
    }

    .site-map--page {
        height: 56vh;
    }
}

/* The site form: latitude and longitude side by side, stacked on a phone. */
.site-location {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.site-form-hint {
    margin: 0;
    color: var(--ft-stencil-soft);
    font-size: 13px;
}

@media (max-width: 520px) {
    .site-location {
        grid-template-columns: minmax(0, 1fr);
    }
}
