/**
 * Header Styles (BEM)
 * Block: .header
 * Modifiers: --light, --dark, --sticky
 */

/* ==========================================================================
   Header Block
   ========================================================================== */

.header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: var(--z-header);
	height: var(--header-height);
	width: 100%;
	transition: background-color var(--transition-base), backdrop-filter var(--transition-base);
}

/* ==========================================================================
   Header Modifiers
   ========================================================================== */
.header__wrapper {
	position: relative;
	padding: var(--spacing-xl) 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 0 auto; 
}

/* Light theme (default for pages with white background) */
.header--light {
	background-color: transparent;
}

.header--light.header--sticky {
	
}

/* Dark theme (for pages with dark hero/image background) */
.header--dark {
	background: var(--gradient-header-dark);
}

/* ==========================================================================
   Header Left Section
   ========================================================================== */

.header__left {
	display: flex;
	align-items: center;
	gap: 5.5rem;
}

/* ==========================================================================
   Header Logo
   ========================================================================== */

.header__logo {
	flex-shrink: 0;
	width: 14.3rem;
	height: 5.2rem;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity var(--transition-fast);
}

.header__logo svg {
	width: 100%;
	height: 100%;
}

/* Logo color variants */
.header--light .header__logo svg {
	fill: var(--color-black);
}

.header--dark .header__logo svg {
	fill: var(--color-white);
}

.header--light.header--sticky .header__logo svg {
	fill: var(--color-black);
}

/* ==========================================================================
   Header Navigation
   ========================================================================== */

.header__nav {
	display: flex;
	align-items: center;
	border-radius: var(--radius-md);
	overflow: hidden;
}

/* Light theme nav background */
.header--light .header__nav {
	background-color: var(--color-black-50);
}

/* Dark theme nav background */
.header--dark .header__nav {
	background: rgba(43, 43, 43, 0.16);
	backdrop-filter: blur(1.2rem);
}

.header__nav-list {
	display: flex;
	align-items: stretch;
}

.header__nav-item {
	display: flex;
}

.header__nav-link {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--spacing-md);
	padding: 2rem var(--spacing-xl);
	border-radius: var(--radius-md);
	font-family: var(--font-inter);
	font-size: var(--font-size-sm);
	font-weight: var(--font-weight-semibold);
	line-height: var(--line-height-normal);
	letter-spacing: 0.02em;
	text-transform: uppercase;
	white-space: nowrap;
	transition: background-color var(--transition-fast), color var(--transition-fast);
}

/* Light theme link colors */
.header--light .header__nav-link {
	color: var(--color-black);
}

.header--light .header__nav-link:hover {
	background-color: rgba(0, 0, 0, 0.05); 
}

/* Dark theme link colors */
.header--dark .header__nav-link {
	color: var(--color-white);
}

.header--dark .header__nav-link:hover {
	background-color: rgba(255, 255, 255, 0.1);
}

/* Active nav item (Catalog) */
.header__nav-link--active {
	
}

.header__nav-item:first-child .header__nav-link--active {
	background-color: var(--color-black) !important;
	color: var(--color-white) !important;
}

.header__nav-item:first-child .header__catalog-icon {
	transform: rotate(0deg);
	transition: transform var(--transition-base);
}

.header__nav-item:first-child:hover .header__catalog-icon {
	transform: rotate(180deg);
}

.header--dark .header__nav-item:first-child .header__nav-link,
.header--light .header__nav-item:first-child .header__nav-link {
	background-color: rgba(0, 0, 0, 1); 
	color: var(--color-white);
}

.header__nav-item:first-child .header__nav-link:hover {
	background-color: var(--color-black-800);
}

/* ==========================================================================
   Catalog Icon (4 dots grid)
   ========================================================================== */

.header__catalog-icon {
	width: 2.4rem;
	height: 2.4rem;
	position: relative;
	flex-shrink: 0;
}

.header__catalog-dot {
	position: absolute;
	width: 0.6rem;
	height: 0.6rem;
	background-color: var(--color-white);
	border-radius: 50%;
}

.header__catalog-dot:nth-child(1) {
	left: 0.3rem;
	top: 0.3rem;
}

.header__catalog-dot:nth-child(2) {
	right: 0.3rem;
	top: 0.3rem;
}

.header__catalog-dot:nth-child(3) {
	left: 0.3rem;
	top: 1.5rem;
}

.header__catalog-dot:nth-child(4) {
	right: 0.3rem;
	top: 1.5rem;
}

/* ==========================================================================
   Header CTA Button (Where to Buy)
   ========================================================================== */

.header__cta {
	display: flex;
	align-items: center;
	gap: var(--spacing-md);
	padding: 1.8rem var(--spacing-xl);
	background-color: var(--color-black);
	border-radius: var(--radius-md);
	transition: background-color var(--transition-fast);
}

.header__cta:hover {
	background-color: var(--color-black-800);
}

.header__cta-text {
	color: var(--color-white);
	font-family: var(--font-inter);
	font-size: var(--font-size-sm);
	font-weight: var(--font-weight-semibold);
	line-height: var(--line-height-normal);
	letter-spacing: 0.02em;
	text-transform: uppercase;
	white-space: nowrap;
}

.page-template-page-where-buy .header__cta {
	display: none;
}

/* ==========================================================================
   Marketplace Icons
   ========================================================================== */

.header__marketplaces {
	display: flex;
	align-items: center;
	gap: 0.2rem;
	padding: 0;
	background-color: var(--color-white);
	border-radius: var(--radius-lg);
}

.header__marketplace-icon {
	width: 2.8rem;
	height: 2.8rem;
	border-radius: var(--radius-full);
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
}

.header__marketplace-icon img,
.header__marketplace-icon svg {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.header__marketplace-icon--wb svg {
	width: 100%;
	height: 100%;
}

/* ==========================================================================
   Header Accent (corner element)
   ========================================================================== */

.header__accent {
	position: absolute;
	left: 0;
	top: 0;
	width: 3.4rem;
	height: 3rem;
}

.header--light .header__accent {
	background-color: var(--color-black);
}

.header--dark .header__accent {
	background-color: var(--color-white);
}

.header--dark .header__accent + .header__left svg path {
	fill: var(--color-white);
}

.header__menu-toggle,
.header-mobile__cta {
	display: none;
}

/* ==========================================================================
   Skip Link (Accessibility)
   ========================================================================== */

.skip-link {
	position: absolute;
	left: -999.9rem;
	top: auto;
	width: 0.1rem;
	height: 0.1rem;
	overflow: hidden;
	z-index: calc(var(--z-header) + 1);
}

.skip-link:focus {
	position: fixed;
	top: 0;
	left: 0;
	width: auto;
	height: auto;
	padding: var(--spacing-lg) var(--spacing-xl);
	background-color: var(--color-white);
	color: var(--color-black);
	font-size: var(--font-size-sm);
	text-decoration: none;
	outline: 0.2rem solid var(--color-black);
}

/* ==========================================================================
   Body offset for fixed header
   ========================================================================== */

body.has-fixed-header {
	padding-top: var(--header-height);
}

/* Pages with transparent header over hero */
body.has-transparent-header {
	padding-top: 0;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1089px) {	
	:root {
		--header-height: var(--header-height-mobile);
	}

	.header {
		padding: 0;
	}

	.header__wrapper {
		padding: var(--spacing-lg) 0;
	}

	.header__left {
		gap: var(--spacing-xl);
	}

	.header__accent {
		left: 0;
		width: 3.4rem;
		height: 1.6rem;
	}

	.header__nav, .header__cta {
		display: none; /* Will be replaced with mobile menu */
	}

	.header__logo {
		width: 14.3rem;
		height: auto;
	}

	.header-mobile__cta {
		position: fixed;
		bottom: var(--spacing-lg);
		right: var(--spacing-lg);
		padding: 0;
		background-color: var(--color-white);
		font-size: 0;
		align-items: center;
		gap: var(--spacing-md);
		border-radius: 3.2rem;
		box-shadow: 0 2px 16px 0 rgba(0, 0, 0, 0.24);
	}
	.header-mobile__marketplaces {
		padding: 0;
		background-color: var(--color-white);
		border-radius: var(--radius-lg);
		flex-direction: column;
		gap: 0.4rem;
		display: flex;
	}
	.header-mobile__marketplace-icon {
		width: 4.4rem;
		height: 4.4rem;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.header-mobile__marketplace-icon svg {
		width: 100%;
		height: 100%;
	}
	.header__menu-toggle {
		position: absolute;
		right: 0;
		top: var(--spacing-lg);
		display: flex;
		background-color: rgba(43, 43, 43, 0.32);
        backdrop-filter: blur(12px);
		border: none;
		padding: 0;
		cursor: pointer;
		border-radius: var(--radius-md);
		gap: 0.6rem;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		height: 4.8rem;
		width: 4.8rem;
		transition: background-color var(--transition-fast), backdrop-filter var(--transition-fast);
		z-index: 1000;
	}
	.header__menu-toggle-icon {
		width: 2.4rem;
		height: 0.2rem;
		transform: translateY(0);
		background-color: var(--color-black);
		transition: transform var(--transition-fast), opacity var(--transition-fast);
	}

	.header--dark .header__menu-toggle-icon {
		background-color: var(--color-white);
	}

	.header--menu-open,
	.header--menu-open.header--dark {
		background: var(--color-white); 
		backdrop-filter: none;
		height: 100vh;
		overflow-y: auto;
	}

	.header--menu-open.header--dark .header__accent + .header__left svg path {
		fill: var(--color-black);
	}

	.header--menu-open .container {
		height: 100%;
		padding: 0;
	}

	.header--menu-open .header__wrapper {
		height: 100svh;
		padding: var(--spacing-lg);
		flex-direction: column;
		align-items: flex-start;
		justify-content: flex-start;
		gap: var(--spacing-2xl);
	}

	.header--menu-open .header__accent {
		background-color: var(--color-black);
		left: var(--spacing-lg);
		top: -1.4rem;
		width: 3.4rem;
		height: 3rem;
	}

	.header--menu-open .header__left {
		width: 100%;
		flex-direction: column;
		align-items: flex-start;
		gap: var(--spacing-2xl);
		flex: 1;
	}

	.header--menu-open .header__logo svg {
		fill: var(--color-black);
	}

	.header--menu-open .header__menu-toggle {
		right: var(--spacing-lg);
		top: var(--spacing-lg);
		background-color: rgba(43, 43, 43, 0.16);
		backdrop-filter: blur(1.2rem);
		transition: background-color var(--transition-fast), backdrop-filter var(--transition-fast);
	}

	.header--menu-open .header__menu-toggle-icon {
		transition: transform var(--transition-fast), opacity var(--transition-fast);
	}

	.header--menu-open .header__menu-toggle-icon:nth-child(1) {
		transform: translateY(0.4rem) rotate(45deg);
	}

	.header--menu-open .header__menu-toggle-icon:nth-child(2) {
		transform: translateY(-0.4rem) rotate(-45deg);
	}

	.header--menu-open .header__nav {
		display: flex;
	}

	.header--menu-open .header__nav {
		width: 100%;
		background: transparent;
		border-radius: 0;
		overflow: visible;
	}

	.header--menu-open .header__nav-list {
		flex-direction: column;
		align-items: flex-start;
		width: 100%;
	}

	.header--menu-open .header__nav-item {
		width: 100%;
	}

	.header--menu-open .header__nav-link {
		width: 100%;
		justify-content: flex-start;
		padding: 2rem 0;
		border-bottom: 1px solid var(--color-black-200);
		border-radius: 0;
		font-family: var(--font-actay);
		font-size: var(--font-size-base);
		font-weight: var(--font-weight-bold);
		line-height: var(--line-height-normal);
		letter-spacing: 0.02em;
		text-transform: uppercase;
		color: var(--color-black);
		background-color: transparent;
	}

	.header--menu-open .header__nav-item:last-child .header__nav-link {
		border-bottom: 0;
	}

	.header--menu-open .header__nav-link:hover {
		background-color: transparent;
	}

	.header--menu-open .header__catalog-icon {
		display: none;
	}

	.header--menu-open .header__nav-link--active {
		background-color: transparent !important;
		color: var(--color-black) !important;
	}

	.header--menu-open .header__nav-item:first-child .header__nav-link--active {
		background-color: transparent !important;
		color: var(--color-black) !important;
	}

	.header--menu-open .header__nav-item:first-child .header__nav-link {
		background-color: transparent;
		color: var(--color-black);
		padding-right: 0;
	}

	.header--menu-open .header__cta {
		width: 100%;
		justify-content: center;
		margin-top: auto;
		padding: 1.6rem 1.6rem 1.6rem 2.4rem;
		border-radius: var(--radius-md);
	}

	.header--menu-open .header-mobile__cta {
		display: none;
	}

	body.has-mobile-menu {
		overflow: hidden;
	}

	.header-mobile__cta {
		display: flex;
	}
}
