/* Casos de Éxito — todo va prefijado con .ce-wrap para ganarle a los estilos del tema. */
.ce-wrap {
	--ce-gap: clamp(12px, 2.5vw, 28px);
	--ce-radius: 14px;
	--ce-ratio: 4 / 3;
	--ce-accent: #111;
	--ce-accent-text: #fff;
	--ce-card-bg: #fff;
	--ce-muted: #6b7280;
	container-type: inline-size;
	width: 100%;
}

/* ---------- Filtros: fila deslizable en móvil, centrada en pantallas anchas ---------- */
.ce-wrap .ce-filters {
	position: relative;
	display: flex;
	gap: 8px;
	margin: 0 0 var(--ce-gap);
	padding: 4px 2px;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x proximity;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}
.ce-wrap .ce-filters::-webkit-scrollbar { display: none; }
@container (min-width: 720px) {
	.ce-wrap .ce-filters { flex-wrap: wrap; justify-content: center; overflow: visible; }
}

.ce-wrap .ce-filter,
.ce-wrap .ce-filter:hover,
.ce-wrap .ce-filter:focus {
	flex: 0 0 auto;
	min-height: 44px;
	margin: 0;
	padding: 0 18px;
	border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
	border-radius: 999px;
	background: transparent;
	box-shadow: none;
	color: inherit;
	font: inherit;
	font-size: 0.9375rem;
	line-height: 1;
	letter-spacing: normal;
	text-transform: none;
	white-space: nowrap;
	cursor: pointer;
	scroll-snap-align: start;
	transition: background-color 0.2s, color 0.2s, border-color 0.2s;
	-webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
	.ce-wrap .ce-filter:hover { border-color: currentColor; }
}
.ce-wrap .ce-filter[aria-pressed="true"] {
	background: var(--ce-accent);
	border-color: var(--ce-accent);
	color: var(--ce-accent-text);
}

/* ---------- Grid: se adapta al ancho del contenedor, sin JS ni media queries ---------- */
.ce-wrap .ce-grid {
	display: grid;
	gap: var(--ce-gap);
	grid-template-columns: repeat(
		auto-fill,
		minmax(min(100%, max(200px, (100% - (var(--ce-cols) - 1) * var(--ce-gap)) / var(--ce-cols))), 1fr)
	);
}

.ce-wrap .ce-card { min-width: 0; margin: 0; }
.ce-wrap .ce-card[hidden] { display: none; }

.ce-wrap .ce-card__link {
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
	border-radius: var(--ce-radius);
	background: var(--ce-card-bg);
	box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 4px 16px rgb(0 0 0 / 0.06);
	color: inherit;
	text-decoration: none;
	transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.35s;
	-webkit-tap-highlight-color: transparent;
}
.ce-wrap a.ce-card__link:active { transform: scale(0.985); }
@media (hover: hover) {
	.ce-wrap a.ce-card__link:hover {
		transform: translateY(-4px);
		box-shadow: 0 2px 4px rgb(0 0 0 / 0.06), 0 14px 32px rgb(0 0 0 / 0.12);
	}
}
.ce-wrap .ce-card__link:focus-visible,
.ce-wrap .ce-filter:focus-visible,
.ce-wrap .ce-more:focus-visible {
	outline: 2px solid var(--ce-accent);
	outline-offset: 3px;
}

.ce-wrap .ce-card__media {
	position: relative;
	display: block;
	aspect-ratio: var(--ce-ratio);
	overflow: hidden;
	background: #eef0f3;
}
.ce-wrap .ce-card__img {
	display: block;
	width: 100%;
	max-width: none;
	height: 100%;
	margin: 0;
	object-fit: cover;
	transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@media (hover: hover) {
	.ce-efecto-zoom .ce-card__link:hover .ce-card__img { transform: scale(1.05); }
}
/* Efecto "scroll": recorre capturas largas de sitios web al pasar el mouse. */
.ce-efecto-scroll .ce-card__img {
	object-position: 50% 0;
	transition: object-position 3s ease-in-out;
}
@media (hover: hover) {
	.ce-efecto-scroll .ce-card__link:hover .ce-card__img { object-position: 50% 100%; }
}

.ce-wrap .ce-card__play {
	position: absolute;
	inset: 0;
	width: 60px;
	height: 60px;
	margin: auto;
	border-radius: 50%;
	background: rgb(0 0 0 / 0.55);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
}
.ce-wrap .ce-card__play::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 54%;
	border-style: solid;
	border-width: 10px 0 10px 16px;
	border-color: transparent transparent transparent #fff;
	transform: translate(-50%, -50%);
}

.ce-wrap .ce-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 6px;
	padding: 18px 20px 20px;
}
.ce-wrap .ce-card__result {
	align-self: flex-start;
	padding: 4px 10px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--ce-accent) 10%, transparent);
	color: var(--ce-accent);
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1.3;
}
.ce-wrap .ce-card__title {
	margin: 0;
	padding: 0;
	color: inherit;
	font-size: clamp(1rem, 0.95rem + 0.3vw, 1.2rem);
	font-weight: 700;
	line-height: 1.3;
	overflow-wrap: anywhere;
}
.ce-wrap .ce-card__meta { color: var(--ce-muted); font-size: 0.85rem; line-height: 1.4; }
.ce-wrap .ce-card__cta {
	margin-top: auto;
	padding-top: 6px;
	color: var(--ce-accent);
	font-size: 0.875rem;
	font-weight: 600;
}
.ce-wrap .ce-card__cta::after { content: " →"; }

/* ---------- Ver más ---------- */
.ce-wrap .ce-more-wrap { display: flex; justify-content: center; margin-top: var(--ce-gap); }
.ce-wrap .ce-more-wrap[hidden] { display: none; }
.ce-wrap .ce-more,
.ce-wrap .ce-more:hover,
.ce-wrap .ce-more:focus {
	min-height: 48px;
	padding: 0 28px;
	border: 0;
	border-radius: 999px;
	background: var(--ce-accent);
	box-shadow: none;
	color: var(--ce-accent-text);
	font: inherit;
	font-weight: 600;
	text-transform: none;
	cursor: pointer;
}
@container (max-width: 480px) {
	.ce-wrap .ce-more { width: 100%; }
}

.ce-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* ---------- Lightbox (<dialog> nativo) ---------- */
html:has(.ce-modal[open]) { overflow: hidden; }

.ce-modal {
	width: min(1100px, 94vw);
	max-width: none;
	max-height: none;
	padding: 0;
	border: 0;
	border-radius: 14px;
	background: #000;
	color: #fff;
	overflow: visible;
}
.ce-modal[open] { animation: ce-in 0.25s ease-out; }
.ce-modal::backdrop {
	background: rgb(10 10 10 / 0.82);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
}
@keyframes ce-in { from { opacity: 0; transform: scale(0.97); } }

.ce-modal__body iframe,
.ce-modal__body video {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	border: 0;
	border-radius: inherit;
	background: #000;
}
.ce-modal[data-kind="site"] { width: min(1400px, 94vw); background: #fff; }
.ce-modal[data-kind="site"] iframe { aspect-ratio: auto; height: calc(100dvh - 120px); background: #fff; }
.ce-modal[data-kind="image"] { width: fit-content; background: transparent; }
.ce-modal__body img {
	display: block;
	max-width: 94vw;
	max-height: calc(100dvh - 120px);
	width: auto;
	height: auto;
	border-radius: inherit;
}


/* La especificidad extra y los !important puntuales evitan que los estilos
   globales de botones del tema conviertan el cierre en un bloque de color. */
.ce-modal button.ce-modal__close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	display: grid !important;
	place-items: center;
	box-sizing: border-box;
	width: 42px !important;
	height: 42px !important;
	min-width: 0 !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 1px solid rgb(255 255 255 / 0.28) !important;
	border-radius: 50% !important;
	background: rgb(17 17 17 / 0.72) !important;
	box-shadow: 0 4px 16px rgb(0 0 0 / 0.28) !important;
	color: #fff !important;
	font-size: 0 !important;
	line-height: 1 !important;
	text-decoration: none !important;
	-webkit-appearance: none;
	appearance: none;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	cursor: pointer;
}
/* La X se dibuja con CSS: no depende de la fuente del tema. */
.ce-modal button.ce-modal__close::before,
.ce-modal button.ce-modal__close::after {
	content: "" !important;
	position: static !important;
	display: block !important;
	grid-area: 1 / 1;
	width: 18px !important;
	height: 2px !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 2px !important;
	background: #fff !important;
	box-shadow: none !important;
	transform: rotate(45deg) !important;
}
.ce-modal button.ce-modal__close::after { transform: rotate(-45deg) !important; }
.ce-modal button.ce-modal__close:hover { background: rgb(17 17 17 / 0.9) !important; }
.ce-modal button.ce-modal__close:focus-visible {
	outline: 2px solid #fff !important;
	outline-offset: 3px;
}

@media (max-width: 767px) {
	.ce-modal { width: 100vw; border-radius: 0; }
	.ce-modal__body img { max-width: 100vw; }
}

/* ---------- Ficha en la página individual ---------- */
.ce-facts {
	display: flex;
	flex-wrap: wrap;
	gap: 14px 36px;
	margin: 0 0 2em;
	padding: 20px 24px;
	border-radius: 14px;
	background: rgb(0 0 0 / 0.04);
	list-style: none;
}
.ce-facts li { margin: 0; }
.ce-facts strong {
	display: block;
	margin-bottom: 2px;
	opacity: 0.6;
	font-size: 0.75rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

::view-transition-group(*) { animation-duration: 0.35s; }

@media (prefers-reduced-motion: reduce) {
	.ce-wrap *, .ce-modal { transition: none !important; animation: none !important; }
}

/* ---------- Detalle del caso (v2.1): panel desplegable debajo de la tarjeta ---------- */
.ce-wrap .ce-card--detalle { display: flex; flex-direction: column; }
.ce-wrap .ce-card--detalle .ce-card__link { flex: 1; height: auto; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.ce-wrap .ce-card__detail {
	margin: 0;
	padding: 0 20px;
	border-top: 1px solid color-mix(in srgb, currentColor 10%, transparent);
	border-radius: 0 0 var(--ce-radius) var(--ce-radius);
	background: var(--ce-card-bg);
	box-shadow: 0 4px 16px rgb(0 0 0 / 0.06);
	font-size: 0.9rem;
	line-height: 1.55;
}
.ce-wrap .ce-card__detail summary {
	min-height: 44px;
	display: flex;
	align-items: center;
	color: var(--ce-accent);
	font-weight: 600;
	cursor: pointer;
	list-style: none;
}
.ce-wrap .ce-card__detail summary::-webkit-details-marker { display: none; }
.ce-wrap .ce-card__detail summary::after { content: "+"; margin-left: auto; font-size: 1.2rem; }
.ce-wrap .ce-card__detail[open] summary::after { content: "–"; }
.ce-wrap .ce-card__detail p { margin: 0 0 12px; }
.ce-wrap .ce-card__detail p:last-child { margin-bottom: 18px; }
/* El título ahora es <h3>: neutraliza mayúsculas y márgenes del tema. */
.ce-wrap h3.ce-card__title { text-transform: none; letter-spacing: normal; }
