/**
 * Estilos Frontend — Bersoft Home: Bloque "Explora Makaha" (Categorías Editoriales) — v0.2.4.
 * Preset Editorial Vertical Makaha, Carrusel Móvil de 2 Cards Exactas y Control de Geometría.
 *
 * @package Bersoft_Home
 * @since   0.2.0
 * @version 0.2.4
 */

/* ==========================================================================
   1. ESTRUCTURA BASE Y CONTENEDOR FLUIDO
   ========================================================================== */

.bersoft-explore-section {
	width: 100%;
	background-color: var(--bs-exp-bg, #FFFFFF);
	padding-top: var(--bs-exp-pad-top-d, var(--bs-exp-pad-top, 40px));
	padding-bottom: var(--bs-exp-pad-bottom-d, var(--bs-exp-pad-bottom, 48px));
	box-sizing: border-box;
	contain: layout style;
	overflow: hidden;
}

.bersoft-explore-container {
	width: 100%;
	max-width: var(--bs-exp-max-w, 1420px);
	margin: 0 auto;
	padding-left: var(--bs-exp-pad-left-d, 28px);
	padding-right: var(--bs-exp-pad-right-d, 28px);
	box-sizing: border-box;
}

/* ==========================================================================
   2. CABECERA DE SECCIÓN EDITORIAL & TIPOGRAFÍA RESPONSIVE
   ========================================================================== */

.bersoft-explore-header {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 24px;
	margin-bottom: 36px;
}

.bersoft-explore-header-text {
	max-width: 720px;
}

.bersoft-explore-eyebrow {
	display: inline-block;
	font-family: var(--bs-font-family-body, 'Proxima Nova', 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
	font-size: var(--bs-exp-eyebrow-size-d, 13px);
	font-weight: 700;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--bs-exp-eyebrow-color, #0F4C5C);
	margin-bottom: 10px;
	line-height: 1.2;
}

.bersoft-explore-title {
	font-family: var(--bs-font-family-heading, 'Proxima Nova', 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
	font-size: var(--bs-exp-title-size-d, clamp(28px, 3.4vw, 44px));
	font-weight: var(--bs-exp-title-weight, 800);
	line-height: 1.12;
	letter-spacing: -0.025em;
	color: var(--bs-exp-title-color, #0F172A);
	margin: 0 0 10px 0;
	text-wrap: balance;
}

.bersoft-explore-desc {
	font-family: var(--bs-font-family-body, 'Proxima Nova', 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
	font-size: var(--bs-exp-desc-size-d, clamp(15px, 1.2vw, 17px));
	line-height: 1.55;
	color: var(--bs-exp-desc-color, #475569);
	margin: 0;
	text-wrap: pretty;
}

.bersoft-explore-view-all {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: var(--bs-font-family-body, 'Proxima Nova', 'DM Sans', sans-serif);
	font-size: 14.5px;
	font-weight: 700;
	color: #0F4C5C;
	text-decoration: none;
	padding: 8px 16px;
	border-radius: 6px;
	transition: color 180ms ease, background-color 180ms ease, transform 180ms ease;
	white-space: nowrap;
}

.bersoft-explore-view-all .bersoft-arrow-icon {
	transition: transform 180ms ease;
	display: inline-block;
}

.bersoft-explore-view-all:hover {
	color: #0B3844;
	background-color: rgba(15, 76, 92, 0.07);
}

.bersoft-explore-view-all:hover .bersoft-arrow-icon {
	transform: translateX(4px);
}

/* ==========================================================================
   3. CUADRÍCULA EDITORIAL (CSS GRID) & ASPECT RATIO REAL
   ========================================================================== */

.bersoft-explore-grid {
	display: grid;
	grid-template-columns: repeat(var(--bs-exp-cols-d, 6), 1fr);
	gap: var(--bs-exp-gap-v-d, 16px) var(--bs-exp-gap-h-d, 16px);
	width: 100%;
}

/* Tarjeta Editorial Individual */
.bersoft-explore-card {
	position: relative;
	overflow: hidden;
	border-radius: var(--bs-exp-radius, 10px);
	text-decoration: none;
	display: flex;
	flex-direction: column;
	background-color: #07181F;
	box-sizing: border-box;
	transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 320ms cubic-bezier(0.16, 1, 0.3, 1);
	cursor: pointer;
}

/* Aplicación Estricta de Aspect Ratio Real */
.ratio-editorial_tall .bersoft-explore-card {
	aspect-ratio: 9 / 19;
	height: auto;
	min-height: 480px;
	max-height: 660px;
}

.ratio-3-4 .bersoft-explore-card,
.ratio-3\/4 .bersoft-explore-card {
	aspect-ratio: 3 / 4;
	height: auto;
	min-height: 0;
}

.ratio-4-5 .bersoft-explore-card,
.ratio-4\/5 .bersoft-explore-card {
	aspect-ratio: 4 / 5;
	height: auto;
	min-height: 0;
}

.ratio-1-1 .bersoft-explore-card,
.ratio-1\/1 .bersoft-explore-card {
	aspect-ratio: 1 / 1;
	height: auto;
	min-height: 0;
}

.ratio-custom .bersoft-explore-card {
	height: var(--bs-card-custom-h, var(--bs-exp-h-d, 560px));
	aspect-ratio: auto;
}

.bersoft-explore-card:focus-visible {
	outline: 2px solid #0F4C5C;
	outline-offset: 3px;
}

/* Capa 1: Fotografía de la Categoría */
.bersoft-explore-media {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	z-index: 1;
}

.bersoft-explore-picture,
.bersoft-explore-placeholder {
	width: 100%;
	height: 100%;
	display: block;
}

.bersoft-explore-placeholder {
	background: linear-gradient(135deg, #07181F 0%, #0F4C5C 100%);
}

.bersoft-explore-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: var(--bs-card-pos-d, center center);
	display: block;
	transform: scale(1.0);
	transition: transform 450ms cubic-bezier(0.16, 1, 0.3, 1);
	will-change: transform;
}

/* Hover Sutil de Fotografía */
.bersoft-explore-card:hover .bersoft-explore-img {
	transform: scale(1.032);
}

/* Capa 2: Overlay Gradual para Legibilidad */
.bersoft-explore-overlay {
	position: absolute;
	inset: 0;
	z-index: 2;
	background: linear-gradient(
		0deg,
		rgba(7, 24, 31, var(--bs-card-overlay-op, 0.40)) 0%,
		rgba(7, 24, 31, 0.15) 45%,
		rgba(7, 24, 31, 0) 75%
	);
	pointer-events: none;
	transition: opacity 300ms ease;
}

.bersoft-explore-card:hover .bersoft-explore-overlay {
	opacity: 0.85;
}

/* Capa 3: Contenido Tipográfico */
.bersoft-explore-content {
	position: relative;
	z-index: 3;
	height: 100%;
	padding: 24px 16px;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	color: #FFFFFF;
	transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.bersoft-explore-card:hover .bersoft-explore-content {
	transform: translateY(-3px);
}

/* Badge / Etiqueta */
.bersoft-explore-badge {
	align-self: flex-start;
	background-color: var(--bs-hero-accent, #0F4C5C);
	color: #FFFFFF;
	font-family: var(--bs-font-family-body, 'Proxima Nova', 'DM Sans', sans-serif);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	padding: 3px 8px;
	border-radius: 4px;
	margin-bottom: 8px;
}

/* Título de la Categoría */
.bersoft-explore-card-title {
	font-family: var(--bs-font-family-heading, 'Proxima Nova', 'DM Sans', sans-serif);
	font-size: var(--bs-card-title-size, var(--bs-exp-card-title-size-d, 20px));
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--bs-card-title-color, #FFFFFF);
	line-height: 1.15;
	display: block;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.50);
	word-break: break-word;
}

/* Indicador de Acción (Explorar →) */
.bersoft-explore-action-hint {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-family: var(--bs-font-family-body, 'Proxima Nova', 'DM Sans', sans-serif);
	font-size: 12.5px;
	font-weight: 700;
	color: #E0F2FE;
	margin-top: 6px;
	opacity: 0;
	transform: translateX(-6px);
	transition: opacity 220ms ease, transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.bersoft-explore-card:hover .bersoft-explore-action-hint {
	opacity: 1;
	transform: translateX(0);
}

/* ==========================================================================
   4. ORIENTACIÓN TIPOGRÁFICA VERTICAL (CAPTURA 1 REFERENCIA)
   ========================================================================== */

/* En Desktop (≥ 1024px) */
@media (min-width: 1024px) {
	.layout-editorial_vertical .bersoft-explore-card:not(.pos-bottom_left):not(.pos-bottom_right) .bersoft-explore-content,
	.bersoft-explore-card.pos-vertical_right .bersoft-explore-content {
		justify-content: flex-end;
		align-items: flex-end;
		padding: 24px 14px;
	}

	.layout-editorial_vertical .bersoft-explore-card:not(.pos-bottom_left):not(.pos-bottom_right) .bersoft-explore-card-title,
	.bersoft-explore-card.pos-vertical_right .bersoft-explore-card-title {
		writing-mode: vertical-rl;
		text-orientation: mixed;
		transform: rotate(180deg) translate(var(--bs-card-off-x, 0px), var(--bs-card-off-y, 0px));
		margin-bottom: 0;
		white-space: nowrap;
		letter-spacing: 0.12em;
	}

	.bersoft-explore-card.pos-vertical_left .bersoft-explore-content {
		justify-content: flex-end;
		align-items: flex-start;
		padding: 24px 14px;
	}

	.bersoft-explore-card.pos-vertical_left .bersoft-explore-card-title {
		writing-mode: vertical-rl;
		text-orientation: mixed;
		transform: rotate(180deg) translate(var(--bs-card-off-x, 0px), var(--bs-card-off-y, 0px));
		margin-bottom: 0;
		white-space: nowrap;
		letter-spacing: 0.12em;
	}
}

.bersoft-explore-card.pos-bottom_left .bersoft-explore-content {
	justify-content: flex-end;
	align-items: flex-start;
	text-align: left;
}

.bersoft-explore-card.pos-bottom_right .bersoft-explore-content {
	justify-content: flex-end;
	align-items: flex-end;
	text-align: right;
}

/* ==========================================================================
   5. SPANS INTELIGENTES CONTRA VACÍOS
   ========================================================================== */

.last-row-smart_span .bersoft-explore-card.bersoft-span-2-cols {
	grid-column: span 2;
}

.last-row-smart_span .bersoft-explore-card.bersoft-span-3-cols {
	grid-column: span 3;
}

.last-row-smart_span .bersoft-explore-card.bersoft-span-4-cols {
	grid-column: 1 / -1;
}

.last-row-smart_span .bersoft-explore-card.bersoft-span-half {
	grid-column: span 2;
}

/* ==========================================================================
   6. PAGINACIÓN DE CARRUSEL (RESET ESTRICTO & VISIBILIDAD CONTROLADA)
   ========================================================================== */

/* Oculto por defecto en Desktop y Layouts de Grilla Estática */
.bersoft-explore-carousel-pagination {
	display: none;
}

.bersoft-carousel-dot {
	all: unset;
	box-sizing: border-box;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background-color: #cbd5e1;
	border: none;
	padding: 0;
	margin: 0;
	cursor: pointer;
	transition: all 220ms ease;
	outline: none;
}

.bersoft-carousel-dot.is-active {
	width: 22px;
	border-radius: 4px;
	background-color: var(--bs-exp-eyebrow-color, #0F4C5C);
}

.bersoft-carousel-dot:focus-visible {
	outline: 2px solid #0F4C5C;
	outline-offset: 2px;
}

/* ==========================================================================
   7. RESPONSIVE TABLET (768px - 1023px)
   ========================================================================== */

@media (min-width: 768px) and (max-width: 1023px) {
	.bersoft-explore-section {
		padding-top: var(--bs-exp-pad-top-t, 32px);
		padding-bottom: var(--bs-exp-pad-bottom-t, 36px);
	}
	.bersoft-explore-container {
		padding-left: var(--bs-exp-pad-left-t, 20px);
		padding-right: var(--bs-exp-pad-right-t, 20px);
	}

	.bersoft-explore-eyebrow {
		font-size: var(--bs-exp-eyebrow-size-t, 12px);
	}
	.bersoft-explore-title {
		font-size: var(--bs-exp-title-size-t, 30px);
	}
	.bersoft-explore-desc {
		font-size: var(--bs-exp-desc-size-t, 15px);
	}

	.tab-layout-grid_3col .bersoft-explore-grid {
		grid-template-columns: repeat(3, 1fr);
		gap: var(--bs-exp-gap-t, 14px);
	}
	.tab-layout-grid_2col .bersoft-explore-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: var(--bs-exp-gap-t, 14px);
	}
	.tab-layout-carousel_2 .bersoft-explore-grid {
		display: flex;
		overflow-x: auto;
		overflow-y: hidden;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		gap: var(--bs-exp-gap-t, 14px);
		scrollbar-width: none;
	}
	.tab-layout-carousel_2 .bersoft-explore-grid::-webkit-scrollbar {
		display: none;
	}
	.tab-layout-carousel_2 .bersoft-explore-card {
		flex: 0 0 calc((100% - var(--bs-exp-gap-t, 14px)) / 2);
		min-width: calc((100% - var(--bs-exp-gap-t, 14px)) / 2);
		max-width: calc((100% - var(--bs-exp-gap-t, 14px)) / 2);
		scroll-snap-align: start;
	}

	.tab-layout-carousel_2 .bersoft-explore-carousel-pagination {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 8px;
		margin-top: 18px;
	}

	.bersoft-explore-card {
		height: var(--bs-card-custom-h, var(--bs-exp-h-t, 480px));
		aspect-ratio: auto;
	}
	.bersoft-explore-card-title {
		font-size: var(--bs-card-title-size-t, var(--bs-exp-card-title-size-t, 18px));
	}
	.bersoft-explore-img {
		object-position: var(--bs-card-pos-t, center center);
	}

	/* Decisión de tipografía en tablet */
	.tab-text-horizontal .bersoft-explore-card-title {
		writing-mode: horizontal-tb !important;
		transform: none !important;
		white-space: normal !important;
	}
}

/* ==========================================================================
   8. RESPONSIVE MÓVIL (< 768px): CARRUSEL DE 2 CARDS EXACTAS
   ========================================================================== */

@media (max-width: 767px) {
	.bersoft-explore-section {
		padding-top: var(--bs-exp-pad-top-m, 24px);
		padding-bottom: var(--bs-exp-pad-bottom-m, 28px);
	}
	.bersoft-explore-container {
		padding-left: var(--bs-exp-pad-left-m, var(--bs-exp-pad-m, 18px));
		padding-right: var(--bs-exp-pad-right-m, var(--bs-exp-pad-m, 18px));
	}
	.bersoft-explore-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 16px;
		margin-bottom: 22px;
	}

	.bersoft-explore-eyebrow {
		font-size: var(--bs-exp-eyebrow-size-m, 11px);
	}
	.bersoft-explore-title {
		font-size: var(--bs-exp-title-size-m, 24px);
	}
	.bersoft-explore-desc {
		font-size: var(--bs-exp-desc-size-m, 14px);
	}

	/* PRESET MÓVIL RECOMENDADO: Carrusel Horizontal de 2 Cards Exactas */
	.mob-layout-carousel_2 .bersoft-explore-grid {
		display: flex;
		overflow-x: auto;
		overflow-y: hidden;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		gap: var(--bs-exp-gap-m, 12px);
		padding: 4px 0 14px 0;
		scrollbar-width: none;
	}
	.mob-layout-carousel_2 .bersoft-explore-grid::-webkit-scrollbar {
		display: none;
	}
	.mob-layout-carousel_2 .bersoft-explore-card {
		flex: 0 0 calc((100% - var(--bs-exp-gap-m, 12px)) / 2);
		min-width: calc((100% - var(--bs-exp-gap-m, 12px)) / 2);
		max-width: calc((100% - var(--bs-exp-gap-m, 12px)) / 2);
		scroll-snap-align: start;
		scroll-snap-stop: always;
		aspect-ratio: 3 / 4;
		height: auto;
		min-height: 0;
	}

	/* Paginación por Dots del Carrusel Móvil */
	.mob-layout-carousel_2 .bersoft-explore-carousel-pagination {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 8px;
		margin-top: 14px;
	}

	/* Otros Presets Móviles Alternativos */
	.mob-layout-featured_grid .bersoft-explore-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: var(--bs-exp-gap-m, 12px);
	}
	.mob-layout-featured_grid .bersoft-explore-card {
		height: var(--bs-exp-h-m, 320px);
		aspect-ratio: auto;
	}
	.mob-layout-featured_grid .bersoft-explore-card.is-featured-first {
		grid-column: 1 / -1;
		height: var(--bs-exp-feat-h-m, 440px);
	}

	.mob-layout-grid_2col .bersoft-explore-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: var(--bs-exp-gap-m, 12px);
	}
	.mob-layout-grid_2col .bersoft-explore-card {
		height: var(--bs-exp-h-m, 320px);
		aspect-ratio: auto;
	}

	.mob-layout-grid_1col .bersoft-explore-grid {
		grid-template-columns: 1fr;
		gap: var(--bs-exp-gap-m, 14px);
	}
	.mob-layout-grid_1col .bersoft-explore-card {
		height: var(--bs-exp-feat-h-m, 420px);
		aspect-ratio: auto;
	}

	.bersoft-explore-img {
		object-position: var(--bs-card-pos-m, center center);
	}

	.bersoft-explore-content {
		padding: 16px 12px;
	}

	/* En móvil el texto es HORIZONTAL por defecto para máxima legibilidad */
	.mob-text-horizontal .bersoft-explore-card-title,
	.bersoft-explore-section:not(.mob-text-vertical) .bersoft-explore-card-title {
		writing-mode: horizontal-tb !important;
		transform: none !important;
		white-space: normal !important;
		font-size: var(--bs-card-title-size-m, var(--bs-exp-card-title-size-m, 15px)) !important;
		letter-spacing: 0.04em !important;
		line-height: 1.15 !important;
	}

	.bersoft-explore-action-hint {
		opacity: 1;
		transform: none;
	}
}

/* ==========================================================================
   9. ACCESIBILIDAD — PREFERS-REDUCED-MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	.bersoft-explore-card,
	.bersoft-explore-img,
	.bersoft-explore-content,
	.bersoft-explore-action-hint,
	.bersoft-carousel-dot {
		transition: none !important;
		transform: none !important;
	}
	.bersoft-explore-card:hover .bersoft-explore-img {
		transform: none !important;
	}
}
