/* ==========================================================================
   Aurelia — Header
   Mirrors the reference store: utility/announcement bar, sticky flat header
   with a drawer-first navigation, centred logo, search modal and a cart
   notification toast.
   ========================================================================== */

/* ---------- Shared link/utility primitives ---------- */
.link {
	color: inherit;
	text-decoration: none;
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	font: inherit;
}

.link:hover {
	text-decoration: underline;
}

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

.focus-inset:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

.btn-block {
	display: flex;
	width: 100%;
	justify-content: center;
}

/* Visibility helpers.
   .small-hide  -> hidden on phones, shown from 750px up.
   .medium-hide -> hidden on phones and tablets, shown from 990px up. */
@media screen and (max-width: 749px) {
	.small-hide { display: none !important; }
}

@media screen and (max-width: 989px) {
	.medium-hide { display: none !important; }
}

/* ---------- Utility / announcement bar ---------- */
/* Solid brand red with white text and white social glyphs, matching the
   reference store's announcement bar. */
.aurelia-utility-bar {
	background: var(--brand, #7a1220);
	color: #fff;
	font-size: var(--fs-xs);
	line-height: 1.4;
	border-bottom: 1px solid rgba(0, 0, 0, 0.18);
}

.utility-bar__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	align-items: center;
	gap: var(--space-sm);
	min-height: 34px;
	padding-top: 0.25rem;
	padding-bottom: 0.25rem;
}

.utility-bar__grid--3-col > :first-child { justify-self: start; }
.utility-bar__grid--3-col > :last-child  { justify-self: end; }

.list-social {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.list-social__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	/* WCAG 2.5.8 target size: the icon is 15px but the tappable area is padded
	   out to 24px so the utility-bar links are usable on a phone. */
	min-width: 24px;
	min-height: 24px;
	color: #fff;
	opacity: 0.85;
	transition: opacity 0.2s ease, color 0.2s ease;
}

.list-social__link:hover {
	color: #fff;
	opacity: 1;
	text-decoration: none;
}

.list-social__link .icon {
	width: 15px;
	height: 15px;
	display: block;
}

.announcement-bar {
	display: flex;
	justify-content: center;
	text-align: center;
	min-width: 0;
}

.announcement-bar__message {
	margin: 0;
	color: #fff;
	font-weight: 500;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	font-size: 0.72rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.announcement-bar__message:hover {
	color: #fff;
	opacity: 0.85;
}

.localization-wrapper {
	display: flex;
	align-items: center;
	gap: var(--space-sm);
	white-space: nowrap;
}

@media screen and (max-width: 989px) {
	.utility-bar__grid {
		grid-template-columns: 1fr auto;
	}

	.announcement-bar {
		order: -1;
		grid-column: 1 / -1;
		justify-content: center;
	}

	.announcement-bar__message {
		white-space: normal;
	}

	.localization-wrapper {
		display: none;
	}
}

@media screen and (max-width: 749px) {
	.list-social {
		gap: 0.7rem;
	}
}

/* ---------- Sticky header shell ---------- */
.section-header {
	position: relative;
	z-index: 1030;
	background: var(--bg);
}

.section-header.is-sticky {
	position: sticky;
	top: 0;
}

.header-wrapper {
	transition: box-shadow 0.2s ease;
}

/* Dawn hides the header on scroll down and reveals it on scroll up. */
.section-header.is-sticky.is-hidden {
	position: sticky;
	top: 0;
	transform: translateY(-100%);
	transition: transform 0.25s ease;
}

.header-wrapper--border-bottom {
	border-bottom: 1px solid var(--border);
}

.section-header.is-stuck .header-wrapper {
	box-shadow: 0 4px 20px -12px rgba(0, 0, 0, 0.35);
}

/* ---------- Header row: menu | logo | icons ---------- */
/* `minmax(0, 1fr)` on the side tracks keeps the menu button and the icon
   cluster from being squeezed out by a wide logo on narrow phones. */
.header {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	align-items: center;
	gap: var(--space-sm);
	min-height: var(--header-h, 80px);
	padding-top: 0.5rem;
	padding-bottom: 0.5rem;
	color: var(--text);
	background: var(--bg);
}

.header-drawer-container {
	justify-self: start;
	display: flex;
	align-items: center;
}

.header__heading {
	justify-self: center;
	margin: 0;
	display: flex;
	align-items: center;
	min-width: 0;
}

.header__heading-link {
	display: flex;
	align-items: center;
	/* Keeps the wordmark link at a tappable height rather than just the glyph. */
	min-height: 24px;
}

.header__heading-logo-wrapper {
	display: flex;
	align-items: center;
}

/* Optional tagline, gated by the aurelia_tagline_show Customizer control. */
.header__heading {
	flex-direction: column;
	gap: 2px;
}

.header__tagline {
	margin: 0;
	font-size: var(--fs-xs);
	line-height: 1.3;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--muted);
	text-align: center;
}

/* Site title fallback, styled like the reference wordmark. */
.header__heading-logo {
	font-family: var(--font-heading, inherit);
	font-size: clamp(1.25rem, 2.4vw, 1.9rem);
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	line-height: 1;
	white-space: nowrap;
	/* A long site name must be able to shrink instead of pushing the centred
	   logo column wider than the viewport. */
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Custom logo sizing. */
.header__heading .custom-logo-link {
	display: inline-flex;
}

.header__heading img,
.custom-logo {
	max-height: 60px;
	width: auto;
	max-width: 100%;
}

/* Hide the WordPress h1 wrapper spacing quirks. */
.header__heading .site-title,
.header__heading .site-description {
	display: none;
}

.header__icons {
	justify-self: end;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	flex-wrap: wrap;
	gap: clamp(0.25rem, 1.4vw, 1.1rem);
	min-width: 0;
}

/* ---------- Icons ---------- */
.header__icon {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.35rem;
	color: var(--text);
}

.header__icon:hover {
	color: var(--link, var(--primary));
	text-decoration: none;
}

.header__icon .icon {
	width: 22px;
	height: 22px;
	display: block;
}

/* Desktop search sits left of the account icon; hide the mobile copy. */
.header__search--desktop {
	display: none;
}

@media screen and (min-width: 750px) {
	.header__search--mobile { display: none; }
	.header__search--desktop { display: block; }
}

/* Cart count bubble */
.cart-count-bubble {
	position: absolute;
	top: 0;
	right: 0;
	min-width: 17px;
	height: 17px;
	padding: 0 4px;
	border-radius: 999px;
	background: var(--primary);
	color: var(--primary-contrast);
	font-size: 11px;
	font-weight: 700;
	line-height: 17px;
	text-align: center;
	transform: scale(0);
	transition: transform 0.2s ease;
}

.cart-count-bubble.is-visible {
	transform: scale(1);
}

.cart-count-bubble:empty {
	display: none;
}

/* ---------- Drawer ---------- */
/* The drawer and its scrim both start below the sticky header rather than
   covering the viewport edge-to-edge. --aurelia-drawer-top is written by
   header.js from the header's measured bottom edge; the 0px default keeps the
   panel usable if JS never runs. */
.menu-drawer {
	position: fixed;
	top: var(--aurelia-drawer-top, 0px);
	bottom: 0;
	left: 0;
	right: auto;
	width: min(400px, 90vw);
	background: var(--bg);
	z-index: 1050;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
	overscroll-behavior: contain;
	box-shadow: 0 0 40px rgba(0, 0, 0, 0.18);
	transform: translateX(-100%);
	transition: transform 0.3s ease;
	padding: 0;
}

.menu-drawer.is-open {
	transform: none;
}

/* The drawer is only rendered while the JS has it in the DOM. */
.menu-drawer[hidden] {
	display: none;
}

/* A closed drawer must never intercept clicks. */
.menu-drawer:not(.is-open) {
	pointer-events: none;
}

/* Scrim behind the drawer. Also offset below the header so the header stays
   visible and its controls (menu, search, cart) remain clickable. */
.menu-drawer-overlay {
	position: fixed;
	top: var(--aurelia-drawer-top, 0px);
	bottom: 0;
	left: 0;
	right: 0;
	background: rgba(0, 0, 0, 0.4);
	z-index: 1040;
	opacity: 0;
	/* Crucial: a transparent full-viewport layer would otherwise swallow
	   every click, including the hamburger button itself. */
	pointer-events: none;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.menu-drawer-overlay.is-open {
	opacity: 1;
	pointer-events: auto;
	visibility: visible;
}

.menu-drawer__inner-container {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	padding: 0;
}

.menu-drawer__navigation-container {
	flex: 1 1 auto;
}

.menu-drawer__navigation {
	padding: 1.25rem 0;
}

.menu-drawer__menu {
	list-style: none;
	margin: 0;
	padding: 0;
}

.menu-drawer__item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-sm);
	width: 100%;
	padding: 0.85rem 1.25rem;
	font-size: var(--fs-md);
	font-weight: 500;
	text-align: left;
	color: var(--text);
	border: 0;
	background: none;
	cursor: pointer;
}

.menu-drawer__item:hover {
	color: var(--link, var(--primary));
	text-decoration: none;
	background: rgba(0, 0, 0, 0.02);
}

.menu-drawer__item .icon-caret {
	width: 10px;
	height: 6px;
	flex: 0 0 auto;
	transition: transform 0.2s ease;
}

/* Nested panels sit collapsed; JS reveals them. */
.menu-drawer__submenu {
	border-top: 1px solid var(--border);
	background: rgba(0, 0, 0, 0.015);
}

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

.menu-drawer__back-button {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	width: 100%;
	padding: 0.85rem 1.25rem;
	font-size: var(--fs-sm);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--muted);
}

/* The source arrow points right; the back button needs it pointing left. */
.menu-drawer__back-button .icon-arrow {
	width: 12px;
	height: 8px;
	transform: rotate(180deg);
}

.menu-drawer__submenu .menu-drawer__item {
	font-size: var(--fs-base);
	padding-left: 1.6rem;
}

.menu-drawer__submenu .menu-drawer__submenu .menu-drawer__item {
	padding-left: 2.1rem;
}

/* Utility links at the bottom of the drawer. */
.menu-drawer__utility-links {
	border-top: 1px solid var(--border);
	padding: 1.1rem 1.25rem 1.5rem;
	display: flex;
	flex-direction: column;
	gap: 0.9rem;
	font-size: var(--fs-sm);
}

.menu-drawer__account,
.menu-drawer__whatsapp {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	font-weight: 500;
}

.menu-drawer__account .icon {
	width: 18px;
	height: 18px;
}

.menu-drawer__utility-links .list-social {
	gap: 0.9rem;
	margin-top: 0.25rem;
}

/* ---------- Search modal ---------- */
.search-modal {
	position: fixed;
	inset: 0;
	z-index: 1060;
	display: flex;
	align-items: flex-end;
	justify-content: center;
}

.search-modal[hidden] {
	display: none;
}

/* Never intercept clicks while closed. */
.search-modal:not(.is-open) {
	pointer-events: none;
}

.modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.search-modal.is-open .modal-overlay {
	opacity: 1;
}

.search-modal__content {
	position: relative;
	width: 100%;
	max-width: 720px;
	background: var(--bg);
	padding: 1.5rem var(--space-md) 1.75rem;
	border-top-left-radius: 12px;
	border-top-right-radius: 12px;
	transform: translateY(100%);
	transition: transform 0.3s ease;
	box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18);
}

.search-modal.is-open .search-modal__content {
	transform: none;
}

.search-modal__close-button {
	position: absolute;
	top: 1rem;
	right: 1rem;
	padding: 0.35rem;
	color: var(--text);
}

.search-modal .search-form {
	display: flex;
	gap: 0.5rem;
	width: 100%;
}

.search-modal .search-form label {
	flex: 1 1 auto;
}

.search-modal .search-field,
.search-modal input[type="search"] {
	width: 100%;
	padding: 0.8rem 1rem;
	font-size: var(--fs-base);
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

/* ---------- Cart notification ---------- */
.cart-notification {
	position: fixed;
	top: 1.25rem;
	right: 1.25rem;
	z-index: 1070;
	width: min(380px, calc(100vw - 2.5rem));
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 10px;
	box-shadow: 0 12px 40px -12px rgba(0, 0, 0, 0.3);
	padding: 1.1rem 1.25rem 1.25rem;
	opacity: 0;
	transform: translateY(-12px);
	transition: opacity 0.25s ease, transform 0.25s ease;
}

.cart-notification[hidden] {
	display: none;
}

.cart-notification:not(.is-open) {
	pointer-events: none;
}

.cart-notification.is-open {
	opacity: 1;
	transform: none;
}

.cart-notification__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-sm);
}

.cart-notification__heading {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0;
	font-size: var(--fs-base);
	font-weight: 600;
}

.cart-notification__heading .icon-checkmark {
	width: 12px;
	height: 9px;
	color: #2e7d32;
}

.cart-notification__close {
	padding: 0.25rem;
	color: var(--text);
}

.cart-notification-product {
	display: flex;
	align-items: center;
	gap: 0.9rem;
	margin: 1rem 0;
	font-size: var(--fs-sm);
}

.cart-notification-product img {
	width: 56px;
	height: 70px;
	object-fit: cover;
	border-radius: 6px;
	flex: 0 0 auto;
}

.cart-notification-product__details {
	min-width: 0;
}

.cart-notification-product__title {
	margin: 0 0 0.2rem;
	font-weight: 600;
	color: var(--text);
}

.cart-notification-product__price {
	margin: 0;
	color: var(--muted);
}

.cart-notification__links {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}

.cart-notification__continue {
	align-self: center;
	font-size: var(--fs-sm);
	color: var(--muted);
	text-decoration: underline;
}

@media screen and (max-width: 749px) {
	.header {
		min-height: 62px;
	}

	.header__icon .icon {
		width: 20px;
		height: 20px;
	}

	.header__heading-logo {
		font-size: 1.15rem;
		letter-spacing: 0.1em;
	}

	.header__heading img,
	.custom-logo {
		max-height: 44px;
	}

	.announcement-bar__message {
		font-size: 0.7rem;
	}

	.cart-notification {
		top: auto;
		bottom: 1rem;
		right: 1rem;
	}
}

/* Body scroll lock while drawer/modal open. */
body.aurelia-no-scroll {
	overflow: hidden;
}