/** == Header (_header.scss) == */
// Global header and menu styles

:root {
	--knd-font-family-logo: var(--knd-font-family-headings);
}

/* Header layout */
.site-header {
	position: absolute;
	width: 100%;
	top: 0;
	left: 0;
	
	background: $color-page-bg;
	border-bottom: 1px solid $color-page-bg;
	transition: opacity 0.3s;

	&.fixed-header {
		position: fixed;
		width: 100%;
		top: 0;
		left: 0;
		z-index: 500;
		opacity: 1;
	}
	
	.admin-bar & {
		@media screen { top: $adminbar_small_screen;  }
		@media screen and (min-width: 600px) { top: $adminbar_small_screen; }
		@media screen and (min-width: 783px) { top: $adminbar_large_screen; }
	}

	&.invisible {
		opacity: 0;
	}
}

.site-header.hard-top-margin-for-small-screen { 
	top: $adminbar_small_screen; 
}

#wp-admin-bar-kandinsky-main {
	@include upto(large-screens) { display: none;}
}

#wp-admin-bar-leyka-toolbar-menu {
	@include upto(large-screens) { display: none;}
}

#wpadminbar #wp-admin-bar-wpseo-menu.menupop {
	@include upto(large-screens) { display: none;}
}

//Logo layout

//Title
.logo-name {
	display: block;
	font-family: var(--knd-font-family-logo);
	font-weight: var(--knd-font-weight-logo,800);
	font-style: var(--knd-font-style-logo);
	color: var(--knd-color-logo, #183343);
	line-height: 1.2;
	letter-spacing: .03em;
}

.logo-desc {
	display: block;
	font-size: 11px;
	padding-top: 4px;
	text-transform: uppercase;
	color: var(--knd-color-logo-desc, #4d606a);
	font-weight: bold;
	line-height: 1.5;
	letter-spacing: 0.05em;
}

.site-logo {
	display: block;
	height: 100%;
	padding-left: $gut/(2*1.33);

	.logo-name {
		@include ms-respond(font-size, 2);
	}

	.logo-desc {
		display: block;
		padding-top: 4px;
		color: var(--knd-color-logo);
		text-transform: uppercase;
		@include knd-subhead-text();
	}

	@media screen and (max-width: 1400px) { padding-left: $height_gap/2; }
}

//Buttons
.trigger-button {
	cursor: pointer;

	&.donate {
		position: relative;
		margin-right: 1px;
		z-index: 10;

		a {
			@include button();
			margin: $height_gap/2 0 0 $height_gap/2;

			@include for(medium-screens) {
				margin-top: ($logo_full_h + $height_gap - 16*3px)/2;
			}

		}

	}

	&.menu {
		text-align: center;
		cursor: pointer;
		
		#trigger_menu {
			display: block;
			width: $logo_small_h + $height_gap;
			height: $logo_small_h + $height_gap;
			padding: ($logo_small_h + $height_gap - 22px)/2;
			text-align: center;
			background: transparent;
			
			.svg-icon {
				width: 32px;
				height: 22px;
			}
		}

		.svg-icon {
			width: 18px;
			height: 18px;
			fill: $color-text;
			pointer-events: none;
		}

		&:hover .svg-icon {
			fill: $color-main-dark;
		}
		
		@include for(medium-screens) {
			#trigger_menu { margin-top: ($logo_full_h - $logo_small_h) /2; }
		}
	}
}

/** Main menu **/
.nav-overlay {
	display: none;
	background: rgba(0,0,0, 0.4);

	.menu-open & {
		display: block;
		z-index: 1000;
		position: fixed;
		top:0;
		left: 0;
		width: 100%;
		height: 100%;
	}
}

.searchform {
	width: 100%;

	.action {
		display: none;
	}
	
	input {
		@include knd-head-tiny-text();
		letter-spacing: normal;
		text-transform: none;
		padding: 18px $gut/2;
		color: $color-text;
		background: transparent;
		border: none;
		width: 100%;
		border-bottom: 1px solid $color-page-bg-dark;
		
		&:focus {
			box-shadow: inset 0px 1px 2px rgba(50,50,50, 0.08);
			background: var(--knd-color-white);
			color: var(--knd-color-black);
			padding-bottom: 17px;
			border-bottom: 2px solid $color-main;
		}
	}
}

.site-nav {
	display: block;
	z-index: 1020;
	position: fixed;
	top:0;
	right: -290px;
	width: 290px;
	height: 100%;
	background: $color-page-bg;
	overflow-y: auto;
	transition: right 0.3s, visibility 0s linear 300ms;
	visibility: hidden;

	@include for(medium-screens){
		right: -310px;
		width: 310px;
	}
	
	.admin-bar & {
		top: var(--knd-adminbar-height);
		height: calc( 100% - var(--knd-adminbar-height) );
	}
	
	.menu-open & {
		right: 0;
		visibility: visible;
		transition: right 0.3s, visibility 0s linear 0s;
	}

	.search-holder {
		.svg-icon {
			display: none;
		}
	}
	
	.knd-social-links {
		padding: $gut/2;
		.svg-icon {
			fill: $color-text;
		}
	}

}

.site-nav-title {
	border-bottom: 1px solid $color-page-bg-dark;
	position: relative;
	height: 76px;

	.snt-cell {
		display: flex;
		align-items: center;
		height: 100%;
		max-width: 205px;
		padding-left: $gut/2;
	}

	.logo-name {
		display: flex;
		align-items: center;
		font-size: 18px;
		line-height: 1;
		max-width: 100%;
		height: calc( 100% - 24px );

		img {
			display: block;
			height: auto;
			width: auto;
			max-width: 100%;
			max-height: 100%;
		}

		> span {
			text-overflow: ellipsis;
			overflow: hidden;
			white-space: nowrap;
		}
	}

	.close {
		background: $color-main;
		width: $logo_small_h + $height_gap;
		height: $logo_small_h + $height_gap;
		text-align: center;
		cursor: pointer;
		border: 0;
		position: absolute;
		top: 0;
		right: 0;
		padding: ( $logo_small_h + $height_gap - 18px)/2;

		.svg-icon {
			width: 18px;
			height: 18px;
			fill: var(--knd-color-white);
		}

		&:hover {
			background: $color-main-dark;
		}

		&:focus {
			outline-color: var(--knd-color-base);
		}
	}
}

.main-menu {
	li {
		border-bottom: 1px solid $color-page-bg-dark;
		position: relative;

		& > a {
			display: block;
			padding: 19px $gut/2;
			transition: color 0.3s, background 0.3s, border 0.3s, opacity 0.3s;

			@include knd-nav-caps-text();
			font-weight: bold;
			color: $color-text;

			&:hover, &:focus, &:active {
				background: $color-main;
				color: var(--knd-color-white);
			}
		}

		a {
			position: relative;
		}
	}

	.menu-item-has-children {

		> a {
			padding-right: 21px + 19px + 19px;
		}

		.submenu-trigger {
			display: block;
			position: absolute;
			top: 0;
			right: 0;
			z-index: 100;
			cursor: pointer;
			text-align: center;
			border: 0;
			background-color: transparent;
			color: var(--knd-color-base);

			width: 21px + 19px + 19px;
			height: 21px + 19px + 19px;
			padding: (21px + 19px + 19px - 14px)/2;

			.svg-icon {
				display: block;
				width: 14px;
				height: 14px;
				fill: currentColor;
				vertical-align: middle;
			}

			&:hover {
				.svg-icon {
					fill: var(--knd-color-white);
				}
			}
		}

		&:hover {
			.submenu-trigger {
				color: #fff;
			}
		}
	}

	> li .submenu-trigger {
		&:hover {
			background: $color-main;
			border-left-color: $color-main;
		}
	}

	> .menu-item-has-children {

		> a:after {
			content: '';
			position: absolute;
			top: 0;
			bottom: 0;
			right: 0;
			width: 1px;
			background-color: $color-page-bg-dark;
			z-index: -1;
		}

		> .sub-menu {
			.sub-menu {
				> li > a {
					padding-left: 35px;
				}

				.sub-menu {
					> li > a {
						padding-left: 50px;
					}

					.sub-menu {
						> li > a {
							padding-left: 65px;
						}
					}
				}
			}
		}

	}

	ul.sub-menu {
		display: none;
		visibility: hidden;
		background-color: var(--knd-color-main);
		position: relative;

		li {
			border: none;
			position: relative;
		}

		.submenu-trigger {
			border-left: 0;

			.svg-icon {
				width: 10px;
				height: 10px;
				fill: #fff;
			}
		}

		a {
			color: var(--knd-color-white);
			transition: color 0.3s, background 0.3s, border 0.3s, opacity 0.3s;

			&:hover {
				opacity: .7;
			}

			&:focus {
				outline: none !important;
				box-shadow: inset 0 0 0 2px #fff;
			}

			&:after {
				content: '';
				position: absolute;
				bottom: 0;
				left: 0;
				right: 0;
				height: 1px;
				background-color: #fff;
				opacity: .3;
			}
		}

		.menu-item-has-children > a:after {
			right: -59px;
		}
	}

	li.open {
		> .submenu-trigger {

			.svg-icon {
				transform: rotate(180deg);
				fill: var(--knd-color-white);
			}
		}

		> ul.sub-menu {
			visibility: visible;
		}
	}

	> li.open {
		> .submenu-trigger {
			background: $color-main;
			border-left-color: $color-main;
		}
	}

}

/** New Header Version */
.knd-header {
	background-color: var(--knd-header-background,#fff);
	box-shadow: 0px 1px 0px #E9E9E9;
	position: relative;
	z-index: 101;
}

@media (min-width: 1200px) {
	.knd-header .knd-container-fluid {
		padding-left: 40px;
		padding-right: 40px;
	}
}

.knd-header__inner {
	position: relative;
	display: flex;
	justify-content: space-between;
	align-items: stretch;
	min-height: var(--knd-header-height);
	opacity: 1;
}

.knd-header-mobile-logo {
	max-height: 40px;
	display: flex;
	font-size: 20px;
	font-family: var(--knd-font-family-logo);
	font-weight: var(--knd-font-weight-logo, 800);
	font-style: var(--knd-font-style-logo);
	color: var(--knd-color-logo, #183343);
	line-height: 1;
	align-items: center;

	img {
		max-height: 40px;
		display: block;
		width: auto;
		align-self: center;
	}
}

.knd-header__inner-mobile {
	min-height: 60px;

	.knd-button {
		margin-left: 20px;

		@media (max-width: 379px) {
			display: none;
		}
	}

	.knd-col-right {
		@media (max-width: 379px) {
			flex: initial;
		}
	}
}

@media (min-width: 992px){
	body:not(.is-customize-preview) {
		.knd-header__inner-mobile {
			display: none;
		}

		.knd-header__col.knd-col-left {
			flex: initial;
		}
	}
}

@media (max-width: 991.98px){
	body:not(.is-customize-preview) {
		.knd-header__inner-desktop {
			display: none;
		}
	}
}

@media (min-width: 768px){
	body.is-customize-preview {
		.knd-header__inner-mobile {
			display: none;
		}

		.knd-header__col.knd-col-left {
			-webkit-box-flex: initial;
		}
	}
}

@media (max-width: 767.98px){
	body.is-customize-preview {
		.knd-header__inner-desktop {
			display: none;
		}
	}
}

.knd-header__col {
	display: flex;
	align-items: center;
	flex: 1;
}
.knd-header__col.knd-col-right {
	justify-content: flex-end;
}
.knd-header__col.knd-col-center {
	justify-content: center;
}
.knd-header__col > *:not(:first-child) {
	margin-left: 20px;
}
.knd-header ~ .knd-main {
	padding-top: 0;
}
.knd-header-logo {
	display: block;
	margin-right: 20px;

	&__inner {
		display: flex;
		flex-flow: row nowrap;
		justify-content: flex-start;
		align-items: center;
	}

	.text {
		-ms-flex: 1 1 auto;
		flex: 1 1 auto;

		&:not(:first-child) {
			padding-left: 20px;
		}
	}

	.logo {
		height: 66px;
		flex: 0 0 auto;
		display: flex;
		align-items: center;

		img {
			height: auto;
			width: auto;
			max-height: 100%;
		}

		&-name {
			font-size: var(--knd-font-size-logo,22px);
		}
	}
}

.knd-header-contacts {
	font-size: 14px;
	line-height: 150%;
	text-align: right;
	color: #585858;
}
.knd-header-address {
	display: block;
}

.knd-header-email,
.knd-header-phone {
	display: inline-block;
	margin-left: 20px;
}
.knd-header-email {
	color: var(--knd-color-main);
}
.knd-header-email:hover {
	color: var(--knd-color-main-active);
}
.knd-search-toggle {
	color: #585858;
	background: transparent;
	border: 0;
	cursor: pointer;
	padding: 12px;
	display: flex;
	align-items: center;
	border-radius: var(--knd-button-border-radius);
}
.knd-search-toggle:hover {
	color: var(--knd-color-main-active);
}

/** Header Nav */
.knd-header-nav {

	display: flex;
	align-items: center;
	min-height: 50px;

	.knd-col-right & {
		margin-left: auto;
	}

	> .menu {
		height: 100%;
		padding: 0;
		margin: 0;
		display: flex;
		flex-wrap: wrap;
		font-weight: 700;
		line-height: 120%;
		align-items: center;
		list-style: none;

		li {
			position: relative;
		}

		> li {
			display: flex;
			align-items: center;
			white-space: nowrap;

			&:not(:last-child) {
				margin-right: 20px;
			}

			&.menu-item-has-children {
				> .dropdown-nav-toggle {
					padding-left: 0.15em;
					padding-right: 0.15em;
					padding-top: 0;
					padding-botom: 0;
					margin-bottom: -0.2em;
					background-color: inherit;
					display: inline-block;
					border: none;
					color: currentColor;

					&:focus {
						outline: 2px solid var(--knd-color-main) !important;
					}

					svg {
						display: block;
						width: 0.5em;
					}
				}
				

				> .sub-menu {
					top: 100%;
					left: -10px;
					z-index: 11;
					opacity: 0;
					visibility: hidden;
					pointer-events: none;
				}

				&:hover,
				&.focus {
					> .sub-menu {
						opacity: 1;
						visibility: visible;
						pointer-events: all;
					}
				}
			}

			> a {
				display: flex;
				align-items: center;
				height: 100%;
				padding: 8px 5px;
			}
		}

		.sub-menu {
			position: absolute;
			display: block;
			padding: 0;
			margin: 0;
			text-align: left;
			list-style: none;
			background-color: var(--knd-header-background);
			padding: 10px 0;
			right: 9999rem;
			transition: opacity 0.15s linear, transform 0.15s linear, right 0s 0.15s;

			.sub-menu {
				display: block;
				top: -10px;
				left: 100%;
				z-index: 1;
				opacity: 0;
			}
		}
	}

	> .knd-nav-menu {
		font-size: var(--knd-font-size-menu, 18px);
		--knd-font-submenu-size: .85em;

		&-flex {
			flex-wrap: nowrap;
			overflow: hidden;
			width: 100%;
		}
	}

	a {
		color: var(--knd-color-menu,#4d606a);

		&:hover {
			color: var(--knd-color-menu-hover,#dd1400);
		}
	}

	.sub-menu {
		box-shadow: 0px 3px 7px rgba(95, 93, 93, 0.25);

		.menu-item-has-children {
			display: flex;

			> a {
				flex-grow: 1;
			}

			.dropdown-nav-toggle {
				background-color: inherit;
				border: 0;
				color: currentColor;
				width: 24px;
				justify-content: center;
				align-items: center;
				display: flex;

				svg {
					display: block;
					transform: rotate(-90deg);
				}
			}
		}
	}
}

.knd-header-nav {
	> .menu li.menu-item-has-children:hover,
	> .menu li.menu-item-has-children.focus {
		> .sub-menu {
			opacity: 1;
			//visibility: visible;
		}
	}
	> .menu li.menu-item-has-children > a:focus {
		 + .sub-menu {
			opacity: 1;
		}
	}

}
.knd-header-nav .menu li:hover > .sub-menu {
	opacity: 1;
}

.knd-header-nav .sub-menu {
	max-width: 300px;
	width: max-content;

	& > li a {
		display: flex;
		flex-wrap: nowrap;
		align-items: center;
		justify-content: space-between;
		min-width: 200px;
		padding: 10px 20px;
		transition: color 0.25s;
		font-size: var(--knd-font-submenu-size);
		white-space: normal;
	}
}

.knd-header-nav > .menu {
	li.menu-item-has-children {
		.sub-menu-left {
			left: auto;
			right: 100%;
		}
	}
	> li.menu-item-has-children {
		> .sub-menu-left {
			left: auto;
			right: -20px;
		}
	}
}

@media (min-width: 992px) {
	body.knd-header-type-3 .knd-header__col.knd-col-left {
		flex: 100%;
	}
}

body.is-customize-preview.knd-header-type-2 .knd-header__col.knd-col-right {
	flex: auto;
}
body.is-customize-preview.knd-header-type-2 .knd-header__col.knd-col-left {
	flex: 1;
}

.knd-header-nav-truncate {

	> ul {
		margin-left: auto !important;
	}

	.more-menu-item {
		margin-left: -13px;

		> a {
			display: flex;
			flex-direction: column;
			gap: 3px;
			min-width: 36px;
			
			> span {
				position: relative;
				display: flex;
				width: 4px;
				height: 4px;
				border-radius: 50%;
				background-color: currentColor;
			}

			&:before,
			&:after {
				content: '';
				width: 4px;
				height: 4px;
				border-radius: 50%;
				background-color: currentColor;
			}
		}
	}
}
.knd-header-nav-truncate.truncate-hidden {
	width: 100%;
	left: 0;
	position: relative;
}
.knd-header-nav-truncate.truncate-hidden > .menu {
	position: absolute;
	opacity: 0;
	visibility: hidden;
}
// .knd-header__col.knd-col-right {
// 	flex: auto;
// }


/* Language switcher */
.knd-language-switcher {
	font-size: var(--knd-font-size-menu, 18px);
	--knd-font-submenu-size: .85em;
	display: flex;
	gap: 20px;
	font-weight: 700;
	line-height: 120%;

	> li {
		display: flex;
		position: relative;
		z-index: 1;

		> a {
			padding: 8px 5px;
			color: var(--knd-color-menu, #4d606a);
			display: flex;
			align-items: center;

			&:hover {
				color: var(--knd-color-menu-hover, #dd1400);
			}

			> img {
				
			}
		}
		.sub-menu {
			top: 100%;
			left: -12px;
			position: absolute;
			display: none;
			margin: 0;
			text-align: left;
			list-style: none;
			background-color: var(--knd-header-background);
			box-shadow: 0px 3px 7px rgba(95, 93, 93, 0.25);

			li > a {
				padding: 10px 20px;
				color: var(--knd-color-menu, #4d606a);
				display: flex;
				align-items: center;
				font-size: var(--knd-font-submenu-size);

				&:hover {
					color: var(--knd-color-menu-hover, #dd1400);
				}

				> span:not(:first-child) {
					margin-left: 0 !important;
					padding-left: 5px;
				}
			}
		}

		&:hover > .sub-menu,
		&:focus > .sub-menu {
			display: block;
		}
	}

	&,
	.nav-language-switcher {
		text-transform: uppercase;
	}

}

body:not(.dom-loaded) .knd-header-nav .sub-menu {
	display: none;
}

/*cs-scroll-sticky */

/* Header Search */
.knd-search {
	position: fixed;
	z-index: 110;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background-color: rgba(255,255,255,.85);
	overflow: hidden;
	display: none;
	outline: none;
}
.knd-search__inner {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	display: flex;
	justify-content: center;
	align-items: center;
}
.knd-search__inner .knd-container {
	width: 800px;
}
.knd-search-close {
	position: absolute;
	display: block;
	width: 35px;
	height: 35px;
	top: 15px;
	right: 15px;
	cursor: pointer;
	border: 0;
	background: transparent;

	.admin-bar & {
		top: 48px;
	}

	&:before,
	&:after {
		content: '';
		width: 100%;
		height: 2px;
		background-color: #000;
		position: absolute;
		top: 50%;
		margin-top: -1px;
		left: 0;
		transform: rotate(45deg);
	}

	&:after {
		transform: rotate(-45deg);
	}
}

.knd-search__form {
	position: relative;
}
.knd-search__form .knd-search__input {
	border-radius: 1px;
	background-color: rgba(255,255,255,.5);
	padding: 18px 30px;
	width: 100%;
	border: 2px solid var(--knd-color-main);

	.site-nav & {
		background-color: transparent;

		&:focus {
			background: var(--knd-color-white);
			color: var(--knd-color-black);
			box-shadow: none;
		}
	}
}
.knd-search__form {
	.knd-search__submit {
		position: absolute;
		top: 2px;
		bottom: 2px;
		right: 2px;
		width: 56px;
		text-align: center;
		border: 0;
		box-shadow: none;
		background-color: transparent;
		color: var(--knd-color-main);

		&:focus {
			outline: none !important;
			box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 4px var(--knd-color-main);
		}
	}
}


/** Off Canvas */
.knd-offcanvas {
	&-button {
		text-align: center;
		padding: 20px 20px 0;

		&:last-child {
			padding-bottom: 20px;
		}
	}

	&-toggle {
		display: block;
		padding: 10px 5px;
		cursor: pointer;
		border: 0;
		background: transparent;
		border-radius: var(--knd-button-border-radius);

		> span {
			display: block;
			width: 30px;
			height: 3px;
			margin-top: 5px;
			background: var(--knd-color-main);

			&:first-child {
				margin-top: 0;
			}
		}

		&:hover > span {
			background: var(--knd-color-main-active);
			cursor: pointer;
		}
	}
}

.knd-header .knd-social-links li {
	width: 46px;
	height: 46px;
	display: flex;
	justify-content: center;
	align-items: center;
}

.knd-header__inner {
	.knd-social-links {
		flex-wrap: nowrap;

		li a {
			text-align: center;
			vertical-align: middle;
			transition: color 0.3s, background 0.3s, border-color 0.3s, opacity 0.3s;
			text-decoration: none;
			width: 24px;
			height: 24px;
			line-height: 24px;
			border-radius: 50%;
			display: flex;
			justify-content: center;
			align-items: center;
			background-color: #fff;

			.svg-icon {
				width: 14px;
				height: 14px;
				fill: var(--knd-color-main);
			}
			.image-icon {
				display: block;
				width: 14px;
				height: 14px;
				background-color: var(--knd-color-main);
			}

			&:hover {
				background-color: var(--knd-color-main);

				.svg-icon {
					fill: #fff;
				}
				.image-icon {
					background-color: #fff;
					opacity: 1;
				}
			}

		}

		@media (max-width: 1199.98px) {
			display: none;
		}
	}
}
