/* Locations map — three offices (LA / Warsaw / Singapore).
   Sits between the CTA section and the footer.

   Loads in tandem with locations-map.js. MapLibre CSS is loaded
   dynamically by the JS at boot time, so this file only carries
   the section chrome (layout, header, side list, markers, popup
   skinning). */

.locations-section {
    /* `position: relative; z-index: 1` lifts this section above the
       homepage's `<section class="hero">`, which uses `position: sticky;
       top: 0` and renders at z:0 — without this, the sticky hero's
       contents bleed through our white card. Same trick used by
       `.cta-section`. */
    position: relative;
    z-index: 1;
    padding: 100px 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
}

.locations-section .section-header {
    margin-bottom: 48px;
}

.locations-stage {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
}

@media (max-width: 900px) {
    .locations-stage { grid-template-columns: 1fr; }
}

.locations-map-wrap {
    position: relative;
    min-width: 0;
    border-right: 1px solid var(--border-color);
    background: #f5f5f5; /* tile placeholder while loading */
}

@media (max-width: 900px) {
    .locations-map-wrap {
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
    }
}

.locations-map {
    width: 100%;
    height: clamp(440px, 60vh, 600px);
}

@media (max-width: 900px) {
    .locations-map { height: clamp(340px, 50vh, 480px); }
}

/* Back-to-overview chip — top right */
.locations-back {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px 6px 10px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-fast), opacity var(--transition-fast), transform var(--transition-fast);
}

.locations-back[hidden] {
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    display: inline-flex;
    visibility: hidden;
}

.locations-back:not([hidden]) { opacity: 1; transform: translateY(0); }
.locations-back:hover { background: #fff; }

/* Side panel — office list */
.locations-list {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg-card);
}

.locations-list-items {
    list-style: none;
    margin: 0;
    padding: 8px;
    overflow-y: auto;
    flex: 1;
}

.locations-list-item {
    width: 100%;
    display: grid;
    grid-template-columns: 10px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 14px 14px;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    font-family: var(--font-main);
    transition: background-color var(--transition-fast);
}

.locations-list-item + .locations-list-item { margin-top: 2px; }
.locations-list-item:hover { background: var(--bg-secondary); }
.locations-list-item.is-active { background: rgba(207, 255, 4, 0.18); }

.locations-list-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-main);
    border: 2px solid var(--bg-card);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.locations-list-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.locations-list-city {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.locations-list-entity {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.35;
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.locations-list-country {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Marker — injected by JS. Use lime brand pin with white outline + soft
   shadow. Two-element structure (outer 24×24 hit target, inner 14 px dot)
   to satisfy a11y target size while keeping the visual unchanged. Same
   "don't transition transform on .cg-marker" caveat as the yes-eu source. */
.cg-marker {
    width: 24px;
    height: 24px;
    background: transparent;
    border: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.cg-marker__dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-main);
    border: 2px solid #0a0a0a;
    box-shadow: 0 0 0 3px rgba(207, 255, 4, 0.30), 0 2px 8px rgba(0, 0, 0, 0.35);
    transition: box-shadow var(--transition-fast), width var(--transition-fast), height var(--transition-fast);
    pointer-events: none;
}

.cg-marker:hover .cg-marker__dot {
    width: 18px;
    height: 18px;
    box-shadow: 0 0 0 6px rgba(207, 255, 4, 0.45), 0 0 0 1px #0a0a0a, 0 4px 12px rgba(0, 0, 0, 0.45);
}

/* Hide non-focused markers during fly transitions so 2 of the 3 markers
   don't visibly slide across the viewport when the camera pans between
   continents. */
#locations-map.is-flying .cg-marker:not(.is-focused) { opacity: 0 !important; }
#locations-map .cg-marker { transition: opacity 360ms ease-out; }

/* Popup skinning */
.cg-popup .maplibregl-popup-content {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 10px !important;
    box-shadow: var(--shadow-md) !important;
    padding: 16px 38px 16px 18px !important;
    font-family: var(--font-main) !important;
    font-size: 13px !important;
    min-width: 220px;
}

.cg-popup .maplibregl-popup-tip { display: none !important; }

.cg-popup .maplibregl-popup-close-button {
    position: absolute !important;
    top: 6px !important;
    right: 6px !important;
    width: 24px !important;
    height: 24px !important;
    padding: 0 !important;
    font-size: 18px !important;
    line-height: 1 !important;
    border: 1px solid var(--border-color) !important;
    background: var(--bg-secondary) !important;
    color: var(--text-secondary) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background var(--transition-fast), color var(--transition-fast) !important;
}

.cg-popup .maplibregl-popup-close-button:hover {
    background: var(--text-primary) !important;
    color: var(--bg-card) !important;
}

.cg-pop { display: flex; flex-direction: column; gap: 3px; }
.cg-pop__city {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    font-weight: 600;
}
.cg-pop__name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 2px;
}
.cg-pop__address {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-top: 4px;
}
.cg-pop__time {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* Attribution — small, unobtrusive */
.locations-map-wrap .maplibregl-ctrl-attrib {
    background: rgba(255, 255, 255, 0.6) !important;
    font-size: 10px !important;
}
.locations-map-wrap .maplibregl-ctrl-attrib a { color: var(--text-secondary) !important; }
