/**
 * Butler Arquitetura — estilos dos blocos.
 *
 * Carregado no front-end e no editor (via registro do bloco), garantindo
 * que a pré-visualização no editor seja igual à exibição final.
 *
 * @package butlerarq
 */

/* ==========================================================================
   GALERIA HORIZONTAL
   ========================================================================== */

.butlerarq-gallery {
	position: relative;
	max-width: 100%;
	margin: clamp(28px, 5vh, 56px) 0;
}

/*
 * Seletor reforçado com ".butlerarq-gallery" para vencer as regras de
 * tipografia do conteúdo (".butlerarq-content ul/li"), que também se
 * aplicam a listas dentro de posts/páginas.
 */
.butlerarq-gallery .butlerarq-gallery__track {
	--butlerarq-gallery-gap: clamp(8px, 1.2vw, 16px);
	--butlerarq-gallery-item-size: calc((100% - (3 * var(--butlerarq-gallery-gap))) / 4);
	display: flex;
	gap: var(--butlerarq-gallery-gap);
	margin: 0;
	padding: 0;
	list-style: none;
	overflow-x: auto;
	scroll-behavior: smooth;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.butlerarq-gallery .butlerarq-gallery__track::-webkit-scrollbar {
	display: none;
}

/*
 * Até 4 imagens visíveis por vez (sem marcadores de lista).
 *
 * O tamanho vem de "width" (e não de "flex-basis") de propósito: assim a
 * largura é resolvida de forma definitiva e a imagem com width:100% nunca
 * contribui com sua largura intrínseca, evitando que a linha ultrapasse os
 * limites do bloco (tanto no site quanto no canvas do editor).
 */
.butlerarq-gallery .butlerarq-gallery__item {
	flex: 0 0 auto;
	width: var(--butlerarq-gallery-item-size);
	max-width: 100%;
	min-width: 0;
	overflow: hidden;
	margin: 0;
	padding: 0;
	list-style: none;
}

.butlerarq-gallery__link {
	display: block;
}

/* Imagens quadradas. */
.butlerarq-gallery__img {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: cover;
}

/* Setas: mesma aparência das setas de navegação da Home (apenas o traço). */
.butlerarq-gallery__arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	color: rgba(17, 17, 17, 0.7);
	cursor: pointer;
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
	transition: color 0.25s ease, opacity 0.25s ease;
}

.butlerarq-gallery__arrow:hover,
.butlerarq-gallery__arrow:focus-visible {
	/*
	 * Cor literal (e não var(--butlerarq-dark)) porque esta folha também é
	 * carregada no editor, onde as variáveis do style.css não existem.
	 */
	color: #111111;
}

.butlerarq-gallery__arrow.is-disabled {
	opacity: 0.22;
	pointer-events: none;
}

.butlerarq-gallery__arrow--prev {
	left: 0;
}

.butlerarq-gallery__arrow--next {
	right: 0;
}

@media screen and (max-width: 763px) {
	.butlerarq-gallery .butlerarq-gallery__track {
		--butlerarq-gallery-item-size: calc((100% - var(--butlerarq-gallery-gap)) / 2);
	}
}

/* --------------------------------------------------------------------------
   Ajustes válidos apenas dentro do canvas do editor.
   -------------------------------------------------------------------------- */

/*
 * No editor as setas não rolam nada (o JS de rolagem roda só no site), então
 * a barra de rolagem fica visível para dar acesso a todas as imagens.
 */
.editor-styles-wrapper .butlerarq-gallery .butlerarq-gallery__track {
	scrollbar-width: thin;
}

.editor-styles-wrapper .butlerarq-gallery .butlerarq-gallery__track::-webkit-scrollbar {
	display: block;
	height: 8px;
}
