/* Hero — metade amarela (conteúdo) + metade KV */
.hero {
	position: relative;
	padding-top: var(--hero-stack-h);
	min-height: 100vh;
	min-height: 100dvh;
	background: #a5fa00;
	overflow-x: clip;
	overflow-y: visible;
	max-width: 100%;
}

.hero img {
	user-select: none;
	-webkit-user-select: none;
	-webkit-user-drag: none;
	user-drag: none;
	pointer-events: none;
}

/* KV: metade direita no desktop — não invade a esquerda */
.hero:not(.hero--flow) .hero__media {
	position: absolute;
	top: var(--hero-stack-h);
	left: 50%;
	right: 0;
	bottom: 0;
	width: 50%;
	height: auto;
	overflow: hidden;
	pointer-events: none;
	z-index: 0;
}

.hero:not(.hero--flow) picture.hero__image--home,
.hero:not(.hero--flow) .hero__image--home {
	width: 100%;
	height: 100%;
	min-height: 100%;
}

.hero:not(.hero--flow) picture.hero__image--home img,
.hero:not(.hero--flow) .hero__image--home img {
	width: 100%;
	height: 100%;
	min-height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: center center;
}

.hero:not(.hero--flow) .hero__image--cadastro {
	display: none !important;
}

/* Slideshow KV — crossfade em camadas (nova por cima da atual) */
.hero__slideshow {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	background: #a5fa00;
}

.hero__slideshow .hero__image--home {
	position: absolute;
	inset: 0;
	margin: 0;
	opacity: 0;
	z-index: 0;
	pointer-events: none;
	/* transição controlada via JS no crossfade */
	transition: none;
}

.hero__slideshow .hero__image--home.is-active,
.hero__slideshow .hero__image--home.is-leaving {
	opacity: 1;
}

.hero__slideshow .hero__image--home.is-leaving {
	z-index: 1;
}

.hero__slideshow .hero__image--home.is-entering {
	z-index: 2;
}

.hero__media {
	position: relative;
	width: 100%;
	z-index: 0;
	line-height: 0;
}

picture.hero__image {
	display: block;
	width: 100%;
	height: 100%;
}

picture.hero__image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hero__image {
	width: 100%;
	height: auto;
}

.hero__overlay {
	display: none;
	position: absolute;
	top: var(--hero-stack-h);
	left: 0; right: 0;
	bottom: 0;
	z-index: 1;
	pointer-events: none;
}

/* Elementos decorativos — acima do background, abaixo do conteúdo */
.hero__elementos {
	display: none;
}

.hero__elemento {
	position: absolute;
	width: 14%!important;
	width: 250px;
	line-height: 0;
	z-index: 2;
}

.hero__elemento picture,
.hero__elemento img {
	display: block;
	width: 100%;
	height: auto;
}

.hero__elemento--1 img {
	animation: hero-elemento-spin 60s linear infinite;
}

.hero__elemento--2 img {
	animation: hero-elemento-spin 90s linear infinite;
}

.hero__elemento--hand img {
	animation: hero-elemento-pulse 1.4s ease-in-out infinite;
}

.hero__elemento--1 {
	top: calc(var(--hero-stack-h) + 1.2rem);
	right: -2rem;
}

.hero__elemento--2 {
	bottom: -2rem;
	left: 54%;
	transform: translateX(-50%);
}

.hero__elemento--hand {
	top: 61%;
	left: -2rem;
	width: 8% !important;
	max-width: 120px;
	transform: translateY(-50%);
}

.hero.hero--flow .hero__elementos,
.hero.hero--logged .hero__elementos {
	/* display: none; */
}

@keyframes hero-elemento-spin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

@keyframes hero-elemento-pulse {
	0%, 100% {
		transform: rotate(0deg) scale(1) translate(0, 0);
	}
	15% {
		transform: rotate(-4deg) scale(1.04) translate(-2px, 1px);
	}
	30% {
		transform: rotate(3deg) scale(1.08) translate(2px, -2px);
	}
	45% {
		transform: rotate(-3deg) scale(1.05) translate(-1px, 2px);
	}
	60% {
		transform: rotate(2deg) scale(1.1) translate(1px, -1px);
	}
	75% {
		transform: rotate(-1deg) scale(1.03) translate(-1px, 0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.hero__elemento img,
	.hero__selo-img {
		animation: none;
	}
}

.hero__content {
	position: relative;
	top: auto;
	left: auto;
	right: auto;
	height: auto;
	min-height: calc(100dvh - var(--hero-stack-h));
	max-height: none;
	z-index: 2;
	display: block;
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: 0;
	box-sizing: border-box;
	pointer-events: none;
	overflow: visible;
}

/* Selo na metade amarela (esquerda) */
.hero__selo {
	position: absolute;
	top: 0;
	left: 0;
	width: 50%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(1.2rem, 3vh, 2.4rem) clamp(2rem, 4vw, 4.8rem);
	box-sizing: border-box;
	pointer-events: none;
	line-height: 0;
	z-index: 2;
}

.hero__selo picture {
	position: relative;
	display: block;
	width: min(100%, 520px);
	max-width: 520px;
}

@media (max-width: 991px) {
	.hero__selo picture {
		width: 100%;
		left: inherit;
		margin-top: 0;
	}
}

.hero__selo-img {
	display: block;
	width: 100%;
	height: auto;
	filter: drop-shadow(0 10px 28px rgba(0, 0, 0, 0.3));
	transform-origin: center center;
	will-change: transform;
}

@keyframes hero-selo-wiggle {
	0%,
	12% {
		transform: rotate(0deg);
	}
	18% {
		transform: rotate(-3.5deg);
	}
	24% {
		transform: rotate(3.5deg);
	}
	30% {
		transform: rotate(-2.5deg);
	}
	36% {
		transform: rotate(2.5deg);
	}
	42% {
		transform: rotate(-1.5deg);
	}
	48% {
		transform: rotate(1deg);
	}
	54%,
	100% {
		transform: rotate(0deg);
	}
}

.hero.hero--flow .hero__selo {
	display: none;
}

.hero--flow .hero__image--home,
.hero--flow .hero__slideshow { display: none !important; }
.hero--flow .hero__image--cadastro:not([hidden]) { display: block !important; }

/* Box login / logado — à esquerda da metade direita (mais imagem à vista) */
.hero__hub {
	position: absolute;
	top: 0;
	left: 50%;
	width: 50%;
	height: 100%;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	margin: 0;
	padding: clamp(1.6rem, 3vw, 3.2rem);
	box-sizing: border-box;
	pointer-events: none;
}

.hero__hub .hero__vitrine-box,
.hero__hub .hero__logged-box,
.hero__hub .page-card {
	width: min(100%, 42rem);
	margin: 0;
	pointer-events: auto;
}

.hero__cpf-form {
	display: flex;
	flex-direction: row;
	align-items: flex-start;
	flex-wrap: wrap;
	gap: 1.2rem;
}

.hero__cpf-form__field {
	flex: 1 1 16rem;
	min-width: 0;
}

.hero__cpf-form .form-control {
	min-height: 48px;
	padding: 1.2rem 1.4rem;
	background: #ffffff;
	border: 1px solid rgba(0, 0, 0, 0.25);
	border-radius: 6px;
	font-size: 1.5rem;
	color: var(--color-text-dark);
}

.hero__cpf-form .form-control:focus {
	border-color: #004921;
	box-shadow: 0 0 0 2px #ffffff, 0 0 0 3px #004921, 0 0 0 5px rgba(0, 215, 0, 0.4);
	outline: none;
}

.hero__cpf-form .btn-primary {
	margin-top: 0;
	flex: 0 0 auto;
	width: auto;
	min-width: 14rem;
}

.hero__cpf-hint {
	margin-top: var(--space-2);
	font-size: 1.15rem;
	color: var(--color-text-soft);
	line-height: 1.45;
}

.hero__logged-actions {
	display: flex;
	flex-direction: column;
	gap: 1.2rem;
}

@media (min-width: 992px) {
	.hero__content {
		padding: 0;
	}
}

/* Desktop em resoluções menores / altura curta — amplia o hero para caber selo + login */
@media (min-width: 992px) and (max-width: 1440px) {
	.hero:not(.hero--flow):not(.hero--logged) {
		min-height: max(100dvh, 78rem);
	}

	.hero__selo picture {
		width: min(100%, 420px);
		max-width: 420px;
	}

	.hero__hub {
		padding: clamp(1.4rem, 2.4vw, 2.8rem);
	}
}

@media (min-width: 992px) and (max-height: 900px) {
	.hero:not(.hero--flow):not(.hero--logged) {
		min-height: max(100dvh, 86rem);
	}

	.hero__hub {
		align-items: center;
		padding-top: clamp(1.2rem, 2vh, 2.4rem);
		padding-bottom: clamp(1.2rem, 2vh, 2.4rem);
	}
}

@media (min-width: 992px) and (max-height: 760px) {
	.hero:not(.hero--flow):not(.hero--logged) {
		min-height: max(100dvh, 94rem);
	}
}

@media (max-width: 991px) {
	/*
	 * O split 50/50 usa a altura do .hero__content — precisa ser maior que 100dvh
	 * em telas baixas para o login + atalhos caberem sem cortar.
	 */
	.hero:not(.hero--flow):not(.hero--logged):not(.hero--hub-collapsed) {
		min-height: max(100dvh, 112rem);
	}

	/* KV: metade inferior — deslocada ~95% da altura do box de login */
	.hero:not(.hero--flow) .hero__media {
		top: calc(50% + var(--hero-stack-h) / 2 + var(--hero-kv-nudge, calc(18rem * 0.95)));
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		height: auto;
		background: transparent;
	}

	.hero__content {
		width: 100%;
		max-width: 100%;
		min-height: max(calc(100dvh - var(--hero-stack-h)), 100rem);
		padding: 0;
		padding-bottom: 12rem;
		box-sizing: border-box;
	}

	/* Selo na metade superior amarela — respiro sob menu/countdown no mobile */
	.hero__selo {
		top: 0;
		left: 0;
		width: 100%;
		height: 50%;
		padding: calc(var(--countdown-h, 0px) + 1.8rem) var(--space-3) var(--space-3);
		align-items: center;
		justify-content: center;
		box-sizing: border-box;
	}

	.hero__selo picture {
		width: min(88vw, 520px);
		max-width: 520px;
		top: 0;
		margin-top: 0.4rem;
	}

	/* Box no topo da metade inferior — altura auto para o card não estourar */
	.hero__hub {
		top: 50%;
		left: 0;
		width: 100%;
		height: auto;
		min-height: 50%;
		align-items: flex-start;
		justify-content: center;
		padding: 0 1.6rem 1.6rem;
	}

	.hero__elementos {
		display: none;
	}
}

/* iPhone SE / alturas curtas — aproxima selo e login (menos vão amarelo) */
@media (max-width: 991px) and (max-height: 740px) {
	.hero:not(.hero--flow):not(.hero--logged):not(.hero--hub-collapsed) {
		min-height: max(100dvh, 112rem);
	}

	.hero__content {
		min-height: max(calc(100dvh - var(--hero-stack-h)), 100rem);
		padding-bottom: 12rem;
	}

	.hero__selo {
		height: 34%;
		align-items: flex-start;
		justify-content: center;
		padding-top: calc(var(--countdown-h, 0px) + 1rem);
		padding-bottom: 0.4rem;
	}

	.hero__selo picture {
		width: min(78vw, 420px);
		margin-top: 0;
	}

	.hero__hub {
		top: 34%;
		min-height: 66%;
	}

	.hero:not(.hero--flow) .hero__media {
		top: calc(34% + var(--hero-stack-h) / 2 + var(--hero-kv-nudge, calc(18rem * 0.95)));
	}
}

@media (max-width: 575px) {
	.hero__selo {
		padding-top: calc(var(--countdown-h, 0px) + 2.2rem);
		padding-bottom: var(--space-2);
	}

	.hero__selo picture {
		width: min(92vw, 520px);
	}
}

/* SE ~375×667 — aperta ainda mais o vão entre selo e card */
@media (max-width: 400px) and (max-height: 700px) {
	.hero:not(.hero--flow):not(.hero--logged):not(.hero--hub-collapsed) {
		min-height: max(100dvh, 108rem);
	}

	.hero__content {
		min-height: max(calc(100dvh - var(--hero-stack-h)), 96rem);
		padding-bottom: 11rem;
	}

	.hero__selo {
		height: 30%;
		align-items: flex-start;
		padding-top: calc(var(--countdown-h, 0px) + 0.6rem);
		padding-bottom: 0;
		padding-left: var(--space-2);
		padding-right: var(--space-2);
	}

	.hero__selo picture {
		width: min(76vw, 380px);
		margin-top: 0;
	}

	.hero__hub {
		top: 30%;
		min-height: 70%;
		padding-left: 1.2rem;
		padding-right: 1.2rem;
	}

	.hero:not(.hero--flow) .hero__media {
		top: calc(30% + var(--hero-stack-h) / 2 + var(--hero-kv-nudge, calc(18rem * 0.95)));
	}
}

@media (max-width: 375px) {
	.hero__hub {
		top: 33% !important;
	}

	.hero__selo {
		align-items: flex-start;
		padding-top: calc(var(--countdown-h, 0px) + 5.4rem) !important;
	}

	.hero__selo picture {
		margin-top: 0.8rem;
	}
}

/* 390–430px (ex.: iPhone 12/13/14) */
@media (min-width: 390px) and (max-width: 430px) {
	.hero__hub {
		top: 46% !important;
	}
}
