/**
 * WoP - Banco de Imagens
 *
 * Namespace "wem-bdi" (Banco De Imagens) para nao colidir com nenhum
 * outro widget do WEM.
 */

.wem-bdi {
	--wem-bdi-font: Soho, Arial, sans-serif;
}

/* ------------------------------------------------------------------ *
 * Cabecalho: titulo + dropdown + imagem de destaque (com o nome da
 * regiao sobreposto, em dois tamanhos) + botao "Ver mais fotos"
 * ------------------------------------------------------------------ */

.wem-bdi__header {
	position: relative;
}

.wem-bdi__title-wrap {
	margin: 0 0 24px;
}

.wem-bdi__title {
	margin: 0;
	font-family: var(--wem-bdi-font);
	font-size: 40px;
	font-weight: 800;
	color: #1a1a1a;
}

/* ---- Dropdown + imagem de destaque lado a lado ---- */

.wem-bdi__hero-row {
	display: flex;
	/* flex-start (nao "stretch"): o dropdown NAO deve esticar ate a
	   altura da imagem de destaque - se esticasse, o seu container
	   (position: relative) ficaria tao alto quanto a imagem, e a lista
	   (position: absolute; top: 100%) apareceria so depois dessa altura
	   toda, ou seja la em baixo, na seccao da grelha - bug reportado
	   pelo Emanuel. Com flex-start, o dropdown mantem a altura do seu
	   proprio conteudo (o botao), e a lista aparece mesmo por baixo dele. */
	align-items: flex-start;
	gap: 24px;
	box-sizing: border-box;
}

/* ---- Dropdown de regioes ---- */

.wem-bdi__dropdown {
	position: relative;
	display: block;
	flex: none;
	width: 320px;
	max-width: 100%;
	z-index: 3;
}

.wem-bdi__dropdown-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	padding: 12px 20px;
	border: none;
	border-radius: 4px;
	background: #ba2229;
	color: #fff;
	font-family: var(--wem-bdi-font);
	font-size: 15px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	cursor: pointer;
}

.wem-bdi__dropdown-toggle__icon-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	flex: none;
	border: 1.5px solid currentColor;
	border-radius: 50%;
	color: inherit;
	box-sizing: border-box;
}

.wem-bdi__dropdown-toggle__icon {
	width: 14px;
	height: 14px;
	flex: none;
	transition: transform 0.15s ease;
}

.wem-bdi__dropdown.is-open .wem-bdi__dropdown-toggle__icon {
	transform: rotate(180deg);
}

.wem-bdi__dropdown-list {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	width: 100%;
	max-height: 320px;
	overflow-y: auto;
	background: #fff;
	border-radius: 4px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
	box-sizing: border-box;
}

.wem-bdi__dropdown-list[hidden] {
	display: none;
}

.wem-bdi__dropdown-item {
	padding: 18px 20px;
	border-bottom: 1px solid #ececec;
	text-align: center;
	font-family: var(--wem-bdi-font);
	font-size: 16px;
	color: #2c2c2c;
	cursor: pointer;
	box-sizing: border-box;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.wem-bdi__dropdown-item:last-child {
	border-bottom: none;
}

.wem-bdi__dropdown-item:hover {
	background: #f2f2f2;
}

.wem-bdi__dropdown-item.is-active {
	color: #ba2229;
	font-weight: 700;
}

/* ---- Imagem de destaque + nome da regiao ---- */

.wem-bdi__hero {
	position: relative;
	flex: 1;
	min-width: 0;
	height: 420px;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: #1a1a1a;
}

.wem-bdi__hero__image {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wem-bdi__hero__ghost-name {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	font-family: var(--wem-bdi-font);
	font-size: clamp(60px, 12vw, 160px);
	font-weight: 800;
	line-height: 1;
	color: transparent;
	-webkit-text-stroke: 1px rgba(255, 255, 255, 0.5);
	white-space: nowrap;
	overflow: hidden;
	pointer-events: none;
	z-index: 1;
}

.wem-bdi__hero__name {
	position: relative;
	z-index: 2;
	margin: 0;
	padding: 6px 16px;
	font-family: var(--wem-bdi-font);
	font-size: clamp(28px, 5vw, 56px);
	font-weight: 800;
	color: #fff;
	background: #ba2229;
}

/* ---- Botao "Ver mais fotos" ---- */

.wem-bdi__cta-wrap {
	display: flex;
	justify-content: center;
	margin-top: 24px;
}

.wem-bdi__cta {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

/* ------------------------------------------------------------------ *
 * Grelha de imagens + spinner de carregamento
 * ------------------------------------------------------------------ */

.wem-bdi__grid-wrap {
	position: relative;
	margin-top: 48px;
	scroll-margin-top: 32px;
	box-sizing: border-box;
}

.wem-bdi__grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 32px;
}

.wem-bdi__card {
	display: flex;
	flex-direction: column;
}

.wem-bdi__card__image {
	display: block;
	width: 100%;
	aspect-ratio: 3 / 2;
	object-fit: cover;
	margin-bottom: 12px;
	background-color: #eee;
}

/* Baixa/Alta resolucao lado a lado - ambos sao "campos de botao/link"
   normais do WEM (classes .wem-botao/.wem-botao--{variante}, ver
   render_card() na classe de suporte); o aspeto (cor, tipografia, borda)
   vem sempre de WEM > Configurar > WoP-Botao consoante a variante
   escolhida nos controlos do widget - aqui so o layout (lado a lado,
   cada um a dividir o espaco a meio). */
.wem-bdi__card__buttons {
	display: flex;
	flex-direction: row;
	align-items: stretch;
	gap: 8px;
}

.wem-bdi__card__button {
	flex: 1 1 0;
	justify-content: center;
	text-align: center;
}

.wem-bdi__loading {
	display: none;
	position: absolute;
	inset: 0;
	z-index: 6;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.6);
}

.wem-bdi__grid-wrap.is-loading .wem-bdi__loading {
	display: flex;
}

.wem-bdi__grid-wrap.is-loading .wem-bdi__grid {
	opacity: 0.35;
	pointer-events: none;
	transition: opacity 0.15s ease;
}

.wem-bdi__spinner {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: 3px solid var(--wem-bdi-spinner-fundo, rgba(26, 26, 26, 0.15));
	border-top-color: var(--wem-bdi-spinner-cor, #ba2229);
	animation: wem-bdi-spin 0.7s linear infinite;
}

@keyframes wem-bdi-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.wem-bdi__spinner {
		animation-duration: 1.6s;
	}
}

.wem-bdi__empty {
	text-align: center;
	padding: 60px 20px;
	color: #6a6a6a;
}

.wem-bdi__empty[hidden] {
	display: none;
}

/* ------------------------------------------------------------------ *
 * Responsivo
 * ------------------------------------------------------------------ */

@media (max-width: 991px) {
	.wem-bdi__grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 767px) {
	.wem-bdi__hero-row {
		flex-direction: column;
	}

	.wem-bdi__dropdown {
		width: 100%;
	}

	.wem-bdi__hero {
		height: 280px;
	}

	.wem-bdi__grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 20px;
	}
}
