/**
 * Micro-animações. Tudo dentro de prefers-reduced-motion: no-preference — quem pediu menos
 * movimento no sistema vê o site estático. A revelação ao fazer scroll é ativada por
 * assets/js/animacoes.js (sem JS o conteúdo aparece normalmente).
 */

@media (prefers-reduced-motion: no-preference) {

	/* ---------- Botões: sobem 2px com sombra ---------- */
	.wp-block-button__link,
	.wpcf7-submit {
		transition: background-color .25s ease, color .25s ease, transform .25s ease, box-shadow .25s ease;
	}
	.wp-block-button__link:hover,
	.wpcf7-submit:hover {
		transform: translateY(-2px);
		box-shadow: 0 6px 16px rgba(0, 173, 159, .25);
	}
	.wp-block-button__link:active,
	.wpcf7-submit:active {
		transform: translateY(0);
		box-shadow: none;
	}

	/* ---------- Cartões de casas: elevam-se e a foto aproxima ---------- */
	.hcs-cartao,
	.destaques-home .o-posts-grid-post-blog {
		transition: transform .35s ease, box-shadow .35s ease;
	}
	.hcs-cartao:hover,
	.destaques-home .o-posts-grid-post-blog:hover {
		transform: translateY(-4px);
		box-shadow: 0 14px 30px rgba(61, 57, 53, .12);
	}

	.hcs-cartao__imagem,
	.destaques-home .o-posts-grid-post-image,
	.alojamento-post > a,
	.home_section_bottom_loop .grid-wrapper {
		overflow: hidden;
		border-radius: 8px;
		isolation: isolate; /* Safari: sem isto o zoom (transform) da foto saía dos cantos redondos */
	}
	.hcs-cartao__imagem img,
	.destaques-home .o-posts-grid-post-image a,
	.alojamento-post > a img {
		border-radius: 8px;
	}
	.hcs-cartao__imagem img,
	.destaques-home .o-posts-grid-post-image a,
	.alojamento-post > a img,
	.home_section_bottom_loop .aspect {
		transition: transform .7s cubic-bezier(.2, .6, .2, 1);
	}
	.hcs-cartao:hover .hcs-cartao__imagem img,
	.destaques-home .o-posts-grid-post-blog:hover .o-posts-grid-post-image a,
	.alojamento-post:hover > a img,
	.home_section_bottom_loop .grid-item:hover .aspect {
		transform: scale(1.05);
	}

	/* ---------- Sublinhado que cresce (menu no desktop e rodapé) ---------- */
	@media (min-width: 960px) {
		.hcs-menu-principal .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation-item__content {
			text-decoration: none !important;
			background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
			transition: background-size .3s ease;
		}
		.hcs-menu-principal .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation-item__content:hover,
		.hcs-menu-principal .wp-block-navigation__responsive-container:not(.is-menu-open) .current-menu-item > .wp-block-navigation-item__content {
			background-size: 100% 1px;
		}
	}
	.hcs-rodape__menu .wp-block-navigation-item__content {
		text-decoration: none !important;
		background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
		transition: background-size .3s ease;
	}
	.hcs-rodape__menu .wp-block-navigation-item__content:hover {
		background-size: 100% 1px;
	}

	/* ---------- Menu do telemóvel: links entram em cascata ---------- */
	@keyframes hcs-entra {
		from { opacity: 0; transform: translateY(10px); }
		to   { opacity: 1; transform: none; }
	}
	.hcs-menu-principal .is-menu-open .wp-block-navigation-item {
		animation: hcs-entra .45s cubic-bezier(.2, .6, .2, 1) backwards;
	}
	.hcs-menu-principal .is-menu-open .wp-block-navigation-item:nth-child(2) { animation-delay: .06s; }
	.hcs-menu-principal .is-menu-open .wp-block-navigation-item:nth-child(3) { animation-delay: .12s; }
	.hcs-menu-principal .is-menu-open .wp-block-navigation-item:nth-child(4) { animation-delay: .18s; }
	.hcs-menu-principal .is-menu-open .wp-block-navigation-item:nth-child(5) { animation-delay: .24s; }
	.hcs-menu-principal .is-menu-open .wp-block-navigation-item:nth-child(6) { animation-delay: .30s; }

	/* ---------- Galeria do alojamento: setas e lupa ---------- */
	.alojamento .metaslider .flex-direction-nav a,
	.alojamento .metaslider .ms-lightbox-btn {
		transition: transform .25s ease, opacity .25s ease;
	}
	.alojamento .metaslider .flex-direction-nav a:hover,
	.alojamento .metaslider .ms-lightbox-btn:hover {
		transform: scale(1.12);
	}

	/* ---------- Revelação ao fazer scroll (classe posta pelo JS só abaixo da dobra) ---------- */
	.hcs-revelar {
		opacity: 0;
		transform: translateY(24px);
		transition: opacity .8s ease, transform .8s cubic-bezier(.2, .6, .2, 1);
		transition-delay: calc(var(--hcs-i, 0) * 90ms);
	}
	.hcs-revelar.is-visivel {
		opacity: 1;
		transform: none;
	}
}

/* ---------- Hero da homepage: entrada ao carregar ---------- */
@media (prefers-reduced-motion: no-preference) {
	@keyframes hcs-sobe {
		from { opacity: 0; transform: translateY(18px); }
		to   { opacity: 1; transform: none; }
	}
	@keyframes hcs-da-direita {
		from { opacity: 0; transform: translateX(14px); }
		to   { opacity: 1; transform: none; }
	}
	@keyframes hcs-sobe-suave {
		from { opacity: 0; transform: translateY(10px); }
		to   { opacity: 1; transform: none; }
	}
	@keyframes hcs-afasta {
		from { transform: scale(1.08); }
		to   { transform: scale(1); }
	}

	/* Foto de fundo: afasta-se devagar. */
	.hcs-home .home_section > .wp-block-cover__image-background {
		animation: hcs-afasta 2.4s cubic-bezier(.2, .6, .2, 1) both;
	}

	/* Título, texto e botão sobem em sequência. */
	.hcs-home .home_section h1,
	.hcs-home .home_section_content p,
	.hcs-home .home_section .wp-block-themeisle-blocks-button-group {
		animation: hcs-sobe .7s cubic-bezier(.2, .6, .2, 1) backwards;
	}
	.hcs-home .home_section_content p { animation-delay: .12s; }
	.hcs-home .home_section .wp-block-themeisle-blocks-button-group { animation-delay: .24s; }

	/* Cartões: entram da direita, um a um (no telemóvel sobem). */
	.hcs-home .destaques-home .o-posts-grid-post-blog {
		animation: hcs-da-direita .8s cubic-bezier(.25, .1, .25, 1) backwards; /* backwards: depois da entrada o hover volta a funcionar */
	}
	.hcs-home .destaques-home .o-posts-grid-post-blog:nth-child(1) { animation-delay: .25s; }
	.hcs-home .destaques-home .o-posts-grid-post-blog:nth-child(2) { animation-delay: .4s; }
	.hcs-home .destaques-home .o-posts-grid-post-blog:nth-child(3) { animation-delay: .55s; }

	@media (max-width: 781px) {
		.hcs-home .destaques-home .o-posts-grid-post-blog {
			animation-name: hcs-sobe-suave;
		}
	}
}
