/* Reef Trust programs map.*/

.reef-map {
  --reef-pin-size: 4.6%;   /* marker diameter as % of map width */
  --reef-accent: #007096; /* DCCEEW heading and link colour */
  max-width: 1100px;
  margin: 0 auto;
}

.reef-map__stage {
  position: relative;
}

.reef-map__base {
  display: block;
  width: 100%;
}

.reef-map__pins {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Pin */
.reef-map__pin {
  position: absolute;
  left: var(--pin-left);
  top: var(--pin-top);
  width: var(--reef-pin-size);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
}

.reef-map__pin--open {
  z-index: 20;
}

.reef-map__marker {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.reef-map__marker:hover,
.reef-map__marker[aria-expanded="true"] {
  transform: scale(1.12);
}

.reef-map__marker:focus-visible {
  outline: 3px solid var(--reef-accent);
  outline-offset: 3px;
}

.reef-map__icon {
  display: block;
  width: 100%;
}

/* Popup, to the right of the marker with an arrow pointing back at it */
.reef-map__popup {
  position: absolute;
  left: calc(100% + 18px);
  top: 50%;
  transform: translateY(calc(-50% + var(--popup-shift, 0px)));
  width: 480px;
  padding: 1.25rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.22);
  font-size: 0.95rem;
  line-height: 1.5;
}

.reef-map__popup::before {
  content: "";
  position: absolute;
  top: calc(50% - var(--popup-shift, 0px));
  left: -14px;
  margin-top: -14px;
  border: 14px solid transparent;
  border-left: 0;
  border-right-color: #fff;
}

/* Flipped to the left when it would overflow the right edge */
.reef-map__pin--flip .reef-map__popup {
  left: auto;
  right: calc(100% + 18px);
}

.reef-map__pin--flip .reef-map__popup::before {
  left: auto;
  right: -14px;
  border: 14px solid transparent;
  border-right: 0;
  border-left-color: #fff;
}

.reef-map__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.reef-map__close:hover,
.reef-map__close:focus-visible {
  background: #eef4f4;
  outline: 2px solid var(--reef-accent);
}

.reef-map__popup-title {
  margin: 0 2rem 0.75rem 0;
  font-size: 1.1rem;
  line-height: 1.3;
  color: var(--reef-accent);
}

/* Thumbnail on the right with the text wrapping around it, like the Murray-Darling map */
.reef-map__popup figure {
  float: right;
  width: 200px;
  max-width: 50%;
  margin: 0.25rem 0 0.5rem 1rem;
}

/* Same crop for every photo, so portrait and square photos look alike */
.reef-map__popup figure img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 4px;
}

/* Keeps the floated thumbnail inside the popup */
.reef-map__body {
  display: flow-root;
}

.reef-map__body p {
  margin: 0 0 0.6rem;
}

/* Set the bullets explicitly, so theme list styles can't hide them */
.reef-map__body ul {
  margin: 0 0 0.6rem 1.25rem;
  padding: 0;
  list-style-type: disc;
}

.reef-map__more {
  margin: 0.5rem 0 0;
  font-weight: 600;
}

/* Popup below the marker. Used on phones */
.reef-map__pin--below .reef-map__popup {
  top: calc(100% + 14px);
  left: 50%;
  box-sizing: border-box;
  width: calc(100vw - 2rem);
  max-width: 480px;
  transform: translateX(calc(-50% + var(--popup-shift-x, 0px)));
}

/* Arrow on the top edge, pointing up at the marker */
.reef-map__pin--below .reef-map__popup::before {
  top: -14px;
  left: calc(50% - var(--popup-shift-x, 0px));
  margin-top: 0;
  margin-left: -14px;
  border: 14px solid transparent;
  border-top: 0;
  border-bottom-color: #fff;
}

/* Popup above the marker, when it doesn't fit below */
.reef-map__pin--above .reef-map__popup {
  top: auto;
  bottom: calc(100% + 14px);
}

/* Arrow on the bottom edge when the popup is above the marker */
.reef-map__pin--above .reef-map__popup::before {
  top: auto;
  bottom: -14px;
  border: 14px solid transparent;
  border-bottom: 0;
  border-top-color: #fff;
}

/* Screen-reader-only text: what the marker icon colours mean */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
