/*
Theme Name:   SwissBusiness Child
Theme URI:    https://example.com/
Description:  GeneratePress child theme with an accessible, site-wide hamburger navigation menu.
Author:       Alex
Template:     generatepress
Version:      1.0.0
License:      GNU General Public License v2 or later
License URI:  http://www.gnu.org/licenses/gpl-2.0.html
Text Domain:  swissbusiness-child
*/

/* =========================================================
   Design tokens
   Adjust these once and the whole menu re-themes.
   ========================================================= */
:root {
	--sb-menu-bg:        #fbf8f2;
	--sb-menu-border:    #8b7355;
	--sb-bar-color:      #2a2520;
	--sb-link-color:     #2a2520;
	--sb-link-hover-bg:  #efe7d8;
	--sb-focus-ring:     #8b7355;
	--sb-z:              9999;
}

/* =========================================================
   Hide GeneratePress' native navigation
   We replace it entirely with the global hamburger below,
   so suppress the parent theme's primary/secondary nav and
   its own mobile toggle to avoid a duplicate menu.
   ========================================================= */
.main-navigation,
.secondary-navigation,
.main-navigation .menu-toggle {
	display: none !important;
}

/* =========================================================
   Hamburger toggle button
   ========================================================= */
.sb-menu-toggle {
	display: inline-flex;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 44px;          /* 44px = comfortable touch target */
	height: 44px;
	padding: 9px;
	margin: 0;
	background: none;
	border: none;
	cursor: pointer;
	box-sizing: border-box;
}

.sb-menu-toggle span {
	display: block;
	width: 100%;
	height: 3px;
	background: var(--sb-bar-color);
	border-radius: 3px;
	transition: transform .25s ease, opacity .2s ease;
}

/* Hamburger -> X animation when open */
.sb-menu-toggle[aria-expanded="true"] span:nth-child(1) {
	transform: translateY(8px) rotate(45deg);
}
.sb-menu-toggle[aria-expanded="true"] span:nth-child(2) {
	opacity: 0;
}
.sb-menu-toggle[aria-expanded="true"] span:nth-child(3) {
	transform: translateY(-8px) rotate(-45deg);
}

/* Keyboard focus visibility */
.sb-menu-toggle:focus-visible,
.sb-global-menu a:focus-visible {
	outline: 2px solid var(--sb-focus-ring);
	outline-offset: 2px;
}

/* =========================================================
   The menu panel
   ========================================================= */
.sb-menu-wrap {
	position: relative;
	display: flex;
	justify-content: flex-end;
}

.sb-global-menu {
	position: absolute;
	right: 0;
	top: calc(100% + 6px);
	min-width: 220px;
	background: var(--sb-menu-bg);
	border: 1px solid var(--sb-menu-border);
	border-radius: 6px;
	padding: 12px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
	z-index: var(--sb-z);

	/* Hidden state (animated) */
	opacity: 0;
	visibility: hidden;
	transform: translateY(-8px);
	transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
}

.sb-global-menu.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
	transition: opacity .2s ease, transform .2s ease, visibility 0s;
}

/* Menu list reset */
.sb-global-menu ul {
	list-style: none;
	margin: 0;
	padding: 0;
}
.sb-global-menu li {
	margin: 0;
}
.sb-global-menu a {
	display: block;
	padding: 10px 12px;
	color: var(--sb-link-color);
	text-decoration: none;
	border-radius: 4px;
	white-space: nowrap;
}
.sb-global-menu a:hover,
.sb-global-menu .current-menu-item > a {
	background: var(--sb-link-hover-bg);
}

/* Sub-menus: flow inline rather than fly out, for a simple panel */
.sb-global-menu .sub-menu {
	padding-left: 12px;
}

/* =========================================================
   Respect reduced-motion preferences
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
	.sb-menu-toggle span,
	.sb-global-menu {
		transition: none;
	}
}
