/* Cabeçalho — medidas a 1440 / 834 / 390 px. Os seletores começam por #mt-cabecalho para
   ganharem às regras gerais.

   Barra fixa: a barra pára a 10 px do topo (6 px no telemóvel) quando o scroll chega
   aos 43 px (39 px no telemóvel). É o cabeçalho inteiro que fica sticky com top negativo:
   a faixa de avisos sai por cima e a barra pára no mesmo sítio, sem clone
   nem salto. O cabeçalho deixa passar os cliques (pointer-events) e só a
   faixa e a barra os apanham, como antes. */

.mt-cab {
	--mt-cab-colar: 43px;   /* 8 de padding + 37 da faixa + 8 de espaço − 10 de margem */
	position: sticky;
	top: calc(var(--mt-cab-colar) * -1);
	z-index: 999;
	pointer-events: none;
}
body.admin-bar .mt-cab { top: calc(32px - var(--mt-cab-colar)); }
@media (max-width: 782px) {
	body.admin-bar .mt-cab { top: calc(46px - var(--mt-cab-colar)); }
}
@media (max-width: 600px) {
	/* aqui a barra do WordPress rola com a página */
	body.admin-bar .mt-cab { top: calc(var(--mt-cab-colar) * -1); }
}

#mt-cabecalho .mt-cab__dentro {
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	align-items: center;
	gap: 0.5rem;
	width: 100%;
	max-width: 94%;
	margin: 0 auto;
	padding: 0.5rem 0;
}

/* ── Faixa de avisos ─────────────────────────────────────────────────────── */

#mt-cabecalho .mt-cab__avisos {
	position: relative;
	z-index: 999;
	display: flex;
	flex-direction: column;
	width: 100%;
	min-width: 0;
	overflow: hidden;
	padding: 0.5rem;
	border-radius: 12px;
	background-color: var(--mx-global-color-primary);
	pointer-events: auto;
}

/* Era um carrossel Swiper com rotação contínua: 3 avisos à vista (1 no
   tablet e no telemóvel), 10 px entre eles, 15 s por aviso, linear. Aqui é
   uma animação CSS. --mt-passo = largura de um aviso + o espaço. */
#mt-cabecalho .mt-avisos {
	position: relative;
	overflow: hidden;
	cursor: grab;
	-webkit-mask-image: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, black 30%, black 70%, rgba(0, 0, 0, 0) 100%);
	mask-image: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, black 30%, black 70%, rgba(0, 0, 0, 0) 100%);
}
#mt-cabecalho .mt-avisos__trilho {
	--mt-vista: 3;
	--mt-passo: calc((100% - (var(--mt-vista) - 1) * 10px) / var(--mt-vista) + 10px);
	display: flex;
	width: 100%;
	animation: mt-avisos 60s linear infinite;
	will-change: transform;
}
#mt-cabecalho .mt-avisos:hover .mt-avisos__trilho { animation-play-state: paused; }
@keyframes mt-avisos {
	from { transform: translateX(0); }
	to   { transform: translateX(calc(var(--mt-passo) * -4)); }
}
#mt-cabecalho .mt-avisos__item {
	flex: 0 0 calc(var(--mt-passo) - 10px);
	margin-right: 10px;
	color: var(--mx-global-color-secondary);
	font-size: 14px;
	font-style: italic;
	font-weight: 400;
	line-height: 1.5;
	text-align: center;
}
@media (prefers-reduced-motion: reduce) {
	#mt-cabecalho .mt-avisos__trilho { animation: none; }
}

/* ── Barra: logo, menu, língua, pesquisa, conta, carrinho ───────────────── */

#mt-cabecalho .nav-bar {
	position: relative;
	z-index: 999;
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	justify-content: flex-start;
	align-items: center;
	gap: 1.5rem;
	width: 100%;
	min-width: 0;
	padding: 1rem;
	border-radius: 12px;
	background-color: transparent;
	transition: background-color 0.4s ease-in-out, box-shadow 0.4s ease-in-out;
	pointer-events: auto;
}
#mt-cabecalho .nav-bar.mt-sticky--effects {
	background-color: #fff !important;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}
#mt-cabecalho .nav-bar > * {
	position: relative;
	min-width: 0;
	max-width: 100%;
}

#mt-cabecalho .mt-cab__logo { text-align: start; }
#mt-cabecalho .mt-cab__logo a { display: inline-block; }
#mt-cabecalho .mt-cab__logo img {
	display: inline-block;
	vertical-align: middle;
	width: 110px;
}

#mt-cabecalho .mt-cab__nav { align-self: flex-end; }

#mt-cabecalho .mt-cab__pesquisa .ms-toggle {
	font-size: 26px;
	color: var(--mx-global-color-primary);
}

#mt-cabecalho .mt-cab__conta {
	align-self: center;
	padding: 5px;
}
#mt-cabecalho .mt-cab__conta-icone { line-height: 0; text-align: center; }
#mt-cabecalho .mt-cab__conta a.mt-icon {
	display: inline-block;
	font-size: 25px;
	line-height: 1;
	text-align: center;
	color: var(--mx-global-color-primary);
	border-color: var(--mx-global-color-primary);
	transition: all 0.3s;
}
#mt-cabecalho .mt-cab__conta a.mt-icon svg {
	position: relative;
	display: block;
	width: auto;
	height: 25px;
	fill: var(--mx-global-color-primary);
}

#mt-cabecalho .mt-cab__carrinho {
	--mcc-icon-size: 26px;
	--mcc-icon: var(--mx-global-color-primary);
	--mcc-accent: var(--mx-global-color-accent);
}
#mt-cabecalho .mt-cab__carrinho .mc-cart__count { background: var(--mx-global-color-accent); }
#mt-cabecalho .mt-cab__carrinho .mc-cart__panel {
	width: 500px;
	font-family: var(--mx-global-typography-text-font-family), Sans-serif;
	font-size: var(--mx-global-typography-text-font-size);
	font-weight: var(--mx-global-typography-text-font-weight);
}

/* ── Tablet ──────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
	#mt-cabecalho .mt-cab__dentro { max-width: 96%; }
	#mt-cabecalho .mt-avisos__trilho { --mt-vista: 1; }
	#mt-cabecalho .nav-bar { justify-content: center; gap: 1rem; }
	#mt-cabecalho .mt-cab__logo { flex-grow: 1; flex-shrink: 0; }
	#mt-cabecalho .mt-cab__logo img { width: 100px; }
	#mt-cabecalho .mt-cab__lingua,
	#mt-cabecalho .mt-cab__conta { display: none; }
}

/* ── Telemóvel ───────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
	.mt-cab { --mt-cab-colar: 39px; } /* 6,4 + 33,8 + 4,8 − 6 */
	#mt-cabecalho .mt-cab__dentro { gap: 0.3rem; padding: 0.4rem 0 0; }
	#mt-cabecalho .mt-cab__avisos { padding: 0.4rem; }
	#mt-cabecalho .nav-bar { padding: 0.8rem; }
	#mt-cabecalho .mt-cab__logo img { width: 90px; }
}
