/**
 * Cabeçalho em duas seções — desktop inspirado na referência enviada.
 */

.site-header {
	--header-primary: var(--studioalmadolar-surface, #fff);
	--header-secondary: var(--studioalmadolar-surface-muted, #fafafa);
	position: relative;
	z-index: 50;
	width: 100%;
	color: var(--studioalmadolar-ink, #2f2a26);
	border-bottom: 1px solid var(--studioalmadolar-line, #e5e5e5);
}

.site-header__section {
	width: 100%;
	background: var(--header-primary);
}

.site-header__section--secondary {
	background: var(--header-secondary);
	border-top: 1px solid var(--studioalmadolar-line, #e5e5e5);
}

.site-header__inner {
	box-sizing: border-box;
	width: 100%;
	max-width: 1200px;
	margin: 0 auto;
	padding-inline: 2em;
}

.site-header__row {
	display: flex;
	align-items: center;
}

.site-header__row--primary {
	display: grid;
	grid-template-columns: auto minmax(280px, 1fr) auto auto;
	gap: 1.25em;
	min-height: 84px;
	padding-block: 0.85em;
}

.site-header__row--secondary {
	gap: 1.5em;
	min-height: 58px;
	padding-block: 0.55em;
}

.site-branding {
	display: flex;
	align-items: center;
	min-width: 0;
}

.site-branding img,
.site-branding .custom-logo {
	display: block;
	width: auto;
	max-width: 220px;
	height: auto;
}

.site-branding__logo--dark {
	display: none;
}

html[data-theme='dark'] .site-branding--has-dark-logo .site-branding__logo--light {
	display: none;
}

html[data-theme='dark'] .site-branding--has-dark-logo .site-branding__logo--dark {
	display: inline;
}

.site-branding__fallback {
	color: var(--studioalmadolar-ink, #2f2a26);
	font-family: var(--studioalmadolar-font-display);
	font-size: 1.5em;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
}

.site-header__search {
	min-width: 0;
}

.site-header__search .studioalmadolar-shop-search {
	width: 100%;
	max-width: none;
	min-height: 48px;
	margin: 0;
	padding: 4px 5px 4px 16px;
	background: var(--studioalmadolar-surface-elevated, #fff);
	border-radius: 999px;
	box-shadow: 0 2px 8px rgba(47, 42, 38, 0.07);
}

.site-header__search .studioalmadolar-shop-search__submit {
	min-height: 38px;
	padding-inline: 1.1em;
	font-size: 0.9em;
	color: var(--studioalmadolar-accent-contrast, #fff);
}

.site-header__actions {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 0.35em;
}

.site-header__action {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: content-box;
	padding: 11px;
	color: var(--studioalmadolar-ink, #2f2a26);
	text-decoration: none;
	background: transparent;
	border: 0;
	border-radius: 999px;
	cursor: pointer;
	transition: color 0.2s ease, background-color 0.2s ease;
}

.site-header__action:hover,
.site-header__action:focus-visible {
	color: var(--studioalmadolar-ink, #2f2a26);
	background: var(--studioalmadolar-accent-soft, #efe9e3);
	outline: 0;
}

.site-header :is(a, button, input, summary):focus {
	outline: 3px solid var(--studioalmadolar-focus, #8b5e3c);
	outline-offset: 2px;
}

@supports selector(:focus-visible) {
	.site-header :is(a, button, input, summary):focus:not(:focus-visible) {
		outline: 0;
	}

	.site-header :is(a, button, input, summary):focus-visible {
		outline: 3px solid var(--studioalmadolar-focus, #8b5e3c);
		outline-offset: 2px;
	}
}

.site-header__action .site-header__action-count {
	position: absolute;
	top: 1px;
	right: 0;
	min-width: 17px;
	height: 17px;
	padding: 0 4px;
	color: var(--studioalmadolar-accent-contrast, #fff);
	font-size: 0.65em;
	font-weight: 600;
	line-height: 17px;
	text-align: center;
	background: var(--studioalmadolar-accent, #2f2a26);
	border-radius: 999px;
}

.theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 88px;
	height: 44px;
	padding: 0;
	color: var(--studioalmadolar-ink-soft, #666);
	background: transparent;
	border: 0;
	border-radius: 999px;
	cursor: pointer;
}

.theme-toggle__track {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 75px;
	height: 36px;
	box-sizing: border-box;
	gap: 15px;
	padding: 0 9px;
	background: var(--studioalmadolar-toggle-track, #e3e5ea);
	border: 1px solid var(--studioalmadolar-line, #d5d7dc);
	border-radius: 999px;
}

.theme-toggle__icon {
	position: relative;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.theme-toggle__icon--sun {
	color: var(--studioalmadolar-toggle-sun, #695b4e);
}

.theme-toggle__icon--moon {
	color: var(--studioalmadolar-toggle-moon, #526078);
}

.theme-toggle__thumb {
	position: absolute;
	z-index: 0;
	top: 3px;
	left: 3px;
	width: 28px;
	height: 28px;
	background: var(--studioalmadolar-surface-elevated, #fff);
	border-radius: 50%;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
	transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

html[data-theme='dark'] .theme-toggle__thumb {
	transform: translateX(39px);
}

.main-navigation {
	min-width: 0;
	flex: 1 1 auto;
	overflow-x: auto;
	scrollbar-width: thin;
}

.main-navigation ul {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 1.65em;
	width: max-content;
	min-width: 100%;
	margin: 0;
	padding: 0;
	list-style: none;
}

.main-navigation a {
	position: relative;
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	color: var(--studioalmadolar-ink, #2f2a26);
	font-family: var(--studioalmadolar-font-body);
	font-size: 0.95em;
	line-height: 1.4;
	text-decoration: none;
	white-space: nowrap;
}

.main-navigation a::after {
	content: '';
	position: absolute;
	right: 100%;
	bottom: 5px;
	left: 0;
	height: 2px;
	background: var(--studioalmadolar-accent, #2f2a26);
	transition: right 0.2s ease;
}

.main-navigation a:hover::after,
.main-navigation a:focus-visible::after,
.main-navigation .current-menu-item > a::after {
	right: 0;
}

.main-navigation__placeholder {
	color: var(--studioalmadolar-danger, #aa3333);
	font-size: 0.85em;
}

.cep-widget {
	flex: 0 0 auto;
}

.cep-widget__trigger {
	display: flex;
	align-items: center;
	gap: 0.55em;
	min-height: 44px;
	padding: 0.45em 0.85em;
	color: var(--studioalmadolar-ink, #2f2a26);
	font-family: var(--studioalmadolar-font-body);
	font-size: 0.9em;
	font-weight: 600;
	text-align: left;
	background: var(--studioalmadolar-surface-elevated, #fff);
	border: 1px solid var(--studioalmadolar-line, #e5e5e5);
	border-radius: 6px;
	cursor: pointer;
}

.cep-widget__text {
	display: grid;
	gap: 1px;
}

.cep-widget__city {
	display: block;
	max-width: 180px;
	overflow: hidden;
	color: var(--studioalmadolar-ink-soft, #666);
	font-size: 0.82em;
	font-weight: 400;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cep-widget__city:empty {
	display: none;
}

.cep-widget__label--mobile {
	display: none;
}

.cep-widget__overlay {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 1em;
	background: rgba(0, 0, 0, 0.58);
}

.cep-widget__overlay.is-open {
	display: flex;
}

body.has-cep-dialog {
	overflow: hidden;
}

.cep-widget__popup {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 420px;
	padding: 1.5em;
	color: var(--studioalmadolar-ink, #2f2a26);
	background: var(--studioalmadolar-surface-elevated, #fff);
	border: 1px solid var(--studioalmadolar-line, #e5e5e5);
	border-radius: 12px;
	box-shadow: 0 18px 55px rgba(0, 0, 0, 0.22);
}

.cep-widget__popup h3 {
	margin: 0 2em 0.45em 0;
	font-size: 1.2em;
	line-height: 1.35;
}

.cep-widget__popup > p {
	margin: 0 0 1em;
	color: var(--studioalmadolar-ink-soft, #666);
	line-height: 1.5;
}

.cep-widget__close {
	position: absolute;
	top: 0.6em;
	right: 0.6em;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	color: var(--studioalmadolar-ink, #2f2a26);
	background: transparent;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
}

.cep-widget__input-label {
	display: block;
	margin-bottom: 0.35em;
	font-size: 0.9em;
	font-weight: 600;
}

.cep-widget__input {
	box-sizing: border-box;
	width: 100%;
	min-height: 46px;
	padding: 0.7em 0.8em;
	color: var(--studioalmadolar-ink, #2f2a26);
	font-size: 1em;
	background: var(--studioalmadolar-surface, #fff);
	border: 1px solid var(--studioalmadolar-line-strong, #bbb);
	border-radius: 6px;
	outline: 0;
}

.cep-widget__input:focus {
	border-color: var(--studioalmadolar-focus, #8b5e3c);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--studioalmadolar-focus, #8b5e3c) 25%, transparent);
}

.cep-widget__status {
	min-height: 1.5em;
	margin: 0.35em 0 0.65em;
	color: var(--studioalmadolar-ink-soft, #666);
	font-size: 0.88em;
}

.cep-widget__status.is-error {
	color: var(--studioalmadolar-danger, #aa3333);
}

.cep-widget__actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1em;
}

.cep-widget__use {
	min-height: 44px;
	padding: 0.7em 1.3em;
	color: var(--studioalmadolar-accent-contrast, #fff);
	font-weight: 600;
	background: var(--studioalmadolar-accent, #2f2a26);
	border: 0;
	border-radius: 6px;
	cursor: pointer;
}

.cep-widget__use:disabled {
	opacity: 0.6;
	cursor: wait;
}

.cep-widget__skip {
	color: var(--studioalmadolar-link, #5d3c28);
	font-size: 0.9em;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Mobile: três linhas, com 20px entre componentes e 10px entre ações. */
.site-header__mobile-menu {
	display: none;
}

@media (max-width: 782px) {
	.site-header__inner {
		padding-inline: 12px;
	}

	.site-header__row--primary {
		grid-template-areas:
			'brand actions menu'
			'search search search';
		grid-template-columns: 30vw minmax(0, 1fr) auto;
		column-gap: 20px;
		row-gap: 20px;
		padding-block: 12px 20px;
	}

	.site-branding {
		grid-area: brand;
		width: 30vw;
	}

	.site-branding img,
	.site-branding .custom-logo {
		width: 30vw;
		max-width: 30vw;
		height: auto;
	}

	.site-branding__fallback {
		display: block;
		width: 30vw;
		max-width: 30vw;
		overflow: hidden;
		font-size: clamp(0.8rem, 3.5vw, 1.1rem);
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.site-header__search {
		grid-area: search;
	}

	.site-header__search .studioalmadolar-shop-search {
		min-height: 48px;
	}

	.site-header__search .studioalmadolar-shop-search__submit {
		min-width: 44px;
		padding-inline: 12px;
	}

	.site-header__theme-toggle--desktop {
		display: none;
	}

	.site-header__mobile-theme {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 16px;
		min-height: 52px;
		margin-bottom: 8px;
		padding: 0 12px 8px;
		border-bottom: 1px solid var(--studioalmadolar-line, #e5e5e5);
	}

	.site-header__mobile-theme-label {
		font-size: 0.9rem;
		font-weight: 600;
	}

	.theme-toggle__track {
		width: 84px;
		padding-inline: 9px;
	}

	html[data-theme='dark'] .theme-toggle__thumb {
		transform: translateX(48px);
	}

	.site-header__actions {
		grid-area: actions;
		justify-self: end;
		justify-content: flex-end;
		margin-left: auto;
		gap: 10px;
	}

	.site-header__action,
	.site-header__action--favorites {
		display: inline-flex;
	}

	.site-header__action svg,
	.site-header__mobile-menu-trigger svg {
		flex: 0 0 22px;
		width: 22px;
		height: 22px;
	}

	.site-header__mobile-menu {
		position: relative;
		grid-area: menu;
		display: block;
	}

	.site-header__mobile-menu-trigger {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		box-sizing: content-box;
		padding: 11px;
		color: var(--studioalmadolar-ink, #2f2a26);
		background: transparent;
		border: 0;
		border-radius: 999px;
		cursor: pointer;
		list-style: none;
	}

	.site-header__mobile-menu-trigger::-webkit-details-marker {
		display: none;
	}

	.site-header__mobile-menu-trigger:hover,
	.site-header__mobile-menu-trigger:focus-visible,
	.site-header__mobile-menu[open] .site-header__mobile-menu-trigger {
		background: var(--studioalmadolar-accent-soft, #efe9e3);
		outline: 0;
	}

	.site-header__mobile-menu-panel {
		position: absolute;
		top: calc(100% + 10px);
		right: 0;
		z-index: 60;
		box-sizing: border-box;
		width: min(300px, calc(100vw - 24px));
		max-height: min(60vh, 480px);
		overflow-y: auto;
		padding: 12px;
		color: var(--studioalmadolar-ink, #2f2a26);
		background: var(--studioalmadolar-surface-elevated, #fff);
		border: 1px solid var(--studioalmadolar-line, #e5e5e5);
		border-radius: 10px;
		box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
	}

	.site-header__mobile-menu-panel ul {
		display: grid;
		gap: 4px;
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.site-header__mobile-menu-panel a {
		display: flex;
		align-items: center;
		min-height: 44px;
		padding: 0 12px;
		color: inherit;
		text-decoration: none;
		border-radius: 7px;
	}

		.site-header__mobile-menu-panel a:hover,
		.site-header__mobile-menu-panel a:focus-visible {
			background: var(--studioalmadolar-accent-soft, #efe9e3);
			outline: 0;
		}

		body.has-mobile-menu {
			overflow: hidden;
		}

		.site-header__mobile-menu[open] .site-header__mobile-menu-panel {
			position: fixed;
			inset: 0;
			z-index: 1000;
			display: flex;
			flex-direction: column;
			box-sizing: border-box;
			width: 100vw;
			max-height: none;
			overflow-y: auto;
			padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
			background: var(--studioalmadolar-surface-elevated, #fff);
			border: 0;
			border-radius: 0;
			box-shadow: none;
			animation: studioalmadolar-mobile-menu-in 0.2s ease-out both;
		}

		.site-header__mobile-menu-head {
			display: flex;
			align-items: center;
			justify-content: space-between;
			min-height: 48px;
			margin-bottom: 26px;
		}

		.site-header__mobile-menu-brand {
			display: inline-flex;
			align-items: center;
			color: var(--studioalmadolar-ink, #2f2a26);
		}

		.site-header__mobile-menu-close {
			display: inline-flex;
			align-items: center;
			justify-content: center;
			width: 48px;
			height: 48px;
			padding: 0;
			color: var(--studioalmadolar-ink, #2f2a26);
			background: transparent;
			border: 1px solid currentColor;
			border-radius: 50%;
			cursor: pointer;
		}

		.site-header__mobile-menu-close:hover,
		.site-header__mobile-menu-close:focus-visible {
			color: var(--studioalmadolar-accent, #2f2a26);
			background: var(--studioalmadolar-accent-soft, #efe9e3);
			outline: 0;
		}

		.site-header__mobile-menu-panel > ul {
			gap: 2px;
			width: 100%;
			min-width: 0;
			margin-bottom: 18px;
		}

		.site-header__mobile-menu-panel > ul a {
			justify-content: space-between;
			min-height: 54px;
			padding-inline: 4px;
			font-size: clamp(1rem, 4.5vw, 1.25rem);
			font-weight: 600;
			letter-spacing: 0.01em;
			text-transform: uppercase;
			border-bottom: 1px solid var(--studioalmadolar-line, #e5e5e5);
			border-radius: 0;
		}

		.site-header__mobile-theme {
			order: 0;
			margin-top: 18px;
			margin-bottom: 0;
			padding: 14px 4px 0;
			border-top: 1px solid var(--studioalmadolar-line, #e5e5e5);
			border-bottom: 0;
		}

		.site-header__mobile-account {
			order: 1;
			margin-top: auto;
			padding-top: 22px;
		}

		.site-header__mobile-login {
			display: flex;
			align-items: center;
			justify-content: center;
			gap: 10px;
			box-sizing: border-box;
			width: 100%;
			min-height: 58px;
			padding: 12px 20px;
			color: var(--studioalmadolar-ink, #2f2a26);
			font: inherit;
			font-size: 1.05rem;
			font-weight: 600;
			letter-spacing: 0.02em;
			text-transform: uppercase;
			text-decoration: none;
			background: transparent;
			border: 1px solid currentColor;
			border-radius: 999px;
			cursor: pointer;
		}

		.site-header__mobile-login:hover,
		.site-header__mobile-login:focus-visible {
			color: var(--studioalmadolar-accent-contrast, #fff);
			background: var(--studioalmadolar-accent, #2f2a26);
			outline: 0;
		}

		.site-header__mobile-partners {
			order: 2;
			margin-top: 18px;
		}

		.site-header__mobile-partners ul {
			display: grid;
			gap: 2px;
			margin: 0;
			padding: 0;
			list-style: none;
		}

		.site-header__mobile-partners a {
			justify-content: space-between;
			min-height: 48px;
			padding-inline: 4px;
			font-size: 0.98rem;
			font-weight: 600;
			text-decoration: underline;
			text-underline-offset: 5px;
			border-radius: 0;
		}

		@keyframes studioalmadolar-mobile-menu-in {
			from { opacity: 0; transform: translateY(10px); }
			to { opacity: 1; transform: translateY(0); }
		}

		.site-header__row--secondary {
		display: grid;
		grid-template-columns: auto minmax(0, 1fr);
		align-items: center;
		gap: 20px;
		min-height: 60px;
		padding-block: 8px;
		overflow: hidden;
	}

	.cep-widget__trigger {
		max-width: 145px;
		padding-inline: 10px;
	}

	.cep-widget__label {
		display: block;
		max-width: 105px;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.cep-widget__city {
		display: none;
	}

	.cep-widget__label--desktop {
		display: none;
	}

	.cep-widget__label--mobile {
		display: block;
	}

	.main-navigation--categories {
		min-width: 0;
		overflow-x: auto;
		overflow-y: hidden;
		cursor: grab;
		overscroll-behavior-inline: contain;
		scroll-snap-type: inline proximity;
		touch-action: pan-y;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}

	.main-navigation--categories.is-dragging {
		cursor: grabbing;
		scroll-snap-type: none;
		user-select: none;
	}

	.main-navigation--categories::-webkit-scrollbar {
		display: none;
	}

	.main-navigation--categories ul {
		gap: 20px;
		width: max-content;
		min-width: max-content;
	}

	.main-navigation--categories li {
		scroll-snap-align: start;
	}
}

@media (max-width: 382px) {
	.site-header__inner {
		padding-inline: 8px;
	}

	.site-header__row--primary {
		grid-template-columns: 25vw minmax(0, 1fr) auto;
		column-gap: 4px;
	}

	.site-branding,
	.site-branding img,
	.site-branding .custom-logo,
	.site-branding__fallback {
		width: 25vw;
		max-width: 25vw;
	}

	.site-header__actions {
		gap: 10px;
	}


	.site-header__row--secondary {
		grid-template-columns: minmax(112px, 42%) minmax(0, 1fr);
	}

	.cep-widget__trigger {
		width: 100%;
		max-width: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.theme-toggle__thumb,
	.site-header__action,
	.main-navigation a::after,
	.site-header__mobile-menu[open] .site-header__mobile-menu-panel {
			animation: none;
			transition: none;
		}
	}
