/**
 * Off-Canvas Menu Styles
 *
 * @package Elementic
 * @since 1.1.0
 */

/* Mobile Menu Toggle Button */
.elementic-mobile-menu-toggle {
	display: none;
	background: transparent;
	border: none;
	padding: 10px;
	cursor: pointer;
	z-index: 1001;
	position: relative;
}

.mobile-menu-icon {
	display: flex;
	flex-direction: column;
	gap: 5px;
	width: 30px;
}

.mobile-menu-icon .line {
	display: block;
	height: 3px;
	background-color: var(--elementic-primary-color, #ff8c00);
	border-radius: 2px;
	transition: all 0.3s ease;
}

.elementic-mobile-menu-toggle:hover .line,
.elementic-mobile-menu-toggle:focus .line {
	background-color: var(--elementic-secondary-color, #e67a00);
	filter: brightness(1.05);
}

/* Animated toggle icon */
.elementic-mobile-menu-toggle.active .line-1 {
	transform: rotate(45deg) translateY(8px);
}

.elementic-mobile-menu-toggle.active .line-2 {
	opacity: 0;
}

.elementic-mobile-menu-toggle.active .line-3 {
	transform: rotate(-45deg) translateY(-8px);
}

/* Off-Canvas Menu Container — must stack above #masthead / .el-menu-box (mega-menu.css z-index ~100000) */
.elementic-off-canvas-menu {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 9999;
	visibility: hidden;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.elementic-off-canvas-menu.active {
	visibility: visible;
	opacity: 1;
	z-index: 200000;
	pointer-events: auto;
}

/* While open, drop header stacking so search bar / masthead cannot cover the overlay or steal clicks */
body.off-canvas-menu-open #masthead {
	z-index: 100 !important;
}

body.off-canvas-menu-open .el-menu-box {
	z-index: auto !important;
}

/* Overlay */
.off-canvas-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.6);
	cursor: pointer;
}

/* Off-Canvas Container */
.off-canvas-container {
	position: absolute;
	top: 0;
	left: -320px;
	width: 320px;
	max-width: 85%;
	height: 100%;
	background: #ffffff;
	box-shadow: 2px 0 15px rgba(0, 0, 0, 0.1);
	overflow-y: auto;
	transition: left 0.3s ease;
	display: flex;
	flex-direction: column;
	z-index: 1;
}

.elementic-off-canvas-menu.active .off-canvas-container {
	left: 0;
}

/* Off-Canvas Header */
.off-canvas-header {
	padding: 20px;
	border-bottom: 1px solid #eee;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.off-canvas-close {
	background: transparent;
	border: none;
	font-size: 24px;
	cursor: pointer;
	padding: 5px;
	color: var(--elementic-primary-color, #ff8c00);
	transition: color 0.3s ease;
	position: absolute;
	right: 15px;
	top: 15px;
	z-index: 2;
}

.off-canvas-close:hover,
.off-canvas-close:focus {
	color: var(--elementic-primary-color, #ff8c00);
}

.off-canvas-site-title {
	margin: 0;
	font-size: 20px;
}

.off-canvas-site-title a {
	color: #333;
	text-decoration: none;
}

/* Off-Canvas Content */
.off-canvas-content {
	flex: 1;
	padding: 20px;
	overflow-y: auto;
}

/* Off-Canvas Navigation */
.off-canvas-navigation {}

#off-canvas-primary-menu,
.off-canvas-menu-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.off-canvas-menu-list .menu-item {
	border-bottom: 1px solid #f5f5f5;
}

.off-canvas-menu-list .menu-item a {
	display: block;
	padding: 12px 0;
	color: #333;
	text-decoration: none;
	font-size: 16px;
	transition: all 0.3s ease;
}

.off-canvas-menu-list .menu-item a:hover,
.off-canvas-menu-list .menu-item a:focus {
	color: var(--elementic-primary-color, #ff8c00);
	padding-left: 10px;
}

.off-canvas-menu-list .sub-menu {
	list-style: none;
	padding-left: 20px;
	margin: 0;
	display: none;
}

.off-canvas-menu-list .menu-item-has-children.active > .sub-menu {
	display: block;
}

.off-canvas-menu-list .menu-item-has-children > a::after {
	content: '\f107';
	font-family: 'Font Awesome 7 Free';
	font-weight: 900;
	float: right;
	transition: transform 0.3s ease;
}

.off-canvas-menu-list .menu-item-has-children.active > a::after {
	transform: rotate(180deg);
}

/* Off-Canvas Widgets */
.off-canvas-widgets {
	margin-top: 30px;
	padding-top: 30px;
	border-top: 1px solid #eee;
}

.off-canvas-widget {
	margin-bottom: 30px;
}

.off-canvas-widget-title {
	font-size: 18px;
	margin-bottom: 15px;
	color: #333;
}

/* Off-Canvas Footer */
.off-canvas-footer {
	padding: 20px;
	border-top: 1px solid #eee;
	background: #f9f9f9;
}

.off-canvas-social {
	display: flex;
	gap: 15px;
	justify-content: center;
}

.off-canvas-social a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	background: var(--elementic-primary-color, #ff8c00);
	color: #fff;
	border-radius: 50%;
	text-decoration: none;
	transition: all 0.3s ease;
}

.off-canvas-social a:hover,
.off-canvas-social a:focus {
	transform: translateY(-3px);
	box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Responsive: match primary nav breakpoint (tablet + mobile) */
@media screen and (max-width: 1220px) {
	/* Top row: centered title (middle column), hamburger flush right (third column) */
	.el-menu-box {
		grid-template-columns: 1fr auto 1fr;
		grid-template-rows: auto auto;
		align-items: center;
		column-gap: 12px;
	}

	.el-menu-box__brand {
		grid-column: 2;
		grid-row: 1;
		justify-self: center;
		max-width: 100%;
	}

	.el-menu-box__nav.main-navigation {
		grid-column: 3;
		grid-row: 1;
		display: flex;
		justify-content: flex-end;
		align-items: center;
		width: 100%;
		min-width: 0;
	}

	.el-menu-box__search {
		grid-column: 1 / -1;
		grid-row: 2;
		order: 0;
		width: 100%;
	}

	.elementic-mobile-menu-toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		margin-left: 0;
		flex-shrink: 0;
	}
}

/* Body scroll lock when menu is open */
body.off-canvas-menu-open {
	overflow: hidden;
}
