/* The map page (/carte), and only it. Everything else of the page comes
   from site.css; the tokens (--ink, --paper, --s-*) are defined there.
   Reference: design/systeme (board.css, "Map markers") and design/DA.md.

   MapLibre's own stylesheet is not loaded: the page uses none of its
   controls. The few rules the library needs are at the end of this file. */

/* ------------------------------------------------------------------ */
/* « Près de toi »: the one button of the page, and its answer         */
/* ------------------------------------------------------------------ */

.near [hidden] {
  display: none;
}
.near__ask > * + * {
  margin-top: var(--s-4);
}
.near__ask > p,
.near__status > p {
  max-width: var(--measure);
}
.near__found {
  margin-top: var(--s-6);
}
.near__found > * + * {
  margin-top: var(--s-5);
}
.near__found > div:not(.state) > * + * {
  margin-top: var(--s-4);
}
/* « 1 site » stays in one piece beside a title that wraps */
.near .group span:last-child {
  white-space: nowrap;
}
/* .near__status is never hidden itself (no `display: none` while it is
   empty): a live region that appears together with its text is not
   announced. Empty, it has no height and its margin collapses into the
   next one. */
/* How far a row is: the reason it is in this list, right under its level */
.row__dist {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  margin-top: var(--s-1);
  font: var(--t-small);
  font-weight: 700;
}
/* ------------------------------------------------------------------ */
/* The block                                                           */
/* ------------------------------------------------------------------ */

.map__jump {
  margin-bottom: calc(-1 * var(--s-2));
}
.map {
  border-top: var(--rule) solid var(--ink);
}
/* What the map cannot say stays glued to it, whatever is scrolled: the
   band sticks to the top of the window as long as a part of the map is in
   it (its containing block, .map, ends with the stage) */
.map__caveat {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  background: var(--mist);
  font: var(--t-small);
}
.map__caveat .picto {
  flex: none;
  margin-top: 0.125rem;
}
.map__stage {
  position: relative;
  height: 70vh;
  min-height: 20rem;
  max-height: 36rem;
  background: var(--mist);
  overflow: hidden;
}
.map [hidden],
[data-map-about][hidden] {
  display: none;
}
/* Its own stacking context: a marker never climbs over the panel */
.map__view {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.map__off {
  position: relative;
  z-index: 1;
  max-width: var(--measure);
  padding: var(--s-4);
  font-weight: 700;
}
/* Said over a map that has its markers but no landmark: a block of paper
   closed by an ink rule, beside the controls */
.map__notes {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  max-width: min(var(--measure), calc(100% - var(--target) - 2 * var(--s-3)));
}
.map__note {
  padding: var(--s-2) var(--s-3);
  border-right: var(--rule) solid var(--ink);
  border-bottom: var(--rule) solid var(--ink);
  background: var(--paper);
  font: var(--t-small);
  font-weight: 700;
}
.map__note a {
  padding-block: var(--link-pad);
  white-space: nowrap;
}
.map__note a:focus-visible {
  outline-offset: calc(var(--frame) - var(--link-pad));
}
/* Without a script there is no map to make room for, nor to wait for */
@media (scripting: none) {
  .map__stage {
    height: auto;
    min-height: 0;
  }
  [data-map-wait],
  .map__jump,
  .map__credit,
  .legend {
    display: none;
  }
}
.map--failed .map__stage {
  height: auto;
  min-height: 0;
}
.map--failed .map__view {
  display: none;
}
/* On a phone the map runs edge to edge */
@media (max-width: 37.49em) {
  .map {
    margin-inline: calc(-1 * var(--margin));
  }
  .map__caveat {
    padding-inline: var(--margin);
  }
}

/* ------------------------------------------------------------------ */
/* Controls: paper squares with an ink rule, no shadow                 */
/* ------------------------------------------------------------------ */

.map__tools {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
  z-index: 2;
  display: grid;
  gap: var(--s-1);
}
.map__tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--target);
  height: var(--target);
  padding: 0;
  border: var(--rule) solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}
.map__tool:hover {
  background: var(--mist);
}
.map__tool:focus-visible {
  outline-offset: 0;
  box-shadow: 0 0 0 var(--frame) var(--paper);
}

/* ------------------------------------------------------------------ */
/* The panel of a marker: the rows of the list, as they are            */
/* ------------------------------------------------------------------ */

.map__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  max-height: 72%;
  overflow: auto;
  overscroll-behavior: contain;
  padding: var(--s-2) var(--s-4) var(--s-1);
  border-top: var(--rule) solid var(--ink);
  background: var(--paper);
}
/* Focus is moved here when a marker opens it: the block itself shows
   where one is, and a frame is the mark of an alert plaque */
.map__panel:focus {
  outline: none;
}
.map__panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}
.map__panel-title {
  font: var(--t-small);
  font-weight: 700;
}
.map__close {
  flex: none;
  border-color: transparent;
}
.map__item {
  position: relative;
  display: grid;
  grid-template-columns: var(--hang) minmax(0, 1fr) auto;
  row-gap: var(--s-2);
  padding-block: var(--s-3);
  border-top: var(--hair) solid var(--line);
}
/* The rows were laid out for the width of a page: in the panel they keep
   the layout of a phone at every width */
.map__item > .row__mark {
  position: static;
  grid-column: 1;
  grid-row: 1;
}
.map__item > .row__main {
  grid-column: 2;
  grid-row: 1;
}
.map__item > .row__side {
  grid-column: 2 / -1;
  grid-row: 2;
}
.map__item > .row__go {
  grid-column: 3;
  grid-row: 1;
  margin: var(--s-1) 0 0 var(--s-2);
}
.map__item .row__name a::after {
  left: 0;
}
.map__item.row--state > .row__mark {
  margin-left: var(--s-1);
}
@media (min-width: 37.5em) {
  .map__panel {
    right: auto;
    width: 23rem;
    max-height: calc(100% - var(--s-5));
    border-right: var(--rule) solid var(--ink);
  }
}

/* ------------------------------------------------------------------ */
/* Markers. Fixed colours: a pin is white on a light map and on a dark */
/* one, and its sign keeps the light values.                           */
/* ------------------------------------------------------------------ */

.pin {
  display: block;
  width: 2.75rem;
  height: 3.2083rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.pin svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform-origin: 50% 100%;
}
.pin--approx {
  width: 3.5rem;
  height: 3.5rem;
}
.pin--quiet {
  width: 2.75rem;
  height: 2.75rem;
}
.pin--cluster {
  width: 3rem;
  height: 3.25rem;
}
.pin--approx svg,
.pin--quiet svg,
.pin--cluster svg {
  transform-origin: 50% 50%;
}
/* Selected: the drop turns to ink and grows by a quarter */
.pin[aria-expanded="true"] svg {
  transform: scale(1.25);
}
.pin[aria-expanded="true"] .m-pin,
.pin[aria-expanded="true"] .m-halo {
  fill: #101B3B;
  stroke: #FFFFFF;
  stroke-width: 2;
}
.pin[aria-expanded="true"] .m-ring {
  stroke-width: 4;
}
/* Flat ink is for official sources: selected, a marker nobody official
   stated keeps its white and its dashes, under a thicker line */
.pin--reported[aria-expanded="true"] .m-pin,
.pin--reported[aria-expanded="true"] .m-halo {
  fill: #FFFFFF;
  stroke: #101B3B;
  stroke-width: 3;
  stroke-dasharray: 4.5 3.2;
}
/* Where the visitor is: a small full dot of Plouf, the colour of no level,
   with no sign, no point and no hand cursor. It is not an alert and cannot
   be pressed; it sits under every marker, so that no sign is hidden. Its
   ring is wider than the widest marker, selected: next to an alert, where
   it matters most, the position still shows around the marker. */
.here {
  width: 1.5rem;
  height: 1.5rem;
  pointer-events: none;
}
.here svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.m-here-case {
  fill: #FFFFFF;
  stroke: #101B3B;
  stroke-width: 1.5;
}
.m-here {
  fill: #2F5BFF;
}
.m-here-halo,
.m-here-ring {
  fill: none;
}
.m-here-halo {
  stroke: #FFFFFF;
  stroke-width: 6;
}
.m-here-ring {
  stroke: #2F5BFF;
  stroke-width: 3;
}
.pin:focus-visible {
  outline: none;
}
.pin:focus-visible svg {
  outline: var(--frame) solid #101B3B;
  outline-offset: 0.125rem;
  border-radius: var(--radius);
  box-shadow: 0 0 0 0.125rem #FFFFFF;
  background: rgba(255, 255, 255, 0.6);
}
@media (prefers-reduced-motion: no-preference) {
  .pin svg {
    transition: transform 0.12s ease-out;
  }
}
/* A white casing under every outline: the ink line, and its dashes, stay
   readable on a dark map */
.m-case {
  fill: #FFFFFF;
  stroke: #FFFFFF;
  stroke-width: 4.5;
  stroke-linejoin: round;
}
.m-pin {
  fill: #FFFFFF;
  stroke: #101B3B;
  stroke-width: 1.5;
  stroke-linejoin: round;
}
/* Dashed: "do not lean on it". Nobody official said it. */
.m-pin--reported,
.pin--reported .m-pin {
  stroke-width: 2;
  stroke-dasharray: 4.5 3.2;
}
.m-halo {
  fill: #FFFFFF;
  stroke: #101B3B;
  stroke-width: 1.5;
}
.pin--reported .m-halo {
  stroke-width: 2;
  stroke-dasharray: 4.5 3.2;
}
/* The area an alert placed on its commune may be in */
.m-area {
  fill: #101B3B;
  fill-opacity: 0.1;
  stroke: #101B3B;
  stroke-width: 1.5;
  stroke-dasharray: 2 4;
  stroke-linecap: round;
}
@media (prefers-color-scheme: dark) {
  .m-area {
    fill: #FFFFFF;
    fill-opacity: 0.16;
    stroke: #FFFFFF;
  }
}
/* In a group, only when its sign is that of an alert placed on a commune */
.pin--cluster .m-area {
  display: none;
}
.pin--cluster.pin--loose .m-area {
  display: inline;
}
.m-back {
  fill: #FFFFFF;
}
.m-ring {
  fill: #FFFFFF;
  stroke: #101B3B;
  stroke-width: 2.5;
}
.m-ring--gap {
  stroke-dasharray: 4.5 3.2;
}
/* On a dark map a white disc under ink dashes reads as a cog: the quiet
   marker turns to ink, its dashed ring to white, and keeps the light
   theme's reading (a dashed circle: do not lean on it). */
@media (prefers-color-scheme: dark) {
  .m-back {
    fill: #101B3B;
    stroke: #FFFFFF;
    stroke-width: 0;
  }
  .m-ring {
    fill: #101B3B;
    stroke: #FFFFFF;
  }
}
.m-cluster {
  fill: #101B3B;
  stroke: #FFFFFF;
  stroke-width: 2;
}
.m-cluster__n {
  fill: #FFFFFF;
  font: 800 15px var(--display);
  font-variant-numeric: tabular-nums;
  text-anchor: middle;
}
.m-sign.s-ban {
  --sa: #C21F30;
  --sb: #FFFFFF;
}
.m-sign.s-warning {
  --sa: #F2A33A;
  --sb: #101B3B;
}
.m-sign.s-unconfirmed {
  --sa: #9A2EAE;
  --sb: #9A2EAE;
  --so: #FFFFFF;
}
.pin:not(.pin--reported)[aria-expanded="true"] .m-sign.s-ban {
  --sa: #FFFFFF;
  --sb: #C21F30;
}

/* ------------------------------------------------------------------ */
/* Legend                                                              */
/* ------------------------------------------------------------------ */

.legend {
  display: grid;
  gap: var(--s-2);
  font: var(--t-small);
}
.legend li {
  display: grid;
  grid-template-columns: var(--hang) minmax(0, 1fr);
  align-items: center;
  max-width: var(--measure);
}
.legend__mark {
  width: 2rem;
  height: 2.25rem;
  overflow: visible;
}
.legend [hidden] {
  display: none;
}
.legend [data-map-here] .legend__mark {
  width: 2rem;
  height: 2rem;
}

@media (forced-colors: active) {
  .m-pin,
  .m-halo,
  .m-back,
  .m-ring {
    fill: Canvas;
    stroke: CanvasText;
  }
  .m-case {
    fill: Canvas;
    stroke: Canvas;
  }
  .m-cluster {
    fill: CanvasText;
    stroke: Canvas;
  }
  .m-cluster__n {
    fill: Canvas;
  }
  .m-area {
    fill: none;
    stroke: CanvasText;
  }
  .m-here-case {
    fill: Canvas;
    stroke: CanvasText;
  }
  .m-here {
    fill: Highlight;
  }
  .m-here-halo {
    stroke: Canvas;
  }
  .m-here-ring {
    stroke: Highlight;
  }
}
@media print {
  .near__ask,
  .map,
  .map__jump,
  .legend {
    display: none;
  }
}

/* ------------------------------------------------------------------ */
/* What MapLibre GL JS needs from a stylesheet                         */
/* ------------------------------------------------------------------ */

.maplibregl-map {
  overflow: hidden;
  font: var(--t-small);
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
.maplibregl-canvas {
  position: absolute;
  left: 0;
  top: 0;
}
.maplibregl-canvas-container.maplibregl-interactive {
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}
.maplibregl-canvas-container.maplibregl-interactive:active {
  cursor: grabbing;
}
.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,
.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas {
  touch-action: pan-x pan-y;
}
.maplibregl-canvas-container.maplibregl-touch-drag-pan,
.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas {
  touch-action: pinch-zoom;
}
.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,
.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas {
  touch-action: none;
}
.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures,
.maplibregl-canvas-container.maplibregl-touch-drag-pan.maplibregl-cooperative-gestures .maplibregl-canvas {
  touch-action: pan-x pan-y;
}
.maplibregl-canvas:focus-visible {
  outline-offset: calc(-1 * var(--frame));
}
.maplibregl-marker {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
}
.maplibregl-control-container {
  display: none;
}
/* "Use two fingers": said in a slab of ink, like every instruction */
.maplibregl-cooperative-gesture-screen {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
  background: rgba(16, 27, 59, 0.72);
  color: #FFFFFF;
  font: var(--t-lead);
  text-align: center;
  opacity: 0;
  pointer-events: none;
}
.maplibregl-cooperative-gesture-screen.maplibregl-show {
  opacity: 1;
}
.maplibregl-cooperative-gesture-screen .maplibregl-mobile-message {
  display: none;
}
@media (hover: none), (pointer: coarse) {
  .maplibregl-cooperative-gesture-screen .maplibregl-desktop-message {
    display: none;
  }
  .maplibregl-cooperative-gesture-screen .maplibregl-mobile-message {
    display: block;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .maplibregl-cooperative-gesture-screen {
    transition: opacity 1s ease 1s;
  }
  .maplibregl-cooperative-gesture-screen.maplibregl-show {
    transition: opacity 0.05s;
  }
}
