/* Companion flat map (map.js + Leaflet). Leaflet needs a sized container.
   The basemap is light grey (CARTO Positron) in BOTH site themes, so there are
   still no [data-theme="dark"] overrides here — the map does not follow Night
   Tube. Everything drawn on top of it is therefore styled for a PALE
   background: dark text with a white halo, dark leader lines, and silhouettes
   that rely on their black stroke (set in map.js) for separation. */

.board-map {
    width: 100%;
    height: 55vh;
    min-height: 300px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #c9ced8;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
    background: #e8eaed;
    /* touch-action is deliberately NOT set here. Leaflet sets it itself on
       .leaflet-container (per enabled handler) and overriding it from outside
       is the usual way pinch-zoom gets broken on phones. Only the tap-highlight
       flash is suppressed. */
    -webkit-tap-highlight-color: transparent;
}

/* Snail trails carry the same altitude colours as the symbols, but a polyline
   has no stroke of its own — so on the light basemap the white (ground) and
   yellow (low) runs would disappear, which is exactly the traffic you most want
   to follow. One drop-shadow on the whole overlay pane outlines every trail at
   once; casing each run with a second, wider polyline underneath would double
   the layer count that trailRuns() works hard to keep down. */
.board-map .leaflet-overlay-pane {
    filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.55));
}

/* Aircraft markers -------------------------------------------------------- */

/* The icon box is exactly the symbol's size (20/22/26) and Leaflet anchors it
   at its centre. overflow must stay visible so the leader line and datablock
   can spill outside that box without being clipped. */
.ac-icon {
    background: none;
    border: none;
    overflow: visible;
}

/* Only this element rotates (map.js sets the transform to the track). The
   surrounding .ac-icon stays upright so the datablock text never flips. */
.ac-rot {
    display: block;
    width: 100%;
    height: 100%;
    transform-origin: 50% 50%;
    /* A soft dark halo, working with the symbol's black stroke, lifts the
       white/yellow low-altitude silhouettes off the pale basemap. Lighter than
       the old dark-map value (0.95) — at full strength it reads as a smudge
       against light terrain rather than as definition. */
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.45));
}

.ac-sil {
    display: block;
}

/* Short horizontal leader from the symbol's right edge to the flag. Kept
   axis-aligned rather than the usual ATC diagonal: a rotated 2 px rule
   antialiases onto partial pixels at every angle, and at this size the
   diagonal reads as fuzz rather than as a line. left:100% is the box edge and
   top:50% is exact because every icon size is an even integer. */
.ac-leader {
    position: absolute;
    left: 100%;
    top: 50%;
    width: 12px;
    height: 2px;
    margin-top: -1px;
    background: rgba(20, 26, 36, 0.55);
    pointer-events: none; /* never intercept a map drag */
}

/* Two-line datablock, vertically centred on the leader: 2 lines x 12 px
   line-height = 24 px tall, so -12 px centres it on whole pixels. No
   translate(-50%) anywhere — that is the classic source of half-pixel text. */
.ac-flag {
    position: absolute;
    left: 100%;
    top: 50%;
    margin-left: 12px;
    margin-top: -12px;
    white-space: nowrap;
    pointer-events: none;
    /* White halo, not black: the text is now dark and sits over pale terrain
       and label text, so it needs to be knocked OUT of its surroundings. */
    text-shadow: 0 0 3px rgba(255, 255, 255, 0.95), 0 1px 2px rgba(255, 255, 255, 0.9);
}

.ac-flag b {
    display: block;
    font-size: 10px;
    line-height: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.ac-tail {
    color: #10151f;
}

/* Dimmer than the tail so the eye reads identity first, then the numbers. */
.ac-data {
    color: rgba(38, 48, 66, 0.85);
    font-weight: 500;
}

/* Leaflet's tooltip on a light basemap. */
.board-map .leaflet-tooltip {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(20, 26, 36, 0.22);
    color: #10151f;
    box-shadow: none;
}

.board-map .leaflet-tooltip-left::before { border-left-color: rgba(255, 255, 255, 0.95); }
.board-map .leaflet-tooltip-right::before { border-right-color: rgba(255, 255, 255, 0.95); }
.board-map .leaflet-tooltip-top::before { border-top-color: rgba(255, 255, 255, 0.95); }
.board-map .leaflet-tooltip-bottom::before { border-bottom-color: rgba(255, 255, 255, 0.95); }

/* Mobile ------------------------------------------------------------------ */
/* At ~360 px wide a 44-52 px symbol plus a two-line flag is enormous, and a
   dozen of them overlap into noise. Below this breakpoint map.js drops every
   symbol to the 20 px floor and the flags are hidden entirely — the symbols
   (position, heading, altitude colour) still carry the useful information, and
   tapping one shows its tooltip. This media query MUST stay in step with the
   matchMedia() query in map.js. */
@media (max-width: 560px) {
    .board-map {
        height: 46vh;
        min-height: 260px;
        max-height: 420px;
    }

    .ac-leader,
    .ac-flag {
        display: none;
    }
}
