/* ==========================================================================
   Amanco 3D Carousel — Frontend Styles  v2.2
   Responsive & mobile mejorado
   ========================================================================== */

/* Wrapper externo */
.a3dc-wrapper {
	position: relative;
	width: 100%;
	max-width: 1100px;
	margin: 0 auto;
	padding: 0 60px 30px;
	box-sizing: border-box;
	font-family: inherit;
	-webkit-user-select: none;
	user-select: none;
	/* Evitar scroll horizontal en mobile */
	overflow: hidden;
}

/* Palco 3D */
.a3dc-stage {
	position: relative;
	width: 100%;
	height: 340px; /* sobrescrito por JS según tamaño real de tarjeta */
	perspective: 1200px;
	perspective-origin: 50% 50%;
	overflow: visible;
}

/* =========================================================================
   Estado inicial: ocultar SOLO los cards y las flechas hasta que JS
   aplique los transforms 3D. El stage y el caption permanecen visibles
   para evitar colapso de layout si JS falla o se retrasa.

   Fallback CSS: si JS no agrega .a3dc-ready en 1.5s, la animación
   revela el carrusel de todas formas.
   ========================================================================= */
@keyframes a3dc-fallback-reveal {
	to { opacity: 1; }
}

.a3dc-track,
.a3dc-nav {
	opacity: 0;
	/* Fallback: revelación automática después de 1.5s */
	animation: a3dc-fallback-reveal 0.35s ease 1.5s forwards;
}

/* Clase añadida por JS — cancela la animación y revela inmediatamente */
.a3dc-wrapper.a3dc-ready .a3dc-track,
.a3dc-wrapper.a3dc-ready .a3dc-nav {
	opacity: 1;
	animation: none;
}

/* Trilho (preserve-3d para efecto de profundidad) */
.a3dc-track {
	position: relative;
	width: 100%;
	height: 100%;
	transform-style: preserve-3d;
}

/* ==========================================================================
   Cards
   ========================================================================== */
.a3dc-item {
	position: absolute;
	top: 50%;
	left: 50%;
	border-radius: 18px;
	overflow: hidden;
	cursor: pointer;
	transform-origin: center center;
	will-change: transform, opacity, z-index;
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
	transition: box-shadow 0.35s ease;
	background: #d9cfc0;
}

.a3dc-item.active {
	cursor: default;
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.30);
}

.a3dc-item:not(.active):hover {
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.a3dc-item img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
	-webkit-user-drag: none;
}

/* Placeholder cuando no hay imagen */
.a3dc-item-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	background: linear-gradient(145deg, #c8bca8, #e0d8cc);
	color: #6b5f52;
	font-size: 15px;
	font-weight: 600;
	text-align: center;
	padding: 20px;
	box-sizing: border-box;
}

/* Link invisible sobre el card activo */
.a3dc-item-link {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: none;
}
.a3dc-item.active .a3dc-item-link {
	display: block;
}

/* ==========================================================================
   Flechas de navegación
   ========================================================================== */
.a3dc-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 200;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	border: none;
	background: var(--a3dc-primary, #004490);
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.20);
	padding: 0;
	flex-shrink: 0;
	/* Tamaño mínimo de touch target */
	min-width: 44px;
	min-height: 44px;
}

.a3dc-nav:hover,
.a3dc-nav:focus {
	background: #0057b8;
	transform: translateY(-50%) scale(1.08);
	outline: none;
}

/* Desktop: flechas fuera del stage */
.a3dc-prev { left: 4px; }
.a3dc-next { right: 4px; }

/* ==========================================================================
   Leyenda (Caption)
   ========================================================================== */
.a3dc-caption {
	text-align: center;
	padding: 28px 20px 10px;
	min-height: 120px;
}

/* El título también es un enlace cuando el ítem tiene URL */
.a3dc-caption-title-link {
	text-decoration: none;
	display: block;
}
.a3dc-caption-title-link:hover .a3dc-caption-title {
	color: var(--a3dc-primary, #004490);
	text-decoration: underline;
}

.a3dc-caption-title {
	margin: 0 0 10px;
	font-size: 22px;
	font-weight: 700;
	color: #1a1a1a;
	line-height: 1.3;
	transition: color 0.2s ease;
}

.a3dc-caption-desc {
	margin: 0 auto 18px;
	font-size: 14px;
	color: #555;
	max-width: 640px;
	line-height: 1.65;
}

.a3dc-caption-btn {
	display: inline-block;
	background: var(--a3dc-primary, #004490);
	color: var(--a3dc-btn-text, #ffffff) !important;
	padding: 10px 28px;
	border-radius: 5px;
	text-decoration: none !important;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.6px;
	text-transform: uppercase;
	transition: background 0.2s ease, transform 0.15s ease;
}

.a3dc-caption-btn:hover {
	background: #0057b8;
	transform: translateY(-1px);
}

/* ==========================================================================
   Bullets
   ========================================================================== */
.a3dc-bullets {
	display: flex;
	justify-content: center;
	align-items: center;
	flex-wrap: wrap;
	gap: 7px;
	list-style: none;
	margin: 12px 0 0;
	padding: 0;
}

.a3dc-bullet {
	display: block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: #c0c0c0;
	border: none;
	padding: 0;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.2s ease;
	/* Touch target suficiente */
	position: relative;
}
.a3dc-bullet::before {
	content: '';
	position: absolute;
	inset: -8px;
}

.a3dc-bullet.active,
.a3dc-bullet:hover {
	background: var(--a3dc-primary, #004490);
	transform: scale(1.35);
}

/* ==========================================================================
   Responsive — Tablet (≤ 900px)
   ========================================================================== */
@media (max-width: 900px) {
	.a3dc-wrapper {
		padding-left: 52px;
		padding-right: 52px;
	}
	.a3dc-caption-title { font-size: 19px; }
}

/* ==========================================================================
   Responsive — Mobile grande (≤ 768px)
   Las flechas se mueven DENTRO del wrapper (posición relativa al borde)
   ========================================================================== */
@media (max-width: 768px) {
	.a3dc-wrapper {
		padding-left: 48px;
		padding-right: 48px;
	}

	/* Flechas dentro del área visible, superpuestas al stage */
	.a3dc-prev {
		left: 2px;
		z-index: 300;
	}
	.a3dc-next {
		right: 2px;
		z-index: 300;
	}

	.a3dc-nav {
		width: 40px;
		height: 40px;
		font-size: 18px;
		opacity: 0.92;
	}

	.a3dc-caption {
		padding-top: 32px;
		min-height: 100px;
	}
	.a3dc-caption-title { font-size: 18px; }
	.a3dc-caption-desc  { font-size: 13px; }
}

/* ==========================================================================
   Responsive — Mobile pequeño (≤ 480px)
   ========================================================================== */
@media (max-width: 480px) {
	.a3dc-wrapper {
		padding-left: 44px;
		padding-right: 44px;
		padding-bottom: 20px;
	}

	.a3dc-nav {
		width: 36px;
		height: 36px;
		font-size: 16px;
	}

	.a3dc-prev { left: 1px; }
	.a3dc-next { right: 1px; }

	/* En pantallas muy pequeñas el ítem activo ocupa casi todo el ancho:
	   reducir border-radius para mejor aprovechamiento del espacio */
	.a3dc-item {
		border-radius: 12px;
	}

	.a3dc-caption {
		padding: 28px 10px 8px;
		min-height: 80px;
	}
	.a3dc-caption-title { font-size: 16px; }
	.a3dc-caption-desc  { font-size: 12px; margin-bottom: 12px; }
	.a3dc-caption-btn   { padding: 9px 20px; font-size: 12px; }
}
