/* Mobile nav — CodeHim / off-canvas pattern (overlay z998, drawer z999, left slide)
   https://codehim.com/menu/easy-sliding-drawer-in-vanilla-javascript/ */

.rfy-header--scrolled {
	box-shadow: var(--rfy-shadow-md);
}

.rfy-header--scrolled .rfy-header__inner {
	padding-block: 10px;
}

/* Hamburger — mobile only */
.rfy-nav-toggle {
	display: none;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: 5px;
	width: 44px;
	height: 44px;
	padding: 10px;
	border: 1px solid var(--rfy-line);
	border-radius: var(--rfy-radius-sm);
	background: var(--rfy-surface);
	cursor: pointer;
	flex-shrink: 0;
}

.rfy-nav-toggle__bar {
	display: block;
	width: 100%;
	height: 2px;
	background: var(--rfy-primary-dark);
	border-radius: 2px;
	transition: transform 0.2s ease, opacity 0.2s ease;
}

.rfy-nav-toggle[aria-expanded="true"] .rfy-nav-toggle__bar:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}
.rfy-nav-toggle[aria-expanded="true"] .rfy-nav-toggle__bar:nth-child(2) {
	opacity: 0;
}
.rfy-nav-toggle[aria-expanded="true"] .rfy-nav-toggle__bar:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

/* Overlay — behind drawer */
.rfy-mobile-overlay {
	position: fixed;
	inset: 0;
	z-index: 998;
	background: rgba(30, 12, 5, 0.55);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease-in, visibility 0.2s ease-in;
	border: 0;
	padding: 0;
	margin: 0;
	cursor: pointer;
}

/* Drawer — RTL: slides in from physical RIGHT (right:-280px → 0) */
.rfy-mobile-drawer {
	position: fixed;
	top: 0;
	right: -280px;
	left: auto;
	width: min(280px, 88vw);
	height: 100%;
	z-index: 999;
	background: var(--rfy-surface);
	box-shadow: -4px 0 24px rgba(30, 12, 5, 0.15);
	transition: right 0.2s ease-in-out;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 16px 0 24px;
}

.rfy-mobile-drawer__close {
	display: block;
	margin: 0 16px 12px 16px;
	margin-inline-start: 16px;
	margin-inline-end: auto;
	width: 44px;
	height: 44px;
	border: 1px solid var(--rfy-border);
	border-radius: var(--rfy-radius-sm);
	background: var(--rfy-background);
	color: var(--rfy-foreground);
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
}

.rfy-mobile-drawer .rfy-nav__list {
	flex-direction: column;
	align-items: stretch;
	gap: 4px;
	padding: 0 12px;
	margin: 0;
	list-style: none;
}

.rfy-mobile-drawer .rfy-nav__list a {
	display: block;
	padding: 14px 16px;
	border-radius: var(--rfy-radius-sm);
	font-size: 1.125rem;
	font-weight: 600;
	color: var(--rfy-foreground);
	text-decoration: none;
}

.rfy-mobile-drawer .rfy-nav__list a:hover,
.rfy-mobile-drawer .rfy-nav__list a[aria-current="page"] {
	background: var(--rfy-background);
	color: var(--rfy-primary);
}

/* OPEN — one class on body (CodeHim show-nav pattern) */
body.rfy-nav-open {
	overflow: hidden;
}

body.rfy-nav-open .rfy-main {
	pointer-events: none;
}

body.rfy-nav-open .rfy-mobile-overlay {
	opacity: 1;
	visibility: visible;
}

body.rfy-nav-open .rfy-mobile-drawer {
	right: 0;
	left: auto;
}

@media (max-width: 768px) {
	body {
		padding-bottom: 68px;
	}

	/* RTL: logo left, hamburger right */
	.rfy-header__inner {
		justify-content: space-between;
		flex-wrap: nowrap;
	}

	.rfy-nav-toggle {
		display: inline-flex;
		order: -1;
	}

	.rfy-logo {
		order: 0;
	}

	.rfy-header__inner > .rfy-nav {
		display: none;
	}

	.rfy-header-actions {
		display: flex;
		order: 1;
		margin-inline-start: auto;
	}

	.rfy-header-actions .rfy-btn--primary {
		display: none;
	}

	.rfy-mobile-drawer__auth {
		margin-top: auto;
		padding: 20px 24px 28px;
		display: flex;
		flex-direction: column;
		gap: 12px;
		border-top: 1px solid var(--rfy-line);
	}

	.rfy-mobile-drawer__auth .rfy-btn {
		width: 100%;
		justify-content: center;
	}

	#rfy-mobile-drawer {
		display: flex;
		flex-direction: column;
	}

	.rfy-bottom-nav {
		display: flex;
		position: fixed;
		inset-inline: 0;
		bottom: 0;
		z-index: 300;
		background: var(--rfy-surface);
		border-top: 1px solid var(--rfy-line);
		box-shadow: 0 -4px 20px rgba(43, 31, 20, 0.08);
		padding-bottom: env(safe-area-inset-bottom, 0px);
		height: calc(60px + env(safe-area-inset-bottom, 0px));
		align-items: stretch;
	}

	.rfy-bottom-nav__item {
		flex: 1;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 3px;
		padding: 6px 4px;
		text-decoration: none;
		color: var(--rfy-muted);
		font-size: 11px;
		font-weight: 600;
		-webkit-tap-highlight-color: transparent;
	}

	.rfy-bottom-nav__item.is-active {
		color: var(--rfy-primary);
	}

	.rfy-bottom-nav__icon {
		width: 22px;
		height: 22px;
		stroke-width: 1.8;
		flex-shrink: 0;
	}

	.rfy-bottom-nav__item--cta {
		color: var(--rfy-primary);
	}

	.rfy-bottom-nav__item--cta .rfy-bottom-nav__icon {
		fill: var(--rfy-primary);
		stroke: var(--rfy-primary);
	}
}

@media (min-width: 769px) {
	.rfy-nav-toggle,
	.rfy-mobile-overlay,
	.rfy-mobile-drawer {
		display: none !important;
	}

	.rfy-bottom-nav {
		display: none !important;
	}
}
