/**
 * entity-map-widget.css — in-article related-points map widget chrome.
 * Loaded via ~$addCssFileOnce:'/maps/css/entity-map-widget.css'~ (server
 * BUILD_NUMBER-stamped; no SRI — first-party chrome, not the integrity trio).
 *
 * Palette borrows the ptv2 host hues from static/ptv2/assets/styles/app.css
 * (ink #001d49 / #00317c, accent #0790d1 / #007fc6, muted #6a7381,
 * line #f3f3f3, amber #fbb727). Card/sheet content styles mirror the fixed
 * legacy contract of static/maps/css/gmap2.css (.gmap-detail-card /
 * .gmap-marker-*) and the [hidden]-driven bottom-sheet rules of
 * templates/ptv2_fe_map_page.htm:29-40 — self-contained here because article
 * pages load neither gmap2.css nor the map-page template <style>.
 */

.entity-map-widget {
    --ie-ink: #001d49;
    --ie-ink-deep: #00317c;
    --ie-accent: #0790d1;
    --ie-accent-deep: #007fc6;
    --ie-muted: #6a7381;
    --ie-line: #f3f3f3;
    --ie-amber: #fbb727;
    margin: 20px 0 10px; /* .article__info-entity-map rhythm (app.css:1923) */
}

/* ---- header row ---------------------------------------------------- */

.entity-map-widget__header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 0 0 8px;
}

.entity-map-widget__label {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--ie-ink);
}

.entity-map-widget__count {
    display: inline-block;
    padding: 1px 9px;
    border-radius: 999px;
    background: rgba(7, 144, 209, 0.12);
    color: var(--ie-ink-deep);
    font-size: 12px;
    font-weight: 600;
    line-height: 18px;
}

.entity-map-widget__count[hidden] {
    display: none;
}

.entity-map-widget__full-link {
    margin-left: auto;
    color: var(--ie-accent-deep);
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
}

.entity-map-widget__full-link:hover {
    color: var(--ie-accent);
    text-decoration: underline;
}

/* ---- canvas stage --------------------------------------------------- */

.entity-map-widget__stage {
    position: relative;
    border: 1px solid var(--ie-line);
    border-radius: 10px; /* existing .map-canvas precedent (app.css:1927) */
    overflow: hidden;
    background: #fafafa;
}

.entity-map-widget__canvas {
    width: 100%;
    height: 270px;
}

/* ---- mobile cooperative-touch lock ---------------------------------- */

/* The overlay intercepts every gesture while locked (touch-action:auto)
 * so the PAGE scrolls normally over the widget; the engine container below
 * computes touch-action:none and owns gestures only after the first tap. */
.entity-map-widget__lock {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: auto;
    cursor: pointer;
    background: linear-gradient(180deg, rgba(0, 29, 73, 0.14) 0%, rgba(0, 29, 73, 0.32) 100%);
    transition: opacity 0.2s ease;
}

.entity-map-widget__pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100% - 32px);
    padding: 10px 18px;
    border: 1px solid rgba(0, 29, 73, 0.12);
    border-radius: 999px;
    background: #fff;
    color: var(--ie-ink);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    font-family: inherit;
    text-align: left;
    box-shadow: 0 4px 14px rgba(0, 29, 73, 0.22);
    cursor: pointer;
}

.entity-map-widget__pill-icon {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    fill: var(--ie-accent);
}

.entity-map-widget__relock {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 30;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid #d7dde6;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--ie-ink);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    line-height: 16px;
    box-shadow: 0 2px 8px rgba(16, 24, 40, 0.16);
    cursor: pointer;
}

.entity-map-widget__relock[hidden] {
    display: none;
}

.entity-map-widget__relock-icon {
    flex: 0 0 auto;
    width: 13px;
    height: 13px;
    fill: var(--ie-muted);
}

/* Desktop: no overlay, no chip — the map is directly interactive. */
@media (min-width: 769px) {
    .entity-map-widget__lock,
    .entity-map-widget__relock {
        display: none;
    }
}

/* ---- marker cap overflow link ---------------------------------------- */

.entity-map-widget__more {
    margin: 8px 0 0;
    font-size: 13px;
}

.entity-map-widget__more[hidden] {
    display: none;
}

.entity-map-widget__more a {
    color: var(--ie-accent-deep);
    font-weight: 600;
    text-decoration: none;
}

.entity-map-widget__more a:hover {
    text-decoration: underline;
}

/* ---- detail card (legacy gmap2.css contract, self-contained) ----------- */

.gmap-marker-info-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.entity-map-widget .gmap-marker-info,
.entity-map-widget .gmap-detail-card,
.gmap-marker-info-group .gmap-marker-info,
.gmap-marker-info-group .gmap-detail-card {
    min-width: 220px;
    max-width: 300px;
    padding: 10px 12px;
    background: #fff;
    border-radius: 6px;
    font: 12px/16px Arial, Helvetica, sans-serif;
    color: #222;
    overflow: hidden; /* contain the floated thumbnail */
}

.entity-map-widget .gmap-detail-card-img,
.gmap-marker-info-group .gmap-detail-card-img {
    float: left;
    width: 44px;
    height: 44px;
    margin: 0 10px 6px 0;
    object-fit: cover;
    border-radius: 8px;
    background: #e8e8e8;
}

.entity-map-widget .gmap-marker-title,
.gmap-marker-info-group .gmap-marker-title {
    margin: 0 0 3px;
    font-size: 13px;
    line-height: 17px;
    font-weight: bold;
    color: #1a1a1a;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: break-word;
}

.entity-map-widget .gmap-marker-cat,
.gmap-marker-info-group .gmap-marker-cat {
    float: right;
    max-width: 60%;
    margin: 0 0 4px 8px;
    font-size: 11px;
    color: #226bd7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entity-map-widget .gmap-marker-desc,
.gmap-marker-info-group .gmap-marker-desc {
    clear: both;
    margin: 2px 0 6px;
    font-size: 12px;
    line-height: 16px;
    color: #444;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.entity-map-widget .gmap-marker-link,
.gmap-marker-info-group .gmap-marker-link {
    clear: both;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #eef1f5;
}

.entity-map-widget .gmap-marker-link a,
.gmap-marker-info-group .gmap-marker-link a {
    font-size: 12px;
    font-weight: bold;
    color: #226bd7;
    text-decoration: none;
}

.entity-map-widget .gmap-marker-link a:hover,
.gmap-marker-info-group .gmap-marker-link a:hover {
    text-decoration: underline;
}

.entity-map-widget .gmap-marker-link a::after,
.gmap-marker-info-group .gmap-marker-link a::after {
    content: " \2192";
}

/* ---- bottom sheet (ptv2_fe_map_page.htm:29-40 contract) ---------------- */

.entity-map-widget .gmap-detail-sheet {
    box-sizing: border-box;
    position: relative;
    padding: 16px;
    border: 1px solid #d7dde6;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(16, 24, 40, 0.14);
    font: 13px/18px Arial, Helvetica, sans-serif;
    color: #222;
}

.entity-map-widget .gmap-detail-sheet[hidden] {
    display: none;
}

.entity-map-widget .gmap-detail-sheet.gmap-detail-sheet--shown {
    box-shadow: 0 -4px 20px rgba(16, 24, 40, 0.18);
}

.entity-map-widget .gmap-detail-sheet-close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 1;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #d7dde6;
    border-radius: 50%;
    background: #fff;
    color: #55606e;
    font-size: 16px;
    line-height: 26px;
    text-align: center;
    cursor: pointer;
}

.entity-map-widget .gmap-detail-sheet-close:hover {
    background: #f0f6ff;
    color: #226bd7;
}

/* Inside the sheet the card blends into the host (the sheet IS the card). */
.entity-map-widget .gmap-detail-sheet .gmap-marker-info,
.entity-map-widget .gmap-detail-sheet .gmap-detail-card {
    min-width: 0;
    max-width: none;
    padding: 0 28px 0 0;
    border-radius: 0;
    background: transparent;
}

.entity-map-widget .gmap-detail-sheet .gmap-detail-card-img {
    width: 48px;
    height: 48px;
}

.entity-map-widget .gmap-detail-sheet .gmap-marker-title {
    font-size: 14px;
    line-height: 19px;
}

/* ---- mobile layout ------------------------------------------------------ */

@media (max-width: 768px) {
    .entity-map-widget__canvas {
        height: 240px;
    }

    .entity-map-widget__header {
        flex-wrap: wrap;
    }

    /* Slide-up fixed bottom sheet driven by transform; the [hidden]
     * attribute keeps display:block so the transition can run. */
    .entity-map-widget .gmap-detail-sheet {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 3000;
        max-height: 60vh;
        overflow-y: auto;
        border-radius: 12px 12px 0 0;
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
        transform: translateY(100%);
        transition: transform 0.2s ease;
        visibility: hidden;
    }

    .entity-map-widget .gmap-detail-sheet[hidden] {
        display: block;
        transform: translateY(100%);
        visibility: hidden;
    }

    .entity-map-widget .gmap-detail-sheet:not([hidden]) {
        transform: translateY(0);
        visibility: visible;
    }
}