/*
 * area.css — página de listado de un área formativa (Figma 2007:4835).
 *
 * Se encola sólo en la plantilla "Área formativa".
 */

/* =========================================================
   Tipografía de display (Figma: "Cabinet Grotesk Variable")
   ========================================================= */

@font-face {
	font-family: "Cabinet Grotesk";
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url("../fonts/cabinet-grotesk-700.woff2") format("woff2");
}

@font-face {
	font-family: "Cabinet Grotesk";
	font-style: normal;
	font-weight: 800;
	font-display: swap;
	src: url("../fonts/cabinet-grotesk-800.woff2") format("woff2");
}

/* =========================================================
   1. Banda superior: título + buscador (Figma 2007:5010 / 5024 / 5011)
   ========================================================= */

.fc-area-hero {
	position: relative;
	/* El azul de esta banda es #16254e, distinto del corporativo #192b5d. */
	background: var(--fc-navy-deep);
	isolation: isolate;
	/*
	 * flow-root evita que el margen inferior negativo del buscador se colapse
	 * hacia fuera: así resta altura a la banda y el buscador sobresale.
	 */
	display: flow-root;
	/*
	 * La banda mide 288px en Figma (y=92→380): 118 (arriba) + 75 (título) +
	 * 67 (hueco) + 56 (buscador) − 28 (el buscador sobresale media altura).
	 * Sin `overflow: hidden`, para que esa mitad inferior del buscador se vea
	 * fuera de la banda; la foto no desborda porque usa `object-fit: cover`.
	 */
	padding-block: 118px 0;
}

/*
 * Aquí la opacidad SÍ va en CSS: a diferencia del hero de la home, este PNG
 * no trae el velo horneado en el alfa.
 */
.fc-area-hero__bg {
	position: absolute;
	inset: 0;
	z-index: -1;
	width: 100%;
	height: 100%;
	object-fit: cover;
	/*
	 * Figma muestra la franja y=262.8→550.8 de una imagen de 1280px de alto.
	 * Con `cover`, el desplazamiento equivalente es 262.8 / (1280 - 288).
	 */
	object-position: center 26.5%;
	opacity: 0.15;
}

.fc-area-hero__title {
	max-width: 1080px;
	margin-inline: auto;
	color: var(--fc-white);
	font-size: clamp(2.25rem, 1.02rem + 3.41vw, 4.6875rem); /* 36 → 75px */
	font-weight: var(--fc-weight-bold);
	line-height: var(--fc-lh-tight);
	text-align: center;
}

/* El buscador monta sobre el borde inferior de la banda. */
.fc-area-hero__search {
	position: relative;
	z-index: 1;
	width: min(833px, 100%);
	margin: 67px auto -28px;
}

.fc-search {
	display: flex;
	align-items: center;
	gap: var(--fc-space-md);
	min-height: 56px;
	padding-left: var(--fc-space-md);
	background: var(--fc-white);
	border-radius: var(--fc-radius-sm);
	/*
	 * El halo translúcido de Figma (border de 10px) se dibuja con box-shadow
	 * para que no altere la caja: el buscador debe medir 56px de alto, igual
	 * que el botón de la lupa.
	 */
	box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.1), 0 2px 4px rgba(0, 0, 0, 0.1);
}

.fc-search__input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--fc-ink);
	font-size: 18px;
	font-weight: 500;
	line-height: 30px;
}

.fc-search__input::placeholder {
	color: var(--fc-neutral-3);
	opacity: 1;
}

.fc-search__submit {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	border: 0;
	border-radius: 0 var(--fc-radius-sm) var(--fc-radius-sm) 0;
	background: var(--fc-navy);
	cursor: pointer;
	transition: background-color 0.18s ease;
}

.fc-search__submit:hover {
	background: #0f1c3f;
}

.fc-search__submit img {
	width: 24px;
	height: 24px;
}

@media (max-width: 600px) {
	.fc-area-hero {
		padding-block: 56px 0;
	}

	.fc-area-hero__search {
		margin-top: 32px;
	}

	.fc-search {
		box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.1), 0 2px 4px rgba(0, 0, 0, 0.1);
	}
}

/* =========================================================
   2. Listado: barra lateral de filtros + rejilla (Figma 2007:5033)
   ========================================================= */

.fc-area-listing {
	padding-top: 78px;
}

.fc-area-listing__inner {
	display: grid;
	grid-template-columns: var(--fc-filters-width) minmax(0, 1fr);
	gap: var(--fc-listing-gap);
	/*
	 * En Figma este bloque mide 1450px y la barra de filtros sobresale por la
	 * izquierda del contenedor de la página, mientras la rejilla de tarjetas
	 * queda alineada con el resto de secciones. Se reproduce anclando el borde
	 * derecho al contenedor y dejando que crezca hacia la izquierda.
	 */
	max-width: calc(var(--fc-container-listing) + var(--fc-gutter));
	margin-left: auto;
	margin-right: max(var(--fc-gutter), calc((100% - var(--fc-container)) / 2));
	padding-left: var(--fc-gutter);
}

/* ---- Filtros ---- */

.fc-filters {
	padding-top: 90px; /* alinea con la primera fila de tarjetas */
}

.fc-filters__group {
	border-bottom: 1px solid var(--fc-neutral-5);
}

.fc-filters__group:first-child {
	border-top: 1px solid transparent;
}

.fc-filters__summary {
	display: flex;
	align-items: center;
	gap: var(--fc-space-2xs);
	padding: 12px 24px 12px 0;
	color: var(--fc-neutral-2);
	font-size: var(--fc-fs-sm);
	font-weight: var(--fc-weight-bold);
	line-height: var(--fc-lh-heading);
	cursor: pointer;
	list-style: none;
}

.fc-filters__summary::-webkit-details-marker {
	display: none;
}

.fc-filters__group[open] > .fc-filters__summary {
	color: var(--fc-navy);
}

.fc-filters__chevron {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	transform: rotate(180deg); /* cerrado: apunta hacia abajo */
	transition: transform 0.18s ease;
}

.fc-filters__group[open] .fc-filters__chevron {
	transform: rotate(0deg);
}

.fc-filters__options {
	display: flex;
	flex-direction: column;
	gap: var(--fc-space-2xs);
	padding-bottom: 12px;
}

.fc-filters__option {
	display: flex;
	align-items: center;
	gap: var(--fc-space-xs);
	cursor: pointer;
}

.fc-filters__option input {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	margin: 8px 0;
	border: 1px solid var(--fc-neutral-4);
	border-radius: 2px;
	accent-color: var(--fc-navy);
}

.fc-filters__option span {
	color: var(--fc-neutral-2);
	font-size: var(--fc-fs-sm);
	line-height: 28px;
}

/* ---- Barra de migas y orden (Figma 2007:5055) ---- */

.fc-area-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: var(--fc-space-sm);
	min-height: 44px;
	margin-bottom: 45px;
}

.fc-breadcrumb {
	color: var(--fc-navy);
	font-size: var(--fc-fs-sm);
	line-height: var(--fc-lh-heading);
}

.fc-breadcrumb a {
	text-decoration: none;
}

.fc-breadcrumb a:hover {
	text-decoration: underline;
}

.fc-breadcrumb__sep {
	color: var(--fc-cyan);
	font-weight: var(--fc-weight-bold);
	padding-inline: 2px;
}

.fc-area-sort {
	display: flex;
	align-items: center;
	width: 193px;
	max-width: 100%;
	padding: 8px 12px;
	background: var(--fc-white);
	border: 1px solid var(--fc-neutral-6);
	border-radius: var(--fc-radius-sm);
}

.fc-area-sort select {
	appearance: none;
	width: 100%;
	padding: 0 20px 0 0;
	border: 0;
	background: transparent url("../img/icons/chevron-down-micro.svg") no-repeat right center / 16px 16px;
	color: var(--fc-neutral-2);
	font-size: var(--fc-fs-sm);
	line-height: 28px;
	cursor: pointer;
}

/* ---- Rejilla de resultados ---- */

.fc-course-grid {
	display: grid;
	/*
	 * 3 por fila a 1920 (tarjetas de 361px, las de 357 del diseño) y también
	 * en portátiles de 1440. Por debajo pasa a 2 y luego a 1; el mínimo de
	 * 280px es el ancho al que los dos botones del pie siguen cabiendo.
	 */
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	column-gap: 29px;
	row-gap: 45px;
}

.fc-area-results__more {
	display: flex;
	justify-content: center;
	margin-top: 45px;
}

.fc-more {
	display: inline-flex;
	align-items: center;
	gap: var(--fc-space-md);
	background: none;
	border: 0;
	color: var(--fc-navy);
	font-size: 20px;
	font-weight: var(--fc-weight-bold);
	line-height: var(--fc-lh-heading);
	text-decoration: none;
	cursor: pointer;
}

.fc-more__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 4px;
	background: var(--fc-cyan);
	border-radius: var(--fc-radius-sm);
	transition: background-color 0.18s ease;
}

.fc-more:hover .fc-more__icon {
	background: #3fbcc9;
}

.fc-more__icon img {
	width: 24px;
	height: 24px;
}

/* =========================================================
   3. Tarjeta de formación (Figma 2007:4767)
   ========================================================= */

.fc-course {
	display: flex;
	flex-direction: column;
	background: var(--fc-white);
	border: 1px solid var(--fc-neutral-5);
	border-radius: var(--fc-radius-md);
	overflow: hidden;
	transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.fc-course:hover {
	border-color: var(--fc-neutral-4);
	box-shadow: var(--fc-shadow-card);
}

.fc-course__media {
	height: 200px;
	background: var(--fc-white);
}

.fc-course__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.fc-course__body {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	padding-top: 30px;
}

.fc-course__content {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 6px;
	flex: 1 1 auto;
	padding-inline: 30px;
}

.fc-course__tag {
	display: inline-flex;
	align-items: center;
	min-height: 29px;
	padding: 0 28px 0 7px;
	background: var(--fc-navy);
	color: var(--fc-offwhite);
	font-size: var(--fc-fs-sm);
	font-weight: var(--fc-weight-bold);
	line-height: var(--fc-lh-sm);
}

.fc-course__title {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3; /* 3 líneas = los 87px del diseño */
	overflow: hidden;
	width: 100%;
	/*
	 * Reservar SIEMPRE las tres líneas, aunque el título ocupe una o dos. Sin esto, la rejilla
	 * estira cada fila a la altura de su tarjeta más alta y las filas cuyo título más largo cabe
	 * en dos líneas salen 29px más bajas que el resto: en Gestión Empresarial pasaba en 9 de las
	 * 112 filas. El clamp de arriba ya impide que pase de tres.
	 */
	min-height: calc(3em * var(--fc-lh-heading));
	color: var(--fc-neutral-1);
	font-family: var(--fc-font-display);
	font-size: 24px;
	font-weight: var(--fc-weight-extrabold);
	line-height: var(--fc-lh-heading);
}

.fc-course__title a {
	text-decoration: none;
}

.fc-course__title a:hover {
	text-decoration: underline;
}

.fc-course__meta {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: var(--fc-space-xs);
	width: 100%;
	padding: 16px 12px 8px 0;
}

.fc-course__meta-item {
	display: flex;
	align-items: center;
	gap: var(--fc-space-xs);
}

.fc-course__meta-icon {
	flex: 0 0 auto;
	display: inline-flex;
	padding: 8px;
	background: rgba(26, 43, 92, 0.05);
	border-radius: var(--fc-radius-pill);
}

.fc-course__meta-icon img {
	width: 20px;
	height: 20px;
}

.fc-course__meta-label {
	display: block;
	color: var(--fc-neutral-2);
	font-size: var(--fc-fs-xs);
	font-weight: 500;
	line-height: 28px;
}

.fc-course__meta-value {
	display: block;
	color: var(--fc-neutral-1);
	font-family: var(--fc-font-display);
	font-size: var(--fc-fs-sm);
	font-weight: var(--fc-weight-extrabold);
	line-height: var(--fc-lh-heading);
}

.fc-course__actions {
	display: flex;
	align-items: center;
	gap: var(--fc-space-2xs);
	width: 100%;
	padding: 14px 12px;
}

.fc-course__pdf,
.fc-course__more {
	flex: 1 1 0;
	min-width: 0;
	color: var(--fc-navy);
	font-size: var(--fc-fs-sm);
	font-weight: var(--fc-weight-bold);
	line-height: var(--fc-lh-heading);
	text-align: center;
}

.fc-course__pdf {
	text-decoration: underline;
	text-underline-position: from-font;
}

.fc-course__more {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding-block: 12px;
	border: 2px solid var(--fc-navy);
	border-radius: var(--fc-radius-sm);
	text-decoration: none;
	transition: background-color 0.18s ease, color 0.18s ease;
}

.fc-course__more:hover {
	background: var(--fc-navy);
	color: var(--fc-white);
}

/* =========================================================
   4. Adaptación a pantallas menores
   ========================================================= */

@media (max-width: 1024px) {
	.fc-area-listing {
		padding-top: 60px;
	}

	/* Los filtros pasan a ocupar todo el ancho, encima de los resultados. */
	.fc-area-listing__inner {
		grid-template-columns: minmax(0, 1fr);
		gap: 32px;
		max-width: calc(var(--fc-container) + var(--fc-gutter) * 2);
		margin-inline: auto;
		padding-inline: var(--fc-gutter);
	}

	.fc-filters {
		padding-top: 0;
	}

	.fc-area-toolbar {
		margin-bottom: 24px;
	}
}

@media (max-width: 600px) {
	.fc-course-grid {
		grid-template-columns: minmax(0, 1fr);
		row-gap: 28px;
	}

	.fc-course__content {
		padding-inline: 20px;
	}

	.fc-course__title {
		font-size: 20px;
	}
}

/* Recuento por opción y acciones del formulario de filtros (catálogo conectado). */
.fc-filters__option span:first-of-type {
	flex: 1 1 auto;
}

.fc-filters__count {
	flex: 0 0 auto;
	color: var(--fc-neutral-4);
	font-size: 14px;
	font-variant-numeric: tabular-nums;
}

.fc-filters__actions {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--fc-space-xs);
	padding-top: var(--fc-space-md);
}

.fc-filters__apply {
	width: 100%;
	justify-content: center;
}

.fc-filters__clear {
	color: var(--fc-neutral-4);
	font-size: 14px;
	text-decoration: underline;
}

.fc-filters__clear:hover,
.fc-filters__clear:focus-visible {
	color: var(--fc-navy);
}
