/* =========================================================
   The marker: its shape, its ring, its states.

   Not its colour. That used to be here — a table of families copied out of
   `cartography/pins.py`, with a test whose only job was to stop the two
   drifting — and it meant a category added from the back-office could not be
   given a colour without a deployment. The palette is `PinFamily` rows now,
   and the colour arrives on the element itself: the map sets `--pin-color`
   from the pin it was handed, a template writes it inline. One authority, no
   copy to police, and repainting a category in the back-office reaches every
   surface at once.

   What is left below is the marker's own design, which belongs to no
   category: the disc, the paper ring that lifts it off any basemap, and the
   clay of the one the reader is on.
   ========================================================= */

:root {
  /* The one the reader is on. Clay is the charter's own accent — "la
     ponctuation, les CTA chauds" — and the only warm tone that does not
     collide with the category hues, which is what lets a selected pharmacy
     still read as selected. */
  --pin-selected: var(--koorda-clay);
  /* Drawn inside every marker: at least 3:1 on all the discs. */
  --pin-glyph: #fbf8f2;
}

/* Everything without a colour of its own wears the brand's. Overridden on the
   element by whoever draws it — `cartography.pins.DEFAULT_PIN_COLOUR` is the
   same value, server-side, for the clients that cannot read this file. */
.koorda-pin {
  --pin-color: var(--koorda-forest);
}

.koorda-pin__marker {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  /* Small until chosen. At 34px sixty of them were the loudest thing on the
     map — louder than the two ends of a journey drawn among them — and the
     one somebody had tapped looked like all the others. The chosen one grows
     (`--selected`); the rest stay quiet. */
  width: 24px;
  height: 24px;
  border-radius: var(--radius-pill);
  background: var(--pin-color);
  color: var(--pin-glyph);
  /* Paper, on every basemap: the ring is what lifts a marker off the ground,
     so it does not follow the theme the way a surface would. */
  border: 2px solid #fbf8f2;
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  cursor: pointer;
  transition: transform 120ms ease-out;
}

/* A marker is a touch target before it is a symbol: the disc is 24px, what a
   finger can hit is still 36. */
.koorda-pin__marker::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: var(--radius-pill);
}

.koorda-pin__marker:hover {
  transform: scale(1.2);
  z-index: 2;
}

/* The selected one changes colour, not just size.
   Scale alone was the whole signal before, and a 25% difference is invisible
   unless the two are side by side — which, on a map, they rarely are. Clay
   says "this one" from across the frame, and the wider ring keeps it legible
   on a dark satellite tile. */
.koorda-pin__marker--selected {
  background: var(--pin-selected);
  border-width: 3px;
  transform: scale(1.45);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--pin-selected) 28%, transparent);
  z-index: 3;
}

.koorda-pin__marker--selected:hover {
  transform: scale(1.45);
}

/* The two ends of a journey. Never alike, and never like a place: a ring to
   leave from, a pin to arrive at — the glyphs their fields wear in the form.
   Larger than a resting marker, because on a map with a route on it they are
   the two things being looked for. */
.route-end {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  border: 3px solid #fbf8f2;
  box-shadow: var(--shadow-sm);
  font-size: 15px;
  /* Above the places, whatever order the markers were added in. */
  z-index: 4;
}

.route-end--depuis {
  background: #fbf8f2;
  color: var(--koorda-forest);
  border-color: var(--koorda-forest);
}

.route-end--vers {
  width: 36px;
  height: 36px;
  background: var(--pin-selected);
  color: var(--pin-glyph);
  font-size: 18px;
}

/* A category's own image, where it has one. Clipped to the disc and inset a
   little: a logo that touched the paper ring would read as a sticker on the
   map rather than as a marker. */
.koorda-pin__logo {
  width: 68%;
  height: 68%;
  object-fit: contain;
  border-radius: var(--radius-pill);
}

/* The same colour, at list size, so a row and its pin read as one thing. */
.koorda-pin__glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--pin-color) 14%, transparent);
  color: var(--pin-color);
}

@media (prefers-reduced-motion: reduce) {
  .koorda-pin__marker,
  .koorda-pin__marker:hover,
  .koorda-pin__marker--selected,
  .koorda-pin__marker--selected:hover {
    transition: none;
    transform: none;
  }
  /* The colour and the ring carry the whole signal when motion is refused —
     which is why the selected state was not left as a scale in the first
     place. */
}
