/* The world map shared by the map pages (jifto-map.js). Colours of the map are custom properties
 * on the map's element, so a page restyles it without touching the script. Light and dark follow
 * the site's theme; .world-map--dark keeps the dark set on pages that are dark throughout. */

.world-map {
    --map-water: #f5f4f1;
    --map-land: #e2e0d9;
    --map-coast: #c4c1b7;
    --map-border: #ffffff;
    --map-state: rgba(255, 255, 255, 0.75);
    --map-focus: #0f0f0f;
    --map-hover: rgba(0, 0, 0, 0.08);
    --map-label: rgba(15, 15, 15, 0.62);
    --map-label-halo: rgba(245, 244, 241, 0.9);
    --map-card: rgba(251, 250, 247, 0.94);
    --map-card-line: rgba(0, 0, 0, 0.1);
    --map-text: #0f0f0f;
    --map-muted: #555555;

    position: relative;
    width: 100%;
    height: 100%;
    background: var(--map-water);
    font-family: var(--site-font-sans, "Inter", -apple-system, BlinkMacSystemFont, sans-serif);
}

:root[data-theme="dark"] .world-map,
.world-map.world-map--dark {
    --map-water: #0c0d0e;
    --map-land: #2a2d30;
    --map-coast: #41464b;
    --map-border: #0c0d0e;
    --map-state: rgba(12, 13, 14, 0.7);
    --map-focus: #ffffff;
    --map-hover: rgba(255, 255, 255, 0.1);
    --map-label: rgba(240, 240, 240, 0.86);
    --map-label-halo: rgba(12, 13, 14, 0.9);
    --map-card: rgba(24, 26, 28, 0.9);
    --map-card-line: rgba(255, 255, 255, 0.1);
    --map-text: #e6e6e6;
    --map-muted: rgba(230, 230, 230, 0.66);
}

.world-map .maplibregl-canvas {
    outline: none;
}

/* The tooltip that follows the pointer. Moved with a transform, so it never causes layout. */
.world-map-tip {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 3;
    max-width: 260px;
    padding: 8px 11px;
    border: 1px solid var(--map-card-line);
    border-radius: 8px;
    background: var(--map-card);
    color: var(--map-text);
    font-size: 12.5px;
    line-height: 1.4;
    pointer-events: none;
    backdrop-filter: blur(10px);
    will-change: transform;
}

.world-map-tip strong {
    display: block;
    font-weight: 600;
}

.world-map-tip span {
    display: block;
    color: var(--map-muted);
}

/* MapLibre's own controls, in the map's colours. */
.world-map .maplibregl-ctrl-group {
    overflow: hidden;
    border: 1px solid var(--map-card-line);
    border-radius: 8px;
    background: var(--map-card);
    box-shadow: none;
    backdrop-filter: blur(10px);
}

.world-map .maplibregl-ctrl-group button + button {
    border-top: 1px solid var(--map-card-line);
}

:root[data-theme="dark"] .world-map .maplibregl-ctrl-icon,
.world-map.world-map--dark .maplibregl-ctrl-icon {
    filter: invert(1);
}

.world-map .maplibregl-ctrl-attrib {
    background: var(--map-card);
    color: var(--map-muted);
    font-size: 11px;
}

.world-map .maplibregl-ctrl-attrib a {
    color: inherit;
}

:root[data-theme="dark"] .world-map .maplibregl-ctrl-attrib-button,
.world-map.world-map--dark .maplibregl-ctrl-attrib-button {
    filter: invert(1);
}
