/*
* CozyStay — Mobile menu
*
* Two parts: the toggle button in the header, and the panel it opens.
*
* The panel markup is the theme's own (template-parts/site-header/
* mobile-menu-panel.php), so this styles a known structure rather than
* defending against whatever a page builder hands over. The outer .sidemenu /
* .show / .close-button contract is kept because main.js drives it.
*
* Contents
*   1. Toggle button
*   2. Panel shell
*   3. Head: logo + close
*   4. Language switcher
*   5. Navigation + accordion
*   6. Social + copyright
*   7. RTL
*/

/* ---------------------------------------------------------------------------
* 1. Toggle button
*
* Stock is a 35x50 box whose bars are absolutely positioned pseudo elements on
* an empty span: a thin target, no pressed state, no open/close animation.
* ------------------------------------------------------------------------- */

.menu-toggle {
	--cs-mt-pad: 6px;
	display: inline-flex;
	align-items: center;
	justify-content: flex-start;
	padding: var(--cs-mt-pad);
	min-width: calc(var(--line-width) + var(--cs-mt-pad) * 2);
	min-height: 44px;
	border-radius: 4px;
	-webkit-tap-highlight-color: transparent;
}

.menu-toggle .menu-toggle-icon {
	display: block;
	width: var(--line-width);
	height: 100%;
	pointer-events: none;
}

/* Bars are positioned against the button, so the new padding is handed back. */
.menu-toggle .menu-toggle-icon:before,
.menu-toggle .menu-toggle-icon:after {
	left: var(--cs-mt-pad);
	transition: transform 0.3s ease, height 0.3s ease, width 0.3s ease;
}

.menu-toggle.text-icon-reverse .menu-toggle-icon:before,
.menu-toggle.text-icon-reverse .menu-toggle-icon:after {
	right: var(--cs-mt-pad);
	left: auto;
}

.menu-toggle .menu-toggle-icon:after {
	width: calc(var(--line-width) * 0.66);
}

.menu-toggle:hover .menu-toggle-icon:after {
	width: var(--line-width);
}

/* Open: the bars cross. Without this the icon never acknowledges the panel. */
.menu-toggle.toggled-on .menu-toggle-icon:before {
	height: 0;
	-webkit-transform: translateY(-50%) rotate(45deg);
	transform: translateY(-50%) rotate(45deg);
}

.menu-toggle.toggled-on .menu-toggle-icon:after {
	width: var(--line-width);
	-webkit-transform: translateY(-50%) rotate(-45deg);
	transform: translateY(-50%) rotate(-45deg);
}

.menu-toggle:active {
	-webkit-transform: scale(0.94);
	transform: scale(0.94);
}

.menu-toggle:focus-visible {
	outline: 2px solid var(--primary-color, #b99d75);
	outline-offset: 2px;
}

.menu-toggle[aria-disabled="true"] {
	opacity: 0.4;
	cursor: not-allowed;
}

/* Elementor gives the widget its own stacking context; without this a
* neighbouring absolutely placed header element can eat the tap. */
.elementor-widget-cs_menu_toggle {
	position: relative;
	z-index: 999;
}

.elementor-widget-container .menu-toggle {
	display: inline-flex;
}

/* ---------------------------------------------------------------------------
* 2. Panel shell
* ------------------------------------------------------------------------- */

/*
* Above everything the theme uses. The site header sits at 999, but a sticky
* header driven by Elementor writes its own inline z-index, and racing an
* inline style from a stylesheet is not a fight worth having.
*/
.sidemenu.show {
	z-index: 999998;
}

body.cs-sidemenu-open {
	overscroll-behavior: contain;
}

/*
* Hide the header while the panel is open.
*
* Raising the panel alone still left the header's logo and its sticky toggle
* showing through, and two logos at once reads as a rendering fault. The body
* class is only applied when the panel has its own close control — see
* mobile-menu.js — so the visitor always keeps a way out.
*/
body.cs-sidemenu-hide-header .site-header,
body.cs-sidemenu-hide-header #sticky-site-header,
body.cs-sidemenu-hide-header .custom-sticky-header,
body.cs-sidemenu-hide-header .elementor-location-header {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

/* The panel lives outside the header, so it is unaffected by the rule above —
* but a stray toggle rendered elsewhere on the page would not be. */
body.cs-sidemenu-hide-header .menu-toggle {
	pointer-events: none;
}

body.cs-sidemenu-hide-header .sidemenu,
body.cs-sidemenu-hide-header .sidemenu * {
	pointer-events: auto;
}

.sidemenu.sidemenu-native {
	--cs-mm-bg: var(--secondary-color, #53624e);
	--cs-mm-text: #fff;
	--cs-mm-muted: rgba(255, 255, 255, 0.6);
	--cs-mm-line: rgba(255, 255, 255, 0.14);
	--cs-mm-accent: var(--primary-color, #b99d75);
	--cs-mm-pad: 26px;
}

.sidemenu.sidemenu-native .container {
	display: flex;
	flex-direction: column;
	padding: 0 var(--cs-mm-pad) 36px;
	background-color: var(--cs-mm-bg);
	color: var(--cs-mm-text);
}

/* The theme spaces every direct child by 50px; this panel manages its own. */
.sidemenu.sidemenu-native .container > * {
	margin-bottom: 0;
}

/* ---------------------------------------------------------------------------
* 3. Head: logo + close
* ------------------------------------------------------------------------- */

.sidemenu-native .cs-mm-head {
	position: sticky;
	top: 0;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 22px 0 18px;
	margin-bottom: 8px;
	background-color: var(--cs-mm-bg);
	border-bottom: 1px solid var(--cs-mm-line);
}

.sidemenu-native .cs-mm-logo {
	display: block;
	flex: 0 1 auto;
	max-width: 62%;
	line-height: 0;
}

.sidemenu-native .cs-mm-logo img {
	display: block;
	width: auto;
	max-width: 100%;
	max-height: 58px;
	height: auto;
}

.sidemenu-native .cs-mm-logo-text {
	color: var(--cs-mm-text);
	font-family: var(--heading-font, inherit);
	font-size: 20px;
	line-height: 1.3;
}

/*
* The theme places .sidemenu-header absolutely for custom panels. Here it is a
* flex child of the head instead, so it can never land on top of the logo.
*/
.sidemenu-native .cs-mm-head .sidemenu-header {
	position: static;
	flex: 0 0 auto;
	padding: 0;
	margin: 0;
	width: auto;
	border: 0;
}

.sidemenu-native .close-button {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	border-radius: 50%;
	color: var(--cs-mm-text);
	font-size: 0;
	cursor: pointer;
	transition: background-color 0.25s ease;
}

.sidemenu-native .close-button:before,
.sidemenu-native .close-button:after {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 20px;
	height: 1.5px;
	background: currentColor;
	content: "";
}

.sidemenu-native .close-button:before {
	-webkit-transform: translate(-50%, -50%) rotate(45deg);
	transform: translate(-50%, -50%) rotate(45deg);
}

.sidemenu-native .close-button:after {
	-webkit-transform: translate(-50%, -50%) rotate(-45deg);
	transform: translate(-50%, -50%) rotate(-45deg);
}

.sidemenu-native .close-button:hover {
	background: rgba(255, 255, 255, 0.1);
}

.sidemenu-native .close-button:focus-visible {
	outline: 2px solid var(--cs-mm-accent);
	outline-offset: 2px;
}

/* ---------------------------------------------------------------------------
* 4. Language switcher
* ------------------------------------------------------------------------- */

.sidemenu-native .cs-mm-lang {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 14px 0 4px;
	margin: 0;
	list-style: none;
}

.sidemenu-native .cs-mm-lang li {
	margin: 0;
	padding: 0;
}

.sidemenu-native .cs-mm-lang li:not(:last-child):after {
	margin-left: 6px;
	color: var(--cs-mm-muted);
	content: "/";
}

.sidemenu-native .cs-mm-lang a {
	color: var(--cs-mm-muted);
	font-size: 13px;
	letter-spacing: 0.08em;
	line-height: 1.6;
	text-transform: uppercase;
	transition: color 0.25s ease;
}

.sidemenu-native .cs-mm-lang li.is-current a,
.sidemenu-native .cs-mm-lang a:hover {
	color: var(--cs-mm-text);
}

/* ---------------------------------------------------------------------------
* 5. Navigation + accordion
* ------------------------------------------------------------------------- */

.sidemenu-native .cs-mm-nav {
	flex: 1 1 auto;
	padding: 10px 0 24px;
}

.sidemenu-native .cs-mm-menu,
.sidemenu-native .cs-mm-sub {
	margin: 0;
	padding: 0;
	list-style: none;
}

.sidemenu-native .cs-mm-item {
	margin: 0;
	padding: 0;
	border-bottom: 1px solid var(--cs-mm-line);
}

.sidemenu-native .cs-mm-item:last-child {
	border-bottom: 0;
}

/*
* The row is the key to the alignment problem. The link and its toggle are
* flex siblings, so the toggle sits on the item's own line by construction —
* the old build placed it absolutely and it drifted whenever the item grew.
*/
.sidemenu-native .cs-mm-row {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 56px;
}

.sidemenu-native .cs-mm-link {
	flex: 1 1 auto;
	min-width: 0;
	padding: 14px 0;
	color: var(--cs-mm-text);
	font-family: var(--heading-font, inherit);
	font-size: 22px;
	line-height: 1.3;
	text-transform: none;
	transition: color 0.25s ease;
}

.sidemenu-native .cs-mm-link:hover,
.sidemenu-native .current-menu-item > .cs-mm-row > .cs-mm-link,
.sidemenu-native .current-menu-ancestor > .cs-mm-row > .cs-mm-link {
	color: var(--cs-mm-accent);
}

.sidemenu-native .cs-mm-toggle {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	width: 44px;
	height: 44px;
	background: none;
	border: 1px solid var(--cs-mm-line);
	border-radius: 50%;
	color: var(--cs-mm-text);
	cursor: pointer;
	transition: background-color 0.25s ease, border-color 0.25s ease;
}

.sidemenu-native .cs-mm-toggle:hover {
	border-color: var(--cs-mm-accent);
	background: rgba(255, 255, 255, 0.06);
}

.sidemenu-native .cs-mm-toggle:focus-visible {
	outline: 2px solid var(--cs-mm-accent);
	outline-offset: 2px;
}

/* Chevron, drawn from two borders so no icon font is required. */
.sidemenu-native .cs-mm-toggle-icon {
	display: block;
	width: 9px;
	height: 9px;
	margin-top: -3px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	-webkit-transform: rotate(45deg);
	transform: rotate(45deg);
	transition: transform 0.3s ease;
}

.sidemenu-native .cs-mm-toggle[aria-expanded="true"] .cs-mm-toggle-icon {
	margin-top: 3px;
	-webkit-transform: rotate(-135deg);
	transform: rotate(-135deg);
}

/* Collapsed by default; the height is animated by mobile-menu.js. */
.sidemenu-native .cs-mm-sub {
	overflow: hidden;
	height: 0;
	transition: height 0.3s ease;
}

.sidemenu-native .cs-mm-sub .cs-mm-item {
	border-bottom: 0;
}

.sidemenu-native .cs-mm-sub .cs-mm-row {
	min-height: 0;
}

.sidemenu-native .cs-mm-sub .cs-mm-link {
	padding: 9px 0 9px 16px;
	color: var(--cs-mm-muted);
	font-family: var(--body-font, inherit);
	font-size: 15px;
}

.sidemenu-native .cs-mm-sub .cs-mm-link:hover {
	color: var(--cs-mm-text);
}

.sidemenu-native .cs-mm-sub .cs-mm-sub .cs-mm-link {
	padding-left: 32px;
}

/* ---------------------------------------------------------------------------
* 6. Social + copyright
* ------------------------------------------------------------------------- */

.sidemenu-native .cs-mm-social {
	padding: 20px 0 0;
	border-top: 1px solid var(--cs-mm-line);
}

.sidemenu-native .cs-mm-social .social-nav {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.sidemenu-native .cs-mm-social .social-nav li {
	margin: 0;
	padding: 0;
}

.sidemenu-native .cs-mm-social .social-nav a {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	color: var(--cs-mm-text);
	font-size: 16px;
	transition: background-color 0.25s ease, color 0.25s ease;
}

.sidemenu-native .cs-mm-social .social-nav a:hover {
	background: rgba(255, 255, 255, 0.1);
	color: var(--cs-mm-accent);
}

.sidemenu-native .cs-mm-copyright {
	padding-top: 18px;
	color: var(--cs-mm-muted);
	font-size: 13px;
	line-height: 1.6;
}

@media only screen and (max-width: 400px) {
	.sidemenu.sidemenu-native {
		--cs-mm-pad: 20px;
	}

	.sidemenu-native .cs-mm-link {
		font-size: 19px;
	}

	.sidemenu-native .cs-mm-row {
		min-height: 50px;
	}
}

/* Short viewports — landscape phones — need the head to stop being sticky or
* it eats most of the panel. */
@media only screen and (max-height: 520px) {
	.sidemenu-native .cs-mm-head {
		position: relative;
	}

	.sidemenu-native .cs-mm-row {
		min-height: 44px;
	}

	.sidemenu-native .cs-mm-link {
		padding: 9px 0;
		font-size: 18px;
	}
}

/* ---------------------------------------------------------------------------
* 7. RTL
* ------------------------------------------------------------------------- */

.rtl .sidemenu-native .cs-mm-sub .cs-mm-link {
	padding-right: 16px;
	padding-left: 0;
}

.rtl .sidemenu-native .cs-mm-sub .cs-mm-sub .cs-mm-link {
	padding-right: 32px;
	padding-left: 0;
}

.rtl .sidemenu-native .cs-mm-toggle-icon {
	-webkit-transform: rotate(135deg);
	transform: rotate(135deg);
}

.rtl .sidemenu-native .cs-mm-lang li:not(:last-child):after {
	margin-right: 6px;
	margin-left: 0;
}
