/**
 * Estilos del plugin Tarjetas Hover.
 * Grilla responsive con overlay animado al hover.
 */

/* -------------------------------------------------------------------------
   Grilla responsive
   ------------------------------------------------------------------------- */

.th-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
	width: 100%;
	margin: 0 auto;
}

/* Tablet: 2 columnas */
@media (max-width: 1024px) {
	.th-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 20px;
	}
}

/* Mobile: 1 columna */
@media (max-width: 767px) {
	.th-grid {
		grid-template-columns: 1fr;
		gap: 16px;
	}
}

/* -------------------------------------------------------------------------
   Tarjeta individual
   ------------------------------------------------------------------------- */

.th-card {
	position: relative;
	overflow: hidden;
	border-radius: 8px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.th-card-inner {
	position: relative;
	width: 100%;
	height: var(--th-card-height, 360px);
	overflow: hidden;
}

.th-card-image {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	transition: transform 0.4s ease;
}

.th-card:hover .th-card-image {
	transform: scale(1.05);
}

/* -------------------------------------------------------------------------
   Overlay con animación suave
   ------------------------------------------------------------------------- */

.th-card-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 24px;
	text-align: center;
	background-color: color-mix(
		in srgb,
		var(--th-overlay-color, #000000) calc(var(--th-overlay-opacity, 0.65) * 100%),
		transparent
	);
	color: #ffffff;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.35s ease, visibility 0.35s ease;
}

.th-card:hover .th-card-overlay {
	opacity: 1;
	visibility: visible;
}

.th-card-title {
	margin: 0 0 12px;
	font-size: 1.35rem;
	font-weight: 700;
	line-height: 1.3;
	color: #ffffff;
}

.th-card-text {
	margin: 0 0 16px;
	font-size: 0.95rem;
	line-height: 1.5;
	color: rgba(255, 255, 255, 0.9);
}

.th-card-btn {
	display: inline-block;
	padding: 10px 24px;
	font-size: 0.9rem;
	font-weight: 600;
	text-decoration: none;
	color: #ffffff;
	background-color: transparent;
	border: 2px solid #ffffff;
	border-radius: 4px;
	transition: background-color 0.3s ease, color 0.3s ease;
}

.th-card-btn:hover,
.th-card-btn:focus {
	background-color: #ffffff;
	color: #1a1a1a;
}

/* -------------------------------------------------------------------------
   Mobile: overlay visible por defecto o activado con tap
   ------------------------------------------------------------------------- */

@media (max-width: 767px) {
	.th-card-overlay {
		opacity: 1;
		visibility: visible;
	}

	.th-card--active .th-card-overlay {
		opacity: 1;
		visibility: visible;
	}

	.th-card:not(.th-card--active) .th-card-overlay {
		opacity: 0.85;
		visibility: visible;
	}
}

/* -------------------------------------------------------------------------
   Modal popup
   ------------------------------------------------------------------------- */

.th-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.2s ease, visibility 0.2s ease;
}

.th-modal--open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.th-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.65);
}

.th-modal-dialog {
	position: relative;
	max-width: 720px;
	width: calc(100% - 32px);
	margin: 10vh auto;
	background: #ffffff;
	border-radius: 10px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
	padding: 24px;
	max-height: 80vh;
	overflow: auto;
}

.th-modal-close {
	position: absolute;
	top: 12px;
	right: 12px;
	border: 0;
	background: transparent;
	color: #1a1a1a;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 8px;
}

.th-modal-close:focus {
	outline: 2px solid rgba(0, 0, 0, 0.25);
	outline-offset: 2px;
}

.th-modal-image {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 8px;
	margin-bottom: 16px;
}

.th-modal-title {
	margin: 0 0 12px;
	font-size: 1.35rem;
	font-weight: 700;
	color: #1a1a1a;
}

.th-modal-content {
	color: #1a1a1a;
	line-height: 1.6;
}

.th-modal-content p {
	margin-top: 0;
}

.th-modal-button {
	display: inline-block;
	margin-top: 18px;
	padding: 10px 22px;
	background: #111827;
	color: #ffffff;
	text-decoration: none;
	border-radius: 8px;
	font-weight: 600;
}

.th-modal-button:focus {
	outline: 2px solid rgba(0, 0, 0, 0.25);
	outline-offset: 2px;
}

@media (max-width: 767px) {
	.th-modal-dialog {
		width: calc(100% - 16px);
		margin: 5vh auto;
		padding: 16px;
		max-height: 88vh;
	}
}
