/* Inline Header Search Bar */
#header-search-bar {
    display: none;
    align-items: center;
    flex: 1;
    width: 100%;
}

.search-form .search-button {
	background-image: url('../assets/icons/search.svg');
	background-size: 100%;
	width: 20px;
	height: 20px;
	cursor: pointer;
}

.search-page-wrapper .search-form .search-button {
	height: 57px;
	width: 44px;
	background-size: 50%;
	background-repeat: no-repeat;
	background-position: center center;
}

.search-page-wrapper .search-form {
	background-color: var(--wp--preset--color--lightest-gray);
	font-family: var(--wp--preset--font-family--centra-no2);
	font-size: var(--wp--preset--font-size--large);
}

.search-page-wrapper .search-form input {
	background-color: var(--wp--preset--color--lightest-gray);
	padding: 1rem 1.5rem;
	font-weight: 500;
	font-family: var(--wp--preset--font-family--centra-no2);
	font-size: var(--wp--preset--font-size--large);
	border: none;
	outline: transparent;
}

.has-white-color .search-form .search-button {
	background-image: url('../assets/icons/search-white.svg');
}

.header-menu-wrapper, .header-buttons-wrapper {
    gap: var(--two-spacer);
}

.header-menus.search-active {
    flex-grow: 1;
	width: 100%;
	max-width: 670px;
}

.header-menus.search-active #header-search-bar {
    display: flex;
}

.header-menus.search-active #header-menu-wrapper,
.header-menus.search-active #header-buttons-wrapper {
    display: none !important;
}

.header-menus.search-active #search-toggle {
    display: none;
}

#header-search-bar .search-form-wrapper {
    flex: 1;
}

#header-search-bar .search-field {
    background-color: var(--wp--preset--color--lightest-gray);
    border: none;
    border-radius: 5px;
    font-size: 1.125rem;
    padding: 0.35rem 0rem 0.35rem 0.8rem;
    color: inherit;
	width: 100%;
	outline: none;
	font-family: var(--wp--preset--font-family--centra-no2);
	font-weight: 500;
}

#header-search-bar .search-field::placeholder {
    color: currentColor;
    opacity: 0.6;
}

.has-white-color #header-search-bar .search-field {
    color: var(--wp--preset--color--black);
}

.has-white-color #header-search-bar .search-field::placeholder {
    color: var(--wp--preset--color--black);
}

input[type="search"]::-webkit-search-cancel-button {

    /* Remove default */
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
  
    /* Now your own custom styles */
    height: 25px;
    width: 24px;
    background-color: currentColor;
    mask: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M22%203H7C6.31%203%205.77%203.35%205.41%203.88L0%2012L5.41%2020.11C5.77%2020.64%206.31%2021%207%2021H22C23.1%2021%2024%2020.1%2024%2019V5C24%203.9%2023.1%203%2022%203ZM19%2015.59L17.59%2017L14%2013.41L10.41%2017L9%2015.59L12.59%2012L9%208.41L10.41%207L14%2010.59L17.59%207L19%208.41L15.41%2012L19%2015.59Z%22%20fill%3D%22currentColor%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat !important;
    background-size: 30px 30px;
    margin-right: 10px;
    /* Will place small red box on the right of input (positioning carries over) */
  }

#header-search-bar .search-button {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
}

.search-bar-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 2rem;
    line-height: 1;
    padding: 0 0 0 1rem;
    color: currentColor;
}

.search-bar-close:hover {
    opacity: 0.7;
}

#search-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem 0 .5rem 1rem;
    font-size: var(--wp--preset--font-size--medium);
    right: 0px;
}

#search-toggle:hover {
    opacity: 0.7;
}

.has-white-color .hamburger-inner,
.has-white-color .hamburger-inner::before,
.has-white-color .hamburger-inner::after,
.has-white-color .hamburger.is-active .hamburger-inner,
.has-white-color .hamburger.is-active .hamburger-inner::before,
.has-white-color .hamburger.is-active .hamburger-inner::after {
	background-color: white;
}


.header-menu > li a {
	font-size: 2rem;
	font-weight: 500;
}

/* Header Menu Button Styles */

.header-buttons-wrapper {
	margin-top: var(--five-spacer)
}

/* Gray buttons */

.header-buttons {
    align-items: center;
}

.header-buttons a {
    background-color: var(--wp--preset--color--lightest-gray);
    color: var(--wp--preset--color--black);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    font-family: var(--wp--preset--font-family--centra-mono);
    font-size: var(--wp--preset--font-size--small);
    transition: opacity 0.2s ease;
}

.header-buttons a:hover {
    opacity: 0.8;
} 

/* Logged-in greeting text — no button styles */
.header-buttons > li.header-greeting {
    display: flex;
    align-items: center;
    white-space: nowrap;
	font-weight: 500;
    font-size: 1.125rem;
}

/* First Button - Yellow button */
.header-buttons > li:first-child:not(.header-greeting) a {
    background-color: var(--wp--preset--color--yellow);
    color: var(--wp--preset--color--black);
    padding: 0.5rem 1rem;
    border-radius: 5px;
    font-family: var(--wp--preset--font-family--centra-mono);
    font-size: var(--wp--preset--font-size--small);
    transition: opacity 0.2s ease;
	font-weight: 400;
}

/* First Button - Yellow button */
body.logged-in .header-buttons li.account-button a {
    background-color: var(--wp--preset--color--lightest-gray);
}

.header-buttons > li:first-child:not(.header-greeting) a:hover {
    opacity: 0.8;
}

.header-byline {
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	line-height: 1.1;
	margin-top: var(--one-spacer);
}

@media (min-width: 782px) {
	body.home .header-byline {
		display: none;
	}
}

/* Nav hover dim effect */
#header-menu > li {
    transition: opacity 0.2s ease;
}

/* Only dim non-active items when the menu actually has an active item AND is not being hovered. */
#header-menu:has(> li.current-menu-item, > li.current-menu-parent, > li.current-menu-ancestor, > li.current-page-ancestor):not(:has(> li:hover)) > li:not(.current-menu-item):not(.current-menu-parent):not(.current-menu-ancestor):not(.current-page-ancestor) {
    opacity: 0.3;
}

/* On hover: dim all items */
#header-menu:has(> li:hover) > li {
    opacity: 0.3;
}

/* On hover: restore hovered item and active items */
#header-menu:has(> li:hover) > li:hover,
#header-menu:has(> li:hover) > li.current-menu-item,
#header-menu:has(> li:hover) > li.current-menu-parent,
#header-menu:has(> li:hover) > li.current-menu-ancestor,
#header-menu:has(> li:hover) > li.current-page-ancestor {
    opacity: 1;
}

/* Dropdowns */
 .header-menu .menu-item-has-children {
	position: relative;
	display: inline;
	inline-size: fit-content;
	padding-right: 30px;
 }

 .header-menu .menu-item-has-children::after {
	content: '';
	background-image: url('../assets/icons/collapse-chevron.svg');
	background-size: 100%;
	width:22px;
	height: 14px;
	margin-left: var(--one-point-five-spacer);
	display: inline-block;
	position: absolute;
	right: 0;
	top: 18px;
 }
 .has-white-color .header-menu .menu-item-has-children::after {
	background-image: url('../assets/icons/collapse-chevron-white.svg');
 }
 .header-menu .menu-item-has-children.child-shown::after {
	transform: rotate(180deg);
 }

 .header-menu .sub-menu {
	top: 100%;
	left: calc( var(--one-spacer) * -1 );
	z-index: 10;
	background-color: white;
	max-height: 0;
	height: 0;
	overflow: hidden;
 }
 
 header.bg-solid-democrat .header-menu .sub-menu {
	background-color: var(--wp--preset--color--democrat-blue);
 }

 header.bg-solid-republican .header-menu .sub-menu {
	background-color: var(--wp--preset--color--republican-red);
 }

 header.bg-solid-independent .header-menu .sub-menu {
	background-color: #8a7500;
 }
 

 @media (max-width: 991px) {
 .header-menu .sub-menu.shown {
	 margin-top: var(--one-spacer);
 }
 .header-byline {
    margin-top: 0;
    margin-bottom: var(--one-spacer);
 }
 .header-bottom {
    display: flex;
    flex-direction: column-reverse;
 }
 .header-menus {
    padding-top: var(--two-spacer);
 }
 }

 .header-menu .sub-menu li a {
		font-size: 32px;
		font-size: 1.125rem;
}

.header-menu .menu-item-has-children .sub-menu.shown {
		height: auto;
		max-height: 1000px;
}

.desktop-search-toggle {
	display: none;
}

.header-menus {
	flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    position: relative;
    z-index: 1;
}

.mobile-search {
	position: fixed;
	bottom: var(--two-spacer);
	width: calc(100% - var(--three-spacer) * 2 );
}

.mobile-search .search-field {
	order: 1;
	border: none;
	border-bottom: 1px solid var(--color-lightgray);
	border-radius: 0;
	font-family: 'Centra Mono';
	padding: 0 0 var(--one-spacer);
	margin-left: var(--one-point-five-spacer);
}

header.bg-solid-democrat .mobile-search .search-field {
	background-color: var(--wp--preset--color--democrat-blue);
	color: white;
	border-bottom-color: white;
}

header.bg-solid-republican .mobile-search .search-field {
	background-color: var(--wp--preset--color--republican-red);
	color: white;
	border-bottom-color: white;
}

header.bg-solid-independent .mobile-search .search-field {
	background-color: #8a7500;
	color: white;
	border-bottom-color: white;
}
header.has-white-color .mobile-search .search-field::placeholder {
	color: white;
}

 @media screen and (min-width: 992px) {
	.header-menu > li a {
		font-size: 1.125rem;
	}
	.header-menu .menu-item-has-children:hover .sub-menu {
		display: block;
 	}
	.header-menu .menu-item-has-children {
		position: relative;
		display: block;
		inline-size: none;
		padding-right: none;
	}
	.header-menu .menu-item-has-children::after {
		display: none;
	}
	.header-menu .sub-menu {
		display: none;
		position: absolute;
		height: auto;
		max-height: none;
		min-width: 120px;
		overflow: visible;
		padding: 0.5rem var(--one-spacer);
		background-color: var(--wp--preset--color--white);
		border: 2px solid var(--wp--preset--color--lightest-gray);
		border-radius: 5px;
		margin-top: 0;
	}
	.header-menu .sub-menu li a {
		font-size: auto;
	}
	/* Sub-menu item dim/highlight on hover */
	.header-menu .sub-menu > li {
		transition: opacity 0.2s ease;
	}
	.header-menu .sub-menu:has(> li:hover) > li {
		opacity: 0.3;
	}
	.header-menu .sub-menu:has(> li:hover) > li:hover {
		opacity: 1;
	}
	.desktop-search-toggle {
		display: block;
	}
	.header-menu .menu-item-has-children {
		padding-right: 0;
	}
	.header-menus {
		flex-grow: 0;
		flex-direction: row;
		align-items: center;
		justify-content: none;
		position: relative;
		top: auto;
		height: auto;
	}
 }