/*
 * Blog Lojas 2001 - animacoes.
 * Tudo aqui e camada extra: sem o JS (ou com "reduzir movimento" no sistema)
 * a classe .tem-anim nao entra e o site fica exatamente como antes.
 */

:root {
	--ease-saida: cubic-bezier(.2, .7, .2, 1);
	--ease-mola: cubic-bezier(.34, 1.56, .64, 1);
	--altura-adminbar: 0px;
}

body.admin-bar { --altura-adminbar: 32px; }

@media (max-width: 782px) {
	body.admin-bar { --altura-adminbar: 46px; }
}

/* Abaixo de 600px a barra do admin rola junto com a pagina. */
@media (max-width: 600px) {
	body.admin-bar { --altura-adminbar: 0px; }
}

/* ==========================================================================
   1. Revelar ao rolar
   ========================================================================== */

.tem-anim .grid-posts > .post-card:not(.visivel),
.tem-anim .secao-titulo:not(.visivel),
.tem-anim .sidebar > *:not(.visivel),
.tem-anim .lista-tags > a:not(.visivel),
.tem-anim .post-tags > a:not(.visivel),
.tem-anim .texto-do-post > h2:not(.visivel),
.tem-anim .texto-do-post > h3:not(.visivel),
.tem-anim .texto-do-post > figure:not(.visivel),
.tem-anim .texto-do-post > table:not(.visivel),
.tem-anim .texto-do-post > blockquote:not(.visivel),
.tem-anim .texto-do-post > .wp-block-table:not(.visivel),
.tem-anim .texto-do-post > .wp-block-image:not(.visivel),
.tem-anim .author-box:not(.visivel),
.tem-anim .nav-posts:not(.visivel),
.tem-anim .newsletter-banner:not(.visivel),
.tem-anim .rodape-colunas > *:not(.visivel),
.tem-anim .ver-todos-cta:not(.visivel),
.tem-anim .aviso-vazio:not(.visivel) {
	opacity: 0;
	transform: translate3d(0, 26px, 0);
}

.tem-anim .lista-tags > a:not(.visivel),
.tem-anim .post-tags > a:not(.visivel) {
	transform: translate3d(0, 10px, 0) scale(.92);
}

/* So durante a entrada: depois a classe sai e o hover original dos cards volta. */
.tem-anim .revelando {
	transition: opacity .7s var(--ease-saida), transform .7s var(--ease-saida) !important;
	transition-delay: var(--atraso, 0ms) !important;
}

/* Barra vermelha do titulo de secao "cresce" quando o titulo aparece. */
.tem-anim .secao-titulo h2::before,
.tem-anim .secao-titulo h3::before {
	transform-origin: bottom;
	transition: transform .55s var(--ease-saida) .25s;
}

.tem-anim .secao-titulo:not(.visivel) h2::before,
.tem-anim .secao-titulo:not(.visivel) h3::before {
	transform: scaleY(0);
}

/* ==========================================================================
   2. Cabecalho fixo inteligente
   ========================================================================== */

.site-header {
	position: sticky;
	top: var(--altura-adminbar);
	transition: transform .35s var(--ease-saida), box-shadow .25s ease;
}

.site-header.rolou {
	box-shadow: 0 6px 18px rgba(16, 24, 40, .10);
}

.tem-anim .site-header.escondido {
	transform: translate3d(0, calc(-100% - var(--altura-adminbar)), 0);
}

/* Ancoras (indice do post, FAQ) nao ficam escondidas atras do cabecalho. */
html { scroll-behavior: smooth; }

.texto-do-post h2,
.texto-do-post h3,
[id] { scroll-margin-top: 96px; }

/* ==========================================================================
   3. Banner principal
   ========================================================================== */

/* Zoom lento na foto do slide ativo. */
.tem-anim .hero-slide .hero-img {
	transform-origin: 60% 50%;
}

.tem-anim .hero-slide.ativo .hero-img {
	animation: lojas2001-zoom 7.5s ease-out both;
}

/* Texto do slide entra em cascata a cada troca. */
.tem-anim .hero-slide.ativo .hero-conteudo > * {
	animation: lojas2001-subir .7s var(--ease-saida) both;
}

.tem-anim .hero-slide.ativo .hero-conteudo > *:nth-child(2) { animation-delay: .08s; }
.tem-anim .hero-slide.ativo .hero-conteudo > *:nth-child(3) { animation-delay: .16s; }
.tem-anim .hero-slide.ativo .hero-conteudo > *:nth-child(4) { animation-delay: .24s; }
.tem-anim .hero-slide.ativo .hero-conteudo > *:nth-child(5) { animation-delay: .32s; }

/* Indicador ativo vira barra de tempo ate o proximo slide. */
.hero-ponto { position: relative; overflow: hidden; }

.tem-anim .hero-slider.rodando .hero-ponto.ativo {
	background: rgba(255, 255, 255, .45);
}

.tem-anim .hero-slider.rodando .hero-ponto.ativo::after {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--vermelho);
	transform-origin: left;
	animation: lojas2001-tempo var(--ciclo, 6s) linear forwards;
}

.tem-anim .hero-seta {
	transition: background var(--transicao), color var(--transicao), box-shadow .25s ease;
}

.tem-anim .hero-seta:hover {
	box-shadow: 0 4px 16px rgba(0, 0, 0, .28);
}

/* ==========================================================================
   4. Cards
   ========================================================================== */

.post-card { position: relative; }

/* Brilho que segue o cursor (so com mouse). */
.tem-anim.ponteiro-fino .post-card::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
	border-radius: inherit;
	opacity: 0;
	background: radial-gradient(
		340px circle at var(--mx, 50%) var(--my, 50%),
		rgba(0, 108, 181, .10),
		transparent 60%
	);
	transition: opacity .3s ease;
}

.tem-anim.ponteiro-fino .post-card:hover::before { opacity: 1; }

.tem-anim .post-card-corpo h3 a {
	background-image: linear-gradient(var(--azul-100), var(--azul-100));
	background-repeat: no-repeat;
	background-position: 0 100%;
	background-size: 0 35%;
	transition: background-size .45s var(--ease-saida), color var(--transicao);
}

.tem-anim .post-card:hover .post-card-corpo h3 a {
	background-size: 100% 35%;
}

/* ==========================================================================
   5. Botoes: onda no clique
   ========================================================================== */

.btn { position: relative; overflow: hidden; isolation: isolate; }

.onda-clique {
	position: absolute;
	z-index: -1;
	width: 12px;
	height: 12px;
	margin: -6px 0 0 -6px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .45);
	pointer-events: none;
	animation: lojas2001-onda .6s ease-out forwards;
}

.btn-secundario .onda-clique { background: rgba(0, 108, 181, .18); }

.tem-anim .btn svg { transition: transform .25s var(--ease-mola); }
.tem-anim .btn:hover svg,
.tem-anim .ver-tudo:hover svg { transform: translateX(4px); }
.tem-anim .ver-tudo svg { transition: transform .25s var(--ease-mola); }

/* ==========================================================================
   6. Imagens do post
   ========================================================================== */

.tem-anim .texto-do-post img.carregando {
	opacity: 0;
	filter: blur(8px);
}

.tem-anim .texto-do-post img {
	transition: opacity .6s ease, filter .6s ease;
}

/* ==========================================================================
   7. Barra de leitura e voltar ao topo
   ========================================================================== */

.barra-leitura {
	position: fixed;
	top: var(--altura-adminbar);
	left: 0;
	right: 0;
	z-index: 60;
	height: 4px;
	pointer-events: none;
	background: linear-gradient(90deg, var(--vermelho), #ff6a5c);
	transform: scaleX(0);
	transform-origin: left;
	will-change: transform;
}

.voltar-topo {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 55;
	width: 50px;
	height: 50px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--azul);
	color: #fff;
	cursor: pointer;
	display: grid;
	place-items: center;
	box-shadow: 0 6px 18px rgba(0, 74, 128, .35);
	opacity: 0;
	visibility: hidden;
	transform: translate3d(0, 16px, 0) scale(.85);
	transition: opacity .3s ease, transform .35s var(--ease-mola), visibility .3s, background var(--transicao);
}

.voltar-topo.ativo {
	opacity: 1;
	visibility: visible;
	transform: none;
}

.voltar-topo:hover { background: var(--azul-escuro); }
.voltar-topo:focus-visible { outline: 3px solid var(--vermelho); outline-offset: 3px; }

.voltar-topo .seta {
	width: 20px;
	height: 20px;
	transition: transform .25s var(--ease-mola);
}

.voltar-topo:hover .seta { transform: translateY(-3px); }

.voltar-topo .anel {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	transform: rotate(-90deg);
}

.voltar-topo .anel circle {
	fill: none;
	stroke-width: 3;
}

.voltar-topo .anel .trilho { stroke: rgba(255, 255, 255, .22); }
.voltar-topo .anel .progresso {
	stroke: var(--vermelho);
	stroke-linecap: round;
	stroke-dasharray: 144.5;
	stroke-dashoffset: 144.5;
}

@media (max-width: 600px) {
	.voltar-topo { right: 14px; bottom: 14px; width: 46px; height: 46px; }
}

/* ==========================================================================
   8. Transicao entre paginas (navegadores que suportam)
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
	@view-transition { navigation: auto; }

	::view-transition-old(root) { animation: lojas2001-sair .18s ease both; }
	::view-transition-new(root) { animation: lojas2001-entrar .32s var(--ease-saida) both; }
}

/* ==========================================================================
   9. Keyframes
   ========================================================================== */

@keyframes lojas2001-zoom {
	from { transform: scale(1.09); }
	to   { transform: scale(1); }
}

@keyframes lojas2001-subir {
	from { opacity: 0; transform: translate3d(0, 18px, 0); }
	to   { opacity: 1; transform: none; }
}

@keyframes lojas2001-tempo {
	from { transform: scaleX(0); }
	to   { transform: scaleX(1); }
}

@keyframes lojas2001-onda {
	from { transform: scale(0); opacity: 1; }
	to   { transform: scale(28); opacity: 0; }
}

@keyframes lojas2001-sair {
	to { opacity: 0; }
}

@keyframes lojas2001-entrar {
	from { opacity: 0; transform: translate3d(0, 10px, 0); }
	to   { opacity: 1; transform: none; }
}

/* ==========================================================================
   10. Preferencias e impressao
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.site-header.escondido { transform: none; }
	.barra-leitura { display: none; }
}

@media print {
	.barra-leitura,
	.voltar-topo { display: none !important; }

	.tem-anim * { opacity: 1 !important; transform: none !important; filter: none !important; }
}
