/* Layout base — mobile-first (§9). Breakpoints: 360 · 600 · 900 · 1200 · 1440 */

/* Sem isso, o drawer do menu mobile (.site-header__nav, `position:fixed`
   + `transform: translateX(100%)` quando fechado) conta pra
   `document.documentElement.scrollWidth` mesmo posicionado fora da tela
   — quirk conhecido do CSS (a caixa antes do transform já é usada no
   cálculo de overflow do documento). Sem risco de mascarar bug de
   verdade: cada sprint já testa ausência de scroll horizontal em várias
   larguras via script (§17); isso só neutraliza esse caso específico. */
html,
body {
	overflow-x: hidden;
}

.container {
	width: 100%;
	max-width: 1200px;
	margin-inline: auto;
	padding-inline: 1rem;
}

@media (min-width: 600px) {
	.container {
		padding-inline: 1.5rem;
	}
}

@media (min-width: 1200px) {
	.container {
		padding-inline: 2rem;
	}
}

/* Skip link (§10.3) — visível só ao focar */
.skip-link {
	position: absolute;
	top: -100%;
	left: 0.5rem;
	z-index: 1000;
	padding: 0.75rem 1.25rem;
	background-color: var(--boek-petroleo);
	color: var(--boek-white);
	border-radius: 0 0 0.5rem 0.5rem;
	transition: top var(--boek-transition, 200ms ease-out);
}

.skip-link:focus-visible {
	top: 0;
}

.site-header {
	background-color: var(--boek-white);
}

.site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding-block: 1rem;
	min-height: var(--boek-tap-min);
}

.site-header__brand {
	margin: 0;
	line-height: 0; /* evita que o line-height do <p> abra espaço extra acima/abaixo da logo */
	flex-shrink: 0; /* sem isso, o flex row (.site-header__inner) espreme a logo em telas
	                   estreitas e o navegador estica/distorce a imagem pra caber */
}

.site-header__brand a {
	display: inline-flex;
}

/* Logo principal (§4.9) — altura fixa, largura acompanha a proporção real
   do arquivo (3.3:1). Sem header sticky/encolhível ainda (§5.1, item 2
   segue pendente) — esta é a altura de repouso única por enquanto. */
.site-header__logo {
	height: 42px;
	width: auto;
	max-width: 100%;
}

.site-footer__brand {
	margin: 0 0 1rem;
	line-height: 0;
}

.site-footer__brand a {
	display: inline-flex;
}

/* Logo negativa (âmbar) — mesma lógica da logo do header, altura menor
   porque o footer não encolhe/expande. */
.site-footer__logo {
	height: 34px;
	width: auto;
	max-width: 100%;
}

/* Menu principal (header) — §3, §9. ≥900px: dropdown por CSS puro, sem
   JS, abre no hover (mouse) OU no :focus-within (teclado, Tab dentro do
   item pai já revela o submenu). Abaixo de 900px: drawer lateral
   controlado por menu-mobile.js (botão hambúrguer, overlay, accordion
   nos submenus) — ver regras no fim deste bloco. */
.primary-menu {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.15rem;
	list-style: none;
	padding: 0;
	margin: 0;
}

.primary-menu .menu-item {
	position: relative;
}

.primary-menu > .menu-item > a {
	display: flex;
	align-items: center;
	min-height: var(--boek-tap-min);
	padding: 0.5rem 0.75rem;
	color: var(--boek-ink);
	text-decoration: none;
	font-family: var(--boek-font-heading);
	font-weight: 600;
	font-size: var(--boek-text-small);
	border-radius: 0.5rem;
	transition: background-color var(--boek-transition);
}

.primary-menu > .menu-item > a:hover {
	background-color: var(--boek-creme);
}

/* Chevron do link em si — só faz sentido ≥900px (dropdown por hover). No
   mobile, quem indica "tem submenu" é o botão de accordion dedicado
   (.submenu-toggle, injetado por menu-mobile.js), não este pseudo-elemento. */
@media (min-width: 900px) {
	.primary-menu .menu-item-has-children > a::after {
		content: "";
		width: 0.4em;
		height: 0.4em;
		margin-left: 0.4em;
		border-right: 2px solid currentColor;
		border-bottom: 2px solid currentColor;
		transform: rotate(45deg);
		flex-shrink: 0;
	}

	.primary-menu .sub-menu {
		position: absolute;
		top: 100%;
		left: 0;
		z-index: 20;
		min-width: 240px;
		list-style: none;
		margin: 0;
		padding: 0.5rem;
		background-color: var(--boek-white);
		border-radius: 0.75rem;
		box-shadow: 0 8px 24px rgba(15, 14, 26, 0.16);
		opacity: 0;
		visibility: hidden;
		transform: translateY(4px);
		transition: opacity var(--boek-transition), transform var(--boek-transition), visibility var(--boek-transition);
	}

	.primary-menu .menu-item-has-children:hover > .sub-menu,
	.primary-menu .menu-item-has-children:focus-within > .sub-menu {
		opacity: 1;
		visibility: visible;
		transform: translateY(0);
	}
}

.primary-menu .sub-menu a {
	display: flex;
	align-items: center;
	min-height: var(--boek-tap-min);
	padding: 0.5rem 0.75rem;
	color: var(--boek-ink);
	text-decoration: none;
	font-size: var(--boek-text-small);
	border-radius: 0.5rem;
	white-space: nowrap;
}

.primary-menu .sub-menu a:hover {
	background-color: var(--boek-creme);
}

/* ===== Botão hambúrguer (§9, §7.4 item 14) — só existe visualmente
   abaixo de 900px. Ícone em CSS puro (mask-image, mesmo padrão de
   .btn--whatsapp em components/botoes.css) — hambúrguer e X empilhados
   no mesmo elemento, um escondido via opacity conforme aria-expanded,
   pra poder animar a troca em vez de trocar o markup na hora do clique. */
.menu-hamburguer {
	position: relative;
	z-index: 101; /* acima do drawer (100) — senão o botão fica coberto
	                 pelo painel quando ele desliza por cima do header */
	display: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	flex-shrink: 0;
	padding: 0;
	border: none;
	border-radius: 0.5rem;
	background: none;
	cursor: pointer;
	transition: background-color var(--boek-transition);
}

.menu-hamburguer:hover {
	background-color: var(--boek-creme);
}

.menu-hamburguer__icone,
.menu-hamburguer__icone::before {
	content: "";
	display: block;
	width: 22px;
	height: 22px;
	background-color: var(--boek-ink);
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='5' width='18' height='2' rx='1'/%3E%3Crect x='3' y='11' width='18' height='2' rx='1'/%3E%3Crect x='3' y='17' width='18' height='2' rx='1'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='5' width='18' height='2' rx='1'/%3E%3Crect x='3' y='11' width='18' height='2' rx='1'/%3E%3Crect x='3' y='17' width='18' height='2' rx='1'/%3E%3C/svg%3E");
}

/* aria-expanded="true" (aberto): troca a máscara pro X — mesmo elemento,
   sem duplicar markup. */
.menu-hamburguer[aria-expanded="true"] .menu-hamburguer__icone {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='11' width='18' height='2' rx='1' transform='rotate(45 12 12)'/%3E%3Crect x='3' y='11' width='18' height='2' rx='1' transform='rotate(-45 12 12)'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='11' width='18' height='2' rx='1' transform='rotate(45 12 12)'/%3E%3Crect x='3' y='11' width='18' height='2' rx='1' transform='rotate(-45 12 12)'/%3E%3C/svg%3E");
}

/* ===== Overlay — escurece o resto da tela atrás do drawer, e é a área
   clicável de "fechar ao clicar fora" (§9, §10.3). */
.menu-overlay {
	position: fixed;
	inset: 0;
	z-index: 90;
	background-color: rgba(15, 14, 26, 0.5);
}

.menu-overlay[hidden] {
	display: none;
}

/* Botão de accordion dos submenus (injetado por menu-mobile.js só existe
   como elemento — some visualmente aqui por padrão) — mesmo bug que o
   hambúrguer já evitava com `display:none` base, mas este aqui não
   tinha essa regra fora da media query: sem ela, o <button> sem estilo
   nenhum aparecia no desktop como uma caixinha cinza vazia (aparência
   padrão do navegador pra <button>), entre "TV por Assinatura" e "Apps
   e Streaming" (Sprint 33.5 — bug introduzido no 33.3). */
.submenu-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	flex-shrink: 0;
	padding: 0;
	border: none;
	border-radius: 0.5rem;
	background: none;
	color: var(--boek-ink);
	cursor: pointer;
}

.submenu-toggle:hover {
	background-color: var(--boek-creme);
}

.submenu-toggle::after {
	content: "";
	width: 0.5em;
	height: 0.5em;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform var(--boek-transition);
}

.submenu-toggle[aria-expanded="true"]::after {
	transform: rotate(-135deg);
}

@media (max-width: 899px) {
	.menu-hamburguer {
		display: inline-flex;
	}

	/* Drawer lateral (desliza da direita) — escolhido em vez de dropdown
	   full-width por precisar de menos CSS novo: reaproveita a lista
	   vertical que o menu já usava antes (§3), só move ela pra dentro de
	   um painel fixo com scroll próprio. */
	.site-header__nav {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		z-index: 100;
		width: min(85vw, 320px);
		overflow-y: auto;
		background-color: var(--boek-white);
		box-shadow: -8px 0 24px rgba(15, 14, 26, 0.16);
		padding: 4.5rem 1rem 2rem;
		transform: translateX(100%);
		transition: transform var(--boek-transition);
	}

	.site-header__nav.is-aberto {
		transform: translateX(0);
	}

	.primary-menu {
		flex-direction: column;
		align-items: stretch;
		width: 100%;
	}

	.primary-menu > .menu-item > a {
		width: 100%;
	}

	/* Cada item com filhos vira uma linha "link + botão de accordion"
	   lado a lado, em vez do link sozinho ocupando a largura toda. */
	.primary-menu .menu-item-has-children {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
	}

	.primary-menu .menu-item-has-children > a {
		flex: 1;
	}

	.submenu-toggle {
		display: flex;
	}

	.primary-menu .sub-menu {
		position: static;
		list-style: none;
		margin: 0;
		padding-left: 1rem;
		display: none;
	}

	.primary-menu .menu-item-has-children.is-aberto > .sub-menu {
		display: block;
	}
}

.site-footer {
	background-color: var(--boek-surface);
	color: var(--boek-white);
	padding-block: 2rem;
}

.site-footer a {
	color: var(--boek-white);
}

.footer-menu {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.25rem;
	list-style: none;
	padding: 0;
	margin: 0 0 1rem;
}

.footer-menu a {
	display: inline-flex;
	align-items: center;
	min-height: var(--boek-tap-min);
	text-decoration: underline;
	font-size: var(--boek-text-small);
}

/* Foco visível consistente em todo o site (§10.3). Usa --boek-petroleo,
   não --boek-coral: o anel de foco aparece sobre qualquer fundo do site
   (branco, creme, superfície escura), e coral só bate 3:1 (mínimo do
   WCAG 1.4.11 pra componentes não-texto) contra branco puro — contra
   --boek-creme cai pra 2.78:1, reprova. Petróleo passa em ambos com
   folga (6.08:1 e 5.54:1). */
:focus-visible {
	outline: 2px solid var(--boek-petroleo);
	outline-offset: 2px;
}
