/**
 * Image Hotspot — front-end styles.
 * Shared with the admin editor so the editor is a true WYSIWYG preview.
 */

.ihs-map {
	--ihs-color: #2563eb;
	--ihs-pin-size: 26px;
	--ihs-shift: 0px;
	margin: 0 auto 1.5em;
	max-width: 100%;
}

.ihs-map__frame {
	position: relative;
	display: block;
	line-height: 0;
	overflow: visible;
}

.ihs-map__image {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
	border-radius: 4px;
}

.ihs-map__layer {
	position: absolute;
	inset: 0;
	line-height: normal;
}

/* ---------- Hotspots ---------- */

.ihs-hs {
	position: absolute;
	z-index: 2;
}

.ihs-hs--pin {
	width: var(--ihs-pin-size);
	height: var(--ihs-pin-size);
	transform: translate(-50%, -50%);
}

.ihs-hs__target {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.ihs-hs__target:focus-visible {
	outline: 2px solid #111;
	outline-offset: 3px;
}

/* Pin marker. */
.ihs-hs--pin .ihs-hs__target {
	position: relative;
	border-radius: 50%;
	background: var(--ihs-color);
	border: 3px solid #fff;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
	transition: transform 0.15s ease;
}

.ihs-hs--pin .ihs-hs__target:hover,
.ihs-hs--pin.is-open .ihs-hs__target {
	transform: scale(1.15);
}

/* Pulse ring. */
.ihs-map.is-pulsing .ihs-hs--pin .ihs-hs__target::after {
	content: "";
	position: absolute;
	inset: -3px;
	border-radius: 50%;
	border: 2px solid var(--ihs-color);
	animation: ihs-pulse 2s ease-out infinite;
	pointer-events: none;
}

@keyframes ihs-pulse {
	0%   { transform: scale(1);   opacity: 0.8; }
	70%  { transform: scale(1.9); opacity: 0; }
	100% { transform: scale(1.9); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.ihs-map.is-pulsing .ihs-hs--pin .ihs-hs__target::after {
		animation: none;
	}
}

/* Shapes (circle + rectangle). */
.ihs-hs--circle .ihs-hs__target,
.ihs-hs--rect .ihs-hs__target {
	position: relative;
	border: 2px solid var(--ihs-color);
	border-radius: 4px;
	transition: box-shadow 0.15s ease;
}

.ihs-hs--circle .ihs-hs__target {
	border-radius: 50%;
}

.ihs-hs--circle .ihs-hs__target::before,
.ihs-hs--rect .ihs-hs__target::before {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--ihs-color);
	opacity: 0.22;
	border-radius: inherit;
	transition: opacity 0.15s ease;
}

.ihs-hs--circle .ihs-hs__target:hover::before,
.ihs-hs--rect .ihs-hs__target:hover::before,
.ihs-hs.is-open .ihs-hs__target::before {
	opacity: 0.4;
}

/* ---------- Tooltip ---------- */

.ihs-tip {
	position: absolute;
	z-index: 10;
	left: 50%;
	bottom: calc(100% + 14px);
	transform: translateX(calc(-50% + var(--ihs-shift)));
	width: max-content;
	max-width: min(280px, 70vw);
	padding: 14px 16px;
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
	font-size: 14px;
	line-height: 1.5;
	text-align: start;
	cursor: default;
}

.ihs-tip[hidden] {
	display: none !important;
}

.ihs-hs--circle .ihs-tip,
.ihs-hs--rect .ihs-tip {
	bottom: calc(100% + 10px);
}

.ihs-tip.is-below {
	bottom: auto;
	top: calc(100% + 14px);
}

.ihs-map--dark .ihs-tip {
	background: #1f2430;
	color: #f3f4f6;
}

.ihs-map--light .ihs-tip {
	background: #ffffff;
	color: #1f2430;
	border: 1px solid #e5e7eb;
}

.ihs-tip__title {
	margin: 0 0 6px;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	color: inherit;
}

.ihs-tip__text {
	margin: 0;
	color: inherit;
	opacity: 0.9;
}

.ihs-tip__text p {
	margin: 0 0 8px;
}

.ihs-tip__text p:last-child {
	margin-bottom: 0;
}

.ihs-tip__link {
	display: inline-block;
	margin-top: 10px;
	font-weight: 600;
	color: var(--ihs-color);
	text-decoration: none;
}

.ihs-tip__link:hover,
.ihs-tip__link:focus {
	text-decoration: underline;
}

.ihs-tip__close {
	position: absolute;
	top: 4px;
	inset-inline-end: 6px;
	width: 22px;
	height: 22px;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	opacity: 0.55;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
}

.ihs-tip__close:hover {
	opacity: 1;
}

.ihs-tip__arrow {
	position: absolute;
	top: 100%;
	left: calc(50% - var(--ihs-shift));
	width: 12px;
	height: 12px;
	margin-left: -6px;
	background: inherit;
	border: inherit;
	border-top: 0;
	border-left: 0;
	transform: rotate(45deg);
	margin-top: -6px;
}

.ihs-tip.is-below .ihs-tip__arrow {
	top: auto;
	bottom: 100%;
	margin-top: 0;
	margin-bottom: -6px;
	border: inherit;
	border-bottom: 0;
	border-right: 0;
}

/* Screen-reader helper (fallback when the theme does not provide one). */
.ihs-map .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Small screens: pins stay tappable. */
@media (max-width: 600px) {
	.ihs-map {
		--ihs-pin-size: 30px;
	}
}
