/*
 * Sitewide styles, loaded on every page (the guide styles in lp-guides.css load only on guide pages).
 *
 * Header mega menu: core Navigation submenus with the lp-mega class, three tiers deep:
 * top item > group column (lp-mega-col, a label with no link) > hub links. On desktop the
 * dropdown becomes one wide panel with a column per group. Core still opens and closes it
 * (hover, focus, keyboard); this file only lays it out. Without it, the menu is core's own
 * nested dropdowns, so nothing breaks.
 */
/* Sticky header: stays at the top while the page scrolls (below the admin bar when signed in to
   WordPress). The z-index also keeps the open mega menu above the page, including the homepage hero,
   which makes its own stacking context. */
.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 100;
	background: var(--wp--preset--color--base, #FFFFFF);
	box-shadow: 0 1px 0 rgba(17, 33, 24, 0.08);
}
@media (max-width: 600px) {
	/* The admin bar scrolls away on phones, so the header pins to the very top there. */
	.wp-site-blocks > header.wp-block-template-part { top: 0; }
}

/* Log in button at the right end of the header row. */
.lp-header-login { flex-shrink: 0; }
.lp-header-login .wp-block-button__link { padding: 0.55em 1.15em; font-size: 15px; line-height: 1.2; white-space: nowrap; }

@media (min-width: 600px) {
	/* Anchor the panel to the header row (its full content width), not to the menu list. */
	.wp-block-template-part .alignwide:has(li.lp-mega) { position: relative; }
	.wp-block-navigation:has(li.lp-mega),
	.wp-block-navigation:has(li.lp-mega) .wp-block-navigation__responsive-container:not(.is-menu-open),
	.wp-block-navigation:has(li.lp-mega) .wp-block-navigation__responsive-dialog,
	.wp-block-navigation__container:has(> li.lp-mega),
	.wp-block-navigation li.lp-mega { position: static; }

	/* A strip under the top item bridges the gap down to the panel, so it stays open on the way. */
	.wp-block-navigation li.lp-mega > .wp-block-navigation-item__content { position: relative; }
	.wp-block-navigation li.lp-mega > .wp-block-navigation-item__content::after { content: ""; position: absolute; left: -16px; right: -28px; top: 100%; height: 34px; }

	.wp-block-navigation li.lp-mega > ul.wp-block-navigation__submenu-container {
		left: 0 !important;
		right: 0 !important;
		top: 100%;
		display: grid !important;
		grid-template-columns: repeat(6, minmax(0, 1fr));
		gap: 22px 28px;
		width: auto !important;
		height: auto !important;
		padding: 26px 30px !important;
		border: 1px solid #DED6C5 !important;
		border-radius: 14px;
		box-shadow: 0 18px 50px rgba(17, 33, 24, 0.16);
	}
	.wp-block-navigation li.lp-mega-ce > ul.wp-block-navigation__submenu-container { grid-template-columns: repeat(5, minmax(0, 1fr)); }

	/* Columns: the group label is a heading, its links are listed under it rather than in a flyout. */
	.wp-block-navigation li.lp-mega li.lp-mega-col { display: block; }
	.wp-block-navigation li.lp-mega li.lp-mega-col > .wp-block-navigation-item__content {
		display: block;
		margin-bottom: 6px;
		padding: 0 0 8px !important;
		border-bottom: 1px solid #ECE6D8;
		color: #5E6B63;
		font-size: 12px;
		font-weight: 800;
		letter-spacing: 0.06em;
		text-transform: uppercase;
		cursor: default;
	}
	.wp-block-navigation li.lp-mega li.lp-mega-col > .wp-block-navigation__submenu-icon { display: none; }
	.wp-block-navigation li.lp-mega li.lp-mega-col > ul.wp-block-navigation__submenu-container {
		position: static !important;
		visibility: inherit !important;
		opacity: 1 !important;
		width: auto !important;
		min-width: 0 !important;
		height: auto !important;
		overflow: visible !important;
		padding: 0 !important;
		border: 0 !important;
		background: transparent !important;
		box-shadow: none;
		transform: none;
	}
	.wp-block-navigation li.lp-mega li.lp-mega-col > ul .wp-block-navigation-item__content {
		padding: 5px 0 !important;
		font-size: 15px;
		line-height: 1.35;
		white-space: normal;
	}
	.wp-block-navigation li.lp-mega li.lp-mega-col > ul .wp-block-navigation-item__content:hover,
	.wp-block-navigation li.lp-mega li.lp-mega-col > ul .wp-block-navigation-item__content:focus {
		text-decoration: underline;
	}
}

@media (min-width: 600px) and (max-width: 1100px) {
	.wp-block-navigation li.lp-mega > ul.wp-block-navigation__submenu-container,
	.wp-block-navigation li.lp-mega-ce > ul.wp-block-navigation__submenu-container { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Phone menu (the overlay): the panels would expand to three screens of links, so the menu shows
   only the top items. Licenses and Continuing Education open their hub pages, which list every type. */
.wp-block-navigation__responsive-container.is-menu-open li.lp-mega > ul.wp-block-navigation__submenu-container,
.wp-block-navigation__responsive-container.is-menu-open li.lp-mega > .wp-block-navigation__submenu-icon { display: none; }

/* Single product: the template's image column is 512px, so a square product image filled the screen.
   Cap the gallery column on desktop; on phones the columns stack and the image stays full width. */
@media (min-width: 782px) {
	.single-product .wp-block-columns > .wp-block-column:has(> .wp-block-woocommerce-product-image-gallery) { flex: 0 0 min(380px, 38%) !important; }
	.single-product .wp-block-woocommerce-product-image-gallery { max-width: 380px; }
}
