/*
Theme Name: Baur Consulting
Theme URI: https://baurconsulting.ch
Author: pshemek
Author URI: https://przemek.maczewski.com
Description: Custom theme for baurconsulting.ch website.
Requires at least: 6.5
Tested up to: 6.5.3
Requires PHP: 8.1
Version: 1.2.2-b
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: baurconsulting
*/

*,
*::before,
*::after {
	box-sizing: inherit;
}

html {
	overflow-x: hidden;
	overflow-y: scroll;
	scroll-behavior: smooth;
	box-sizing: border-box;
	-moz-osx-font-smoothing: grayscale;
	-webkit-font-smoothing: antialiased;
}

a,
button,
input:focus,
input[type="button"],
input[type="submit"],
textarea:focus,
.wp-element-button {
	transition: all 0.2s ease-in-out;
}

/* LAYOUT */

.site-sidebar {
	border-right: 1px solid var(--wp--custom--color--border);
}

.is-position-sticky > .site-sidebar > .wp-block-group {
	min-height: calc(100vh - var(--wp--custom--admin-bar--height)) !important;
	color: var(--wp--preset--color--contrast-2);
}

header.wp-block-template-part > .wp-block-group {
	border-bottom: 1px solid var(--wp--custom--color--border);
	color: var(--wp--preset--color--contrast-2);
	height: var(--wp--custom--header--height);
}

.home header.wp-block-template-part > .wp-block-group {
	--wp--custom--color--border: var(--wp--preset--color--contrast-3);
	background-color: var(--wp--preset--color--contrast-2);
	color: var(--wp--preset--color--base);
}

.home header.wp-block-template-part > .wp-block-group {
	--wp--custom--color--link: var(--wp--preset--color--base);
	--wp--custom--color--link-hover: var(--wp--preset--color--base);
}

.home .is-position-sticky > .site-sidebar > .wp-block-group {
	background-color: var(--wp--preset--color--contrast-2);
	color: var(--wp--preset--color--base);
}

.home .is-position-sticky > .site-sidebar > .wp-block-group a {
	color: var(--wp--preset--color--base);
}

/* A trick to include the header height in the first section calculation */
.wp-block-post-content > header.min-h-screen {
	min-height: calc(
		100vh - var(--wp--custom--header--height) -
			var(--wp--custom--admin-bar--height)
	);
}

/* A workaround for the bottom gap in the footer */
footer.wp-block-template-part:has(> .has-contrast-2-background-color) {
	background-color: var(--wp--preset--color--contrast-2);
}

/* NAV OVERLAY */

.wp-block-template-part.nav-overlay {
	display: none;
	position: fixed;
	top: var(--wp--custom--admin-bar--height);
	right: 0;
	left: 0;
	bottom: 0;
	z-index: 1000;
	width: 100%;
	height: calc(100vh - var(--wp--custom--admin-bar--height));
	overflow-y: auto;
	background-color: var(--wp--preset--color--base);
}

@supports (height: 100dvh) {
	.wp-block-template-part.nav-overlay {
		height: calc(100dvh - var(--wp--custom--admin-bar--height));
	}
}

.nav-overlay-toggle {
	all: unset;
}

/* Hamburger button */

.nav-overlay-toggle {
	--_bar-width: 30px;
	--_bar-height: 4px;
	--_hamburger-gap: 6px;
	--_foreground: var(--wp--preset--color--contrast-2);
	--_background: var(--wp--preset--color--base);
	--_animation-timing: 0.15s ease-out;
	--_hamburger-height: calc(var(--_bar-height) * 3 + var(--_hamburger-gap) * 2);
	--x-width: calc(var(--_hamburger-height) * 1.41421356237);

	margin-inline-start: auto;
	display: flex;
	flex-direction: column;
	gap: var(--_hamburger-gap);
	width: max-content;
	cursor: pointer;
}

.home .nav-overlay-toggle[aria-expanded="false"] {
	--_foreground: var(--wp--preset--color--base);
}

.nav-overlay-toggle::before,
.nav-overlay-toggle::after,
.nav-overlay-toggle span {
	content: "";
	width: var(--_bar-width);
	height: var(--_bar-height);
	background-color: var(--_foreground);
	border-radius: 0;
	transform-origin: left center;
	transition:
		opacity var(--_animation-timing),
		width var(--_animation-timing),
		rotate var(--_animation-timing),
		translate var(--_animation-timing),
		background-color var(--_animation-timing);
}

.nav-overlay-toggle[aria-expanded="true"]::before {
	rotate: 45deg;
	width: var(--x-width);
	translate: calc(var(--x-width) / 8) calc(var(--_bar-height) / -2);
}

.nav-overlay-toggle[aria-expanded="true"]::after {
	rotate: -45deg;
	width: var(--x-width);
	translate: calc(var(--x-width) / 8) calc(var(--_bar-height) / 2);
}

.nav-overlay-toggle[aria-expanded="true"] span {
	opacity: 0;
	width: 0;
}

/* Nav overlay */

.nav-overlay-toggle[aria-expanded="true"]
	~ .wp-block-template-part.nav-overlay {
	display: block;
}

body:has(.nav-overlay-toggle[aria-expanded="true"]) {
	position: fixed;
	top: 0;
}

.wp-block-template-part.nav-overlay
	> .wp-block-group
	> :last-child
	> :first-child
	> :first-child
	> :first-child {
	height: var(--wp--custom--header--height);
}

.wp-block-template-part.nav-overlay
	.wp-block-navigation
	.wp-block-navigation-item__content.wp-block-navigation-item__content {
	color: var(--wp--preset--color--contrast);
}

.wp-block-template-part.nav-overlay
	.wp-block-navigation
	.wp-block-navigation-item__content.wp-block-navigation-item__content:hover {
	color: var(--wp--preset--color--contrast-2);
}

#wpconsent-container::part(wpconsent-settings-button) {
	left: auto;
	right: var(--wp--preset--spacing--10);
	bottom: var(--wp--preset--spacing--10);
}

/* MEDIA QUERIES */

@media screen and (min-width: 1025px) {
	.nav-overlay-toggle {
		position: fixed;
		top: 50vh;
		left: calc(max(6vw, 5.875rem) / 2);
		transform: translateX(-50%);
		z-index: 999;
	}
}

@media screen and (max-width: 1024px) {
	.wp-site-blocks > .wp-block-group-is-layout-flex > :first-child,
	.wp-block-template-part.nav-overlay > .wp-block-group > :first-child {
		display: none;
	}

	.wp-site-blocks > .wp-block-group-is-layout-flex > :last-child,
	.wp-block-template-part.nav-overlay > .wp-block-group > :last-child {
		flex-basis: 100%;
	}

	.wp-block-template-part.nav-overlay
		> .wp-block-group
		> :last-child
		> :first-child
		> :first-child
		> :last-child {
		align-items: flex-start;
	}
}

/* UTLITIES */

.basis-full {
	flex-basis: 100% !important;
}

.flex-col {
	flex-direction: column;
}

.flex-wrap {
	flex-wrap: wrap !important;
}

.hidden {
	display: none !important;
}

.min-h-screen {
	min-height: 100vh;
}

@media screen and (min-width: 481px) {
	.sm\:hidden {
		display: none !important;
	}
}

@media screen and (min-width: 782px) {
	.md\:hidden {
		display: none !important;
	}
}

@media screen and (min-width: 782px) and (max-width: 1024px) {
	.md-lg\:grid-cols-2 {
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
	}
}

@media screen and (min-width: 1025px) {
	.lg\:hidden {
		display: none !important;
	}
}

@media screen and (max-width: 1024px) {
	.-lg\:basis-full {
		flex-basis: 100% !important;
	}
	.-lg\:flex-wrap {
		flex-wrap: wrap !important;
	}
	.-lg\:hidden {
		display: none !important;
	}
}

@media screen and (max-width: 781px) {
	.-md\:hidden {
		display: none !important;
	}
	.-md\:col-reverse {
		flex-direction: column-reverse !important;
	}
}

@media screen and (max-width: 480px) {
	.-sm\:flex-col {
		flex-direction: column;
	}
	.-sm\:hidden {
		display: none !important;
	}
}
