/* _map.css - Domain styles for the map of countries, regions and municipalities. Class prefix: map-.
   No CSS isolation here: every class MUST carry the domain prefix. */

.map-frame {
    --map-sea: var(--color-rapporter-5-20);
    --map-land: var(--color-rapporter-6-30);
    --map-land-hover: var(--color-rapporter-6-40);
    --map-land-around: var(--color-rapporter-6-20);
    --map-border: var(--bs-white);
    --map-selected: var(--color-primary-main);
    --map-neighbour: var(--color-rapporter-5-40);
    --map-surrounding: var(--color-rapporter-5-30);
    --map-workplace: var(--color-primary-main-support);
    --map-focus: var(--color-primary-support);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.map-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.map-toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.map-stage {
    position: relative;
}

.map-canvas {
    height: var(--map-height, 32rem);
    overflow: hidden;
    border-radius: 0.5rem;
    background: var(--map-sea);
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.map-canvas:focus-visible {
    outline: 2px solid var(--map-selected);
    outline-offset: 2px;
}

.map-frame-static .map-canvas {
    cursor: default;
    pointer-events: none;
}

.map-canvas-dragging {
    cursor: grabbing;
}

.map-svg {
    display: block;
    width: 100%;
    height: 100%;
}

.map-area {
    fill: var(--map-land);
    stroke: var(--map-border);
    stroke-width: var(--map-border-width, 1);
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    cursor: pointer;
}

.map-area:hover {
    fill: var(--map-land-hover);
}

.map-around {
    fill: var(--map-land-around);
    stroke: var(--map-border);
    stroke-width: var(--map-border-width, 1);
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.map-area.map-area-neighbour {
    fill: var(--map-neighbour);
}

.map-area.map-area-surrounding {
    fill: var(--map-surrounding);
}

.map-area.map-area-workplace {
    fill: var(--map-workplace);
}

.map-area.map-area-selected {
    fill: var(--map-selected);
}

/* With the background map under them, the areas are outlines, and only the marked ones keep a colour.
   The background covers Norway only, so the countries around stay as they are. */
.map-svg-backed .map-area {
    fill-opacity: 0;
    stroke: var(--color-rapporter-6-70);
}

.map-svg-backed .map-area:hover {
    fill-opacity: 0.25;
}

.map-svg-backed .map-area.map-area-neighbour,
.map-svg-backed .map-area.map-area-surrounding,
.map-svg-backed .map-area.map-area-workplace,
.map-svg-backed .map-area.map-area-selected {
    fill-opacity: 0.5;
}

.map-tile {
    pointer-events: none;
}

.map-canvas:focus-visible .map-area-focus {
    stroke: var(--map-focus);
    stroke-width: 3;
}

.map-mark {
    stroke: var(--map-border);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
    cursor: pointer;
}

.map-mark-selected {
    fill: var(--map-selected);
}

.map-mark-workplace {
    fill: var(--map-workplace);
}

.map-label {
    fill: var(--bs-body-color);
    stroke: var(--map-border);
    stroke-linejoin: round;
    paint-order: stroke;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

.map-label-marked {
    font-weight: 700;
}

.map-status {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* The map of a position's workplaces in the campaign wizard. */
.map-workplaces {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.map-workplaces-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.map-credit {
    position: absolute;
    right: 0.5rem;
    bottom: 0.25rem;
    padding: 0 0.25rem;
    border-radius: 0.25rem;
    background: var(--bs-white);
    font-size: 0.75rem;
    pointer-events: none;
}

.map-message {
    position: absolute;
    top: 1rem;
    left: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    background: var(--bs-white);
}
