/**
 * Global shell: skip link, header, navigation drawer, footer.
 *
 * Palette, spacing, radius, and text styles resolve through theme.json variables.
 * Gutters, breakpoints, and drawer sizes are shell contracts from Page 01 and
 * Page 08. They are not global tokens.
 */

.br-skip-link {
	position: absolute;
	top: var(--wp--preset--spacing--xs);
	left: var(--wp--preset--spacing--xs);
	z-index: 100;
	padding: var(--wp--preset--spacing--sm) var(--wp--preset--spacing--md);
	border: 2px solid var(--wp--preset--color--brand-primary);
	border-radius: var(--wp--custom--radius--md);
	background: var(--wp--preset--color--surface-base);
	color: var(--wp--preset--color--brand-primary);
	font-size: var(--wp--custom--type--label-large--font-size);
	font-weight: 600;
	line-height: var(--wp--custom--type--label-large--line-height);
	text-decoration: none;
}

.br-skip-link:not(:focus) {
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/*
 * Header Mobile (76:160): 44px menu, centered logo, 44px Lojas. Below 1024px.
 *
 * UI15-01: the header stays in normal flow and sticks for the whole scroll.
 * Height does not change. The sentinel script only toggles the scroll shadow.
 */

.br-header-sentinel {
	position: absolute;
	top: 0;
	left: 0;
	width: 1px;
	height: 1px;
	pointer-events: none;
}

html {
	scroll-padding-top: calc(64px + 16px);
}

.br-site-header {
	position: sticky;
	top: 0;
	z-index: 10;
	min-height: 64px;

	/* Shell-local: the Header Mobile gutter is 20px, not a spacing token. */
	padding: 0 20px;
	border: 1px solid var(--wp--preset--color--border-default);
	background: var(--wp--preset--color--surface-base);
}

.br-site-header.br-site-header--scrolled {
	box-shadow: 0 1px 2px rgb(from var(--wp--preset--color--surface-overlay) r g b / 8%);
}

/*
 * WordPress sets --wp-admin--admin-bar--height to 32px, or 46px through 782px.
 * From 601px the bar is fixed, so the sticky header must clear it.
 * Through 600px the bar is position:absolute and scrolls away. A permanent
 * 46px top would leave a gap after that scroll, so the header stays at 0.
 * The focused skip link still clears the bar at scroll zero.
 */

body:has(#wpadminbar) .br-skip-link:focus {
	top: calc(var(--wp-admin--admin-bar--height, 32px) + var(--wp--preset--spacing--xs));
}

@media (min-width: 601px) and (max-width: 782px) {

	body:has(#wpadminbar) .br-site-header {
		top: var(--wp-admin--admin-bar--height, 46px);
	}

	html:has(#wpadminbar) {
		scroll-padding-top: calc(var(--wp-admin--admin-bar--height, 46px) + 64px + 16px);
	}
}

@media (min-width: 783px) {

	body:has(#wpadminbar) .br-site-header {
		top: var(--wp-admin--admin-bar--height, 32px);
	}

	html:has(#wpadminbar) {
		scroll-padding-top: calc(var(--wp-admin--admin-bar--height, 32px) + 64px + 16px);
	}
}

/*
 * The account group floats and wraps onto a second row when the toolbar is
 * full. That row paints over Lojas. Keep the group on the first row. Through
 * 600px the bar stays position:absolute and scrolls away, so this pin does
 * not add a permanent header offset.
 */
#wpadminbar #wp-admin-bar-top-secondary {
	position: absolute;
	top: 0;
	right: 0;
	float: none;
}

@media (max-width: 600px) {

	#wpadminbar #wp-admin-bar-my-account > div {
		position: absolute;
		top: 100%;
		right: 0;
		left: auto;
		width: min(100vw, 240px);
	}
}

.br-site-header__inner {
	display: grid;
	grid-template-columns: minmax(44px, 1fr) auto minmax(44px, 1fr);
	align-items: center;
	width: 100%;
	max-width: var(--br-layout-max);
	min-height: calc(64px - 2px);
	margin-inline: auto;
}

.br-site-header__menu,
.br-drawer__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
}

.br-site-header__menu {
	justify-self: start;
}

.br-site-header__logo {
	display: block;
	justify-self: center;
	line-height: 0;
}

.br-site-header__logo-image {
	display: block;
	width: auto;
	height: 34px;
}

.br-site-header__lojas {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	justify-self: end;
	min-width: 44px;
	min-height: 44px;
	padding: 0 var(--wp--preset--spacing--2-xs);
	color: var(--wp--preset--color--brand-primary);
	font-size: var(--wp--custom--type--label-large--font-size);
	font-weight: var(--wp--custom--type--label-large--font-weight);
	letter-spacing: 0;
	line-height: normal;
	text-decoration: none;
}

.br-site-header__nav,
.br-site-header__cta,
.br-site-header__socials {
	display: none;
}

/* Below 1024 the tools wrapper must not become a grid item. */
.br-site-header__tools {
	display: contents;
}

.br-site-header__list {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--xl);
	margin: 0;
	padding: 0;
	list-style: none;
}

/*
 * The WP02 Nav Link keeps a 2px transparent focus border. The negative margin
 * returns its layout box to the 28px Page 01 Nav Link, so the 32px gap and the
 * item positions match 76:150. The border still paints on focus.
 */
.br-site-header__list .br-nav-link {
	margin: -2px;
}

/* Header Desktop (76:150): logo, nav, CTA with space-between. From 1024px. */

@media (min-width: 1024px) {

	.br-site-header {
		min-height: 80px;
		padding: 0 var(--wp--preset--spacing--4-xl);
	}

	html {
		scroll-padding-top: calc(80px + 16px);
	}

	html:has(#wpadminbar) {
		scroll-padding-top: calc(var(--wp-admin--admin-bar--height, 32px) + 80px + 16px);
	}

	.br-site-header__inner {
		display: flex;
		align-items: center;
		justify-content: space-between;
		min-height: calc(80px - 2px);
	}

	.br-site-header__menu,
	.br-site-header__lojas {
		display: none;
	}

	.br-site-header__nav {
		display: block;
	}

	.br-site-header__tools {
		display: flex;
		flex: 0 0 auto;
		align-items: center;
		gap: 4px;
	}

	.br-site-header__cta {
		display: inline-flex;
		flex: 0 0 auto;
		white-space: nowrap;
	}

	.br-site-header__logo-image {
		width: 129px;
		height: auto;
	}
}

/*
 * From 1280 the social icons are their own region, centered in the gap
 * between the nav and the CTA. Below that the row is too tight, so the
 * icons stay hidden and the 1024 nav/CTA positions remain.
 * The tools wrapper leaves the grid so its 4px gap cannot glue the icons
 * to the button. Equal flexible tracks keep the logo and the CTA on the
 * container edges, including when the social nav is not rendered.
 */

@media (min-width: 1280px) {

	.br-site-header__inner {
		display: grid;
		grid-template-columns: auto minmax(0, 1fr) auto minmax(88px, 1fr) auto;
		align-items: center;
		justify-content: stretch;
		column-gap: 0;
	}

	.br-site-header__logo {
		grid-column: 1;
		justify-self: start;
	}

	.br-site-header__nav {
		grid-column: 3;
	}

	.br-site-header__tools {
		display: contents;
	}

	.br-site-header__socials {
		display: block;
		grid-column: 4;
		justify-self: center;
		width: max-content;
	}

	.br-site-header__cta {
		grid-column: 5;
		justify-self: end;
	}

	.br-site-header__social-list {
		display: flex;
		align-items: center;
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.br-site-header__social {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 44px;
		height: 44px;
		border-radius: var(--wp--custom--radius--full);
		color: var(--wp--preset--color--brand-primary);
		text-decoration: none;
	}

	.br-site-header__social:hover {
		background: var(--wp--preset--color--brand-primary-light);
		color: var(--wp--preset--color--brand-primary);
	}

	.br-site-header__social:focus-visible {
		outline: 2px solid var(--wp--preset--color--brand-primary);
		outline-offset: 2px;
	}
}

/*
 * Left navigation drawer (734:2250, 734:2253). Native modal dialog.
 * 87.5% of the viewport, capped at 42rem (672px at 16px), full height.
 */

.br-drawer {
	position: fixed;
	inset: 0 auto 0 0;
	width: 87.5vw;
	max-width: 42rem;
	height: 100vh;
	max-height: none;
	margin: 0;
	padding: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	border: 0;
	background: var(--wp--preset--color--surface-base);
	color: var(--wp--preset--color--text-primary);
}

@supports (height: 100dvh) {

	.br-drawer {
		height: 100dvh;
	}
}

.br-drawer[open] {
	animation: br-drawer-in var(--br-motion-duration) ease-out;
}

/* Implementation inference: Page 08 names the scrim but not its opacity. */
.br-drawer::backdrop {
	background: rgb(from var(--wp--preset--color--surface-overlay) r g b / 40%);
}

.br-drawer[open]::backdrop {
	animation: br-drawer-scrim-in var(--br-motion-duration) ease-out;
}

html:has(.br-drawer[open]) {
	overflow: hidden;
}

@keyframes br-drawer-in {

	from {
		transform: translateX(-100%);
	}

	to {
		transform: none;
	}
}

@keyframes br-drawer-scrim-in {

	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

/* Implementation inference: the drawer interior reuses the Header Mobile bar. */
.br-drawer__bar {
	display: flex;
	align-items: center;
	min-height: 64px;
	padding: 0 20px;
	border-bottom: 1px solid var(--wp--preset--color--border-default);
}

.br-drawer__body {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--wp--preset--spacing--lg);
	width: 100%;

	/* Page 08: tablet navigation content keeps about 560px. */
	max-width: calc(560px + 40px);
	padding: var(--wp--preset--spacing--lg) 20px var(--wp--preset--spacing--xl);
}

.br-drawer__nav {
	width: 100%;
}

.br-drawer__list {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--wp--preset--spacing--sm);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Extends the 32px Nav Link hit area to 44px without changing how it looks. */
.br-drawer__list .br-nav-link::before {
	content: "";
	position: absolute;
	inset: -6px 0;
}

/* Footer Compact (71:320). Below 1440px. */

.br-footer {
	position: relative;

	/* Clip the compact divider's negative margin without becoming a scroll container. */
	overflow: clip;
	border-top: 2px solid var(--wp--preset--color--brand-accent);
	background: var(--wp--preset--color--brand-primary);
	color: var(--wp--preset--color--text-inverse);
}

.br-footer__inner {
	position: relative;
	display: grid;
	grid-template-areas:
		"brand brand"
		"institucional atendimento"
		"social social"
		"divider divider"
		"legal legal";
	grid-template-columns: repeat(2, minmax(0, 1fr));
	align-items: start;
	column-gap: 20px;

	/* Shell-local: the Footer Compact gutter is 20px, not a spacing token. */
	padding: var(--wp--preset--spacing--2-xl) 20px var(--wp--preset--spacing--xl);
}

.br-footer__brand {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--wp--preset--spacing--md);
	grid-area: brand;
}

.br-footer__logo {
	display: block;
	width: auto;
	height: 32px;
}

.br-footer__tagline {
	margin: 0;
	font-size: var(--wp--custom--type--body-small--font-size);
	font-weight: var(--wp--custom--type--body-small--font-weight);
	line-height: 1.4;
}

.br-footer__store-link {
	display: inline-block;
	padding: var(--wp--preset--spacing--xs) 0;
	color: var(--wp--preset--color--text-inverse);
	font-size: var(--wp--custom--type--body-small--font-size);
	font-weight: 600;
	line-height: 18px;
	text-decoration: underline;
}

.br-footer__group--institucional {
	grid-area: institucional;
	margin-top: var(--wp--preset--spacing--lg);
}

.br-footer__group--atendimento {
	grid-area: atendimento;
	margin-top: var(--wp--preset--spacing--lg);
}

.br-footer__group--social {
	grid-area: social;
	margin-top: 20px;
}

/* Footer Compact column headings are 11/14 semibold. Not a text style. */
.br-footer__heading {
	margin: 0 0 var(--wp--preset--spacing--sm);
	color: var(--wp--preset--color--text-inverse);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 1px;
	line-height: 14px;
	text-transform: uppercase;
}

.br-footer__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Footer Compact links are 13/16 with 13px vertical padding: 42px rows. */
.br-footer__link {
	display: block;
	padding: 13px 0;
	color: var(--wp--preset--color--text-inverse);
	font-size: 13px;
	font-weight: 400;
	line-height: 16px;
	text-decoration: none;
}

.br-footer__social-icon,
.br-footer__social-prefix {
	display: none;
}

/* Shell-local exception: divider is white at 15%. No semantic token exists. */
.br-footer__divider {
	height: 1px;
	margin: 2px -20px 0;
	grid-area: divider;
	background: rgb(from var(--wp--preset--color--text-inverse) r g b / 15%);
}

/* Legal copy is white at 60%, as drawn. */
.br-footer__legal {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--wp--preset--spacing--sm);
	margin-top: 37px;
	grid-area: legal;
	color: rgb(from var(--wp--preset--color--text-inverse) r g b / 60%);
	font-size: 11px;
	line-height: 14px;
	text-align: center;
}

.br-footer__copyright {
	margin: 0;
}

.br-footer__privacy {
	color: inherit;
	text-decoration: underline;
}

.br-footer__consent {
	min-width: 24px;
	min-height: 24px;
	margin: 0;
	padding: 4px 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	font-size: inherit;
	line-height: inherit;
	text-align: inherit;
	text-decoration: underline;
	cursor: pointer;
}

.br-footer__consent:hover {
	color: var(--wp--preset--color--text-inverse);
}

.br-footer__consent:focus-visible {
	outline-color: var(--wp--preset--color--text-inverse);
}

.br-footer__legal-links {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--wp--preset--spacing--sm);
	max-width: 100%;
}

.br-footer__legal-links:not(:has(*)) {
	display: none;
}

/* Implementation inference: hover is not drawn. Accent on primary fails contrast. */
.br-footer a:hover {
	color: var(--wp--preset--color--text-inverse);
}

.br-footer__link:hover {
	text-decoration: underline;
}

.br-footer a:focus-visible {
	outline-color: var(--wp--preset--color--text-inverse);
}

/* Footer Wide (71:319). From 1440px. */

@media (min-width: 1440px) {

	.br-footer {
		min-height: 390px;
		border-top-width: 3px;
	}

	.br-footer__inner {
		width: 100%;
		max-width: var(--br-layout-max);
		margin-inline: auto;
		grid-template-areas:
			"brand institucional atendimento social"
			"divider divider divider divider"
			"legal legal legal legal";
		grid-template-columns: 440px 200px 200px 320px;
		column-gap: 40px;
		padding: var(--wp--preset--spacing--3-xl) 0 var(--wp--preset--spacing--xl);
	}

	.br-footer__brand {
		gap: 20px;
	}

	.br-footer__logo {
		height: 40px;
	}

	.br-footer__tagline {
		color: rgb(from var(--wp--preset--color--text-inverse) r g b / 80%);
		line-height: 1.5;
	}

	.br-footer__store-link {
		padding: 0;
		font-weight: 500;
	}

	.br-footer__group--institucional,
	.br-footer__group--atendimento,
	.br-footer__group--social {
		margin-top: 0;
	}

	.br-footer__heading {
		margin-bottom: var(--wp--preset--spacing--md);
		font-size: var(--wp--custom--type--label-overline--font-size);
		font-weight: var(--wp--custom--type--label-overline--font-weight);
		letter-spacing: var(--wp--custom--type--label-overline--letter-spacing);
		line-height: var(--wp--custom--type--label-overline--line-height);
	}

	.br-footer__list {
		display: flex;
		flex-direction: column;
		gap: var(--wp--preset--spacing--sm);
	}

	.br-footer__link {
		padding: 0;
		color: rgb(from var(--wp--preset--color--text-inverse) r g b / 85%);
		font-size: var(--wp--custom--type--body-small--font-size);
		line-height: var(--wp--custom--type--body-small--line-height);
	}

	.br-footer__link--social {
		display: flex;
		align-items: center;
		gap: var(--wp--preset--spacing--xs);
	}

	/* Shell-local exception: social-icon-bg is white at 10%. */
	.br-footer__social-icon {
		display: inline-flex;
		flex: 0 0 28px;
		align-items: center;
		justify-content: center;
		width: 28px;
		height: 28px;
		border-radius: var(--wp--custom--radius--lg);
		background: rgb(from var(--wp--preset--color--text-inverse) r g b / 10%);
	}

	/* Owner decision, visual polish R1: both brand icons are inverse on the blue footer. */
	.br-footer__social-icon--instagram .br-icon,
	.br-footer__social-icon--facebook .br-icon {
		color: var(--wp--preset--color--icon-inverse);
	}

	.br-footer__social-prefix {
		display: inline;
	}

	.br-footer__divider {
		margin: var(--wp--preset--spacing--2-xl) 0 0;
	}

	.br-footer__legal {
		flex-direction: row;
		justify-content: space-between;
		margin-top: var(--wp--preset--spacing--2-xl);
		font-size: var(--wp--custom--type--label-small--font-size);
		line-height: 15px;
		text-align: left;
	}

	.br-footer__legal-links {
		flex-direction: row;
		align-items: center;
		justify-content: flex-end;
		gap: var(--wp--preset--spacing--md);
	}
}
