/* Area map on the villa page (villa page spec, M.4 and M.5).
   The frame sets --map-x/--map-y (circle center on the fallback image),
   --map-d (circle diameter) and --map-w/--map-h (image size), all in CSS px. */

.area-map__frame {
  container-type: size;
}

/* Fallback: the region image, moved so the circle sits mid-frame, clamped so
   the image always covers the frame near the region's edges. */
.area-map__fallback {
  position: absolute;
  inset: 0;
  --map-left: clamp(calc(100cqw - var(--map-w)), calc(50cqw - var(--map-x)), 0px);
  --map-top: clamp(calc(100cqh - var(--map-h)), calc(50cqh - var(--map-y)), 0px);
}

.area-map__image {
  position: absolute;
  left: var(--map-left);
  top: var(--map-top);
  width: var(--map-w);
  height: var(--map-h);
  max-width: none;
  user-select: none;
}

.area-map__circle {
  border: 1px solid #b9986d;
  border-radius: 9999px;
  background: rgb(185 152 109 / 0.15);
  position: absolute;
  left: calc(var(--map-left) + var(--map-x));
  top: calc(var(--map-top) + var(--map-y));
  width: var(--map-d);
  height: var(--map-d);
  transform: translate(-50%, -50%);
}

/* The live map fades in over the fallback once its first frame is drawn. */
.area-map__canvas {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 600ms ease;
}

.area-map__canvas.is-ready {
  opacity: 1;
}

.area-map__canvas .maplibregl-canvas {
  outline: none;
}

/* Cooperative gestures hint, in the site's label face. */
.area-map .maplibregl-cooperative-gesture-screen {
  background: rgb(16 20 19 / 0.72);
  color: #f4efe6;
  font-family: "Barlow", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
}

/* Zoom controls, as on the jungle-dusk prototype: charcoal with an ivory/20 border. */
.area-map__zoom {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  margin: 0;
}

.area-map__zoom[hidden] {
  display: none;
}

.area-map .maplibregl-ctrl-group {
  background: #1c211f;
  border: 1px solid rgb(244 239 230 / 0.2);
  border-radius: 0;
  box-shadow: none;
}

.area-map .maplibregl-ctrl-group button {
  width: 2.25rem;
  height: 2.25rem;
}

.area-map .maplibregl-ctrl-group button + button {
  border-top: 1px solid rgb(244 239 230 / 0.15);
}

.area-map .maplibregl-ctrl-group button:hover {
  background-color: rgb(244 239 230 / 0.06);
}

.area-map .maplibregl-ctrl-group button:focus-visible {
  outline: 1px solid #b9986d;
  outline-offset: -3px;
  box-shadow: none;
}

.area-map .maplibregl-ctrl button .maplibregl-ctrl-icon {
  filter: invert(1) brightness(1.4);
}

.area-map__credit {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  margin: 0;
  padding: 0.25rem 0.625rem;
  background: rgb(16 20 19 / 0.72);
  color: rgb(244 239 230 / 0.7);
  font-family: "Barlow", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
}

.area-map__credit a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgb(244 239 230 / 0.3);
  text-underline-offset: 2px;
}

.area-map__credit a:hover {
  color: #b9986d;
}

@media (prefers-reduced-motion: reduce) {
  .area-map__canvas {
    transition: none;
  }
}
