/**
 * Nucific custom main header.
 *
 * Layout: logo (left) / primary menu (true center) / actions (right).
 * The center column is centered against equal 1fr side columns, so the
 * primary menu stays optically centered regardless of logo or actions width.
 */

.nucific-header {
	position: relative;
	z-index: 100;
}

.nucific-header__inner {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 1.5rem;
	max-width: 1280px;
	margin: 0 auto;
}

/* ---- Logo (left column) ---- */
.nucific-header__logo {
	justify-self: start;
	display: flex;
	align-items: center;
}

.nucific-header__logo img,
.nucific-header__logo .custom-logo {
	display: block;
	width: 150px;
	height: auto;
	max-width: 150px;
}

.nucific-header__logo-text {
	font-size: 1.25rem;
	font-weight: 700;
	text-decoration: none;
	color: inherit;
}

/* ---- Primary menu (center column) ---- */
.nucific-header__primary {
	justify-self: center;
}

/* ---- Actions: guest / account / cart (right column) ---- */
.nucific-header__actions {
	justify-self: end;
	display: flex;
	align-items: center;
	gap: 1.25rem;
}

/* ---- Shared menu styling ---- */
.nucific-menu {
	display: flex;
	align-items: center;
	gap: 1.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.nucific-menu li {
	position: relative;
	margin: 0;
}

.nucific-menu a {
	display: inline-block;
	text-decoration: none;
	color: #222;
	font-family: "Nunito Sans", sans-serif;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
	white-space: nowrap;
}

.nucific-menu a:hover,
.nucific-menu .current-menu-item>a {
	color: #00a79d;
	/* brand teal */
}

/* Sub-menus (depth 2) */
.nucific-menu .sub-menu {
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 200px;
	margin: 0;
	padding: 0.5rem 0;
	list-style: none;
	background: #fff;
	border: 1px solid #eaeaea;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
	opacity: 0;
	visibility: hidden;
	transform: translateY(4px);
	transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
	z-index: 10;
}

.nucific-menu li:hover>.sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.nucific-menu .sub-menu a {
	display: block;
	padding: 0.5rem 1.25rem;
}

/* ---- Guest menu: vertical divider between links ---- */
.nucific-menu--guest>li+li {
	border-left: 1px solid #BDBEBF;
	padding-left: 1.5rem;
}

/* ---- My Account dropdown (desktop) ---- */
.nucific-header__account {
	position: relative;
}

.nucific-header__account-trigger {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0;
	background: none;
	border: 0;
	cursor: pointer;
	color: #222;
	font-family: "Nunito Sans", sans-serif;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
}

.nucific-header__account-trigger:hover {
	color: #00a79d;
}

.nucific-header__account-caret {
	width: 8px;
	height: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-2px) rotate(45deg);
	transition: transform 0.2s ease;
}

.nucific-header__account.is-open-dropdown .nucific-header__account-caret {
	transform: translateY(2px) rotate(-135deg);
}

.nucific-header__account-menu {
	position: absolute;
	top: 100%;
	right: 0;
	min-width: 200px;
	margin-top: 0.5rem;
	padding: 0.5rem 0;
	background: #fff;
	border: 1px solid #eaeaea;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
	opacity: 0;
	visibility: hidden;
	transform: translateY(4px);
	transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
	z-index: 10;
}

.nucific-header__account:hover .nucific-header__account-menu,
.nucific-header__account.is-open-dropdown .nucific-header__account-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.nucific-header__account-menu .nucific-menu {
	flex-direction: column;
	align-items: stretch;
	gap: 0;
}

.nucific-header__account-menu .nucific-menu a {
	display: block;
	padding: 0.5rem 1.25rem;
	white-space: nowrap;
}

/* ---- Cart ---- */
.nucific-header__cart {
	position: relative;
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	color: #222;
}

.nucific-header__cart:hover {
	color: #00a79d;
}

.nucific-header__cart-icon {
	width: 24px;
	height: 24px;
	background: currentColor;
	-webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='9' cy='21' r='1'/><circle cx='20' cy='21' r='1'/><path d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'/></svg>") center / contain no-repeat;
	mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='9' cy='21' r='1'/><circle cx='20' cy='21' r='1'/><path d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'/></svg>") center / contain no-repeat;
}

.nucific-header__cart-count {
	position: absolute;
	top: -8px;
	right: -10px;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	border-radius: 9px;
	background: #00a79d;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
}

/* ---- Login-state visibility (JS toggles the modifier classes) ---- */
.nucific-header.is-guest .nucific-header__account,
.nucific-header.is-logged-in .nucific-header__guest {
	display: none;
}

/* ---- Mobile toggle: hidden on desktop ---- */
.nucific-header__toggle {
	display: none;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	width: 24px;
	height: 24px;
	padding: 0;
	background: none;
	border: 0;
	cursor: pointer;
}

.nucific-header__toggle-bars,
.nucific-header__toggle-bars::before,
.nucific-header__toggle-bars::after {
	display: block;
	width: 24px;
	height: 2px;
	background: #222;
	transition: transform 0.2s ease, top 0.2s ease, background 0.2s ease;
}

.nucific-header__toggle-bars {
	position: relative;
}

.nucific-header__toggle-bars::before,
.nucific-header__toggle-bars::after {
	content: "";
	position: absolute;
	left: 0;
}

.nucific-header__toggle-bars::before {
	top: -7px;
}

.nucific-header__toggle-bars::after {
	top: 7px;
}

/* Hamburger turns into an X while the panel is open. */
.nucific-header.is-open .nucific-header__toggle-bars {
	background: transparent;
}

.nucific-header.is-open .nucific-header__toggle-bars::before {
	top: 0;
	transform: rotate(45deg);
}

.nucific-header.is-open .nucific-header__toggle-bars::after {
	top: 0;
	transform: rotate(-45deg);
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ---------------------------------------------------------------------------
 * Mobile
 * ------------------------------------------------------------------------- */
@media (max-width: 980px) {

	/* Mobile bar: [hamburger] [logo] [cart] */
	.nucific-header__inner {
		grid-template-columns: auto 1fr auto;
		column-gap: 1rem;
		row-gap: 0;
	}

	.nucific-header__toggle {
		display: flex;
		grid-column: 1;
		grid-row: 1;
		justify-self: start;
	}

	.nucific-header__logo {
		grid-column: 2;
		grid-row: 1;
		justify-self: center;
	}

	/* Dissolve the actions group so cart stays in the bar while the
	   guest/account menus drop into the collapsed panel. */
	.nucific-header__actions {
		display: contents;
	}

	.nucific-header__cart {
		grid-column: 3;
		grid-row: 1;
		justify-self: end;
	}

	/* Panel rows, stacked under the bar: primary, then guest/account. */
	.nucific-header__primary {
		grid-column: 1 / -1;
		grid-row: 2;
	}

	.nucific-header__guest {
		grid-column: 1 / -1;
		grid-row: 3;
	}

	.nucific-header__account {
		grid-column: 1 / -1;
		grid-row: 4;
	}

	.nucific-header__primary,
	.nucific-header__guest,
	.nucific-header__account {
		justify-self: stretch;
		display: none;
	}

	/* Open the panel: primary always, plus the menu matching login state. */
	.nucific-header.is-open .nucific-header__primary,
	.nucific-header.is-open.is-guest .nucific-header__guest,
	.nucific-header.is-open.is-logged-in .nucific-header__account {
		display: block;
	}

	/* All menus become a single vertical list in the panel. */
	.nucific-header.is-open .nucific-menu {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		width: 100%;
		box-sizing: border-box;
		padding: 28px 16px;
	}

	/* 16px above and below each hairline comes from the link padding
	   (a flex gap can't center the border that draws the line). */
	.nucific-header.is-open .nucific-menu>li>a {
		display: block;
		padding: 16px 0;
		font-size: 16px;
		font-weight: 600;
	}

	/* Dropdown panel: light grey background. */
	.nucific-header.is-open .nucific-header__primary,
	.nucific-header.is-open .nucific-header__guest,
	.nucific-header.is-open .nucific-header__account {
		background: #F5F5F5;
	}

	/* Hairline separator under every link in the list. */
	.nucific-header.is-open .nucific-menu>li {
		border-bottom: 0.5px solid #D9DADA;
	}

	/* No trailing line under the very last item (bottom of the login group). */
	.nucific-header.is-open .nucific-header__guest .nucific-menu>li:last-child,
	.nucific-header.is-open .nucific-header__account .nucific-menu>li:last-child {
		border-bottom: 0;
	}

	/* Drop the desktop vertical divider in the stacked mobile list. */
	.nucific-menu--guest>li+li {
		border-left: 0;
		padding-left: 0;
	}

	/* Account: no dropdown on mobile — show the links inline in the panel. */
	.nucific-header__account-trigger {
		display: none;
	}

	.nucific-header__account-menu {
		position: static;
		min-width: 0;
		margin: 0;
		padding: 0;
		background: transparent;
		border: 0;
		box-shadow: none;
		opacity: 1;
		visibility: visible;
		transform: none;
	}

	/* On mobile, show sub-menus inline rather than on hover. */
	.nucific-menu--primary .sub-menu {
		position: static;
		opacity: 1;
		visibility: visible;
		transform: none;
		border: 0;
		box-shadow: none;
		padding-left: 1rem;
	}
}