/**
 * header.css — Componente de Header global do FBB Theme.
 *
 * Usa os tokens definidos em assets/css/base/_variables.css. Depende
 * dela via ordem de enqueue (ver inc/enqueue.php) — este arquivo não
 * declara @import para não duplicar requisições HTTP.
 *
 * Breakpoints oficiais do projeto (DESIGN.md): 375 / 768 / 1024 / 1440 / 1920px.
 */

/* =============================================================
 * Topbar
 * ============================================================= */
.fbb-topbar {
	display: block;
	background-color: var( --fbb-color-white );
	color: var( --fbb-color-black );
	border-bottom: 1px solid #e2e2e2;
}

.fbb-topbar__container {
	max-width: var( --fbb-container-max-width );
	margin-inline: auto;
	padding-inline: var( --fbb-container-padding-inline );
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	min-height: 30px;
}

.fbb-topbar__info {
	display: flex;
	align-items: center;
	gap: 24px;
	font-family: var( --fbb-font-family );
	font-weight: var( --fbb-font-weight-medium );
	font-size: 11px;
	line-height: 1.4;
	flex-wrap: wrap;
}

.fbb-topbar__phone {
	color: inherit;
	text-decoration: none;
	white-space: nowrap;
}

.fbb-topbar__phone:hover,
.fbb-topbar__phone:focus-visible {
	text-decoration: underline;
}

.fbb-topbar__social {
	display: flex;
	align-items: center;
	gap: 14px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.fbb-topbar__actions {
	display: inline-flex;
	align-items: center;
	gap: 14px;
	margin-left: auto;
}

.fbb-topbar__language-switcher {
	display: inline-flex;
	align-items: center;
	flex: 0 0 auto;
	gap: 6px;
	line-height: 1;
	max-height: 20px;
	overflow: hidden;
}

.fbb-topbar__language-switcher.tk-translate-switcher--flags .tk-translate-switcher__item {
	width: auto;
	height: 20px;
	flex: 0 0 auto;
	border-radius: 3px;
}

.fbb-topbar__language-switcher .tk-translate-switcher__flag {
	display: block;
	width: auto;
	height: 20px;
	max-width: none;
	max-height: 20px;
	object-fit: contain;
}

.fbb-topbar__social-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	color: var( --fbb-color-navy );
	transition: opacity 0.2s ease;
}

.fbb-topbar__social-link:hover,
.fbb-topbar__social-link:focus-visible {
	opacity: 0.7; /* SUGESTÃO de hover — não extraído do Figma (estático), ver DESIGN.md Seção 6. */
}

.fbb-topbar__social-link svg {
	width: 100%;
	height: 100%;
}

/* =============================================================
 * Header / Nav principal
 * ============================================================= */
.fbb-header {
	position: sticky;
	top: 0;
	z-index: var( --fbb-z-header );
	width: 100%;
}

.fbb-header__nav {
	background-color: var( --fbb-color-offwhite );
	transition: box-shadow 0.25s ease;
}

/* Sombra sutil aplicada via JS (data-fbb-scrolled) quando a página rola —
 * ver assets/js/components/header.js. */
.fbb-header.is-scrolled .fbb-header__nav {
	box-shadow: 0 2px 12px rgba( 0, 0, 0, 0.08 );
}

.fbb-header__container {
	max-width: 1712px;
	margin-inline: auto;
	padding-inline: var( --fbb-container-padding-inline );
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 44px;
	min-height: 152px;
}

.fbb-header__logo {
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
}

.fbb-header__logo-img {
	display: block;
	height: 68px;
	width: auto;
}

.fbb-header__logo .custom-logo-link {
	display: inline-flex;
}

.fbb-header__logo .custom-logo {
	display: block;
	width: auto;
	height: 100px;
}

.fbb-header__nav-wrapper {
	flex: 1;
	display: flex;
	justify-content: center;
	min-width: 0;
}

.fbb-header__menu {
	display: flex;
	width: 100%;
	align-items: center;
	/* Cada item ocupa só a largura do próprio texto (flex: 0 0 auto abaixo);
	 * space-between reparte o espaço sobrando em vãos iguais entre eles, em
	 * vez de caixas de largura igual que deixavam textos curtos com folgas
	 * maiores dos dois lados. */
	justify-content: space-between;
	gap: 12px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.fbb-header__menu > .menu-item {
	position: relative;
	flex: 0 0 auto;
	margin: 0;
}

.fbb-header__menu > .menu-item-has-children {
	min-width: 0;
}

.fbb-header__menu > .menu-item > a {
	position: relative;
	display: inline-flex;
	justify-content: center;
	max-width: 100%;
	align-items: center;
	font-family: var( --fbb-font-family );
	font-weight: var( --fbb-font-weight-medium );
	font-size: 16px;
	color: var( --fbb-color-navy );
	text-decoration: none;
	white-space: nowrap;
	padding-block: 12px;
	transition: color 0.2s ease;
}

.fbb-header__menu > .menu-item > a::after {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	bottom: 5px;
	height: 2px;
	background-color: var( --fbb-color-red );
	transform: scaleX( 0 );
	transform-origin: right center;
	transition: transform 0.25s ease;
}

.fbb-header__menu > .menu-item > a:hover,
.fbb-header__menu > .menu-item > a:focus-visible,
.fbb-header__menu > .current-menu-item > a,
.fbb-header__menu > .current-menu-ancestor > a {
	color: var( --fbb-color-red );
}

.fbb-header__menu > .menu-item > a:hover::after,
.fbb-header__menu > .menu-item > a:focus-visible::after,
.fbb-header__menu > .current-menu-item > a::after,
.fbb-header__menu > .current-menu-ancestor > a::after {
	transform: scaleX( 1 );
	transform-origin: left center;
}

.fbb-header__menu > .menu-item > a:focus-visible {
	outline: 2px solid var( --fbb-color-red );
	outline-offset: 5px;
}

.fbb-header__menu > .menu-item-has-children > a {
	padding-right: 14px;
}

.fbb-header__menu > .menu-item-has-children > a::before {
	content: '';
	position: absolute;
	top: 50%;
	right: 0;
	width: 6px;
	height: 6px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: translateY( -70% ) rotate( 45deg );
}

.fbb-header__menu .sub-menu {
	position: absolute;
	top: calc( 100% - 1px );
	left: 0;
	z-index: calc( var( --fbb-z-header ) + 1 );
	box-sizing: border-box;
	/* Largura própria do submenu: os itens do menu agora só ocupam o espaço
	 * do próprio texto, e amarrar o submenu a essa largura espremia rótulos
	 * como "Relatório de Atividades" em uma coluna estreita. */
	width: max-content;
	min-width: 220px;
	max-width: 280px;
	margin: 0;
	padding: 6px;
	border: 1px solid rgba( 0, 35, 120, 0.12 );
	border-top: 2px solid var( --fbb-color-red );
	border-radius: 0 0 8px 8px;
	background: var( --fbb-color-offwhite );
	box-shadow: 0 12px 24px rgba( 0, 35, 120, 0.12 );
	list-style: none;
	opacity: 0;
	pointer-events: none;
	transform: translateY( 6px );
	visibility: hidden;
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.fbb-header__menu .menu-item-has-children:not( .is-submenu-dismissed ):hover > .sub-menu,
.fbb-header__menu .menu-item-has-children:not( .is-submenu-dismissed ):focus-within > .sub-menu,
.fbb-header__menu .menu-item-has-children.is-submenu-open > .sub-menu {
	opacity: 1;
	pointer-events: auto;
	transform: translateY( 0 );
	visibility: visible;
}

.fbb-header__menu .sub-menu .menu-item {
	margin: 0;
}

.fbb-header__menu .sub-menu a {
	display: block;
	padding: 11px 14px;
	border-radius: 5px;
	color: var( --fbb-color-navy );
	font-family: var( --fbb-font-family );
	font-size: 14px;
	font-weight: var( --fbb-font-weight-medium );
	line-height: 1.35;
	overflow-wrap: anywhere;
	text-decoration: none;
	white-space: normal;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.fbb-header__menu .sub-menu a:hover,
.fbb-header__menu .sub-menu a:focus-visible,
.fbb-header__menu .sub-menu .current-menu-item:not( .fbb-menu-item--anchor ) > a,
.fbb-header__menu .sub-menu .fbb-menu-item--anchor.is-anchor-current > a {
	background: var( --fbb-color-navy );
	color: var( --fbb-color-white );
}

.fbb-header__menu .sub-menu a:focus-visible {
	outline: 2px solid var( --fbb-color-red );
	outline-offset: -3px;
}

.fbb-header__submenu-toggle {
	display: none;
	place-items: center;
	padding: 0;
	border: 1px solid rgba( 0, 35, 120, 0.18 );
	border-radius: 50%;
	background: transparent;
	color: var( --fbb-color-navy );
	cursor: pointer;
}

.fbb-header__submenu-toggle:hover,
.fbb-header__submenu-toggle:focus-visible {
	border-color: var( --fbb-color-red );
	color: var( --fbb-color-red );
}

.fbb-header__submenu-toggle:focus-visible {
	outline: 2px solid var( --fbb-color-red );
	outline-offset: 2px;
}

.fbb-header__submenu-icon {
	display: block;
	width: 8px;
	height: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY( -2px ) rotate( 45deg );
	transition: transform 0.2s ease;
}

.fbb-header__submenu-toggle[aria-expanded="true"] .fbb-header__submenu-icon {
	transform: translateY( 2px ) rotate( 225deg );
}

/* Em tablets sem hover, a seta oferece uma ação touch separada do link. */
@media ( hover: none ) and ( min-width: 768px ) {
	.fbb-header__menu > .menu-item-has-children > a {
		padding-right: 30px;
	}

	.fbb-header__menu > .menu-item-has-children > a::before {
		display: none;
	}

	.fbb-header__submenu-toggle {
		position: absolute;
		top: 50%;
		right: 0;
		display: inline-grid;
		width: 24px;
		height: 24px;
		transform: translateY( -50% );
	}
}

/* =============================================================
 * CTA "DOE AGORA" — base do botão pill vive em components/buttons.css
 * (carregado antes deste arquivo, ver inc/enqueue.php). Aqui só o ajuste
 * de layout específico do header.
 * ============================================================= */
.fbb-header__cta.fbb-btn--pill {
	flex-shrink: 0;
	padding: 22px 34px;
	font-size: 16px;
}

/* =============================================================
 * Hamburger (mobile)
 * ============================================================= */
.fbb-header__hamburger {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 32px;
	height: 32px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 0;
}

.fbb-header__hamburger-line {
	display: block;
	width: 100%;
	height: 2px;
	background-color: var( --fbb-color-navy );
	transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Estado aberto do hamburger — classe alternada via JS. */
.fbb-header__hamburger[aria-expanded="true"] .fbb-header__hamburger-line:nth-child(1) {
	transform: translateY( 7px ) rotate( 45deg );
}

.fbb-header__hamburger[aria-expanded="true"] .fbb-header__hamburger-line:nth-child(2) {
	opacity: 0;
}

.fbb-header__hamburger[aria-expanded="true"] .fbb-header__hamburger-line:nth-child(3) {
	transform: translateY( -7px ) rotate( -45deg );
}

/* =============================================================
 * Responsivo
 * ============================================================= */

/* Tablet e abaixo (≤1023px) — reduz o gap do menu para caber os 7 itens + CTA. */
@media ( max-width: 1023px ) {
	.fbb-header__menu {
		gap: 20px;
	}

	.fbb-header__menu > .menu-item > a {
		font-size: 15px;
	}

	.fbb-btn--pill {
		padding: 16px 24px;
	}
}

/* Navegação recolhida antes que logo, menu e CTA disputem espaço. */
@media ( max-width: 1399px ) {
	.fbb-header__container {
		min-height: 88px;
	}

	.fbb-header__logo .custom-logo,
	.fbb-header__logo-img {
		height: 64px;
	}

	.fbb-header__hamburger {
		display: flex;
	}

	.fbb-header__nav-wrapper {
		position: absolute;
		top: 100%;
		right: 0;
		left: 0;
		height: calc( 100vh - 100% );
		background-color: var( --fbb-color-offwhite );
		flex-direction: column;
		justify-content: flex-start;
		padding: 32px var( --fbb-container-padding-inline );
		transform: translateX( 100% );
		visibility: hidden;
		transition: transform 0.3s ease, visibility 0.3s ease;
		z-index: var( --fbb-z-mobile-nav );
		overflow-y: auto;
	}

	/* Estado aberto — classe alternada via JS (header.js), animada com GSAP. */
	.fbb-header__nav-wrapper.is-open {
		visibility: visible;
		transform: translateX( 0 );
	}

	.fbb-header__menu {
		flex-direction: column;
		align-items: flex-start;
		justify-content: flex-start;
		gap: 24px;
		width: 100%;
	}

	.fbb-header__menu > .menu-item {
		flex: none;
		width: 100%;
	}

	.fbb-header__menu > .menu-item-has-children {
		display: grid;
		grid-template-columns: minmax( 0, 1fr ) 42px;
		align-items: center;
		min-width: 0;
	}

	.fbb-header__menu > .menu-item > a {
		font-size: 20px;
		width: 100%;
		padding-block: 10px;
	}

	.fbb-header__menu > .menu-item-has-children > a {
		padding-right: 8px;
	}

	.fbb-header__menu > .menu-item-has-children > a::before {
		display: none;
	}

	.fbb-header__submenu-toggle {
		position: static;
		display: inline-grid;
		width: 42px;
		height: 42px;
		transform: none;
	}

	.fbb-header__menu .sub-menu {
		position: static;
		grid-column: 1 / -1;
		display: none;
		width: 100%;
		min-width: 0;
		max-width: none;
		margin: 8px 0 0;
		padding: 5px 0 5px 14px;
		border-top: 0;
		border-left: 2px solid var( --fbb-color-red );
		border-radius: 0;
		box-shadow: none;
		opacity: 1;
		pointer-events: auto;
		transform: none;
		visibility: visible;
	}

	.fbb-header__menu .menu-item-has-children.is-submenu-open > .sub-menu {
		display: block;
	}

	.fbb-header__menu .sub-menu a {
		padding: 10px 14px;
		font-size: 16px;
	}

	.fbb-header__cta.fbb-btn--pill {
		display: none; /* CTA mobile é reapresentado dentro do menu aberto, ver header.js/markup futuro. */
	}
}

/* Mobile (375px) */
@media ( max-width: 375px ) {
	.fbb-header__container {
		padding-inline: 20px;
	}

	.fbb-topbar__container {
		padding-inline: 20px;
	}
}

/* Desktop grande (1920px) — permite respiro extra no container. */
@media ( min-width: 1920px ) {
	.fbb-header__container,
	.fbb-topbar__container {
		max-width: 1712px;
	}
}

/* Grid canônico do site: 1440px úteis. */
.fbb-header__container,
.fbb-topbar__container {
	width: 100%;
	max-width: var( --fbb-container-max-width );
	padding-inline: var( --fbb-container-padding-inline );
}

.fbb-header__container {
	max-width: 1680px;
	min-height: 124px;
	gap: 44px;
}

.fbb-header__logo .custom-logo,
.fbb-header__logo-img {
	height: 80px;
}

.fbb-header__menu {
	gap: 12px;
}

.fbb-header__menu > .menu-item > a {
	font-size: 15px;
}

.fbb-header__cta.fbb-btn--pill {
	padding: 17px 24px;
	font-size: 14px;
}

@media ( max-width: 1023px ) {
	.fbb-header__container,
	.fbb-topbar__container {
		padding-inline: var( --fbb-container-padding-tablet );
	}
}

@media ( max-width: 767px ) {
	.fbb-header__container,
	.fbb-topbar__container {
		padding-inline: var( --fbb-container-padding-mobile );
	}

	.fbb-topbar__info {
		gap: 12px;
		font-size: 12px;
	}

	.fbb-topbar__address {
		display: none;
	}

	.fbb-header__container {
		min-height: 72px;
	}

	.fbb-header__logo .custom-logo,
	.fbb-header__logo-img {
		height: 48px;
	}
}

/* Notebook: escala compacta sem alterar a estrutura do header. */
@media ( min-width: 1024px ) and ( max-width: 1439px ) {
	.fbb-header__container,
	.fbb-topbar__container {
		padding-inline: var( --fbb-page-gutter );
	}

	.fbb-topbar__container {
		min-height: 28px;
	}

	.fbb-header__container {
		min-height: 104px;
		gap: 24px;
	}

	.fbb-header__logo .custom-logo,
	.fbb-header__logo-img {
		height: 68px;
	}

	.fbb-header__menu {
		gap: 14px;
	}

	.fbb-header__menu > .menu-item > a,
	.fbb-header__cta.fbb-btn--pill {
		font-size: 13px;
	}

	.fbb-header__cta.fbb-btn--pill {
		padding: 14px 20px;
	}
}

@media ( min-width: 768px ) and ( max-width: 1399px ) {
	.fbb-header__container {
		min-height: 88px;
	}

	.fbb-header__logo .custom-logo,
	.fbb-header__logo-img {
		height: 64px;
	}
}

@media ( max-width: 1399px ) {
	.fbb-header__menu {
		gap: 18px;
	}

	.fbb-header__menu > .menu-item > a {
		font-size: 18px;
	}
}
.has-open-menu {
	overflow: hidden;
}

.fbb-header__logo-placeholder {
	display: block;
	width: 188px;
	height: 72px;
	background: #d9d9d9;
}
