/* JBS custom header — brand colors + industrial-supply chrome */

:root {
	--jbs-red: #b20106;
	--jbs-red-hover: #8f0105;
	--jbs-royal: #050090;
	--jbs-navy: #010131;
	--jbs-slate: #93a2b7;
	--jbs-gray: #d4d4d4;
	--jbs-white: #ffffff;
	--jbs-bg-soft: #f7f8fa;
	--jbs-header-h: 76px;
	--jbs-ease: 220ms ease;
}

/* Hide Divi Theme Builder header while custom header is active */
body.jbs-custom-header .et-l--header {
	display: none !important;
}

body.jbs-custom-header {
	padding-top: 0;
}

.jbs-header {
	position: sticky;
	top: 0;
	z-index: 99999;
	background: var(--jbs-white);
	border-bottom: 1px solid var(--jbs-gray);
	font-family: "Raleway", system-ui, sans-serif;
	-webkit-font-smoothing: antialiased;
}

.jbs-header__inner {
	max-width: 1280px;
	margin: 0 auto;
	padding: 0 24px;
	min-height: var(--jbs-header-h);
	display: flex;
	align-items: center;
	gap: 28px;
}

.jbs-header__logo {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	line-height: 0;
}

.jbs-header__logo img {
	display: block;
	height: 52px;
	width: auto;
	max-width: 160px;
	object-fit: contain;
}

.jbs-header__nav {
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	min-width: 0;
}

.jbs-nav {
	display: flex;
	align-items: center;
	gap: 4px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.jbs-nav__item {
	position: relative;
	margin: 0;
	padding: 0;
	list-style: none;
}

.jbs-nav__link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 12px;
	color: var(--jbs-navy);
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.02em;
	text-decoration: none;
	background: none;
	border: 0;
	cursor: pointer;
	font-family: inherit;
	line-height: 1.2;
	transition: color var(--jbs-ease);
}

.jbs-nav__link:hover,
.jbs-nav__item.is-active > .jbs-nav__link,
.jbs-nav__item.is-open > .jbs-nav__link {
	color: var(--jbs-red);
}

.jbs-nav__item.is-active > .jbs-nav__link {
	box-shadow: inset 0 -2px 0 var(--jbs-red);
}

.jbs-nav__chev {
	width: 0;
	height: 0;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid currentColor;
	opacity: 0.75;
	transition: transform var(--jbs-ease);
}

.jbs-nav__item.is-open > .jbs-nav__link .jbs-nav__chev {
	transform: rotate(180deg);
}

/* Simple dropdown */
.jbs-dropdown {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	min-width: 220px;
	margin: 0;
	padding: 10px 0;
	list-style: none;
	background: var(--jbs-white);
	border: 1px solid var(--jbs-gray);
	border-radius: 12px;
	box-shadow: 0 12px 28px rgba(1, 1, 49, 0.12);
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity var(--jbs-ease), transform var(--jbs-ease), visibility var(--jbs-ease);
	z-index: 20;
}

.jbs-nav__item:hover > .jbs-dropdown,
.jbs-nav__item:focus-within > .jbs-dropdown,
.jbs-nav__item.is-open > .jbs-dropdown {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.jbs-dropdown a {
	display: block;
	padding: 10px 16px;
	color: var(--jbs-navy);
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	transition: background var(--jbs-ease), color var(--jbs-ease);
}

.jbs-dropdown a:hover {
	background: var(--jbs-bg-soft);
	color: var(--jbs-red);
}

/* Products mega — categories + products */
.jbs-nav__item--mega {
	position: static;
}

.jbs-mega {
	position: absolute;
	top: calc(100% + 0px);
	left: 50%;
	transform: translate(-50%, 6px);
	width: min(1120px, calc(100vw - 48px));
	padding: 28px 28px 20px;
	background: var(--jbs-white);
	border: 1px solid var(--jbs-gray);
	border-radius: 16px;
	box-shadow: 0 16px 36px rgba(1, 1, 49, 0.14);
	opacity: 0;
	visibility: hidden;
	transition: opacity var(--jbs-ease), transform var(--jbs-ease), visibility var(--jbs-ease);
	z-index: 20;
}

.jbs-nav__item--mega > .jbs-mega {
	left: 50%;
	right: auto;
	/* Align to header inner width via viewport centering */
	margin-top: 8px;
}

.jbs-nav__item:hover > .jbs-mega,
.jbs-nav__item:focus-within > .jbs-mega,
.jbs-nav__item.is-open > .jbs-mega {
	opacity: 1;
	visibility: visible;
	transform: translate(-50%, 0);
}

.jbs-mega__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 20px 28px;
}

.jbs-mega__grid--catalog {
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: 22px 20px;
	max-height: min(70vh, 520px);
	overflow: auto;
	padding-right: 4px;
	margin-bottom: 4px;
}

.jbs-mega__heading {
	display: block;
	margin: 0 0 8px;
	padding-bottom: 6px;
	border-bottom: 1px solid var(--jbs-gray);
	color: var(--jbs-royal);
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	text-decoration: none;
	line-height: 1.3;
}

.jbs-mega__heading:hover {
	color: var(--jbs-red);
}

.jbs-mega__col ul {
	list-style: none;
	margin: 0 0 6px;
	padding: 0;
}

.jbs-mega__col li {
	margin: 0;
}

.jbs-mega__col a:not(.jbs-mega__heading):not(.jbs-mega__all):not(.jbs-mega__more) {
	display: block;
	padding: 4px 0;
	color: #4b5563;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.35;
	text-decoration: none;
	transition: color var(--jbs-ease);
}

.jbs-mega__col a:not(.jbs-mega__heading):not(.jbs-mega__all):not(.jbs-mega__more):hover {
	color: var(--jbs-red);
}

.jbs-mega__more {
	display: inline-block;
	margin-top: 2px;
	color: var(--jbs-red);
	font-size: 12px;
	font-weight: 700;
	text-decoration: none;
}

.jbs-mega__more:hover {
	text-decoration: underline;
}

.jbs-mega__footer {
	display: flex;
	justify-content: flex-end;
	padding-top: 14px;
	margin-top: 12px;
	border-top: 1px solid var(--jbs-gray);
}

.jbs-mega__all {
	display: inline-block;
	color: var(--jbs-red);
	font-size: 13px;
	font-weight: 700;
	text-decoration: none;
}

.jbs-mega__all:hover {
	text-decoration: underline;
}

/* CTA pill */
.jbs-header__cta {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 11px 18px;
	border-radius: 999px;
	background: var(--jbs-red);
	color: var(--jbs-white) !important;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-decoration: none !important;
	white-space: nowrap;
	transition: background var(--jbs-ease), transform var(--jbs-ease);
}

.jbs-header__cta:hover {
	background: var(--jbs-red-hover);
	transform: translateY(-1px);
}

.jbs-header__cta--mobile {
	display: none;
}

/* Mobile toggle */
.jbs-header__toggle {
	display: none;
	margin-left: auto;
	width: 44px;
	height: 44px;
	padding: 10px;
	border: 0;
	background: transparent;
	cursor: pointer;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
}

.jbs-header__toggle-bar {
	display: block;
	height: 2px;
	width: 100%;
	background: var(--jbs-navy);
	border-radius: 2px;
	transition: transform var(--jbs-ease), opacity var(--jbs-ease);
}

.jbs-header.is-nav-open .jbs-header__toggle-bar:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.jbs-header.is-nav-open .jbs-header__toggle-bar:nth-child(2) {
	opacity: 0;
}

.jbs-header.is-nav-open .jbs-header__toggle-bar:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 1024px) {
	.jbs-header__toggle {
		display: flex;
	}

	.jbs-header__cta--desktop {
		display: none;
	}

	.jbs-header__nav {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		display: none;
		flex-direction: column;
		align-items: stretch;
		justify-content: flex-start;
		padding: 8px 16px 20px;
		background: var(--jbs-white);
		border-bottom: 1px solid var(--jbs-gray);
		box-shadow: 0 16px 28px rgba(1, 1, 49, 0.1);
		max-height: calc(100vh - var(--jbs-header-h));
		overflow: auto;
		-webkit-overflow-scrolling: touch;
	}

	.jbs-header.is-nav-open .jbs-header__nav {
		display: flex;
	}

	.jbs-nav {
		flex-direction: column;
		align-items: stretch;
		width: 100%;
		gap: 0;
	}

	.jbs-nav__item--mega {
		position: relative;
	}

	.jbs-nav__link {
		width: 100%;
		justify-content: space-between;
		padding: 14px 4px;
		border-bottom: 1px solid var(--jbs-gray);
		box-shadow: none !important;
	}

	.jbs-dropdown,
	.jbs-mega {
		position: static !important;
		left: auto !important;
		top: auto !important;
		width: 100% !important;
		max-width: none !important;
		transform: none !important;
		opacity: 1 !important;
		visibility: visible !important;
		display: none;
		box-shadow: none !important;
		border: 0 !important;
		border-radius: 0;
		padding: 6px 0 10px 8px;
		background: var(--jbs-bg-soft);
		margin: 0 0 4px;
	}

	.jbs-nav__item.is-open > .jbs-dropdown,
	.jbs-nav__item.is-open > .jbs-mega {
		display: block;
	}

	/* Mobile Products: categories only (full product mega is desktop) */
	.jbs-mega--catalog {
		padding: 4px 0 12px;
		background: transparent;
	}

	.jbs-mega__grid,
	.jbs-mega__grid--catalog {
		display: flex;
		flex-direction: column;
		grid-template-columns: none;
		gap: 0;
		max-height: none;
		overflow: visible;
		padding-right: 0;
		margin: 0;
	}

	.jbs-mega--catalog .jbs-mega__col {
		margin: 0;
		padding: 0;
	}

	.jbs-mega--catalog .jbs-mega__col ul,
	.jbs-mega--catalog .jbs-mega__more {
		display: none;
	}

	.jbs-mega--catalog .jbs-mega__heading {
		display: block;
		margin: 0;
		padding: 12px 8px;
		border: 0;
		border-bottom: 1px solid var(--jbs-gray);
		color: var(--jbs-navy);
		font-size: 14px;
		font-weight: 600;
		letter-spacing: 0.01em;
		text-transform: none;
		line-height: 1.3;
	}

	.jbs-mega--catalog .jbs-mega__heading:hover,
	.jbs-mega--catalog .jbs-mega__heading:active {
		color: var(--jbs-red);
		background: var(--jbs-bg-soft);
	}

	.jbs-mega__footer {
		justify-content: stretch;
		margin-top: 8px;
		padding: 8px 0 0;
		border-top: 0;
	}

	.jbs-mega__all {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		margin: 0;
		padding: 12px 14px;
		border-radius: 999px;
		border: 1px solid var(--jbs-navy);
		background: transparent;
		color: var(--jbs-navy);
		font-size: 13px;
		font-weight: 700;
		text-align: center;
		text-decoration: none !important;
	}

	.jbs-mega__all:hover,
	.jbs-mega__all:active {
		background: var(--jbs-navy);
		color: var(--jbs-white);
		text-decoration: none !important;
	}

	.jbs-dropdown a {
		padding: 12px 8px;
		border-bottom: 1px solid var(--jbs-gray);
	}

	.jbs-dropdown a:last-child {
		border-bottom: 0;
	}

	.jbs-header__cta--mobile {
		display: inline-flex;
		margin-top: 16px;
		width: 100%;
	}
}

@media (max-width: 480px) {
	.jbs-header__logo img {
		height: 44px;
	}

	.jbs-header__inner {
		padding: 0 16px;
		min-height: 68px;
	}
}
