/**
 * Academia - Formações (Separadores): base styles.
 *
 * Deliberately minimal / unbranded — adapt colors, spacing and fonts to
 * this site's theme.json tokens (var(--wp--preset--color--…) etc).
 *
 * The "Formação à Medida" tab reuses the .bcsd-membros__grid / __card /
 * __modal* classes so it can share bcsd_membros_render_card()'s markup
 * (see helpers.php); that CSS isn't guaranteed to be loaded on this page
 * (block styles only load when their own block is used), so the relevant
 * subset is copied here — forked from
 * blocks/bcsd-iniciativa-membros/assets/iniciativa-membros.css.
 */

/* Tabs — switched by the inline <script> printed via
   bcsd_academia_formacoes_print_inline_script() (see template.php's file
   header for why it's inline rather than block.json's "viewScript"). */

.bcsd-academia-formacoes__tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 2.5rem;
	border-bottom: solid 1px var(--wp--preset--color--neutral-200);
	margin-bottom: 2.5rem;
}

.bcsd-academia-formacoes__tab-btn {
	position: relative;
	background: none;
	border: none;
	margin: 0;
	padding: 0 0 1rem;
	font-family: var(--wp--preset--font-family--fraunces);
	font-size: 1.35rem;
	font-weight: 400;
	color: var(--wp--preset--color--neutral-600);
	cursor: pointer;
}

.bcsd-academia-formacoes__tab-btn.is-active {
	color: var(--wp--preset--color--dark);
}

.bcsd-academia-formacoes__tab-btn.is-active::after {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	bottom: -1px;
	height: 2px;
	background: var(--wp--preset--color--primary);
}

/* Visibility is driven purely by the .is-active class, not the [hidden]
   attribute: the block editor's canvas iframe appears to lose boolean
   attributes like "hidden" (and, as found separately, a radio's "checked")
   when it re-renders this block's markup — see template.php's file header.
   A plain class is a normal attribute, not a special IDL-backed one, so it
   survives that. The "hidden" attribute is still printed in the markup as
   a no-JS/accessibility fallback, but nothing here depends on it. */
.bcsd-academia-formacoes__panel {
	display: none;
}

.bcsd-academia-formacoes__panel.is-active {
	display: block;
}

.bcsd-academia-formacoes__intro {
	color: var(--wp--preset--color--neutral-600);
	max-width: 46rem;
	font-size: clamp(1rem, 1rem + ((1vw - 0.2rem) * 1.333), 1.12rem);
	font-weight: 400;
}

.bcsd-academia-formacoes__actions {
	margin-top: 1.5rem;
}

.bcsd-academia-formacoes__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.75rem 2rem;
	border-radius: 2px;
	background: var(--wp--preset--color--dark);
	color: var(--wp--preset--color--white);
	font-family: var(--wp--preset--font-family--noto-sans);
	font-size: 0.9rem;
	font-weight: 600;
	text-decoration: none !important;
	transition: background 0.2s ease-in-out;
}

.bcsd-academia-formacoes__button:hover {
	background: var(--wp--preset--color--teal-dark);
	color: var(--wp--preset--color--white);
}

.bcsd-academia-formacoes__empty {
	margin: 0;
	padding: 2rem 0;
	color: var(--wp--preset--color--neutral-600);
}

/* Two-column layout: "Formação Especializada" and "Formação à Medida" */

.bcsd-academia-formacoes__columns {
	display: grid;
	grid-template-columns: minmax(220px, 500px) 1fr;
	gap: 2.5rem;

	@media (max-width: 782px) {
		grid-template-columns: 1fr;
	}
}

/* Only one side had content (bcsd_academia_formacoes_render_columns()):
   drop the grid so that side spans the full width instead of sitting in a
   half-empty two-column layout. */
.bcsd-academia-formacoes__columns--full {
	display: block;
}

/* "Formação Base" grid */

.bcsd-academia-formacoes__base-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 1.75rem;
}

.bcsd-academia-formacoes__base-card {
	display: flex;
	flex-direction: column;
	text-decoration: none !important;
	color: inherit;
	border: solid 1px var(--wp--preset--color--neutral-300);
	border-radius: 5px;
	overflow: hidden;

	& img {
		transition: all 0.2s ease-in-out;
	}

	&:hover {
		border-color: var(--wp--preset--color--primary);

		& img {
			transform: scale(1.1);
		}
	}
}

.bcsd-academia-formacoes__base-media {
	position: relative;
	display: block;
	overflow: hidden;
}

.bcsd-academia-formacoes__base-badge {
	position: absolute;
	top: 0.85rem;
	left: 0.85rem;
	padding: 0.3rem 0.75rem;
	background: rgba(0, 0, 0, 0.65);
	color: #fff;
	font-family: var(--wp--preset--font-family--noto-sans);
	font-size: 0.7rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 1px;
	z-index: 1;
}

.bcsd-academia-formacoes__base-image {
	display: block;
	width: 100%;
	height: 12rem;
	object-fit: cover;
}

.bcsd-academia-formacoes__base-image--placeholder {
	background: var(--wp--preset--color--neutral-100);
}

.bcsd-academia-formacoes__base-body {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding: 1.5rem;
}

.bcsd-academia-formacoes__base-title {
	font-family: var(--wp--preset--font-family--fraunces);
	font-size: 1.2rem;
	font-weight: 500;
	color: var(--wp--preset--color--dark);
}

.bcsd-academia-formacoes__base-desc {
	font-size: 0.9rem;
	line-height: 1.5;
	color: var(--wp--preset--color--neutral-600);
}

.bcsd-academia-formacoes__base-cta {
	margin-top: 0.25rem;
	font-family: var(--wp--preset--font-family--noto-sans);
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--wp--preset--color--primary);
}

/* "Formação Especializada" tiles */

.bcsd-academia-formacoes__temas-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 10px;
}

.bcsd-academia-formacoes__tema-card {
	position: relative;
	display: flex;
	align-items: flex-end;
	min-height: 110px;
	padding: 1rem;
	background-color: var(--wp--preset--color--neutral-600);
	background-size: cover;
	background-position: center;
	overflow: hidden;
	border-radius: 5px;
	text-decoration: none !important;
	box-sizing: border-box;
	border-top: 4px solid transparent;
	opacity: 0.9;
	transition: all 0.2s ease-in-out;

	&:hover {
		transform: translateY(-3px);
		opacity: 1;
	}
}

/* Cycles through the theme's accent colors — same 3 colors used by the
   "Como Aprendemos" cards further down this same page. */
.bcsd-academia-formacoes__tema-card--accent-primary {
	border-top-color: var(--wp--preset--color--primary);
}

.bcsd-academia-formacoes__tema-card--accent-secondary {
	border-top-color: var(--wp--preset--color--secondary);
}

.bcsd-academia-formacoes__tema-card--accent-tertiary {
	border-top-color: var(--wp--preset--color--tertiary);
}

.bcsd-academia-formacoes__tema-card::before {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(
		180deg,
		rgba(0, 0, 0, 0) 40%,
		rgba(0, 0, 0, 0.55) 100%
	);
}

.bcsd-academia-formacoes__tema-title {
	position: relative;
	color: #fff;
	font-family: var(--wp--preset--font-family--noto-sans);
	font-weight: 600;
	font-size: 0.95rem;
}

.bcsd-academia-formacoes__tema-card--ver-tudo {
	background-color: var(--wp--preset--color--white);
	border: solid 1px var(--wp--preset--color--neutral-300);
	align-items: center;
	justify-content: center;
}

.bcsd-academia-formacoes__tema-card--ver-tudo::before {
	content: none;
}

.bcsd-academia-formacoes__tema-card--ver-tudo
	.bcsd-academia-formacoes__tema-title {
	color: var(--wp--preset--color--primary);
}

/* "Formação à Medida" membros grid, pagination + modal — see file header. */

.bcsd-membros__grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 1px;
	background: var(--wp--preset--color--neutral-100);
	border: solid 1px var(--wp--preset--color--neutral-200);

	@media (max-width: 1200px) {
		grid-template-columns: repeat(2, 1fr);
	}

	@media (max-width: 480px) {
		grid-template-columns: repeat(1, 1fr);
	}
}

.bcsd-academia-formacoes__pagination {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 0.75rem;
	margin-top: 1.25rem;
}

.bcsd-academia-formacoes__page-current {
	font-family: var(--wp--preset--font-family--noto-sans);
	font-size: 0.9rem;
	color: var(--wp--preset--color--neutral-600);
}

.bcsd-academia-formacoes__page-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	border-radius: 50%;
	border: 1px solid var(--wp--preset--color--neutral-200);
	text-decoration: none !important;
	color: inherit;

	&:hover {
		background-color: var(--wp--preset--color--neutral-100);
	}
}

.bcsd-academia-formacoes__page-link.is-disabled {
	opacity: 0.35;
	cursor: default;
}

.bcsd-academia-formacoes__medida {
	&.is-loading {
		opacity: 0.6;
		pointer-events: none;
	}
}
.bcsd-membros__card {
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	background: var(--wp--preset--color--white);
	min-height: 140px;
	padding: 1.25rem;
	text-decoration: none;
	color: inherit;
	flex-direction: column-reverse;

	& .bcsd-membros__logos {
		margin: 1rem;
		max-width: 10rem;
		max-height: 5rem;
		& img {
			opacity: 0.3;
			width: 100%;
			height: auto;
		}

		& .first-logo {
			filter: grayscale(100%);
		}

		& .second-logo {
			display: none;
		}
	}
}

.bcsd-membros__card:hover,
.bcsd-membros__card:focus-visible {
	& .first-logo {
		display: none;
	}

	& .second-logo {
		display: inline;
		opacity: 1;
	}
}

.bcsd-membros__card-title {
	font-weight: 500;
}

.bcsd-membros__empty {
	padding: 2rem 0;
	text-align: center;
	opacity: 0.7;
}

.bcsd-academia-formacoes--preview .bcsd-membros__card {
	cursor: default;
}

/* Modal */

.bcsd-membros__modal[hidden] {
	display: none;
}

.bcsd-membros__modal {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.bcsd-membros__modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(4px);
}

.bcsd-membros__modal-content {
	position: relative;
	background: #fff;
	border-radius: 10px;
	padding: 2rem;
	max-width: 680px;
	width: calc(100% - 2rem);
	max-height: 85vh;
	overflow-y: auto;

	& p {
		margin: 0;
		padding: 0;
	}

	& .bcsd-membros__modal-top {
		display: flex;
		gap: 2rem;
		align-items: center;
		margin-bottom: 3rem;

		& .bcsd-membros__modal-title {
			font-weight: 200;
			font-size: var(--wp--preset--font-size--xx-large);
		}

		& .bcsd-membros__modal-logo {
			max-width: 5rem;
			border: solid 1px var(--wp--preset--color--neutral-200);
			padding: 1rem;
		}
	}

	& .bcsd-membros__modal-meta {
		display: flex;
		margin-bottom: 1rem;

		& > div {
			width: 50%;
		}

		& .pill {
			padding: 0.2rem 1rem;
			border-radius: 50rem;
			font-size: var(--wp--preset--font-size--small);
			font-weight: 500;

			&.pill__blue {
				background-color: #00b7ae33;
				display: block;
				color: var(--wp--preset--color--teal-dark);
			}
			&.pill__gray {
				border: 1px solid var(--wp--preset--color--neutral-200);
				background-color: var(--wp--preset--color--light);
			}
		}
	}

	& .bcsd-membros__modal-descricao {
		margin-bottom: 2rem;
	}

	& .bcsd-membros__modal-subtitle {
		font-family: var(--wp--preset--font-family--noto-sans);
		text-transform: uppercase;
		font-size: var(--wp--preset--font-size--normal);
		color: var(--wp--preset--color--neutral-600);
		font-weight: 500;
		margin-bottom: 0.5rem;
	}

	& .bcsd-membros__modal-url {
		& {
			color: var(--wp--preset--color--primary);
			font-weight: 600;
		}
	}
}

.bcsd-membros__modal-close {
	position: absolute;
	top: 1.75rem;
	right: 1.75rem;
	width: 2.5rem;
	aspect-ratio: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: solid 1px var(--wp--preset--color--neutral-200);
	border-radius: 50rem;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
}

.bcsd-membros__modal-logo[hidden] {
	display: none;
}

.bcsd-membros__modal-meta {
	margin: 0.5rem 0;
}

body.bcsd-membros-modal-open {
	overflow: hidden;
}
