/* QSO Map: the world in the theme's colours, each call in its mode's (as
   On Air colours them) */
.qm-card h2 { margin-bottom: 0.5rem; }

.qm-map {
    position: relative;
    width: 100%;
    aspect-ratio: 2 / 1;
    border-radius: 0.25rem;
    overflow: hidden;
    border: 1px solid var(--ps-border);
}

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

/* The land is the sea's colour with some of the text's mixed in, the
   borders more: the theme's own colours, darker on a light theme and
   lighter on a dark one, so land stands out from sea in every theme
   (land/sea 1.4:1 or more, borders 1.9:1 on the land; the theme's
   background shades alone are barely 1.1:1 on the light themes) */
.qm-sea { fill: var(--ps-bg-secondary); }
.qm-land {
    fill: var(--ps-bg-tertiary);
    fill: color-mix(in srgb, var(--ps-text-primary) 20%, var(--ps-bg-secondary));
    stroke: var(--ps-border);
    stroke: color-mix(in srgb, var(--ps-text-primary) 50%, var(--ps-bg-secondary));
    stroke-width: 0.75px;
    vector-effect: non-scaling-stroke;
    stroke-linejoin: round;
}

/* A call's colour */
.qm-call { --qm-c: var(--ps-accent); }
.qm-mode-dmr { --qm-c: var(--ps-accent-text, var(--ps-accent)); }
.qm-mode-dstar { --qm-c: var(--ps-info-text, var(--ps-info)); }
.qm-mode-ysf { --qm-c: var(--ps-success-text, var(--ps-success)); }
.qm-mode-p25 { --qm-c: var(--ps-warning-text, var(--ps-warning)); }
.qm-mode-nxdn { --qm-c: var(--ps-danger-text, var(--ps-danger)); }

/* Its path to this station: solid once the call has ended (and fading),
   dotted and flowing toward the station while it is on the air. Under it
   a halo in the page's background, so the path stands out (4.6:1 or more)
   from land and sea alike, in every theme */
.qm-halo {
    fill: none;
    stroke: var(--ps-bg-primary);
    stroke-width: 5px;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    opacity: 0.85;
}
.qm-live .qm-halo { stroke-width: 6px; }
.qm-path {
    fill: none;
    stroke: var(--qm-c);
    stroke-width: 2px;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}
.qm-live .qm-path {
    stroke-width: 3px;
    stroke-dasharray: 0.1 9;
    animation: qm-flow 0.8s linear infinite;
}
@keyframes qm-flow { to { stroke-dashoffset: -9.1; } }
/* A path to hover by (wider than drawn) */
.qm-hit { fill: none; stroke: transparent; stroke-width: 14px; vector-effect: non-scaling-stroke; pointer-events: stroke; }

/* The hovered caller (highlight()): its path over the others, glowing
   up and down; its dot larger; a halo round its card */
#qm-hl { pointer-events: none; }
.qm-glow {
    fill: none;
    stroke: var(--qm-c);
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    animation: qm-glow 1.1s ease-in-out infinite alternate;
}
@keyframes qm-glow {
    from { stroke-width: 4px; opacity: 0.15; }
    to { stroke-width: 11px; opacity: 0.55; }
}
#qm-hl .qm-path { stroke-width: 3px; }
#qm-dots .qm-hl .qm-dot { r: 6px; stroke-width: 2px; }
#qm-dots .qm-hl { opacity: 1 !important; }

.qm-dot { fill: var(--qm-c); stroke: var(--ps-bg-primary); vector-effect: non-scaling-stroke; stroke-width: 1px; }
.qm-pulse {
    fill: none;
    stroke: var(--qm-c);
    vector-effect: non-scaling-stroke;
    stroke-width: 2px;
    transform-box: fill-box;
    transform-origin: center;
    animation: qm-pulse 1.4s ease-out infinite;
}
@keyframes qm-pulse { from { transform: scale(1); opacity: 0.9; } to { transform: scale(3); opacity: 0; } }

/* This station */
.qm-home-dot { fill: var(--ps-text-primary); stroke: var(--ps-bg-primary); vector-effect: non-scaling-stroke; stroke-width: 1.5px; }
.qm-home-ring { fill: none; stroke: var(--ps-text-primary); vector-effect: non-scaling-stroke; stroke-width: 1.5px; opacity: 0.6; }

/* Callers' cards, over the map beside their dots: the flag, callsign
   (ID), name and country; the rest on hover, focus or click */
.qm-pins { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.qm-pin {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    max-width: 15rem;
    padding: 0.1rem 0.4rem 0.15rem;
    font-size: 0.72rem;
    line-height: 1.25;
    white-space: nowrap;
    color: var(--ps-text-primary);
    background: color-mix(in srgb, var(--ps-bg-primary) 86%, transparent);
    border: 1px solid color-mix(in srgb, var(--qm-c) 45%, transparent);
    border-left: 3px solid var(--qm-c);
    border-radius: 0.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
/* A card laid away from its dot: a line back to it (layoutCards) */
.qm-leader { stroke: var(--qm-c); stroke-width: 1px; opacity: 0.7; vector-effect: non-scaling-stroke; }
.qm-pin:hover, .qm-pin:focus-within, .qm-pin.qm-open { z-index: 2; opacity: 1 !important; }
.qm-pin.qm-hl {
    z-index: 3;
    opacity: 1 !important;
    box-shadow: 0 0 0 2px var(--qm-c), 0 0 12px 3px color-mix(in srgb, var(--qm-c) 55%, transparent);
}
.qm-pin:focus-visible { outline: 2px solid var(--qm-c); outline-offset: 1px; }
.qm-pin-head { font-weight: 700; color: var(--qm-c); }
.qm-pin-head .call-menu-btn { font: inherit; color: inherit; }
.qm-pin-id { font-weight: 400; color: var(--ps-text-secondary); }
.qm-pin-live {
    margin-left: 0.2rem;
    padding: 0 0.25rem;
    border-radius: 0.2rem;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--ps-bg-primary);
    background: var(--qm-c);
}
.qm-pin-who { color: var(--ps-text-secondary); overflow: hidden; text-overflow: ellipsis; }
/* About how far away: miles, and km under it; shown with the call's
   details (hover, focus, or the card opened) */
.qm-pin-dist { display: none; color: var(--ps-text-secondary); font-variant-numeric: tabular-nums; }
.qm-pin:hover .qm-pin-dist, .qm-pin:focus-within .qm-pin-dist, .qm-pin.qm-open .qm-pin-dist { display: block; }
.qm-pin-dist span { display: block; }
.qm-pin-more {
    display: none;
    grid-template-columns: auto auto;
    gap: 0 0.6rem;
    margin: 0.2rem 0 0;
    padding-top: 0.2rem;
    border-top: 1px solid var(--ps-border);
}
.qm-pin:hover .qm-pin-more, .qm-pin:focus-within .qm-pin-more, .qm-pin.qm-open .qm-pin-more { display: grid; }
.qm-pin-more dt { color: var(--ps-text-secondary); }
.qm-pin-more dd { margin: 0; font-variant-numeric: tabular-nums; }

.qm-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; margin-top: 0.5rem; font-size: 0.85rem; }
.qm-legend span { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--qm-c); font-weight: 600; }
.qm-legend span::before { content: ""; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--qm-c); }
.qm-note { margin: 0.4rem 0 0; font-size: 0.8rem; color: var(--ps-text-secondary); }

/* On the QSO Map page, On Air and Recent Activity sit below the map */
.qsomap-page #qsomap-onair,
.qsomap-page #qsomap-activity { margin-top: 1rem; }
.qsomap-page .module-panel[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
    .qm-live .qm-path { animation: none; stroke-dasharray: none; }
    .qm-pulse { animation: none; opacity: 0; }
    .qm-glow { animation: none; stroke-width: 8px; opacity: 0.4; }
}
