/* The live map (map.js): MapLibre in the map cards, its controls in the brand's colours, the
   aircraft panel and the list of aircraft. maplibre-gl.min.css (vendor/) is loaded before this. */

.rmamap { position: relative; width: 100%; height: clamp(320px, 52vh, 560px); background: var(--rma-ui-inset); overflow: hidden;
  font: 400 var(--rma-text-sm)/var(--rma-leading-sm) var(--rma-font-text); color: var(--rma-ui-ink); }
/* Home: the hero of its card. A desktop gets most of the window's height, a phone a square (the network
   is wider than tall, so a taller map only adds empty sea and desert). */
.rmamap.rmamap-hero { height: clamp(380px, 64vh, 720px); }
@media (max-width: 639px) { .rmamap.rmamap-hero { height: auto; aspect-ratio: 1 / 1; } }
.rmamap.rmamap-flight { height: auto; aspect-ratio: 16 / 11; }
@media (min-width: 640px) and (max-width: 1279px) { .rmamap.rmamap-flight { aspect-ratio: 2 / 1; } }
.rmamap.rmamap-occ { height: auto; aspect-ratio: 4 / 3; }
.rmamap .maplibregl-canvas:focus-visible { outline: 2px solid var(--rma-ui-accent); outline-offset: -2px; }
.rmamap .maplibregl-canvas.rmamap-pointer { cursor: pointer; }

/* MapLibre's controls, recoloured: no shadow, the brand's edge and panel. */
.rmamap .maplibregl-ctrl-group { background: var(--rma-ui-panel); border: 1px solid var(--rma-ui-edge); border-radius: var(--rma-radius); box-shadow: none; overflow: hidden; }
.rmamap .maplibregl-ctrl-group:not(:empty) { box-shadow: none; }
.rmamap .maplibregl-ctrl-group button { width: 32px; height: 32px; }
.rmamap .maplibregl-ctrl-group button + button { border-top: 1px solid var(--rma-ui-edge); }
.rmamap .maplibregl-ctrl-group button:not(:disabled):hover { background: var(--rma-ui-hover); }
.rmamap .maplibregl-ctrl-group button:focus-visible { outline: 2px solid var(--rma-ui-accent); outline-offset: -2px; box-shadow: none; }
.rmamap .maplibregl-ctrl-top-right .maplibregl-ctrl { margin: var(--space-3) var(--space-3) 0 0; }
.rmamap .maplibregl-ctrl-attrib { background: color-mix(in srgb, var(--rma-ui-panel) 82%, transparent); color: var(--rma-ui-muted);
  font: 400 var(--rma-text-xs)/var(--rma-leading-xs) var(--rma-font-text); padding: 0 var(--space-2); border-top-left-radius: var(--space-1); }
.rmamap .maplibregl-ctrl-attrib a { color: var(--rma-ui-muted); }
.rmamap .maplibregl-cooperative-gesture-screen { background: color-mix(in srgb, var(--rma-ui-strong) 55%, transparent); color: var(--rma-ui-panel);
  font: 500 var(--rma-text-md)/var(--rma-leading-md) var(--rma-font-display); }
@media (prefers-color-scheme: dark) {
  .rmamap .maplibregl-ctrl button .maplibregl-ctrl-icon { filter: invert(1); }
}

/* The chosen aircraft: a small card over the map's top left; along the bottom on a phone. */
.rmamap-panel { position: absolute; z-index: 2; top: var(--space-3); left: var(--space-3); width: 272px; display: grid; gap: var(--space-2);
  padding: var(--space-3) var(--space-4) var(--space-4); background: var(--rma-ui-panel); border: 1px solid var(--rma-ui-edge); border-radius: var(--rma-radius); }
.rmamap-panel[hidden] { display: none; }
.rmamap-panel:focus-visible { outline: 2px solid var(--rma-ui-accent); outline-offset: 2px; }
.rmamap-panel-head { display: flex; align-items: center; gap: var(--space-3); }
.rmamap-flight { font: 600 var(--rma-text-md)/var(--rma-leading-md) var(--rma-font-mono); color: var(--rma-ui-strong); }
.rmamap-close { margin-left: auto; min-height: 32px; padding: 0 var(--space-2); border: 0; border-radius: var(--space-1); background: none; cursor: pointer;
  font: 500 var(--rma-text-sm) var(--rma-font-text); color: var(--rma-ui-muted); }
.rmamap-close:hover { background: var(--rma-ui-hover); color: var(--rma-ui-strong); }
.rmamap-route { margin: 0; }
.rmamap-figs { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2) var(--space-4); margin: var(--space-1) 0 0; }
.rmamap-figs dt { font: 500 var(--rma-text-xs)/var(--rma-leading-xs) var(--rma-font-display); color: var(--rma-ui-muted); }
.rmamap-figs dd { margin: 0; font: 500 var(--rma-text-sm)/var(--rma-leading-sm) var(--rma-font-mono); color: var(--rma-ui-strong); font-variant-numeric: tabular-nums; }
.rmamap-more { justify-self: start; font-weight: 600; }
@media (max-width: 639px) {
  .rmamap-panel { top: auto; bottom: var(--space-5); left: var(--space-2); right: var(--space-2); width: auto; gap: var(--space-1); padding: var(--space-2) var(--space-3) var(--space-3); }
  .rmamap-figs { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-1) var(--space-3); }
}

/* Every aircraft in the air as a button: the keyboard's way to the panel, and a legend. */
.rmamap-list { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: var(--space-3) var(--space-5) var(--space-4); list-style: none;
  border-top: 1px solid var(--rma-ui-line); }
.rmamap-list[hidden] { display: none; }
@media (max-width: 639px) { .rmamap-list { padding: var(--space-3) var(--space-4); } }
.rmamap-chip { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 32px; padding: 0 var(--space-3); cursor: pointer;
  border: 1px solid var(--rma-ui-edge); border-radius: 99px; background: var(--rma-ui-panel); color: var(--rma-ui-ink); font: 400 var(--rma-text-sm) var(--rma-font-text); }
.rmamap-chip:hover { background: var(--rma-ui-hover); }
.rmamap-chip[aria-pressed="true"] { background: var(--rma-ui-accent-sel); border-color: var(--rma-ui-accent); color: var(--rma-ui-strong); }
.rmamap-chip:focus-visible { outline: 2px solid var(--rma-ui-accent); outline-offset: 2px; }
/* In the air with no position yet (a sim flight before the bridge's first fix): listed, not a button. */
.rmamap-chip.is-pending { cursor: default; border-style: dashed; }
.rmamap-chip.is-pending:hover { background: var(--rma-ui-panel); }

.rmamap-note { position: absolute; inset: auto var(--space-4) var(--space-4); margin: 0; color: var(--rma-ui-muted); }

/* The EFB's Route page (efb.js): the map beside the numbers on the iPad in landscape, above them
   in portrait. Its targets are the cockpit's 44 px. */
.efb-route { display: grid; grid-template-columns: minmax(0, 1fr) 320px; height: 100%; min-height: 0; }
.rmamap.rmamap-efb { height: 100%; min-height: 0; }
.rmamap-efb .maplibregl-ctrl-group button { width: var(--tap); height: var(--tap); }
/* Spaced a step tight, so in landscape (820 and 800 px high) the figures, the Follow button and the note
   all fit the panel without scrolling. */
.efb-route-side { display: grid; gap: var(--space-3); align-content: start; min-height: 0; overflow: auto; padding: var(--space-4) var(--space-5);
  border-left: 1px solid var(--rma-ui-line); }
.efb-route-figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2) var(--space-4); margin: 0; }
.efb-route-figs > div { display: grid; gap: 0; min-width: 0; }
.efb-route-figs > .big, .efb-route-figs > .wide { grid-column: 1 / -1; padding-top: var(--space-2); border-top: 1px solid var(--rma-ui-line); }
.efb-route-figs > .big:first-child, .efb-route-figs > .wide:first-child { padding-top: 0; border-top: 0; }
.efb-route-figs dt { font-size: var(--rma-text-sm); color: var(--rma-ui-muted); }
.efb-route-figs dd { margin: 0; font: 400 var(--rma-text-base)/1.4 var(--rma-font-mono); font-variant-numeric: tabular-nums; color: var(--rma-ui-strong); }
.efb-route-figs > .big dd { font: 500 var(--rma-text-xl)/var(--rma-leading-xl) var(--rma-font-mono); }
.efb-follow { min-height: var(--tap); width: 100%; }
.efb-follow[aria-pressed="true"] { border-color: var(--rma-ui-accent); background: var(--rma-ui-accent-sel); color: var(--rma-ui-strong); }
.efb-route-side .help { margin: 0; font-size: var(--rma-text-sm); color: var(--rma-ui-muted); }
/* In portrait the numbers take the height they need under the map (it gets the rest), so the Follow
   button and the note under it are never cut at the panel's edge; only a short screen scrolls them. */
@media (max-width: 999px), (orientation: portrait) {
  .efb-route { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(280px, 1fr) auto; }
  .efb-route-side { gap: var(--space-3); padding: var(--space-4) var(--space-5) var(--space-5); border-left: 0; border-top: 1px solid var(--rma-ui-line); max-height: 62vh; }
  .efb-route-figs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
/* On a phone the page itself scrolls (efb.css), so the panel is as tall as its figures and never a
   second scroller; the map keeps a fixed share of the screen, and two columns keep "on track" and
   "Bearing, true" on one line. */
@media (max-width: 639px) {
  .efb-route { height: auto; grid-template-rows: clamp(280px, 45dvh, 420px) auto; }
  .efb-route-side { max-height: none; overflow: visible; }
  .efb-route-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
