/* Cmsmart B2B Store 2.1.1: mega menu header and footer (markup: inc/header-footer.php, patterns/header.php, footer.php).
   Colours, radii, shadows and fonts are theme.json tokens. Panels open with the Navigation block's own hover intent
   (Cmsmart Stores polish layer: 150 ms in, 250 ms out) and never move the page: they sit absolutely under the header. */

/* ---------- header: the menu row from 1024 px, the drawer below ---------- */
@media (min-width: 600px) and (max-width: 1023px) {
	.ps-header .ps-main-nav .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex;
	}

	.ps-header .ps-main-nav .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
		display: none;
	}
}

@media (min-width: 1024px) {
	/* The chevron that opens a panel by click or Enter: 24 x 24 target (WCAG 2.5.8). */
	.ps-header .ps-main-nav .wp-block-navigation__container > .has-child > .wp-block-navigation-submenu__toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 24px;
		height: 24px;
		margin: 0 6px 0 0;
		padding: 0;
		border-radius: var(--wp--custom--radius--small);
	}

	.ps-header .ps-main-nav .wp-block-navigation__container > .has-child > .wp-block-navigation-submenu__toggle svg {
		width: 12px;
		height: 12px;
		margin: 0;
	}

	.ps-header .ps-main-nav .wp-block-navigation-submenu__toggle:focus-visible {
		outline: 2px solid var(--wp--preset--color--focus);
		outline-offset: 2px;
	}

	/* Panel frame: the full content width under the header row, white card, lift shadow. One block (the child's
	   two-column grid for nested submenus, style.css, must not split the panel). */
	.ps-header .ps-main-nav .cs-mega-item > .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container {
		display: block;
		/* Always the open width: the parent sets it on :hover only, so a closing panel would shrink while it fades
		   out (a layout shift of 0.26). */
		width: min(var(--cmsmart-mega-width, 1140px), var(--wp--style--global--wide-size, 1140px), calc(100vw - 2 * var(--cs-gutter, 24px)));
		min-width: 0;
		padding: 0;
		border: 1px solid var(--wp--preset--color--border);
		border-radius: var(--wp--custom--radius--card);
		background: var(--wp--preset--color--base);
		box-shadow: var(--wp--preset--shadow--lift);
		color: var(--wp--preset--color--contrast);
		white-space: normal;
	}

	/* A bridge over the gap between the menu item and the panel, so a diagonal move keeps it open. */
	.ps-header .ps-main-nav .cs-mega-item > .wp-block-navigation__submenu-container::before {
		content: "";
		position: absolute;
		left: 0;
		right: 0;
		bottom: 100%;
		height: 16px;
	}

	.cs-mega__panel {
		display: grid;
		grid-template-columns: minmax(0, 1fr) 288px;
		gap: 32px;
		padding: 28px 32px 32px;
		text-align: left;
	}
}

/* Esc closes a panel that hover or focus holds open (assets/js/mega-menu.js), until the pointer or focus leaves it. */
.ps-main-nav .wp-block-navigation__container > .has-child.cs-mega-off > .wp-block-navigation__submenu-container {
	visibility: hidden !important;
	opacity: 0 !important;
}

/* ---------- panel content ---------- */
.cs-mega__item {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0;
	list-style: none;
}

.cs-mega__panel {
	text-transform: none;
	letter-spacing: normal;
}

.cs-mega__main {
	min-width: 0;
}

.cs-mega__eyebrow {
	margin: 0 0 14px;
	color: var(--wp--preset--color--primary-dark);
	font-family: var(--wp--preset--font-family--heading);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: var(--wp--custom--tracking--eyebrow);
	text-transform: uppercase;
}

.cs-mega__list {
	display: grid;
	gap: 6px 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.cs-mega__list--tiles {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cs-mega__list--links {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cs-mega__list > li {
	margin: 0;
	padding: 0;
}

/* The header's menu links are uppercase (parent theme.json); panel content is sentence case. */
.ps-header .cs-mega__panel a {
	text-decoration: none;
	text-transform: none;
	letter-spacing: normal;
}

.cs-mega__tile,
.cs-mega__link {
	display: flex;
	gap: 14px;
	align-items: center;
	min-height: 44px;
	padding: 10px 12px;
	border-radius: var(--wp--custom--radius--small);
	color: var(--wp--preset--color--contrast);
	transition: background-color 0.15s ease;
}

.cs-mega__link {
	display: block;
}

.cs-mega__tile:hover,
.cs-mega__link:hover,
.cs-mega__tile:focus-visible,
.cs-mega__link:focus-visible {
	background: var(--wp--preset--color--tint);
}

.cs-mega__panel a:focus-visible {
	outline: 2px solid var(--wp--preset--color--focus);
	outline-offset: 2px;
}

.cs-mega__thumb {
	display: grid;
	flex: 0 0 64px;
	place-items: center;
	width: 64px;
	height: 64px;
	overflow: hidden;
	border-radius: var(--wp--custom--radius--small);
	background: var(--wp--preset--color--tint);
}

.cs-mega__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.cs-mega__thumb .cmb2b-monogram {
	color: var(--wp--preset--color--primary-dark);
	font-family: var(--wp--preset--font-family--heading);
	font-size: 22px;
	font-weight: 600;
}

.cs-mega__text {
	display: block;
	min-width: 0;
}

.cs-mega__name {
	display: block;
	color: var(--wp--preset--color--contrast);
	font-family: var(--wp--preset--font-family--heading);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.35;
}

.cs-mega__desc {
	display: -webkit-box;
	margin-top: 2px;
	overflow: hidden;
	color: var(--wp--preset--color--muted);
	font-size: 13px;
	line-height: 1.45;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.cs-mega__tile:hover .cs-mega__name,
.cs-mega__link:hover .cs-mega__name {
	color: var(--wp--preset--color--primary-dark);
}

.cs-mega__all {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	margin: 10px 0 0 12px;
	color: var(--wp--preset--color--primary-dark);
	font-family: var(--wp--preset--font-family--heading);
	font-size: 14px;
	font-weight: 600;
}

.cs-mega__all:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Account strip of the Business accounts panel. */
.cs-mega__strip {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
	margin-top: 20px;
	padding: 12px 16px;
	border-radius: var(--wp--custom--radius--small);
	background: var(--wp--preset--color--tint);
}

.cs-mega__strip-text {
	flex: 1 1 200px;
	color: var(--wp--preset--color--body-text);
	font-size: 14px;
	line-height: 1.5;
}

.cs-mega__strip-link {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 18px;
	border: 1px solid var(--wp--preset--color--primary-dark);
	border-radius: var(--wp--custom--radius--button);
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--primary-dark);
	font-family: var(--wp--preset--font-family--heading);
	font-size: 14px;
	font-weight: 600;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.ps-header .cs-mega__panel .cs-mega__strip-link.is-primary,
.cs-mega__strip-link:hover {
	background: var(--wp--preset--color--primary-dark);
	color: var(--wp--preset--color--base);
}

.ps-header .cs-mega__panel .cs-mega__strip-link.is-primary:hover {
	background: var(--wp--preset--color--primary-deep);
}

/* Photo card: an inset navy card with real production / product photography, one line and one call to action. */
.cs-mega__photo {
	display: flex;
	flex-direction: column;
	align-self: start;
	overflow: hidden;
	border-radius: var(--wp--custom--radius--card);
	background: var(--wp--preset--color--navy);
	color: var(--wp--preset--color--footer-text);
}

.cs-mega__photo-img {
	display: block;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--wp--preset--color--navy-2);
}

.cs-mega__photo-img img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.25s ease;
}

.cs-mega__photo:hover .cs-mega__photo-img img {
	transform: scale(1.03);
}

.cs-mega__photo-line {
	display: block;
	padding: 16px 18px 4px;
	color: var(--wp--preset--color--footer-text);
	font-size: 14px;
	line-height: 1.5;
}

.cs-mega__photo-cta {
	display: inline-flex;
	align-self: flex-start;
	align-items: center;
	min-height: 44px;
	margin: 10px 18px 18px;
	padding: 0 18px;
	border-radius: var(--wp--custom--radius--button);
	background: var(--wp--preset--color--orange);
	color: var(--wp--preset--color--contrast);
	font-family: var(--wp--preset--font-family--heading);
	font-size: 14px;
	font-weight: 600;
}

.ps-header .cs-mega__panel .cs-mega__photo:focus-visible {
	outline: 2px solid var(--wp--preset--color--focus);
	outline-offset: 3px;
}

/* ---------- drawer (below 1024 px): the panels as accordion sections ---------- */
/* On the home page the parent's frosted header (backdrop-filter) is the containing block of the fixed drawer, which
   then stays a 90 px strip under the hero (bug since 2.0.0): no frost while the drawer is open (as for the search). */
body .ps-header.has-header-background-color:has(.wp-block-navigation__responsive-container.is-menu-open) {
	-webkit-backdrop-filter: none;
	backdrop-filter: none;
}

header.wp-block-template-part:has(.wp-block-navigation__responsive-container.is-menu-open) {
	z-index: 100001;
}

/* A flat section inside the drawer, as wide as the drawer's rows (the panel frame would overflow it): mega panels and
   plain submenus (Help) alike. */
.ps-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container > .has-child > .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container {
	box-sizing: border-box;
	width: 100%;
	min-width: 0;
	padding: 0;
	border: 0;
	box-shadow: none;
}

.wp-block-navigation__responsive-container.is-menu-open .cs-mega__panel {
	display: block;
	padding: 2px 0 14px;
}

.wp-block-navigation__responsive-container.is-menu-open .cs-mega__eyebrow {
	display: none;
}

.wp-block-navigation__responsive-container.is-menu-open .cs-mega__list {
	grid-template-columns: minmax(0, 1fr);
	gap: 0;
}

.wp-block-navigation__responsive-container.is-menu-open .cs-mega__tile,
.wp-block-navigation__responsive-container.is-menu-open .cs-mega__link {
	min-height: 48px;
	padding: 6px 8px;
}

.wp-block-navigation__responsive-container.is-menu-open .cs-mega__thumb {
	flex-basis: 40px;
	width: 40px;
	height: 40px;
}

.wp-block-navigation__responsive-container.is-menu-open .cs-mega__desc {
	-webkit-line-clamp: 1;
}

.wp-block-navigation__responsive-container.is-menu-open .cs-mega__all {
	margin: 4px 0 0 8px;
}

.wp-block-navigation__responsive-container.is-menu-open .cs-mega__photo {
	display: grid;
	grid-template-columns: 112px minmax(0, 1fr);
	grid-template-rows: auto auto;
	margin-top: 14px;
}

.wp-block-navigation__responsive-container.is-menu-open .cs-mega__photo-img {
	grid-row: 1 / 3;
	aspect-ratio: auto;
	min-height: 100%;
}

.wp-block-navigation__responsive-container.is-menu-open .cs-mega__photo-line {
	padding: 12px 14px 0;
	font-size: 13px;
}

.wp-block-navigation__responsive-container.is-menu-open .cs-mega__photo-cta {
	margin: 8px 14px 12px;
	padding: 0 14px;
}

/* ---------- footer: corporate-printing photo cards on the light band ---------- */
.cs-b2b-photos {
	max-width: 1140px;
	margin: 0 auto 40px;
}

.cs-b2b-photos__eyebrow {
	margin: 0;
	color: var(--wp--preset--color--primary-dark);
	font-family: var(--wp--preset--font-family--heading);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: var(--wp--custom--tracking--eyebrow);
	text-transform: uppercase;
}

.cs-b2b-footer .cs-b2b-photos__title {
	margin: 6px 0 20px;
	color: var(--wp--preset--color--contrast);
	font-family: var(--wp--preset--font-family--heading);
	font-size: clamp(22px, 2.2vw, 28px);
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: var(--wp--custom--tracking--heading);
}

.cs-b2b-photos__list {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 24px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.cs-b2b-photos__card {
	margin: 0;
}

.cs-b2b-photos__card a {
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
	border-radius: var(--wp--custom--radius--card);
	background: var(--wp--preset--color--base);
	box-shadow: var(--wp--preset--shadow--card);
	color: var(--wp--preset--color--contrast);
	text-decoration: none;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.cs-b2b-photos__card a:hover {
	box-shadow: var(--wp--preset--shadow--lift);
	transform: translateY(-2px);
}

.cs-b2b-photos__card a:hover .cs-b2b-photos__name {
	color: var(--wp--preset--color--primary-dark);
}

.cs-b2b-photos__card a:focus-visible {
	outline: 2px solid var(--wp--preset--color--focus);
	outline-offset: 3px;
}

.cs-b2b-photos__img {
	display: block;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--wp--preset--color--surface);
}

.cs-b2b-photos__img img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.cs-b2b-photos__text {
	display: block;
	padding: 14px 16px 18px;
}

.cs-b2b-photos__name {
	display: block;
	color: var(--wp--preset--color--contrast);
	font-family: var(--wp--preset--font-family--heading);
	font-size: 16px;
	font-weight: 600;
	line-height: 1.35;
}

.cs-b2b-photos__line {
	display: block;
	margin-top: 4px;
	color: var(--wp--preset--color--muted);
	font-size: 14px;
	line-height: 1.5;
}

/* ---------- footer: navy card with the brand column and four link columns ---------- */
.cs-b2b-footer .cs-b2b-footer__columns {
	flex-wrap: nowrap;
}

.cs-b2b-footer .cs-b2b-footer__columns > .cs-b2b-footer__brand {
	flex: 1.6 1 0;
}

.cs-b2b-footer .ps-footer .cs-b2b-footer__about {
	max-width: 300px;
	margin: 0 0 16px;
}

.cs-b2b-footer .ps-footer .cs-b2b-footer__address {
	margin: 0 0 16px;
}

.cs-b2b-footer .cs-b2b-footer__contact {
	margin: 0;
}

.cs-b2b-footer .ps-footer a.cs-b2b-footer__button {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 18px;
	border: 1px solid rgba(255, 255, 255, 0.5);
	border-radius: var(--wp--custom--radius--button);
	color: var(--wp--preset--color--base);
	font-family: var(--wp--preset--font-family--heading);
	font-weight: 600;
	text-decoration: none;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.cs-b2b-footer .ps-footer a.cs-b2b-footer__button:hover {
	border-color: var(--wp--preset--color--base);
	background: rgba(255, 255, 255, 0.08);
	text-decoration: none;
}

.cs-b2b-footer .cs-b2b-footer__links {
	margin: 0;
	padding: 0;
	list-style: none;
}

.cs-b2b-footer .cs-b2b-footer__links a,
.cs-b2b-footer .ps-footer__nav .wp-block-navigation-item__content {
	display: inline-flex;
	align-items: center;
	min-height: 32px;
	padding: 0;
	text-decoration: none;
}

.cs-b2b-footer h2.ps-footer__title {
	line-height: 1.4;
}

.cs-b2b-footer .ps-footer__bottom {
	justify-content: space-between;
	gap: 8px 24px;
}

@media (max-width: 1023px) {
	.cs-b2b-photos__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 16px;
	}

	.cs-b2b-footer .cs-b2b-footer__columns {
		flex-wrap: wrap !important;
	}

	.cs-b2b-footer .cs-b2b-footer__columns > .wp-block-column {
		flex: 1 1 calc(50% - 16px) !important;
	}

	.cs-b2b-footer .cs-b2b-footer__columns > .cs-b2b-footer__brand {
		flex-basis: 100% !important;
	}
}

@media (max-width: 599px) {
	.cs-b2b-photos {
		margin-bottom: 28px;
	}

	.cs-b2b-photos__list {
		gap: 12px;
	}

	.cs-b2b-photos__text {
		padding: 10px 12px 14px;
	}

	.cs-b2b-photos__name {
		font-size: 15px;
	}

	.cs-b2b-photos__line {
		font-size: 13px;
	}

	.cs-b2b-footer .cs-b2b-footer__links a,
	.cs-b2b-footer .ps-footer__nav .wp-block-navigation-item__content {
		min-height: 44px;
	}
}

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.cs-mega__tile,
	.cs-mega__link,
	.cs-mega__strip-link,
	.cs-mega__photo-img img,
	.cs-b2b-photos__card a,
	.cs-b2b-footer .ps-footer a.cs-b2b-footer__button {
		transition: none;
	}

	.cs-mega__photo:hover .cs-mega__photo-img img,
	.cs-b2b-photos__card a:hover {
		transform: none;
	}

	/* The panels keep their hover-intent delay but appear without the fade. */
	.ps-main-nav:not(.has-modal-open) .wp-block-navigation__submenu-container {
		transition-property: visibility !important;
	}
}
