/* ============================================================
   VAB Image Hotspots — Frontend
   Variables por instancia:
   --vab-dot, --vab-accent, --vab-num, --vab-modal-w
   ============================================================ */

.vab-hotspots {
	--vab-dot: #ffffff;
	--vab-accent: #e2483d;
	--vab-num: var(--vab-accent);
	--vab-modal-w: 420px;
	display: block;
	width: 100%;
	max-width: 100%;
	margin: 0 auto;
}

.vab-hotspots__frame {
	position: relative;
	display: block;
	line-height: 0;
}

.vab-hotspots__bg {
	display: block;
	width: 100%;
	height: auto;
	border-radius: inherit;
}

/* ---------- Marca: punto numerado + etiqueta ---------- */

.vab-hotspots__pin {
	position: absolute;
	transform: translate(-50%, -50%);
	width: 24px;
	height: 24px;
	padding: 0;
	margin: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
	z-index: 3;
	-webkit-appearance: none;
	appearance: none;
}

.vab-size-sm .vab-hotspots__pin { width: 20px; height: 20px; }
.vab-size-lg .vab-hotspots__pin { width: 32px; height: 32px; }

.vab-hotspots__dot {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	background: var(--vab-dot);
	border: 2px solid var(--vab-accent);
	box-shadow: 0 1px 4px rgba( 0, 0, 0, 0.35 );
	color: var(--vab-num);
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	z-index: 1;
	transition: transform 0.15s ease;
}

.vab-size-sm .vab-hotspots__dot { font-size: 10px; }
.vab-size-lg .vab-hotspots__dot { font-size: 15px; }

/* Anillo pulsante (detrás del punto) */
.vab-hotspots__dot::after {
	content: "";
	position: absolute;
	inset: -2px;
	border-radius: 50%;
	border: 2px solid var(--vab-accent);
	z-index: -1;
	animation: vab-pulse 2s ease-out infinite;
}

@keyframes vab-pulse {
	0%   { transform: scale( 0.9 ); opacity: 0.8; }
	70%  { transform: scale( 2.2 ); opacity: 0; }
	100% { transform: scale( 2.2 ); opacity: 0; }
}

/* Etiqueta con el título al lado del punto */
.vab-hotspots__label {
	position: absolute;
	top: 50%;
	left: calc( 100% + 8px );
	transform: translateY( -50% );
	white-space: nowrap;
	max-width: 220px;
	overflow: hidden;
	text-overflow: ellipsis;
	background: rgba( 17, 20, 24, 0.78 );
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	padding: 4px 9px;
	border-radius: 6px;
	pointer-events: none;
	box-shadow: 0 2px 6px rgba( 0, 0, 0, 0.25 );
	transition: opacity 0.15s ease, visibility 0.15s ease;
}

.vab-hotspots__pin.is-flip .vab-hotspots__label {
	left: auto;
	right: calc( 100% + 8px );
}

/* Modo "solo al pasar el ratón": oculta hasta hover o foco por teclado */
.vab-label-hover .vab-hotspots__label {
	opacity: 0;
	visibility: hidden;
}

.vab-label-hover .vab-hotspots__pin:hover .vab-hotspots__label,
.vab-label-hover .vab-hotspots__pin:focus-visible .vab-hotspots__label {
	opacity: 1;
	visibility: visible;
}

/* Modo "visible, oculto en móvil": las etiquetas se ocultan en pantallas
   pequeñas para que no se amontonen sobre la imagen. */
@media ( max-width: 767px ) {
	.vab-label-hide_mobile .vab-hotspots__label {
		display: none;
	}
}

.vab-hotspots__pin:hover .vab-hotspots__dot,
.vab-hotspots__pin:focus-visible .vab-hotspots__dot {
	transform: scale( 1.18 );
}

.vab-hotspots__pin:focus-visible {
	outline: none;
}

.vab-hotspots__pin:focus-visible .vab-hotspots__dot {
	box-shadow: 0 0 0 3px rgba( 255, 255, 255, 0.9 ), 0 0 0 6px var(--vab-accent);
}

.vab-hotspots__tpl { display: none; }

/* ---------- Leyenda inferior ---------- */

.vab-hotspots__legend {
	list-style: none;
	margin: 14px 0 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.vab-hotspots__legend-row { margin: 0; padding: 0; }

.vab-hotspots__legend-item {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	border: 1px solid rgba( 0, 0, 0, 0.12 );
	background: #fff;
	border-radius: 999px;
	padding: 5px 14px 5px 5px;
	margin: 0;
	cursor: pointer;
	font: inherit;
	color: inherit;
	line-height: 1.2;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.vab-hotspots__legend-item:hover {
	border-color: var(--vab-accent);
	box-shadow: 0 2px 8px rgba( 0, 0, 0, 0.08 );
}

.vab-hotspots__legend-item:focus-visible {
	outline: none;
	border-color: var(--vab-accent);
	box-shadow: 0 0 0 3px rgba( 226, 72, 61, 0.25 );
}

.vab-hotspots__legend-num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--vab-accent);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	flex: 0 0 auto;
}

.vab-hotspots__legend-title { font-size: 14px; }

/* ---------- Modal tipo tarjeta ---------- */

.vab-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.vab-modal.is-open { display: flex; }

.vab-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba( 15, 18, 22, 0.62 );
	backdrop-filter: blur( 2px );
}

.vab-modal__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: var(--vab-modal-w, 420px);
	max-height: calc( 100vh - 40px );
	overflow: hidden;
	background: #fff;
	color: #1d2327;
	border-radius: 14px;
	box-shadow: 0 24px 60px rgba( 0, 0, 0, 0.3 );
	padding: 0;
	animation: vab-modal-in 0.18s ease-out;
}

/* Contenedor flex: la imagen queda fija arriba y el contenido hace scroll */
.vab-modal__body {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
	overflow: hidden;
}

@keyframes vab-modal-in {
	from { transform: translateY( 12px ); opacity: 0; }
	to   { transform: translateY( 0 ); opacity: 1; }
}

.vab-modal__close {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 50%;
	background: rgba( 0, 0, 0, 0.45 );
	font-size: 22px;
	line-height: 1;
	color: #fff;
	cursor: pointer;
	z-index: 2;
}

.vab-modal__close:hover,
.vab-modal__close:focus-visible {
	background: rgba( 0, 0, 0, 0.7 );
	outline: none;
}

/* Imagen reducida, encabezando la tarjeta */
/* Imagen del modal con proporción fija (sin deformar) */
.vab-modal__media {
	position: relative;
	flex: 0 0 auto;
	width: 100%;
	margin: 0;
	overflow: hidden;
	line-height: 0;
	background: #f0f0f1;
}

.vab-modal__media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.vab-media-16x9 { padding-top: 56.25%; }   /* 16:9 */
.vab-media-4x3  { padding-top: 75%; }       /* 4:3  */
.vab-media-1x1  { padding-top: 100%; }      /* 1:1  */

/* "Original": respeta la proporción real de la imagen, sin recorte */
.vab-media-orig { padding-top: 0; }
.vab-media-orig img {
	position: static;
	height: auto;
	object-fit: initial;
}

.vab-modal__content {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	padding: 18px 20px 22px;
}

.vab-modal__title {
	margin: 0 0 8px;
	padding-right: 24px;
	font-size: 1.15em;
	line-height: 1.25;
}

.vab-modal__text {
	font-size: 0.9em;
	line-height: 1.55;
	color: #3c434a;
}

.vab-modal__text :first-child { margin-top: 0; }
.vab-modal__text :last-child { margin-bottom: 0; }
.vab-modal__text p { margin: 0 0 0.7em; }
.vab-modal__text ul,
.vab-modal__text ol { margin: 0 0 0.7em; padding-left: 1.4em; }
.vab-modal__text li { margin: 0 0 0.25em; }
.vab-modal__text a { color: var(--vab-accent); text-decoration: underline; }
.vab-modal__text strong { font-weight: 700; }

body.vab-modal-open { overflow: hidden; }

/* ---------- Responsive ---------- */

@media ( max-width: 600px ) {
	.vab-modal { padding: 0; align-items: flex-end; }
	.vab-modal__dialog {
		max-width: 100%;
		max-height: 90vh;
		border-radius: 16px 16px 0 0;
	}
	.vab-hotspots__label { font-size: 12px; max-width: 150px; }
}

/* ---------- Movimiento reducido ---------- */

@media ( prefers-reduced-motion: reduce ) {
	.vab-hotspots__dot::after { animation: none; }
	.vab-modal__dialog { animation: none; }
}
