/*
 * Carrossel.
 *
 * O scroll-snap faz o trabalho pesado: swipe, inércia e navegação por teclado
 * vêm do navegador. As variáveis --fb-* vêm do tema; os valores de reserva
 * mantêm o carrossel apresentável se ele for usado com outro tema.
 */

.sc {
	position: relative;
	/*
	 * A proporção é declarada inline pelo PHP e reserva o espaço antes de
	 * qualquer imagem carregar. É o que mantém o CLS em zero no elemento mais
	 * visível da página.
	 */
	aspect-ratio: var(--sc-altura, 16 / 9);
	overflow: hidden;
	background: var(--fb-lavanda-clara, #f7ebf5);
}

@media (max-width: 781px) {
	.sc {
		aspect-ratio: var(--sc-altura-mobile, 4 / 5);
	}
}

.sc__trilho {
	display: flex;
	height: 100%;
	margin: 0;
	padding: 0;
	list-style: none;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	/* Esconde a barra sem usar overflow:hidden, que mataria o swipe. */
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.sc__trilho::-webkit-scrollbar {
	display: none;
}

.sc__trilho:focus-visible {
	outline: 2px solid var(--fb-foco, #c2a35a);
	outline-offset: -2px;
}

@media (prefers-reduced-motion: reduce) {
	.sc__trilho {
		scroll-behavior: auto;
	}
}

.sc__slide {
	position: relative;
	flex: 0 0 100%;
	width: 100%;
	height: 100%;
	scroll-snap-align: start;
	scroll-snap-stop: always;
}

.sc__figura,
.sc__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
}

.sc__img {
	object-fit: cover;
}

.sc__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(90deg, rgb(74 42 92 / .9) 0%, rgb(74 42 92 / .25) 70%);
}

.sc__slide--centro .sc__overlay {
	background: rgb(74 42 92 / .55);
}

.sc__slide--direita .sc__overlay {
	background: linear-gradient(270deg, rgb(74 42 92 / .9) 0%, rgb(74 42 92 / .25) 70%);
}

/* --- Conteúdo ----------------------------------------------------------- */

.sc__conteudo {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	padding: clamp(1.5rem, 5vw, 4rem);
}

.sc__slide--esquerda .sc__conteudo { justify-content: flex-start; }
.sc__slide--centro   .sc__conteudo { justify-content: center; text-align: center; }
.sc__slide--direita  .sc__conteudo { justify-content: flex-end; }

.sc__caixa {
	max-width: min(46ch, 55%);
	display: grid;
	gap: var(--fb-esp-3, .75rem);
	justify-items: start;
}

.sc__slide--centro .sc__caixa {
	justify-items: center;
	max-width: min(50ch, 80%);
}

.sc__slide--direita .sc__caixa {
	justify-items: end;
	text-align: right;
}

.sc__pre-titulo {
	margin: 0;
	font-size: var(--fb-txt-xs, .8rem);
	font-weight: 600;
	letter-spacing: .18em;
	text-transform: uppercase;
	color: var(--fb-roxo, #8e5c96);
}

/*
 * O título usa a fonte caligráfica da marca, como no mockup. A altura de linha
 * é folgada porque uma script tem ascendentes e descendentes bem longos.
 */
.sc__titulo {
	margin: 0;
	font-family: var(--fb-fonte-script, cursive);
	font-size: clamp(2rem, 1.1rem + 4vw, 4.25rem);
	line-height: 1.15;
	color: var(--fb-roxo-escuro, #6b3f82);
	text-wrap: balance;
	/*
	 * Letras caligráficas têm bearing negativo: a perna do "g" e a entrada do
	 * "P" avançam para fora da caixa de texto. Sem esta folga elas encostam na
	 * borda do slide, que tem overflow hidden.
	 */
	padding-inline: .12em;
	margin-inline: -.12em;
}

.sc__texto {
	margin: 0;
	font-size: var(--fb-txt-md, 1.05rem);
	color: var(--fb-roxo-profundo, #4a2a5c);
	text-wrap: pretty;
}

.sc__botao {
	margin-top: var(--fb-esp-2, .5rem);
}

/* Slide escuro: foto com overlay e texto claro por cima. */
.sc__slide--escuro .sc__pre-titulo,
.sc__slide--escuro .sc__titulo,
.sc__slide--escuro .sc__texto {
	color: #fff;
}

@media (max-width: 781px) {
	.sc__caixa,
	.sc__slide--centro .sc__caixa,
	.sc__slide--direita .sc__caixa {
		max-width: 100%;
		justify-items: center;
		text-align: center;
	}

	.sc__conteudo,
	.sc__slide--esquerda .sc__conteudo,
	.sc__slide--direita .sc__conteudo {
		align-items: flex-end;
		justify-content: center;
		padding-bottom: clamp(2rem, 8vw, 4rem);
	}

	/*
	 * No celular não há espaço para o texto ficar ao lado da foto: ele cai em
	 * cima dela. Este véu garante legibilidade seja qual for a foto que a loja
	 * subir, sem depender de ela lembrar de ajustar o "escurecer a foto" de
	 * cada slide. A direção acompanha a cor do texto escolhida no slide.
	 */
	.sc__conteudo::before {
		content: '';
		position: absolute;
		right: 0;
		bottom: 0;
		left: 0;
		height: 75%;
		pointer-events: none;
		background: linear-gradient(
			to top,
			rgb(253 249 250 / .97) 0%,
			rgb(253 249 250 / .85) 42%,
			rgb(253 249 250 / 0) 100%
		);
	}

	.sc__slide--escuro .sc__conteudo::before {
		background: linear-gradient(
			to top,
			rgb(45 22 56 / .9) 0%,
			rgb(45 22 56 / .6) 45%,
			rgb(45 22 56 / 0) 100%
		);
	}

	.sc__caixa {
		position: relative;
		z-index: 1;
	}
}

/* --- Controles ---------------------------------------------------------- */

.sc__seta {
	position: absolute;
	top: 50%;
	z-index: 3;
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	border: 0;
	border-radius: 50%;
	background: rgb(255 255 255 / .9);
	color: var(--fb-roxo-escuro, #6b3f82);
	box-shadow: var(--fb-sombra-1, 0 2px 10px rgb(74 42 92 / .06));
	transform: translateY(-50%);
	transition: background 180ms, opacity 180ms;
}

.sc__seta:hover {
	background: #fff;
}

.sc__seta:disabled {
	opacity: .35;
	cursor: not-allowed;
}

.sc__seta--anterior { left: var(--fb-esp-4, 1rem); }
.sc__seta--proximo  { right: var(--fb-esp-4, 1rem); }

.sc__dots {
	position: absolute;
	bottom: var(--fb-esp-4, 1rem);
	left: 50%;
	z-index: 3;
	display: flex;
	gap: var(--fb-esp-2, .5rem);
	transform: translateX(-50%);
}

.sc__dots button {
	position: relative;
	width: 10px;
	height: 10px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgb(107 63 130 / .3);
	transition: background 180ms, transform 180ms;
}

/*
 * Alvo de toque de 44px sem aumentar o ponto visível: a área clicável é um
 * pseudo-elemento transparente em volta.
 */
.sc__dots button::before {
	content: '';
	position: absolute;
	width: 44px;
	height: 44px;
	transform: translate(-50%, -50%);
	margin-left: 5px;
	margin-top: 5px;
}

.sc__dots button[aria-selected='true'] {
	background: var(--fb-roxo, #8e5c96);
	transform: scale(1.3);
}

@media (max-width: 781px) {
	.sc__seta {
		width: 40px;
		height: 40px;
	}

	.sc__seta--anterior { left: 6px; }
	.sc__seta--proximo  { right: 6px; }
}
