/**
 * Header: top utility bar, main navigation (with mega-menu), mobile menu.
 */

.tg-masthead {
	position: sticky;
	top: 0;
	z-index: var(--tg-z-header);
	background-color: var(--tg-white);
	box-shadow: var(--tg-shadow-sm);
}

/* ------------------------------------------------------------------ */
/* Top utility bar                                                     */
/* ------------------------------------------------------------------ */

.tg-topbar {
	background-color: var(--tg-dark-blue);
	color: var(--tg-white);
	font-size: var(--tg-text-xs);
}

.tg-topbar__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--tg-space-md);
	padding-block: 8px;
}

.tg-topbar__tagline {
	margin: 0;
	opacity: 0.9;
	font-weight: 500;
	letter-spacing: 0.02em;
}

.tg-topbar__right {
	display: flex;
	align-items: center;
	gap: var(--tg-space-md);
}

.tg-topbar__contact {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	color: var(--tg-white);
	opacity: 0.9;
	white-space: nowrap;
}

.tg-topbar__contact:hover,
.tg-topbar__contact:focus-visible {
	color: var(--tg-orange);
	opacity: 1;
}

.tg-topbar__contact .tg-icon {
	font-size: 14px;
}

.tg-topbar__social {
	display: flex;
	align-items: center;
	gap: 12px;
}

.tg-topbar__social a {
	color: var(--tg-white);
	opacity: 0.8;
	font-size: 14px;
	display: inline-flex;
}

.tg-topbar__social a:hover,
.tg-topbar__social a:focus-visible {
	color: var(--tg-orange);
	opacity: 1;
}

@media (max-width: 768px) {
	.tg-topbar__inner {
		flex-wrap: wrap;
		justify-content: center;
		text-align: center;
		gap: 6px 16px;
	}

	.tg-topbar__right {
		gap: var(--tg-space-sm);
	}
}

@media (max-width: 480px) {
	.tg-topbar__contact span {
		display: none;
	}
}

/* ------------------------------------------------------------------ */
/* Main header row                                                     */
/* ------------------------------------------------------------------ */

.tg-main-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--tg-space-lg);
	padding-block: 5px;
}

.tg-branding {
	flex-shrink: 0;
	max-width: 420px;
}

.tg-logo {
	display: flex;
	align-items: center;
	gap: 14px;
	flex-wrap: nowrap;
	text-decoration: none;
}

.tg-logo .custom-logo-link {
	flex-shrink: 0;
	display: block;
}

.tg-logo img {
	display: block;
	width: auto;
	height: auto;
	max-width: 76px;
	max-height: 76px;
	object-fit: contain;
}

.tg-logo__text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	font-family: var(--tg-font-heading);
	line-height: 1.15;
	white-space: nowrap;
}

.tg-logo__text-primary {
	font-weight: 800;
	font-size: 17px;
	color: var(--tg-dark-blue);
	letter-spacing: 0.01em;
}

.tg-logo__text-secondary {
	font-weight: 600;
	font-size: 11px;
	color: var(--tg-muted);
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

/* ------------------------------------------------------------------ */
/* Primary navigation + mega menu                                      */
/* ------------------------------------------------------------------ */

.tg-primary-nav {
	flex-grow: 1;
	display: flex;
	justify-content: center;
}

.tg-nav-menu {
	display: flex;
	align-items: center;
	gap: 32px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.tg-nav-menu > li {
	position: relative;
}

.tg-nav-menu > li > a {
	display: inline-block;
	padding: 8px 0;
	color: var(--tg-text);
	font-weight: 600;
	font-size: var(--tg-text-sm);
	position: relative;
}

.tg-nav-menu > li > a::after {
	content: "";
	position: absolute;
	left: 0;
	right: 100%;
	bottom: 0;
	height: 2px;
	background-color: var(--tg-green);
	transition: right var(--tg-transition);
}

.tg-nav-menu > li > a:hover,
.tg-nav-menu > li > a:focus-visible,
.tg-nav-menu > li.current-menu-item > a {
	color: var(--tg-green);
}

.tg-nav-menu > li > a:hover::after,
.tg-nav-menu > li > a:focus-visible::after,
.tg-nav-menu > li.current-menu-item > a::after {
	right: 0;
}

/* Dropdown panel (plain submenus) */
.tg-nav-item-has-children > ul.sub-menu {
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	background-color: var(--tg-white);
	border-radius: var(--tg-radius);
	box-shadow: var(--tg-shadow-lg);
	list-style: none;
	margin: 12px 0 0;
	padding: 12px;
	min-width: 240px;
	opacity: 0;
	visibility: hidden;
	transform: translateX(-50%) translateY(8px);
	transition: opacity var(--tg-transition), transform var(--tg-transition), visibility var(--tg-transition);
	z-index: var(--tg-z-dropdown);
}

.tg-nav-item-has-children:hover > ul.sub-menu,
.tg-nav-item-has-children:focus-within > ul.sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(0);
}

.sub-menu li a {
	display: block;
	padding: 10px 14px;
	border-radius: var(--tg-radius-sm);
	color: var(--tg-text);
	font-size: var(--tg-text-sm);
	white-space: nowrap;
}

.sub-menu li a:hover,
.sub-menu li a:focus-visible {
	background-color: var(--tg-background);
	color: var(--tg-green);
}

/* Products mega menu — rendered as a direct child of <header id="tg-masthead">
   (a sibling of .tg-main-header, not nested inside the nav item), so it can
   be positioned with plain `top: 100%` relative to the masthead itself.
   That guarantees it always sits flush under the *entire* header (topbar +
   nav row) regardless of header height, with no JS measurement or timing
   race involved. Width is clamped to match the header row (logo-to-CTA),
   not the full viewport. Visibility is driven by :has() detecting
   hover/focus on the "Products" nav item — see products-mega-menu.php. */
.tg-mega-menu--products {
	position: absolute;
	top: 100%;
	left: 50%;
	width: min(var(--tg-container), calc(100vw - 48px));
	max-height: calc(100vh - 100% - 24px);
	overflow-y: auto;
	background-color: var(--tg-white);
	border: 1px solid var(--tg-border);
	border-radius: var(--tg-radius-lg);
	box-shadow: 0 24px 48px -16px rgba(18, 59, 99, 0.18);
	opacity: 0;
	visibility: hidden;
	transform: translateX(-50%) translateY(-8px);
	transition: opacity var(--tg-transition), transform var(--tg-transition), visibility var(--tg-transition);
	z-index: var(--tg-z-dropdown);
}

/* Invisible bridge spanning from the masthead's bottom edge (where the
   panel starts) up to cover the full nav row height — the "Products" link
   itself sits well above the panel's top edge, so without this the cursor
   has to cross dead space between them and drops out of :hover mid-move,
   causing the menu to close before it can be reached. visibility:hidden
   alone (no pointer-events toggling needed) already fully blocks
   interaction at rest, so the bridge and panel can stay hit-testable
   at all times without being clickable while hidden. */
.tg-mega-menu--products::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 100%;
	height: 80px;
}

.tg-masthead:has(.tg-nav-item-products:hover) .tg-mega-menu--products,
.tg-masthead:has(.tg-nav-item-products:focus-within) .tg-mega-menu--products,
.tg-masthead:has(.tg-mega-menu--products:hover) .tg-mega-menu--products,
.tg-masthead:has(.tg-mega-menu--products:focus-within) .tg-mega-menu--products {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(4px);
}

.tg-mega-menu__inner {
	display: grid;
	grid-template-columns: 260px minmax(0, 1fr);
	column-gap: 32px;
	align-items: start;
	padding: 18px 20px 16px;
}

/* .tg-mega-menu__main wraps the card grid + benefits strip as a single
   grid cell (column 2) that lays its own children out in normal block
   flow — kept as a separate wrapper from .tg-mega-menu__sidebar so the
   benefits strip's position is driven purely by the card grid's own
   height, never by the sidebar's height (they're siblings in different
   grid cells, so a taller sidebar can no longer push the strip down and
   leave a dead gap under a shorter card grid). */
.tg-mega-menu__main {
	min-width: 0;
}

/* Sidebar */
.tg-mega-menu__sidebar {
	background-color: var(--tg-background);
	border-radius: var(--tg-radius-lg);
	padding: 16px;
}

.tg-mega-menu__sidebar-all {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 13px;
	font-weight: 700;
	color: var(--tg-dark-blue);
	margin: 0 0 12px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--tg-border);
}

.tg-mega-menu__sidebar-all-icon {
	display: inline-flex;
	color: var(--tg-green);
}

.tg-mega-menu__sidebar-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tg-mega-menu__sidebar-list li + li {
	margin-top: 6px;
}

.tg-mega-menu__sidebar-list a {
	display: flex;
	align-items: center;
	gap: 9px;
	padding: 9px 10px;
	border-radius: var(--tg-radius-sm);
	color: var(--tg-text);
	font-size: 12px;
	font-weight: 600;
	transition: background-color var(--tg-transition), color var(--tg-transition);
}

.tg-mega-menu__sidebar-list a svg:first-child {
	flex: none;
	color: var(--tg-muted);
	transition: color var(--tg-transition);
}

.tg-mega-menu__sidebar-list a span {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.tg-mega-menu__chevron {
	flex: none;
	opacity: 0;
	transform: translateX(-4px);
	transition: opacity var(--tg-transition), transform var(--tg-transition);
}

.tg-mega-menu__sidebar-list a:hover,
.tg-mega-menu__sidebar-list a:focus-visible,
.tg-mega-menu__sidebar-list li.is-active a {
	background-color: var(--tg-white);
	color: var(--tg-green);
	box-shadow: var(--tg-shadow-sm);
}

.tg-mega-menu__sidebar-list a:hover svg:first-child,
.tg-mega-menu__sidebar-list a:focus-visible svg:first-child,
.tg-mega-menu__sidebar-list li.is-active a svg:first-child {
	color: var(--tg-green);
}

.tg-mega-menu__sidebar-list a:hover .tg-mega-menu__chevron,
.tg-mega-menu__sidebar-list a:focus-visible .tg-mega-menu__chevron,
.tg-mega-menu__sidebar-list li.is-active .tg-mega-menu__chevron {
	opacity: 1;
	transform: translateX(0);
}

/* Category card grid */
.tg-mega-menu__grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 24px 14px;
}

/* A vertical divider between columns gives the eye a fixed boundary to
   read, so column width looks consistent regardless of whether the card's
   own text happens to run short or long. */
.tg-mega-menu__card {
	padding-right: 14px;
	border-right: 1px solid var(--tg-border);
}

.tg-mega-menu__card:nth-child(4n) {
	padding-right: 0;
	border-right: none;
}

.tg-mega-menu__card-title {
	position: relative;
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--tg-dark-blue);
	margin-top: 4px;
	padding-bottom: 12px;
	margin-bottom: 10px;
}

.tg-mega-menu__card-title::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 24px;
	height: 3px;
	border-radius: 2px;
	background-color: var(--tg-green);
	transition: width var(--tg-transition);
}

.tg-mega-menu__card:hover .tg-mega-menu__card-title::after {
	width: 100%;
}

.tg-mega-menu__card-title:hover,
.tg-mega-menu__card-title:focus-visible {
	color: var(--tg-green);
}

.tg-mega-menu__card ul {
	list-style: none;
	margin: 0 0 12px;
	padding: 0;
}

.tg-mega-menu__card li a {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	padding: 5px 0;
	color: var(--tg-muted);
	font-size: 13px;
	line-height: 1.5;
	transition: color var(--tg-transition), transform var(--tg-transition);
}

.tg-mega-menu__card li a:hover,
.tg-mega-menu__card li a:focus-visible {
	color: var(--tg-green);
	transform: translateX(3px);
}

.tg-mega-menu__card-viewall {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	font-weight: 700;
	color: var(--tg-green);
}

.tg-mega-menu__card-viewall svg {
	transition: transform var(--tg-transition);
}

.tg-mega-menu__card-viewall:hover svg,
.tg-mega-menu__card-viewall:focus-visible svg {
	transform: translateX(3px);
}

/* Bottom benefits strip — sits only under the product card grid column,
   not the full panel width (the sidebar column is excluded). */
.tg-mega-menu__benefits {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid var(--tg-border);
}

.tg-mega-menu__benefit {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.tg-mega-menu__benefit-icon {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background-color: rgba(0, 155, 85, 0.1);
	color: var(--tg-green);
}

.tg-mega-menu__benefit-icon svg {
	display: block;
	width: 18px;
	height: 18px;
	flex: none;
}

.tg-mega-menu__benefit strong,
.tg-mega-menu__benefit span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	line-height: 1.3;
}

.tg-mega-menu__benefit strong {
	font-size: 12.5px;
	color: var(--tg-dark-blue);
}

.tg-mega-menu__benefit span {
	font-size: 11.5px;
	color: var(--tg-muted);
}

@media (max-width: 1300px) {
	.tg-mega-menu__inner {
		grid-template-columns: 220px minmax(0, 1fr);
		column-gap: 24px;
	}

	.tg-mega-menu__grid {
		gap: 20px 12px;
	}

	.tg-mega-menu__benefits {
		gap: 12px;
	}
}

@media (max-width: 1024px) {
	.tg-mega-menu--products {
		display: none;
	}
}

/* ------------------------------------------------------------------ */
/* Header actions: CTA + mobile toggle                                 */
/* ------------------------------------------------------------------ */

.tg-header-actions {
	display: flex;
	align-items: center;
	gap: var(--tg-space-md);
	flex-shrink: 0;
}

.tg-header-cta {
	white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Header search: toggle button + drop-down panel                      */
/* ------------------------------------------------------------------ */

.tg-search-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	background: none;
	border: 1px solid var(--tg-border);
	border-radius: var(--tg-radius-sm);
	color: var(--tg-dark-blue);
	cursor: pointer;
	flex-shrink: 0;
	transition: color var(--tg-transition), border-color var(--tg-transition),
		background-color var(--tg-transition);
}

.tg-search-toggle:hover,
.tg-search-toggle:focus-visible {
	color: var(--tg-color-primary);
	border-color: var(--tg-color-primary);
}

.tg-search-toggle svg {
	width: 18px;
	height: 18px;
	display: block;
}

/* The button swaps a magnifier for a close icon; only one is ever shown. */
.tg-search-toggle__close {
	display: none;
}

.tg-search-toggle[aria-expanded="true"] {
	color: var(--tg-color-primary);
	border-color: var(--tg-color-primary);
}

.tg-search-toggle[aria-expanded="true"] .tg-search-toggle__open {
	display: none;
}

.tg-search-toggle[aria-expanded="true"] .tg-search-toggle__close {
	display: block;
}

/*
 * Positioned against .tg-masthead (not the nav row) with top: 100%, the same
 * approach the mega menu uses, so the panel always lands flush beneath the
 * full header regardless of its height — no JS measurement involved.
 */
.tg-header-search {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	z-index: 90;
	background-color: var(--tg-white);
	border-top: 1px solid var(--tg-border);
	box-shadow: var(--tg-shadow);
	opacity: 0;
	transform: translateY(-8px);
	transition: opacity var(--tg-transition), transform var(--tg-transition);
}

.tg-header-search.is-open {
	opacity: 1;
	transform: translateY(0);
}

.tg-header-search__inner {
	padding-block: var(--tg-space-md);
}

.tg-mobile-toggle {
	display: none;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: 5px;
	width: 44px;
	height: 44px;
	background: none;
	border: 1px solid var(--tg-border);
	border-radius: var(--tg-radius-sm);
	cursor: pointer;
	flex-shrink: 0;
}

.tg-mobile-toggle__bar {
	display: block;
	width: 20px;
	height: 2px;
	background-color: var(--tg-dark-blue);
	transition: transform var(--tg-transition), opacity var(--tg-transition);
}

.tg-mobile-toggle[aria-expanded="true"] .tg-mobile-toggle__bar:nth-child(2) {
	transform: translateY(7px) rotate(45deg);
}

.tg-mobile-toggle[aria-expanded="true"] .tg-mobile-toggle__bar:nth-child(3) {
	opacity: 0;
}

.tg-mobile-toggle[aria-expanded="true"] .tg-mobile-toggle__bar:nth-child(4) {
	transform: translateY(-7px) rotate(-45deg);
}

/* ------------------------------------------------------------------ */
/* Mobile menu backdrop                                                 */
/* ------------------------------------------------------------------ */

.tg-mobile-menu-backdrop {
	display: none;
	position: fixed;
	inset: 0;
	background-color: rgba(23, 43, 58, 0.5);
	z-index: calc(var(--tg-z-mobile-menu) - 1);
	opacity: 0;
	transition: opacity var(--tg-transition-slow);
}

.tg-mobile-menu-backdrop.is-open {
	display: block;
	opacity: 1;
}

/* ------------------------------------------------------------------ */
/* Mobile menu panel                                                    */
/* ------------------------------------------------------------------ */

.tg-mobile-menu {
	display: none;
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(320px, 85vw);
	background-color: var(--tg-white);
	box-shadow: var(--tg-shadow-lg);
	z-index: var(--tg-z-mobile-menu);
	padding: var(--space, 24px);
	/* The old 88px top inset reserved room for the toggle button and left a
	   blank strip; the branding header now occupies that space instead. */
	padding-top: 0;
	overflow-y: auto;
	transform: translateX(100%);
	transition: transform var(--tg-transition-slow);
}

/* ------------------------------------------------------------------ */
/* Mobile menu branding header                                          */
/* ------------------------------------------------------------------ */

.tg-mobile-menu__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--tg-space-sm);
	/* Full-bleed across the panel's horizontal padding so the divider spans
	   the whole sheet rather than floating inside it. */
	margin-inline: calc(var(--space, 24px) * -1);
	padding: 18px var(--space, 24px);
	margin-bottom: var(--tg-space-md);
	border-bottom: 1px solid var(--tg-border);
	/* Keeps the branding and close control in reach while a long category
	   list scrolls underneath. */
	position: sticky;
	top: 0;
	background-color: var(--tg-white);
	z-index: 1;
}

.tg-mobile-menu__brand {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
	text-decoration: none;
}

.tg-mobile-menu__logo {
	flex-shrink: 0;
	width: auto;
	height: 40px;
	max-width: 40px;
	object-fit: contain;
}

.tg-mobile-menu__brand-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.tg-mobile-menu__brand-primary {
	font-family: var(--tg-font-heading);
	font-weight: 700;
	font-size: 15px;
	line-height: 1.2;
	color: var(--tg-dark-blue);
}

.tg-mobile-menu__brand-secondary {
	font-size: 9px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--tg-muted);
}

.tg-mobile-menu__close {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	background: none;
	border: 1px solid var(--tg-border);
	border-radius: var(--tg-radius-sm);
	color: var(--tg-dark-blue);
	cursor: pointer;
	transition: color var(--tg-transition), border-color var(--tg-transition);
}

.tg-mobile-menu__close:hover,
.tg-mobile-menu__close:focus-visible {
	color: var(--tg-color-primary);
	border-color: var(--tg-color-primary);
}

.tg-mobile-menu__close svg {
	width: 18px;
	height: 18px;
	display: block;
}

.tg-mobile-menu.is-open {
	display: block;
	transform: translateX(0);
}

.tg-mobile-menu__list {
	list-style: none;
	margin: 0 0 var(--tg-space-lg);
	padding: 0;
}

.tg-mobile-menu__list li {
	border-bottom: 1px solid var(--tg-border);
}

.tg-mobile-menu__list a {
	display: block;
	padding: 14px 4px;
	color: var(--tg-text);
	font-weight: 600;
}

.tg-mobile-menu__list a:hover,
.tg-mobile-menu__list a:focus-visible {
	color: var(--tg-green);
}

.tg-mobile-menu__categories {
	margin: 0 0 var(--tg-space-lg);
}

.tg-mobile-menu__categories-title {
	margin: 0 0 8px;
	font-size: var(--tg-text-xs);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--tg-muted);
}

.tg-mobile-menu__category-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.tg-mobile-menu__category-list li {
	border-bottom: 1px solid var(--tg-border);
}

.tg-mobile-menu__category-list a {
	display: block;
	padding: 12px 4px;
	color: var(--tg-text);
	font-size: var(--tg-text-sm);
	font-weight: 500;
}

.tg-mobile-menu__category-list a:hover,
.tg-mobile-menu__category-list a:focus-visible {
	color: var(--tg-green);
}

.tg-mobile-menu__cta {
	width: 100%;
	margin-bottom: var(--tg-space-sm);
}

.tg-mobile-menu__phone {
	width: 100%;
}

/* ------------------------------------------------------------------ */
/* Responsive breakpoints                                              */
/* ------------------------------------------------------------------ */

@media (max-width: 1024px) {
	.tg-primary-nav,
	.tg-header-cta {
		display: none;
	}

	.tg-mobile-toggle {
		display: inline-flex;
	}
}

@media (max-width: 600px) {
	.tg-main-header__inner {
		gap: var(--tg-space-sm);
	}

	.tg-branding {
		max-width: none;
		min-width: 0;
		flex-shrink: 1;
	}

	.tg-logo {
		gap: 8px;
	}

	.tg-logo img {
		max-width: 44px;
		max-height: 44px;
	}

	.tg-logo__text {
		white-space: normal;
		min-width: 0;
	}

	.tg-logo__text-primary {
		font-size: 14px;
	}

	.tg-logo__text-secondary {
		font-size: 9px;
	}
}
