/* ==========================================================================
   Apex header — utility bar, main row, primary nav, mobile drawer, trust bar
   ========================================================================== */

/* Storefront adds margin-bottom:4.24em to .site-header specifically on
   the homepage (assuming no breadcrumb follows) — kills it so the header
   sits flush against the trust bar everywhere, matching other pages. */
.site-header { background: var(--color-white); border: 0; padding: 0 !important; margin: 0 !important; box-shadow: none; }
.site-header .col-full { padding: 0; max-width: none; }

/* ---- 0. Thin brand accent line (matches the old, client-approved header) ---- */
.apex-utility-bar::before {
	content: '';
	display: block;
	height: 3px;
	background: linear-gradient(90deg, var(--color-red) 0%, var(--color-navy-light) 100%);
}

/* ---- 1. Utility bar ---- */
.apex-utility-bar {
	background: var(--color-bg-alt);
	color: var(--color-text-muted);
	font-size: 0.8125rem;
	border-bottom: 1px solid var(--color-border);
}
.apex-utility-bar__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4);
	height: 36px;
}
.apex-utility-bar__left { display: flex; align-items: center; gap: var(--space-4); }
.apex-utility-bar__phone { display: inline-flex; align-items: center; gap: 6px; color: var(--color-navy); font-weight: 600; }
.apex-utility-bar__phone .apex-icon svg { width: 14px; height: 14px; }
.apex-utility-bar__phone:hover { color: var(--color-red); }
.apex-utility-bar__hours { color: var(--color-text-muted); }
.apex-utility-bar__right { display: flex; align-items: center; gap: var(--space-4); }
.apex-utility-bar__right a { color: var(--color-text-muted); }
.apex-utility-bar__right a:hover { color: var(--color-red); }

/* ---- Sticky wrap: main row + primary nav pin together ---- */
.apex-header-sticky-wrap {
	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--color-white);
}
.apex-header-sticky-wrap.is-stuck {
	box-shadow: 0 4px 16px rgba(1,32,79,.12);
}

/* ---- 2. Main header row ----
   Named grid areas (not column-index order) so hiding the mobile toggle
   on desktop can never shift the other items into the wrong track. */
/* Old, client-approved header had a solid navy main row (not white) —
   logo/search/account/cart all sit on navy here to match. */
.apex-header-main { background: var(--color-navy); padding-block: var(--space-4); }
/* A "toggle" track is declared even on desktop, where the button is
   display:none and the auto track collapses to zero. Without it, any rule
   that reveals the toggle would place a grid-area that doesn't exist here,
   and CSS Grid would answer by inventing an implicit row — which showed up
   as a tall empty navy band between the logo row and the category nav. */
.apex-header-main__inner {
	display: grid;
	grid-template-columns: auto auto 1fr auto;
	grid-template-areas: "toggle logo search actions";
	align-items: center;
	gap: var(--space-4);
}
.apex-mobile-nav-toggle { grid-area: toggle; }

/* Both mobile affordances are strictly under the tablet breakpoint. Stated
   as an explicit min-width guard so no later rule can leak them onto
   desktop, where the full search bar and category nav are already visible. */
@media (min-width: 1025px) {
	.apex-mobile-nav-toggle,
	.apex-header-search-toggle { display: none !important; }
}
.apex-logo { grid-area: logo; }
.apex-header-search { grid-area: search; }
.apex-header-actions { grid-area: actions; }

.apex-mobile-nav-toggle {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 4px;
	width: 40px;
	height: 40px;
	background: transparent;
	border: 0;
	padding: 0;
}
.apex-mobile-nav-toggle span {
	display: block;
	width: 22px;
	height: 2px;
	background: var(--color-white);
	border-radius: 2px;
}

/* The client's own lock-up, drawn white for a dark ground. Height is the
   controlled dimension — the search bar beside it is sized to match. */
.apex-logo { display: flex; align-items: center; }
.apex-logo__img {
	/* Taller than the 54px search bar because the supplied PNG carries its own
	   transparent padding — at an equal box height the artwork inside reads
	   noticeably smaller than the field next to it. */
	height: 64px;
	width: auto;
	max-width: 100%;
	display: block;
}

.apex-header-search { width: 100%; max-width: 760px; min-width: 0; justify-self: stretch; margin-inline: auto; }
/* Squared off, with a small radius, and tall enough to line up with the logo
   (54px) rather than sitting as a short pill in the middle of the row. */
.apex-search-form {
	display: flex;
	align-items: stretch;
	width: 100%;
	min-height: 54px;
	background: var(--color-white);
	border: 1px solid transparent;
	border-radius: var(--radius-md);
	padding-left: 1.1em;
	overflow: hidden;
	transition: box-shadow .15s ease;
}
.apex-search-form:focus-within {
	box-shadow: 0 0 0 3px rgba(255,255,255,.3);
}
.apex-search-form__input {
	flex: 1;
	min-width: 0;
	border: 0;
	background: transparent;
	padding: 0.9em 0.6em;
	font-size: 0.95rem;
	color: var(--color-text);
}
.apex-search-form__input:focus { outline: none; }
/* The button fills the full height of the field, so the two read as one
   control rather than a circle floating inside a box. */
.apex-search-form__submit {
	background: var(--color-navy);
	color: var(--color-white);
	border: 0;
	width: 58px;
	align-self: stretch;
	border-radius: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	transition: background .15s ease;
}
.apex-search-form__submit:hover { background: var(--color-red); }
.apex-search-form__submit .apex-icon svg { width: 18px; height: 18px; }

.apex-header-actions { display: flex; align-items: center; gap: var(--space-4); flex-shrink: 0; }
.apex-header-search-toggle { display: none; background: none; border: 0; color: var(--color-white); }
.apex-header-action {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	color: var(--color-white);
	font-size: 0.7rem;
	font-weight: 600;
	flex-shrink: 0;
	white-space: nowrap;
}
.apex-header-action:hover { color: rgba(255,255,255,.75); }
.apex-header-action .apex-icon svg { width: 22px; height: 22px; }
.apex-header-action .apex-badge {
	position: absolute;
	top: -6px;
	right: -8px;
}
.apex-header-action__label { white-space: nowrap; }

/* Cart gets its own distinct button treatment (old header had a light
   "Cart £0.00" box rather than a bare icon) instead of matching the
   plain account icon links. */
.apex-cart-link {
	flex-direction: row;
	gap: 10px;
	background: var(--color-bg-alt);
	color: var(--color-navy) !important;
	padding: 0.6em 1.1em;
	border-radius: var(--radius-sm);
	font-size: 0.85rem;
}
.apex-cart-link:hover { background: var(--color-white); }
.apex-cart-link .apex-badge { position: static; margin-left: 2px; }
.apex-cart-link__text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.apex-cart-link__label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-muted); }
.apex-cart-link__total { font-weight: 700; }

.apex-header-mobile-search { display: none; padding-block: var(--space-3); border-top: 1px solid var(--color-border); }
.apex-header-mobile-search.is-open { display: block; }

/* ---- 3. Primary category nav ---- */
.apex-primary-nav {
	background: var(--color-navy);
}
.apex-nav-menu {
	display: flex;
	align-items: stretch;
	justify-content: center;
	flex-wrap: wrap;
}
.apex-nav-menu > .menu-item {
	position: relative;
}
/* Thin divider between top-level nav items — matches the old,
   client-approved header. Skipped next to the coloured Offers button,
   where a divider would look like a stray line inside the red block. */
.apex-nav-menu > .menu-item:not(:last-child)::after {
	content: '';
	position: absolute;
	top: 14px;
	bottom: 14px;
	right: 0;
	width: 1px;
	background: rgba(255,255,255,.18);
}
.apex-nav-menu > .menu-item.apex-nav-offers::after,
.apex-nav-menu > .menu-item.menu-item-offers::after,
.apex-nav-menu > .menu-item:has(+ .apex-nav-offers)::after,
.apex-nav-menu > .menu-item:has(+ .menu-item-offers)::after {
	display: none;
}
.apex-nav-menu > .menu-item > a {
	display: flex;
	align-items: center;
	height: 52px;
	padding-inline: var(--space-4);
	color: var(--color-white);
	font-weight: 600;
	font-size: 0.9rem;
	white-space: nowrap;
}
.apex-nav-menu > .menu-item:hover > a,
.apex-nav-menu > .menu-item.current-menu-item > a {
	background: var(--color-navy-light);
	color: var(--color-white);
}
.apex-nav-menu > .menu-item.apex-nav-offers > a,
.apex-nav-menu > .menu-item.menu-item-offers > a {
	background: var(--color-red);
}
.apex-nav-menu > .menu-item.apex-nav-offers:hover > a,
.apex-nav-menu > .menu-item.menu-item-offers:hover > a {
	background: var(--color-red-dark);
}

/* Flyout dropdown for items with children (e.g. Wall Panel sub-rooms) */
.apex-nav-menu .menu-item-has-children > a::after {
	content: '';
	display: inline-block;
	width: 6px; height: 6px;
	margin-left: 6px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	translate: 0 -2px;
}
.apex-nav-menu .sub-menu {
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 240px;
	background: var(--color-white);
	box-shadow: var(--shadow-card-hover);
	border-radius: 0 0 var(--radius-md) var(--radius-md);
	padding: var(--space-2) 0;
	opacity: 0;
	visibility: hidden;
	transform: translateY(4px);
	transition: opacity .15s ease, transform .15s ease, visibility .15s;
	z-index: 50;
}
.apex-nav-menu .menu-item-has-children:hover > .sub-menu,
.apex-nav-menu .menu-item-has-children.is-open > .sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}
.apex-nav-menu .sub-menu .menu-item a {
	display: block;
	padding: 0.6em 1.2em;
	color: var(--color-text);
	font-size: 0.9rem;
	font-weight: 500;
}
.apex-nav-menu .sub-menu .menu-item a:hover { background: var(--color-bg); color: var(--color-red); }

/* ---- Mobile off-canvas nav ---- */
.apex-mobile-nav-overlay {
	position: fixed; inset: 0;
	background: rgba(1,21,54,.5);
	opacity: 0; visibility: hidden;
	transition: opacity .2s ease, visibility .2s;
	z-index: 199;
}
.apex-mobile-nav-overlay.is-open { opacity: 1; visibility: visible; }

.apex-mobile-nav {
	position: fixed;
	top: 0; left: 0;
	width: min(340px, 88vw);
	height: 100%;
	background: var(--color-white);
	transform: translateX(-100%);
	transition: transform .25s ease;
	z-index: 200;
	display: flex;
	flex-direction: column;
	overflow-y: auto;
}
.apex-mobile-nav.is-open { transform: translateX(0); }

.apex-mobile-nav__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--space-4);
	background: var(--color-navy);
	color: var(--color-white);
}
.apex-mobile-nav__brand { display: flex; align-items: center; min-width: 0; }
.apex-mobile-nav__brand img { height: 38px; width: auto; max-width: 100%; display: block; }
.apex-mobile-nav__close { background: none; border: 0; color: var(--color-white); font-size: 1.75rem; line-height: 1; }

.apex-mobile-nav__body { padding: var(--space-2) 0; flex: 1; }
.apex-mobile-nav-menu .menu-item a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-2);
	padding: 0.9em var(--space-4);
	font-weight: 600;
	color: var(--color-navy);
	border-bottom: 1px solid var(--color-border);
}
.apex-mobile-nav-menu .menu-item-has-children > a::after {
	content: '';
	flex-shrink: 0;
	width: 8px; height: 8px;
	border-right: 2px solid var(--color-text-muted);
	border-bottom: 2px solid var(--color-text-muted);
	transform: rotate(45deg);
	transition: transform .2s ease;
}
.apex-mobile-nav-menu .menu-item-has-children.is-expanded > a::after {
	transform: rotate(-135deg);
}
.apex-mobile-nav-menu .sub-menu {
	padding-left: var(--space-4);
	background: var(--color-bg);
	display: none;
}
.apex-mobile-nav-menu .sub-menu .menu-item a { font-weight: 500; font-size: 0.9rem; }
.apex-mobile-nav-menu .menu-item.apex-nav-offers > a,
.apex-mobile-nav-menu .menu-item.menu-item-offers > a {
	color: var(--color-red);
}

.apex-mobile-nav__footer {
	margin-top: var(--space-4);
	padding: var(--space-4);
	border-top: 1px solid var(--color-border);
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}
.apex-mobile-nav__phone { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--color-red); }

/* ---- 4. Trust bar ---- */
.apex-trust-bar {
	background: var(--color-white);
	border-bottom: 1px solid var(--color-border);
}
.apex-trust-bar__inner {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: var(--space-4);
	padding-block: var(--space-3);
}
.apex-trust-bar__item { display: flex; align-items: center; gap: var(--space-3); }
.apex-trust-bar__icon { color: var(--color-red); flex-shrink: 0; }
.apex-trust-bar__icon svg { width: 26px; height: 26px; }
.apex-trust-bar__text { display: flex; flex-direction: column; line-height: 1.3; }
.apex-trust-bar__text strong { font-size: 0.85rem; color: var(--color-navy); }
.apex-trust-bar__text small { color: var(--color-text-muted); font-size: 0.75rem; }

/* ========================================================================
   RESPONSIVE: Tablet (768px - 1024px)
   ======================================================================== */
@media (max-width: 1024px) {
	.apex-header-main__inner {
		gap: var(--space-3);
		padding: 0 var(--space-4);
	}

	.apex-logo__img { height: 46px; }
	.apex-search-form { min-height: 46px; }
	.apex-search-form__submit { width: 50px; }

	.apex-header-search {
		max-width: 100%;
	}

	.apex-header-actions {
		gap: var(--space-3);
	}

	.apex-header-action {
		font-size: 0.65rem;
	}

	.apex-header-action .apex-icon svg {
		width: 20px;
		height: 20px;
	}

	.apex-cart-link {
		padding: 0.5em 0.9em;
		font-size: 0.75rem;
	}

	.apex-trust-bar__inner {
		grid-template-columns: repeat(2, 1fr);
		gap: var(--space-3);
		padding-block: var(--space-2);
	}

	.apex-trust-bar__item {
		gap: var(--space-2);
	}

	.apex-trust-bar__icon svg {
		width: 22px;
		height: 22px;
	}

	.apex-trust-bar__text strong {
		font-size: 0.8rem;
	}

	.apex-trust-bar__text small {
		font-size: 0.7rem;
	}

	.apex-nav-menu > .menu-item > a {
		height: 48px;
		padding-inline: var(--space-3);
		font-size: 0.85rem;
	}
}

/* ========================================================================
   RESPONSIVE: Mobile (480px - 767px)
   ======================================================================== */
@media (max-width: 768px) {
	.apex-header-main {
		padding-block: var(--space-3);
	}

	/* Three real tracks and three matching named areas. The inline search
	   box is dropped here in favour of the slide-down search panel, which
	   the magnifier in the actions cluster opens. */
	.apex-header-main__inner {
		grid-template-columns: auto auto 1fr;
		grid-template-areas: "toggle logo actions";
		gap: var(--space-2);
		padding: 0 var(--space-3);
	}

	.apex-mobile-nav-toggle {
		display: flex;
	}

	.apex-logo__img { height: 38px; }

	.apex-header-search {
		display: none;
	}

	.apex-header-actions {
		justify-self: end;
		gap: var(--space-2);
	}

	.apex-header-action__label {
		display: none;
	}

	.apex-header-action .apex-icon svg {
		width: 18px;
		height: 18px;
	}

	.apex-header-action {
		font-size: 0.6rem;
	}

	.apex-cart-link {
		flex-direction: row;
		padding: 0.4em 0.7em;
		font-size: 0.7rem;
		gap: 6px;
	}

	.apex-cart-link__text {
		flex-direction: row;
		gap: 4px;
		align-items: center;
	}

	.apex-cart-link__label {
		display: none;
	}

	.apex-nav-menu {
		flex-wrap: nowrap;
		overflow-x: auto;
	}

	.apex-nav-menu > .menu-item > a {
		height: 44px;
		padding-inline: var(--space-2);
		font-size: 0.8rem;
	}

	.apex-primary-nav {
		overflow-x: auto;
	}

	.apex-trust-bar__inner {
		grid-template-columns: 1fr;
		gap: var(--space-2);
		padding-block: var(--space-2);
		padding-inline: var(--space-3);
	}

	.apex-trust-bar__item {
		gap: var(--space-2);
	}

	.apex-trust-bar__icon svg {
		width: 20px;
		height: 20px;
	}

	.apex-trust-bar__text strong {
		font-size: 0.75rem;
	}

	.apex-trust-bar__text small {
		font-size: 0.65rem;
		display: none;
	}

	.apex-search-form {
		padding-left: 0.8em;
	}

	.apex-search-form__submit {
		width: 36px;
		height: 36px;
		margin: 2px;
	}
}

/* ========================================================================
   RESPONSIVE: Small Mobile (<480px)
   ======================================================================== */
@media (max-width: 480px) {
	.apex-header-main {
		padding-block: var(--space-2);
	}

	.apex-header-main__inner {
		gap: 8px;
		padding: 0 var(--space-2);
	}

	.apex-logo__img { height: 32px; }

	.apex-header-search {
		max-width: 100%;
	}

	.apex-search-form {
		padding-left: 0.6em;
	}

	.apex-search-form__input {
		font-size: 0.85rem;
		min-height: 40px;
		padding: 0.6em 0.4em;
	}

	.apex-search-form__submit {
		width: 32px;
		height: 32px;
		margin: 0;
	}

	.apex-search-form__submit .apex-icon svg {
		width: 14px;
		height: 14px;
	}

	.apex-header-actions {
		gap: 6px;
	}

	.apex-header-action .apex-icon svg {
		width: 16px;
		height: 16px;
	}

	.apex-cart-link {
		padding: 0.3em 0.5em;
		font-size: 0.65rem;
	}

	.apex-cart-link .apex-badge {
		width: 16px;
		height: 16px;
		font-size: 0.6rem;
		min-width: 16px;
	}

	.apex-nav-menu > .menu-item > a {
		height: 40px;
		padding-inline: 8px;
		font-size: 0.75rem;
	}

	.apex-trust-bar__item {
		gap: 8px;
	}

	.apex-trust-bar__icon svg {
		width: 18px;
		height: 18px;
	}

	.apex-trust-bar__text strong {
		font-size: 0.7rem;
	}

	.apex-utility-bar__inner {
		height: 32px;
		font-size: 0.75rem;
		gap: var(--space-2);
	}

	.apex-utility-bar__phone .apex-icon svg {
		width: 12px;
		height: 12px;
	}

	.apex-utility-bar__right {
		gap: var(--space-2);
	}
}
