# Map legend highlight tooltip

> A hiking map with a legend: hover a symbol to read what it means while every symbol of that kind pulses on the map.

- Category: [Tooltips](https://library.aimran.es/components/tooltips)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-tip-map-legend
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

A paper hiking map with contour lines, a river, forest patches and a dashed trail dotted with campsites, viewpoints, springs and a mountain hut. The legend below is a row of chips: hover or focus one and a tooltip names the feature and counts it, while the matching symbols on the map grow and pulse and the rest fade to grey.

The main color draws the trail and focus ring, the second the paper tone. Each legend entry carries its own color and icon, so adding bike shops, parking or bus stops only takes another item with its map positions.

## Code

### HTML

```html
<div class="uvq08-lgd"><div class="mp" aria-hidden="true"><svg viewBox="0 0 100 100" preserveAspectRatio="none"><path class="rv" d="M0 80C20 72 30 88 50 82S80 64 100 72"/><path class="tr" d="M18 32C26 22 34 16 40 18S44 36 46 44S58 38 63 34S80 24 86 26M46 44C50 50 52 54 56 56S66 66 72 70M46 44C38 54 32 62 27 72"/></svg><i class="sy k0" style="left:18%;top:32%;--k:#2f855a"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 19L12 5l9 14zM12 5v14M9 19l3-5 3 5"/></svg></i><i class="sy k0" style="left:72%;top:70%;--k:#2f855a"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 19L12 5l9 14zM12 5v14M9 19l3-5 3 5"/></svg></i><i class="sy k1" style="left:40%;top:18%;--k:#b45309"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="7" cy="15" r="3.5"/><circle cx="17" cy="15" r="3.5"/><path d="M10.5 15h3M4.5 12.5L7 6h3l.8 6M19.5 12.5L17 6h-3l-.8 6"/></svg></i><i class="sy k1" style="left:86%;top:26%;--k:#b45309"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="7" cy="15" r="3.5"/><circle cx="17" cy="15" r="3.5"/><path d="M10.5 15h3M4.5 12.5L7 6h3l.8 6M19.5 12.5L17 6h-3l-.8 6"/></svg></i><i class="sy k1" style="left:56%;top:56%;--k:#b45309"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="7" cy="15" r="3.5"/><circle cx="17" cy="15" r="3.5"/><path d="M10.5 15h3M4.5 12.5L7 6h3l.8 6M19.5 12.5L17 6h-3l-.8 6"/></svg></i><i class="sy k2" style="left:27%;top:72%;--k:#2563eb"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3.5c3.5 4.5 6 7.6 6 10.5a6 6 0 0 1-12 0c0-2.9 2.5-6 6-10.5z"/></svg></i><i class="sy k2" style="left:63%;top:34%;--k:#2563eb"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3.5c3.5 4.5 6 7.6 6 10.5a6 6 0 0 1-12 0c0-2.9 2.5-6 6-10.5z"/></svg></i><i class="sy k3" style="left:46%;top:44%;--k:#b91c1c"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 11l8-6.5 8 6.5M6 9.5V20h12V9.5M10 20v-5h4v5"/></svg></i></div><div class="lg" role="group" aria-label="Map legend"><span class="wr lg0 pk"><button type="button" style="--k:#2f855a" aria-describedby="uvq08-lgd-0"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 19L12 5l9 14zM12 5v14M9 19l3-5 3 5"/></svg><span>Camping</span></button><span class="tt" role="tooltip" id="uvq08-lgd-0"><b>Camping area</b><span>2 on this route</span></span></span><span class="wr lg1"><button type="button" style="--k:#b45309" aria-describedby="uvq08-lgd-1"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="7" cy="15" r="3.5"/><circle cx="17" cy="15" r="3.5"/><path d="M10.5 15h3M4.5 12.5L7 6h3l.8 6M19.5 12.5L17 6h-3l-.8 6"/></svg><span>Viewpoint</span></button><span class="tt" role="tooltip" id="uvq08-lgd-1"><b>Scenic viewpoint</b><span>3 on this route</span></span></span><span class="wr lg2"><button type="button" style="--k:#2563eb" aria-describedby="uvq08-lgd-2"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3.5c3.5 4.5 6 7.6 6 10.5a6 6 0 0 1-12 0c0-2.9 2.5-6 6-10.5z"/></svg><span>Spring</span></button><span class="tt" role="tooltip" id="uvq08-lgd-2"><b>Drinking water spring</b><span>2 on this route</span></span></span><span class="wr lg3"><button type="button" style="--k:#b91c1c" aria-describedby="uvq08-lgd-3"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 11l8-6.5 8 6.5M6 9.5V20h12V9.5M10 20v-5h4v5"/></svg><span>Refuge</span></button><span class="tt" role="tooltip" id="uvq08-lgd-3"><b>Mountain hut</b><span>1 on this route</span></span></span></div></div>
```

### CSS

```css
.uvq08-lgd {
  --c1: #c2410c;
  --c2: #f3ecd9;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq08-lgd {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  width: 17.5em;
  padding-bottom: 3.8em;
}

.uvq08-lgd .mp {
  position: relative;
  height: 10em;
  border-radius: 1em;
  overflow: hidden;
  background: radial-gradient(30% 26% at 70% 72%,rgba(80,150,90,.2),transparent 70%),radial-gradient(24% 30% at 15% 60%,rgba(80,150,90,.18),transparent 70%),repeating-radial-gradient(circle at 42% 28%,transparent 0 1.3em,rgba(150,110,60,.28) 1.3em calc(1.3em + 1px)),repeating-radial-gradient(circle at 82% 76%,transparent 0 1.1em,rgba(150,110,60,.22) 1.1em calc(1.1em + 1px)),var(--c2);
  box-shadow: inset 0 0 0 1px rgba(120,90,40,.25),0 1em 1.8em -1em rgba(0,0,0,.45);
}

.uvq08-lgd .mp>svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
}

.uvq08-lgd .rv {
  stroke: #5b9bd5;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
}

.uvq08-lgd .tr {
  stroke: var(--c1);
  stroke-width: 2;
  stroke-dasharray: 5 4;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
}

.uvq08-lgd .sy {
  position: absolute;
  display: grid;
  place-items: center;
  width: 1.55em;
  height: 1.55em;
  translate: -50% -50%;
  border-radius: 50%;
  color: var(--k);
  background: #fffdf6;
  box-shadow: 0 0 0 1.5px var(--k),0 .2em .3em rgba(0,0,0,.25);
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),filter calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq08-lgd .sy svg {
  width: 1em;
  height: 1em;
}

.uvq08-lgd .sy::after {
  content: "";
  position: absolute;
  inset: -.15em;
  border-radius: 50%;
  border: 2px solid var(--k);
  opacity: 0;
}

.uvq08-lgd:has(.lg .wr:is(:hover,:focus-within,.pk)) .sy {
  opacity: .3;
  filter: grayscale(1);
}

.uvq08-lgd:has(.lg0:is(:hover,:focus-within,.pk)) .k0 {
  opacity: 1;
  filter: none;
  transform: scale(1.3);
  z-index: 2;
}

.uvq08-lgd:has(.lg0:is(:hover,:focus-within,.pk)) .k0::after {
  animation: uvq08-lgd-p calc(1.4s / var(--k)) ease-out infinite;
}

.uvq08-lgd:has(.lg1:is(:hover,:focus-within,.pk)) .k1 {
  opacity: 1;
  filter: none;
  transform: scale(1.3);
  z-index: 2;
}

.uvq08-lgd:has(.lg1:is(:hover,:focus-within,.pk)) .k1::after {
  animation: uvq08-lgd-p calc(1.4s / var(--k)) ease-out infinite;
}

.uvq08-lgd:has(.lg2:is(:hover,:focus-within,.pk)) .k2 {
  opacity: 1;
  filter: none;
  transform: scale(1.3);
  z-index: 2;
}

.uvq08-lgd:has(.lg2:is(:hover,:focus-within,.pk)) .k2::after {
  animation: uvq08-lgd-p calc(1.4s / var(--k)) ease-out infinite;
}

.uvq08-lgd:has(.lg3:is(:hover,:focus-within,.pk)) .k3 {
  opacity: 1;
  filter: none;
  transform: scale(1.3);
  z-index: 2;
}

.uvq08-lgd:has(.lg3:is(:hover,:focus-within,.pk)) .k3::after {
  animation: uvq08-lgd-p calc(1.4s / var(--k)) ease-out infinite;
}

.uvq08-lgd .lg {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: .35em;
  margin-top: .6em;
}

.uvq08-lgd .wr {
  position: relative;
  min-width: 0;
}

.uvq08-lgd button {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .25em;
  width: 100%;
  padding: .5em .2em .45em;
  border-radius: .9em;
  font-size: .72em;
  white-space: nowrap;
  font-weight: 650;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent);
  transition: all calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq08-lgd button svg {
  flex: none;
  width: 1.35em;
  height: 1.35em;
  color: var(--k);
}

.uvq08-lgd button:hover,.uvq08-lgd .wr.pk button {
  background: color-mix(in srgb,var(--k) 14%,transparent);
  box-shadow: inset 0 0 0 1.5px var(--k);
}

.uvq08-lgd button:active {
  transform: scale(.95);
}

.uvq08-lgd button:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq08-lgd .tt {
  position: absolute;
  left: 50%;
  top: calc(100% + .7em);
  z-index: 3;
  display: grid;
  gap: .1em;
  width: max-content;
  padding: .5em .75em;
  border-radius: .7em;
  font-size: .74em;
  line-height: 1.35;
  color: var(--bg);
  background: var(--fg);
  box-shadow: 0 .8em 1.6em -.6em rgba(0,0,0,.45);
  transform: translate(-50%,-.3em);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq08-lgd .tt::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: .7em;
  height: .7em;
  background: var(--fg);
  transform: translate(-50%,55%) rotate(45deg);
  border-radius: .15em 0 0 0;
}

.uvq08-lgd .tt span {
  opacity: .7;
}

.uvq08-lgd .wr:first-child .tt {
  left: 0;
  transform: translateY(-.3em);
}

.uvq08-lgd .wr:first-child .tt::after {
  left: 1.8em;
}

.uvq08-lgd .wr:last-child .tt {
  left: auto;
  right: 0;
  transform: translateY(-.3em);
}

.uvq08-lgd .wr:last-child .tt::after {
  left: auto;
  right: 1.6em;
  transform: translate(50%,55%) rotate(45deg);
}

.uvq08-lgd .wr:is(:hover,:focus-within,.pk) .tt {
  transform: translate(-50%,0);
  opacity: 1;
  visibility: visible;
}

.uvq08-lgd .wr:is(:first-child,:last-child):is(:hover,:focus-within,.pk) .tt {
  transform: none;
}

@keyframes uvq08-lgd-p {
  0% {
    transform: scale(.9);
    opacity: .9;
  }
  100% {
    transform: scale(2.1);
    opacity: 0;
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq08-lgd,.uvq08-lgd *,.uvq08-lgd *::before,.uvq08-lgd *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
```

### JavaScript

```js
document.querySelectorAll(".uvq08-lgd").forEach(el => {
  const unpk=()=>{el.classList.remove("pk");el.querySelectorAll(".pk").forEach(x=>x.classList.remove("pk"))};el.addEventListener("pointerover",unpk,{once:true});el.addEventListener("focusin",unpk,{once:true});
});
```

### React

```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq08-lgd {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  width: 17.5em;
  padding-bottom: 3.8em;
}

.uvq08-lgd .mp {
  position: relative;
  height: 10em;
  border-radius: 1em;
  overflow: hidden;
  background: radial-gradient(30% 26% at 70% 72%,rgba(80,150,90,.2),transparent 70%),radial-gradient(24% 30% at 15% 60%,rgba(80,150,90,.18),transparent 70%),repeating-radial-gradient(circle at 42% 28%,transparent 0 1.3em,rgba(150,110,60,.28) 1.3em calc(1.3em + 1px)),repeating-radial-gradient(circle at 82% 76%,transparent 0 1.1em,rgba(150,110,60,.22) 1.1em calc(1.1em + 1px)),var(--c2);
  box-shadow: inset 0 0 0 1px rgba(120,90,40,.25),0 1em 1.8em -1em rgba(0,0,0,.45);
}

.uvq08-lgd .mp>svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
}

.uvq08-lgd .rv {
  stroke: #5b9bd5;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
}

.uvq08-lgd .tr {
  stroke: var(--c1);
  stroke-width: 2;
  stroke-dasharray: 5 4;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
}

.uvq08-lgd .sy {
  position: absolute;
  display: grid;
  place-items: center;
  width: 1.55em;
  height: 1.55em;
  translate: -50% -50%;
  border-radius: 50%;
  color: var(--k);
  background: #fffdf6;
  box-shadow: 0 0 0 1.5px var(--k),0 .2em .3em rgba(0,0,0,.25);
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),filter calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq08-lgd .sy svg {
  width: 1em;
  height: 1em;
}

.uvq08-lgd .sy::after {
  content: "";
  position: absolute;
  inset: -.15em;
  border-radius: 50%;
  border: 2px solid var(--k);
  opacity: 0;
}

.uvq08-lgd:has(.lg .wr:is(:hover,:focus-within,.pk)) .sy {
  opacity: .3;
  filter: grayscale(1);
}

.uvq08-lgd:has(.lg0:is(:hover,:focus-within,.pk)) .k0 {
  opacity: 1;
  filter: none;
  transform: scale(1.3);
  z-index: 2;
}

.uvq08-lgd:has(.lg0:is(:hover,:focus-within,.pk)) .k0::after {
  animation: uvq08-lgd-p calc(1.4s / var(--k)) ease-out infinite;
}

.uvq08-lgd:has(.lg1:is(:hover,:focus-within,.pk)) .k1 {
  opacity: 1;
  filter: none;
  transform: scale(1.3);
  z-index: 2;
}

.uvq08-lgd:has(.lg1:is(:hover,:focus-within,.pk)) .k1::after {
  animation: uvq08-lgd-p calc(1.4s / var(--k)) ease-out infinite;
}

.uvq08-lgd:has(.lg2:is(:hover,:focus-within,.pk)) .k2 {
  opacity: 1;
  filter: none;
  transform: scale(1.3);
  z-index: 2;
}

.uvq08-lgd:has(.lg2:is(:hover,:focus-within,.pk)) .k2::after {
  animation: uvq08-lgd-p calc(1.4s / var(--k)) ease-out infinite;
}

.uvq08-lgd:has(.lg3:is(:hover,:focus-within,.pk)) .k3 {
  opacity: 1;
  filter: none;
  transform: scale(1.3);
  z-index: 2;
}

.uvq08-lgd:has(.lg3:is(:hover,:focus-within,.pk)) .k3::after {
  animation: uvq08-lgd-p calc(1.4s / var(--k)) ease-out infinite;
}

.uvq08-lgd .lg {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: .35em;
  margin-top: .6em;
}

.uvq08-lgd .wr {
  position: relative;
  min-width: 0;
}

.uvq08-lgd button {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .25em;
  width: 100%;
  padding: .5em .2em .45em;
  border-radius: .9em;
  font-size: .72em;
  white-space: nowrap;
  font-weight: 650;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent);
  transition: all calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq08-lgd button svg {
  flex: none;
  width: 1.35em;
  height: 1.35em;
  color: var(--k);
}

.uvq08-lgd button:hover,.uvq08-lgd .wr.pk button {
  background: color-mix(in srgb,var(--k) 14%,transparent);
  box-shadow: inset 0 0 0 1.5px var(--k);
}

.uvq08-lgd button:active {
  transform: scale(.95);
}

.uvq08-lgd button:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq08-lgd .tt {
  position: absolute;
  left: 50%;
  top: calc(100% + .7em);
  z-index: 3;
  display: grid;
  gap: .1em;
  width: max-content;
  padding: .5em .75em;
  border-radius: .7em;
  font-size: .74em;
  line-height: 1.35;
  color: var(--bg);
  background: var(--fg);
  box-shadow: 0 .8em 1.6em -.6em rgba(0,0,0,.45);
  transform: translate(-50%,-.3em);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq08-lgd .tt::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: .7em;
  height: .7em;
  background: var(--fg);
  transform: translate(-50%,55%) rotate(45deg);
  border-radius: .15em 0 0 0;
}

.uvq08-lgd .tt span {
  opacity: .7;
}

.uvq08-lgd .wr:first-child .tt {
  left: 0;
  transform: translateY(-.3em);
}

.uvq08-lgd .wr:first-child .tt::after {
  left: 1.8em;
}

.uvq08-lgd .wr:last-child .tt {
  left: auto;
  right: 0;
  transform: translateY(-.3em);
}

.uvq08-lgd .wr:last-child .tt::after {
  left: auto;
  right: 1.6em;
  transform: translate(50%,55%) rotate(45deg);
}

.uvq08-lgd .wr:is(:hover,:focus-within,.pk) .tt {
  transform: translate(-50%,0);
  opacity: 1;
  visibility: visible;
}

.uvq08-lgd .wr:is(:first-child,:last-child):is(:hover,:focus-within,.pk) .tt {
  transform: none;
}

@keyframes uvq08-lgd-p {
  0% {
    transform: scale(.9);
    opacity: .9;
  }
  100% {
    transform: scale(2.1);
    opacity: 0;
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq08-lgd,.uvq08-lgd *,.uvq08-lgd *::before,.uvq08-lgd *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const unpk=()=>{el.classList.remove("pk");el.querySelectorAll(".pk").forEach(x=>x.classList.remove("pk"))};el.addEventListener("pointerover",unpk,{once:true});el.addEventListener("focusin",unpk,{once:true});
}

export default function TipMapLegend() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#c2410c",
          "--c2": "#f3ecd9",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq08-lgd"><div className="mp" aria-hidden="true"><svg viewBox="0 0 100 100" preserveAspectRatio="none"><path className="rv" d="M0 80C20 72 30 88 50 82S80 64 100 72" /><path className="tr" d="M18 32C26 22 34 16 40 18S44 36 46 44S58 38 63 34S80 24 86 26M46 44C50 50 52 54 56 56S66 66 72 70M46 44C38 54 32 62 27 72" /></svg><i className="sy k0" style={{ left: "18%", top: "32%", "--k": "#2f855a" } as CSSProperties}><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M3 19L12 5l9 14zM12 5v14M9 19l3-5 3 5" /></svg></i><i className="sy k0" style={{ left: "72%", top: "70%", "--k": "#2f855a" } as CSSProperties}><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M3 19L12 5l9 14zM12 5v14M9 19l3-5 3 5" /></svg></i><i className="sy k1" style={{ left: "40%", top: "18%", "--k": "#b45309" } as CSSProperties}><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><circle cx="7" cy="15" r="3.5" /><circle cx="17" cy="15" r="3.5" /><path d="M10.5 15h3M4.5 12.5L7 6h3l.8 6M19.5 12.5L17 6h-3l-.8 6" /></svg></i><i className="sy k1" style={{ left: "86%", top: "26%", "--k": "#b45309" } as CSSProperties}><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><circle cx="7" cy="15" r="3.5" /><circle cx="17" cy="15" r="3.5" /><path d="M10.5 15h3M4.5 12.5L7 6h3l.8 6M19.5 12.5L17 6h-3l-.8 6" /></svg></i><i className="sy k1" style={{ left: "56%", top: "56%", "--k": "#b45309" } as CSSProperties}><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><circle cx="7" cy="15" r="3.5" /><circle cx="17" cy="15" r="3.5" /><path d="M10.5 15h3M4.5 12.5L7 6h3l.8 6M19.5 12.5L17 6h-3l-.8 6" /></svg></i><i className="sy k2" style={{ left: "27%", top: "72%", "--k": "#2563eb" } as CSSProperties}><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M12 3.5c3.5 4.5 6 7.6 6 10.5a6 6 0 0 1-12 0c0-2.9 2.5-6 6-10.5z" /></svg></i><i className="sy k2" style={{ left: "63%", top: "34%", "--k": "#2563eb" } as CSSProperties}><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M12 3.5c3.5 4.5 6 7.6 6 10.5a6 6 0 0 1-12 0c0-2.9 2.5-6 6-10.5z" /></svg></i><i className="sy k3" style={{ left: "46%", top: "44%", "--k": "#b91c1c" } as CSSProperties}><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M4 11l8-6.5 8 6.5M6 9.5V20h12V9.5M10 20v-5h4v5" /></svg></i></div><div className="lg" role="group" aria-label="Map legend"><span className="wr lg0 pk"><button type="button" style={{ "--k": "#2f855a" } as CSSProperties} aria-describedby="uvq08-lgd-0"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M3 19L12 5l9 14zM12 5v14M9 19l3-5 3 5" /></svg><span>Camping</span></button><span className="tt" role="tooltip" id="uvq08-lgd-0"><b>Camping area</b><span>2 on this route</span></span></span><span className="wr lg1"><button type="button" style={{ "--k": "#b45309" } as CSSProperties} aria-describedby="uvq08-lgd-1"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><circle cx="7" cy="15" r="3.5" /><circle cx="17" cy="15" r="3.5" /><path d="M10.5 15h3M4.5 12.5L7 6h3l.8 6M19.5 12.5L17 6h-3l-.8 6" /></svg><span>Viewpoint</span></button><span className="tt" role="tooltip" id="uvq08-lgd-1"><b>Scenic viewpoint</b><span>3 on this route</span></span></span><span className="wr lg2"><button type="button" style={{ "--k": "#2563eb" } as CSSProperties} aria-describedby="uvq08-lgd-2"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M12 3.5c3.5 4.5 6 7.6 6 10.5a6 6 0 0 1-12 0c0-2.9 2.5-6 6-10.5z" /></svg><span>Spring</span></button><span className="tt" role="tooltip" id="uvq08-lgd-2"><b>Drinking water spring</b><span>2 on this route</span></span></span><span className="wr lg3"><button type="button" style={{ "--k": "#b91c1c" } as CSSProperties} aria-describedby="uvq08-lgd-3"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M4 11l8-6.5 8 6.5M6 9.5V20h12V9.5M10 20v-5h4v5" /></svg><span>Refuge</span></button><span className="tt" role="tooltip" id="uvq08-lgd-3"><b>Mountain hut</b><span>1 on this route</span></span></span></div></div>
      </div>
    </>
  );
}
```

## Prompt for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Map legend highlight tooltip” block (Tooltips) from AIMRAN Library to my project.

## What it is
A hiking map with a legend: hover a symbol to read what it means while every symbol of that kind pulses on the map.

## Chosen settings
- Main color: #c2410c
- Secondary color: #f3ecd9
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Leyenda del mapa"

## What I need
1. Add it to my project with the same look and animation as the reference code: same sizes, colours, radii, shadows, timings and easing.
2. It is built with plain HTML and CSS (the reference wraps it in a React component with its CSS). If my project uses something else (Vue, Svelte, Astro, plain HTML…), translate it without losing any behaviour. If I use Tailwind, turn the styles into classes; if not, keep the CSS in its own file.
3. Expose the settings above as props (or CSS variables) with those values as defaults.
4. Make it work well on phones: nothing that depends only on hover, touch targets of at least 44 px and no overflow on 320 px screens.
5. Make it look right in light and dark mode.
6. Keep it accessible: semantic HTML, roles and aria-* where needed, visible focus and keyboard support.
7. Respect prefers-reduced-motion: with reduced motion, no big animations but the same end result.

## Reference code
```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq08-lgd {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  width: 17.5em;
  padding-bottom: 3.8em;
}

.uvq08-lgd .mp {
  position: relative;
  height: 10em;
  border-radius: 1em;
  overflow: hidden;
  background: radial-gradient(30% 26% at 70% 72%,rgba(80,150,90,.2),transparent 70%),radial-gradient(24% 30% at 15% 60%,rgba(80,150,90,.18),transparent 70%),repeating-radial-gradient(circle at 42% 28%,transparent 0 1.3em,rgba(150,110,60,.28) 1.3em calc(1.3em + 1px)),repeating-radial-gradient(circle at 82% 76%,transparent 0 1.1em,rgba(150,110,60,.22) 1.1em calc(1.1em + 1px)),var(--c2);
  box-shadow: inset 0 0 0 1px rgba(120,90,40,.25),0 1em 1.8em -1em rgba(0,0,0,.45);
}

.uvq08-lgd .mp>svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
}

.uvq08-lgd .rv {
  stroke: #5b9bd5;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
}

.uvq08-lgd .tr {
  stroke: var(--c1);
  stroke-width: 2;
  stroke-dasharray: 5 4;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
}

.uvq08-lgd .sy {
  position: absolute;
  display: grid;
  place-items: center;
  width: 1.55em;
  height: 1.55em;
  translate: -50% -50%;
  border-radius: 50%;
  color: var(--k);
  background: #fffdf6;
  box-shadow: 0 0 0 1.5px var(--k),0 .2em .3em rgba(0,0,0,.25);
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),filter calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq08-lgd .sy svg {
  width: 1em;
  height: 1em;
}

.uvq08-lgd .sy::after {
  content: "";
  position: absolute;
  inset: -.15em;
  border-radius: 50%;
  border: 2px solid var(--k);
  opacity: 0;
}

.uvq08-lgd:has(.lg .wr:is(:hover,:focus-within,.pk)) .sy {
  opacity: .3;
  filter: grayscale(1);
}

.uvq08-lgd:has(.lg0:is(:hover,:focus-within,.pk)) .k0 {
  opacity: 1;
  filter: none;
  transform: scale(1.3);
  z-index: 2;
}

.uvq08-lgd:has(.lg0:is(:hover,:focus-within,.pk)) .k0::after {
  animation: uvq08-lgd-p calc(1.4s / var(--k)) ease-out infinite;
}

.uvq08-lgd:has(.lg1:is(:hover,:focus-within,.pk)) .k1 {
  opacity: 1;
  filter: none;
  transform: scale(1.3);
  z-index: 2;
}

.uvq08-lgd:has(.lg1:is(:hover,:focus-within,.pk)) .k1::after {
  animation: uvq08-lgd-p calc(1.4s / var(--k)) ease-out infinite;
}

.uvq08-lgd:has(.lg2:is(:hover,:focus-within,.pk)) .k2 {
  opacity: 1;
  filter: none;
  transform: scale(1.3);
  z-index: 2;
}

.uvq08-lgd:has(.lg2:is(:hover,:focus-within,.pk)) .k2::after {
  animation: uvq08-lgd-p calc(1.4s / var(--k)) ease-out infinite;
}

.uvq08-lgd:has(.lg3:is(:hover,:focus-within,.pk)) .k3 {
  opacity: 1;
  filter: none;
  transform: scale(1.3);
  z-index: 2;
}

.uvq08-lgd:has(.lg3:is(:hover,:focus-within,.pk)) .k3::after {
  animation: uvq08-lgd-p calc(1.4s / var(--k)) ease-out infinite;
}

.uvq08-lgd .lg {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: .35em;
  margin-top: .6em;
}

.uvq08-lgd .wr {
  position: relative;
  min-width: 0;
}

.uvq08-lgd button {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .25em;
  width: 100%;
  padding: .5em .2em .45em;
  border-radius: .9em;
  font-size: .72em;
  white-space: nowrap;
  font-weight: 650;
  background: color-mix(in srgb,var(--fg) 6%,transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent);
  transition: all calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq08-lgd button svg {
  flex: none;
  width: 1.35em;
  height: 1.35em;
  color: var(--k);
}

.uvq08-lgd button:hover,.uvq08-lgd .wr.pk button {
  background: color-mix(in srgb,var(--k) 14%,transparent);
  box-shadow: inset 0 0 0 1.5px var(--k);
}

.uvq08-lgd button:active {
  transform: scale(.95);
}

.uvq08-lgd button:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

.uvq08-lgd .tt {
  position: absolute;
  left: 50%;
  top: calc(100% + .7em);
  z-index: 3;
  display: grid;
  gap: .1em;
  width: max-content;
  padding: .5em .75em;
  border-radius: .7em;
  font-size: .74em;
  line-height: 1.35;
  color: var(--bg);
  background: var(--fg);
  box-shadow: 0 .8em 1.6em -.6em rgba(0,0,0,.45);
  transform: translate(-50%,-.3em);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq08-lgd .tt::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: .7em;
  height: .7em;
  background: var(--fg);
  transform: translate(-50%,55%) rotate(45deg);
  border-radius: .15em 0 0 0;
}

.uvq08-lgd .tt span {
  opacity: .7;
}

.uvq08-lgd .wr:first-child .tt {
  left: 0;
  transform: translateY(-.3em);
}

.uvq08-lgd .wr:first-child .tt::after {
  left: 1.8em;
}

.uvq08-lgd .wr:last-child .tt {
  left: auto;
  right: 0;
  transform: translateY(-.3em);
}

.uvq08-lgd .wr:last-child .tt::after {
  left: auto;
  right: 1.6em;
  transform: translate(50%,55%) rotate(45deg);
}

.uvq08-lgd .wr:is(:hover,:focus-within,.pk) .tt {
  transform: translate(-50%,0);
  opacity: 1;
  visibility: visible;
}

.uvq08-lgd .wr:is(:first-child,:last-child):is(:hover,:focus-within,.pk) .tt {
  transform: none;
}

@keyframes uvq08-lgd-p {
  0% {
    transform: scale(.9);
    opacity: .9;
  }
  100% {
    transform: scale(2.1);
    opacity: 0;
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq08-lgd,.uvq08-lgd *,.uvq08-lgd *::before,.uvq08-lgd *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const unpk=()=>{el.classList.remove("pk");el.querySelectorAll(".pk").forEach(x=>x.classList.remove("pk"))};el.addEventListener("pointerover",unpk,{once:true});el.addEventListener("focusin",unpk,{once:true});
}

export default function TipMapLegend() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#c2410c",
          "--c2": "#f3ecd9",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq08-lgd"><div className="mp" aria-hidden="true"><svg viewBox="0 0 100 100" preserveAspectRatio="none"><path className="rv" d="M0 80C20 72 30 88 50 82S80 64 100 72" /><path className="tr" d="M18 32C26 22 34 16 40 18S44 36 46 44S58 38 63 34S80 24 86 26M46 44C50 50 52 54 56 56S66 66 72 70M46 44C38 54 32 62 27 72" /></svg><i className="sy k0" style={{ left: "18%", top: "32%", "--k": "#2f855a" } as CSSProperties}><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M3 19L12 5l9 14zM12 5v14M9 19l3-5 3 5" /></svg></i><i className="sy k0" style={{ left: "72%", top: "70%", "--k": "#2f855a" } as CSSProperties}><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M3 19L12 5l9 14zM12 5v14M9 19l3-5 3 5" /></svg></i><i className="sy k1" style={{ left: "40%", top: "18%", "--k": "#b45309" } as CSSProperties}><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><circle cx="7" cy="15" r="3.5" /><circle cx="17" cy="15" r="3.5" /><path d="M10.5 15h3M4.5 12.5L7 6h3l.8 6M19.5 12.5L17 6h-3l-.8 6" /></svg></i><i className="sy k1" style={{ left: "86%", top: "26%", "--k": "#b45309" } as CSSProperties}><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><circle cx="7" cy="15" r="3.5" /><circle cx="17" cy="15" r="3.5" /><path d="M10.5 15h3M4.5 12.5L7 6h3l.8 6M19.5 12.5L17 6h-3l-.8 6" /></svg></i><i className="sy k1" style={{ left: "56%", top: "56%", "--k": "#b45309" } as CSSProperties}><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><circle cx="7" cy="15" r="3.5" /><circle cx="17" cy="15" r="3.5" /><path d="M10.5 15h3M4.5 12.5L7 6h3l.8 6M19.5 12.5L17 6h-3l-.8 6" /></svg></i><i className="sy k2" style={{ left: "27%", top: "72%", "--k": "#2563eb" } as CSSProperties}><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M12 3.5c3.5 4.5 6 7.6 6 10.5a6 6 0 0 1-12 0c0-2.9 2.5-6 6-10.5z" /></svg></i><i className="sy k2" style={{ left: "63%", top: "34%", "--k": "#2563eb" } as CSSProperties}><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M12 3.5c3.5 4.5 6 7.6 6 10.5a6 6 0 0 1-12 0c0-2.9 2.5-6 6-10.5z" /></svg></i><i className="sy k3" style={{ left: "46%", top: "44%", "--k": "#b91c1c" } as CSSProperties}><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M4 11l8-6.5 8 6.5M6 9.5V20h12V9.5M10 20v-5h4v5" /></svg></i></div><div className="lg" role="group" aria-label="Map legend"><span className="wr lg0 pk"><button type="button" style={{ "--k": "#2f855a" } as CSSProperties} aria-describedby="uvq08-lgd-0"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M3 19L12 5l9 14zM12 5v14M9 19l3-5 3 5" /></svg><span>Camping</span></button><span className="tt" role="tooltip" id="uvq08-lgd-0"><b>Camping area</b><span>2 on this route</span></span></span><span className="wr lg1"><button type="button" style={{ "--k": "#b45309" } as CSSProperties} aria-describedby="uvq08-lgd-1"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><circle cx="7" cy="15" r="3.5" /><circle cx="17" cy="15" r="3.5" /><path d="M10.5 15h3M4.5 12.5L7 6h3l.8 6M19.5 12.5L17 6h-3l-.8 6" /></svg><span>Viewpoint</span></button><span className="tt" role="tooltip" id="uvq08-lgd-1"><b>Scenic viewpoint</b><span>3 on this route</span></span></span><span className="wr lg2"><button type="button" style={{ "--k": "#2563eb" } as CSSProperties} aria-describedby="uvq08-lgd-2"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M12 3.5c3.5 4.5 6 7.6 6 10.5a6 6 0 0 1-12 0c0-2.9 2.5-6 6-10.5z" /></svg><span>Spring</span></button><span className="tt" role="tooltip" id="uvq08-lgd-2"><b>Drinking water spring</b><span>2 on this route</span></span></span><span className="wr lg3"><button type="button" style={{ "--k": "#b91c1c" } as CSSProperties} aria-describedby="uvq08-lgd-3"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M4 11l8-6.5 8 6.5M6 9.5V20h12V9.5M10 20v-5h4v5" /></svg><span>Refuge</span></button><span className="tt" role="tooltip" id="uvq08-lgd-3"><b>Mountain hut</b><span>1 on this route</span></span></span></div></div>
      </div>
    </>
  );
}
```

Give me the complete final code, ready to paste, and tell me in one line where to put it in my project.
````
