/**
 * Grid bento de entradas — Byomedic Blocs
 */

/* Elementor encoge el widget si el contenido no tiene ancho intrínseco */
.elementor-widget-byomedic_posts_bento,
.elementor-widget-byomedic_posts_bento > .elementor-widget-container,
.byomedic-bento-elementor-widget,
.byomedic-bento-elementor-widget > .elementor-widget-container {
	width: 100% !important;
	max-width: 100%;
	align-self: stretch;
	flex: 1 1 100%;
}

.e-con .elementor-widget-byomedic_posts_bento {
	flex-grow: 1;
}

.byomedic-bento {
	--byomedic-bento-gap: 12px;
	--byomedic-bento-radius: 16px;
	--byomedic-bento-min-height: 440px;
	--byomedic-bento-overlay: 0.55;
	box-sizing: border-box;
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	grid-template-rows: repeat(2, minmax(0, 1fr));
	gap: var(--byomedic-bento-gap);
	width: 100%;
	max-width: 100%;
	height: var(--byomedic-bento-min-height);
	min-height: var(--byomedic-bento-min-height);
}

.byomedic-bento--empty {
	display: block;
	min-height: 0;
	padding: 1rem;
	text-align: center;
	color: #666;
}

.byomedic-bento__card {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	min-width: 0;
	min-height: 0;
	align-self: stretch;
	justify-self: stretch;
	overflow: hidden;
	border-radius: var(--byomedic-bento-radius);
	text-decoration: none;
	color: #fff;
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.byomedic-bento__card:hover,
.byomedic-bento__card:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.byomedic-bento__card:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

/* Posiciones bento (4 entradas) */
.byomedic-bento__card--1 {
	grid-column: 1;
	grid-row: 1 / 3;
}

.byomedic-bento__card--2 {
	grid-column: 2;
	grid-row: 1;
}

.byomedic-bento__card--3 {
	grid-column: 3;
	grid-row: 1;
}

.byomedic-bento__card--4 {
	grid-column: 2 / 4;
	grid-row: 2;
}

.byomedic-bento__media,
.byomedic-bento__overlay,
.byomedic-bento__content {
	position: absolute;
	inset: 0;
}

.byomedic-bento__media {
	z-index: 0;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	transition: transform 0.4s ease;
}

.byomedic-bento__card:hover .byomedic-bento__media,
.byomedic-bento__card:focus-visible .byomedic-bento__media {
	transform: scale(1.04);
}

.byomedic-bento__overlay {
	z-index: 1;
	background: linear-gradient(
		180deg,
		rgba(0, 0, 0, 0.05) 0%,
		rgba(0, 0, 0, calc(var(--byomedic-bento-overlay) * 0.45)) 45%,
		rgba(0, 0, 0, var(--byomedic-bento-overlay)) 100%
	);
	pointer-events: none;
}

.byomedic-bento__content {
	inset: auto 0 0 0;
	height: auto;
	z-index: 2;
	padding: 1.25rem 1.5rem 1.5rem;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.byomedic-bento__title {
	font-family: Georgia, "Times New Roman", Times, serif;
	font-size: clamp(1.35rem, 2.2vw, 2rem);
	font-weight: 400;
	line-height: 1.15;
	letter-spacing: 0.01em;
}

.byomedic-bento__excerpt {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	font-size: clamp(0.8rem, 1.1vw, 0.95rem);
	line-height: 1.45;
	opacity: 0.92;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Menos de 4 entradas */
.byomedic-bento--count-1,
.byomedic-bento--count-2,
.byomedic-bento--count-3 {
	grid-template-columns: 1fr;
	grid-template-rows: auto;
	height: auto;
	min-height: 0;
}

.byomedic-bento--count-1 .byomedic-bento__card,
.byomedic-bento--count-2 .byomedic-bento__card,
.byomedic-bento--count-3 .byomedic-bento__card {
	grid-column: 1 !important;
	grid-row: auto !important;
	height: auto;
	min-height: 260px;
}

/* Tablet */
@media (max-width: 1024px) {
	.byomedic-bento:not(.byomedic-bento--count-1):not(.byomedic-bento--count-2):not(.byomedic-bento--count-3) {
		grid-template-columns: 1fr 1fr;
		grid-template-rows: 360px 170px 200px;
		height: auto;
		min-height: 0;
	}

	.byomedic-bento:not(.byomedic-bento--count-1):not(.byomedic-bento--count-2):not(.byomedic-bento--count-3) .byomedic-bento__card--1 {
		grid-column: 1;
		grid-row: 1 / 3;
	}

	.byomedic-bento:not(.byomedic-bento--count-1):not(.byomedic-bento--count-2):not(.byomedic-bento--count-3) .byomedic-bento__card--2 {
		grid-column: 2;
		grid-row: 1;
	}

	.byomedic-bento:not(.byomedic-bento--count-1):not(.byomedic-bento--count-2):not(.byomedic-bento--count-3) .byomedic-bento__card--3 {
		grid-column: 2;
		grid-row: 2;
	}

	.byomedic-bento:not(.byomedic-bento--count-1):not(.byomedic-bento--count-2):not(.byomedic-bento--count-3) .byomedic-bento__card--4 {
		grid-column: 1 / 3;
		grid-row: 3;
	}
}

/* Móvil */
@media (max-width: 767px) {
	.byomedic-bento:not(.byomedic-bento--count-1):not(.byomedic-bento--count-2):not(.byomedic-bento--count-3) {
		grid-template-columns: 1fr;
		grid-template-rows: repeat(4, minmax(220px, auto));
		height: auto;
		min-height: 0;
		gap: 10px;
	}

	.byomedic-bento__card,
	.byomedic-bento__card--1,
	.byomedic-bento__card--2,
	.byomedic-bento__card--3,
	.byomedic-bento__card--4 {
		grid-column: 1 !important;
		grid-row: auto !important;
		min-height: 220px;
	}

	.byomedic-bento__content {
		padding: 0.9rem 1rem 1.1rem;
	}

	.byomedic-bento--count-1 .byomedic-bento__card,
	.byomedic-bento--count-2 .byomedic-bento__card,
	.byomedic-bento--count-3 .byomedic-bento__card {
		min-height: 220px;
	}
}
