/* Resources map: a calm dot-matrix world above the list of help pages by country. Decorative: the list is the content.
   The SVG and marker list come from tools/make_map.py, which also writes the marker positions (a second, generated stylesheet).
   Lit dots mean "the lab has listed pages for this country", nothing more; land without pages stays plain.
   Contrast (WCAG, computed by tests/test_map.py from the colours below and styles.css, not estimated):
     label text --ink-primary on the label chip, chip over a lit cyan dot .............. 14.0:1 (text, needs 4.5; the worst case)
     label text --ink-primary on the label chip over the brightest sea ................. 17.6:1 (text, needs 4.5)
     credit --muted on the page background ............................................. 7.2:1  (text, needs 4.5)
     caption --ink-secondary on the page background .................................... 7.8:1  (text, needs 4.5)
     focus outline and marker ring --neon-cyan on the brightest sea .................... 13.0:1 (UI, needs 3)
     marker ring --neon-cyan on a land dot ............................................. 9.3:1  (UI, needs 3)
     lit dots --neon-cyan on the brightest sea ......................................... 13.0:1 (graphic, needs 3)
     lit dots against unlit land dots .................................................. 9.3:1  (graphic, needs 3)
     unlit land dots on the darkest sea ................................................ 1.5:1  (decorative on purpose, kept under 2) */

.rmap {
    --rmap-sea: #0a0a0a;
    --rmap-sea-glow: rgba(188, 19, 254, 0.1);
    --rmap-land: #3b2a50;
    --rmap-grat: rgba(188, 19, 254, 0.14);
    --rmap-rim: rgba(188, 19, 254, 0.3);
    --rmap-chip: rgba(5, 5, 5, 0.86);
    margin: 0 0 0.5rem;
}

.rmap-box {
    position: relative;
    container: rmap / inline-size;
    border: 1px solid rgba(188, 19, 254, 0.35);
    border-radius: 8px;
    background:
        radial-gradient(ellipse 60% 70% at 50% 45%, var(--rmap-sea-glow), transparent 75%),
        radial-gradient(ellipse 40% 50% at 22% 40%, rgba(0, 243, 255, 0.035), transparent 70%),
        var(--rmap-sea);
    box-shadow: 0 0 28px rgba(188, 19, 254, 0.12);
}

.rmap-svg { display: block; width: 100%; height: auto; }
.rmap .rim { stroke: var(--rmap-rim); }
.rmap .grat { stroke: var(--rmap-grat); }
.rmap .dots { stroke: var(--rmap-land); }
.rmap .cov { stroke: var(--neon-cyan); }
.rmap .lead { stroke: var(--purple-text); opacity: 0.8; }

/* markers: real links, a 44 by 44 px target; the visible part is a ring with a dot */
.mks { position: absolute; inset: 0; margin: 0; padding: 0; list-style: none; pointer-events: none; }
.mk {
    position: absolute;
    display: block;
    width: 44px;
    height: 44px;
    margin: -22px 0 0 -22px;
    border-radius: 50%;
    color: var(--ink-primary);
    text-decoration: none;
    pointer-events: auto;
}
.mk::before, .mk::after {
    content: "";
    position: absolute;
    inset: 15px;
    border-radius: 50%;
    border: 2px solid var(--mk-ring, var(--neon-cyan));
}
.mk::before {
    background: radial-gradient(circle, var(--ink-primary) 0 2px, var(--bg-dark) 3px);
    box-shadow: 0 0 8px 1px var(--glow-cyan);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.mk::after { border-color: var(--neon-cyan); opacity: 0; }
.mk:hover::before { box-shadow: 0 0 16px 4px var(--glow-cyan); transform: scale(1.12); }
.mk:focus-visible { outline: 3px solid var(--neon-cyan); outline-offset: 2px; }
/* on a phone the map is small: slightly heavier dots, a smaller ring (the target stays 44 px) */
@container rmap (max-width: 639px) { .rmap .dots { stroke-width: 4.2; } }
@container rmap (min-width: 640px) {
    .mk::before, .mk::after { inset: 13px; }
    .mk::before { background: radial-gradient(circle, var(--ink-primary) 0 2.5px, var(--bg-dark) 3.5px); box-shadow: 0 0 10px 1px var(--glow-cyan); }
}
@keyframes rmap-ring { from { transform: scale(1); opacity: 0.9; } to { transform: scale(2.6); opacity: 0; } }
@media (prefers-reduced-motion: no-preference) {
    .rmap .mk::after {
        animation: rmap-ring 2.4s cubic-bezier(0.2, 0.8, 0.4, 1);
    }
    .mk:hover::after,
    .mk:focus-visible::after {
        animation: rmap-ring 1.2s cubic-bezier(0.2, 0.8, 0.4, 1);
    }
}

/* the name: always the link's accessible name; shown as a label once the box is wide enough for labels not to collide */
.mkn {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
@container rmap (min-width: 640px) {
    .mkn {
        width: auto;
        height: auto;
        overflow: visible;
        clip-path: none;
        left: 36px;
        top: 50%;
        transform: translateY(-50%);
        padding: 0.1rem 0.45rem;
        border: 1px solid rgba(188, 19, 254, 0.4);
        border-radius: 4px;
        background: var(--rmap-chip);
        font: 500 0.75rem/1.5 var(--font-mono);
        letter-spacing: 0.02em;
    }
    .mk:hover .mkn, .mk:focus-visible .mkn { border-color: var(--neon-cyan); }
}

.rmap-note { margin: 0.6rem 0 0; color: var(--ink-secondary); font-size: 0.9rem; }
.rmap-credit { margin: 0 0 1.5rem; color: var(--muted); font: 0.75rem/1.5 var(--font-mono); }

@media (forced-colors: active) {
    .rmap-box { forced-color-adjust: none; background: Canvas; border-color: CanvasText; box-shadow: none; }
    .rmap .grat { display: none; }
    .rmap .rim, .rmap .dots { stroke: GrayText; }
    .rmap .cov { stroke: Highlight; }
    .rmap .lead { stroke: CanvasText; opacity: 1; }
    .mk { color: LinkText; }
    .mk::before { border-color: LinkText; background: Canvas; box-shadow: none; }
    .mk:focus-visible { outline: 3px solid Highlight; }
    .mkn { background: Canvas; color: LinkText; border-color: LinkText; }
}

@media (prefers-reduced-motion: reduce) {
    .rmap *, .rmap *::before, .rmap *::after { animation: none !important; transition: none !important; }
}

@media print {
    .rmap, .rmap-credit { display: none !important; }
}
