/* ═══════════════════════════════════════════════════════
   BPTK Mobile Menu — Frontend
   All sizing/colors are CSS custom properties set inline
   per instance via the shortcode, so multiple menus on
   one page don't collide.
═══════════════════════════════════════════════════════ */

.bptk-mm-instance {
	font-family: var( --bptk-mm-font, inherit );
}

/* ─── Hamburger trigger ──────────────────────────────── */

.bptk-mm-hamburger {
	position: fixed;
	top: 18px;
	width: var( --bptk-mm-hb-size, 28px );
	height: calc( var( --bptk-mm-hb-size, 28px ) * 0.7 );
	background: transparent;
	border: 0;
	padding: 0;
	cursor: pointer;
	z-index: 99998;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	box-sizing: border-box;
}

.bptk-mm-hb-top-left  { left: 18px; }
.bptk-mm-hb-top-right { right: 18px; }

.bptk-mm-hamburger span {
	display: block;
	width: 100%;
	height: 2px;
	background: var( --bptk-mm-hb-color, #0f172a );
	border-radius: 2px;
	transform-origin: center;
	transition: transform var( --bptk-mm-anim, 320ms ) ease, opacity calc( var( --bptk-mm-anim, 320ms ) * 0.6 ) ease;
}

/* Hamburger → X animation when drawer is open */
.bptk-mm-instance.is-open .bptk-mm-hamburger span:nth-child( 1 ) {
	transform: translateY( calc( ( var( --bptk-mm-hb-size, 28px ) * 0.7 / 2 ) - 1px ) ) rotate( 45deg );
}
.bptk-mm-instance.is-open .bptk-mm-hamburger span:nth-child( 2 ) { opacity: 0; }
.bptk-mm-instance.is-open .bptk-mm-hamburger span:nth-child( 3 ) {
	transform: translateY( calc( -1 * ( ( var( --bptk-mm-hb-size, 28px ) * 0.7 / 2 ) - 1px ) ) ) rotate( -45deg );
}

/* ─── Backdrop ────────────────────────────────────────── */

.bptk-mm-backdrop {
	position: fixed;
	inset: 0;
	background: var( --bptk-mm-ovl-bg, #000 );
	opacity: 0;
	pointer-events: none;
	transition: opacity var( --bptk-mm-anim, 320ms ) ease;
	z-index: 99996;
}

.bptk-mm-instance.is-open .bptk-mm-backdrop {
	opacity: var( --bptk-mm-ovl-a, 0.5 );
	pointer-events: auto;
}

/* ─── Drawer ──────────────────────────────────────────── */

.bptk-mm-drawer {
	position: fixed;
	top: 0;
	bottom: 0;
	width: var( --bptk-mm-width, 320px );
	max-width: 92vw;
	background: var( --bptk-mm-bg, #fff );
	color: var( --bptk-mm-text, #0f172a );
	font-size: var( --bptk-mm-size, 16px );
	z-index: 99997;
	transition: transform var( --bptk-mm-anim, 320ms ) cubic-bezier( .25, .8, .25, 1 );
	display: flex;
	flex-direction: column;
	box-shadow: 0 0 40px rgba( 15, 23, 42, .12 );
	will-change: transform;
}

.bptk-mm-pos-right .bptk-mm-drawer {
	right: 0;
	transform: translateX( 100% );
}

.bptk-mm-pos-left .bptk-mm-drawer {
	left: 0;
	transform: translateX( -100% );
}

.bptk-mm-instance.is-open .bptk-mm-drawer { transform: translateX( 0 ); }

/* ─── Drawer header (back / title / close) ───────────── */

.bptk-mm-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	border-bottom: 1px solid var( --bptk-mm-border, #e2e8f0 );
	flex-shrink: 0;
	min-height: 48px;
	box-sizing: border-box;
}

.bptk-mm-back {
	background: transparent;
	border: 0;
	color: inherit;
	cursor: pointer;
	padding: 6px 10px 6px 4px;
	font-size: var( --bptk-mm-size, 16px );
	display: inline-flex;
	align-items: center;
	gap: 4px;
	border-radius: 6px;
	transition: background .15s, color .15s;
}

.bptk-mm-back:hover { color: var( --bptk-mm-accent, #F38400 ); }

.bptk-mm-back[hidden] { display: none; }

.bptk-mm-back-arrow { font-size: 1.4em; line-height: 1; }

.bptk-mm-title {
	font-size: 0.78em;
	color: var( --bptk-mm-heading, #64748b );
	text-transform: uppercase;
	letter-spacing: 0.06em;
	flex: 1;
	text-align: center;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.bptk-mm-close {
	background: transparent;
	border: 0;
	color: inherit;
	cursor: pointer;
	font-size: 1.6em;
	line-height: 1;
	padding: 0 6px;
	border-radius: 6px;
	transition: color .15s;
}

.bptk-mm-close:hover { color: var( --bptk-mm-accent, #F38400 ); }

/* ─── Panels container + sliding panels ───────────────── */

.bptk-mm-panels-wrap {
	position: relative;
	flex: 1;
	overflow: hidden;
	background: inherit;
}

.bptk-mm-panel {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	margin: 0;
	padding: 0;
	list-style: none;
	background: var( --bptk-mm-bg, #fff );
	overflow-y: auto;
	overflow-x: hidden;
	-webkit-overflow-scrolling: touch;
	transform: translateX( 100% );
	transition: transform var( --bptk-mm-anim, 320ms ) cubic-bezier( .25, .8, .25, 1 );
}

.bptk-mm-panel--level-0          { transform: translateX( 0 ); z-index: 1; }
.bptk-mm-panel--level-1          { z-index: 2; }
.bptk-mm-panel--level-2          { z-index: 3; }
.bptk-mm-panel--level-3          { z-index: 4; }
.bptk-mm-panel.is-active         { transform: translateX( 0 ); }

/* ─── Items (shared) ──────────────────────────────────── */

.bptk-mm-item {
	border-bottom: 1px solid var( --bptk-mm-border, #f1f5f9 );
	position: relative;
}

.bptk-mm-item:last-child { border-bottom: 0; }

/* ─── Link rows (a or button) ─────────────────────────── */

.bptk-mm-link-row {
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	padding: var( --bptk-mm-pad-v, 14px ) var( --bptk-mm-pad-h, 20px );
	background: transparent;
	border: 0;
	color: inherit;
	text-decoration: none;
	font-size: inherit;
	font-family: inherit;
	cursor: pointer;
	text-align: left;
	transition: background .15s, color .15s;
	box-sizing: border-box;
	min-height: 48px; /* WCAG minimum touch target */
}

.bptk-mm-link-row:hover { background: rgba( 0, 0, 0, .03 ); }
.bptk-mm-link-row:active { background: rgba( 0, 0, 0, .06 ); }

.bptk-mm-link-row:focus-visible {
	outline: 2px solid var( --bptk-mm-accent, #F38400 );
	outline-offset: -2px;
}

.bptk-mm-link-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.bptk-mm-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	color: var( --bptk-mm-accent, #F38400 );
	font-size: 1.1em;
}

.bptk-mm-icon::before { font-size: inherit; }

.bptk-mm-chevron {
	color: var( --bptk-mm-heading, #94a3b8 );
	font-size: 1.5em;
	line-height: 1;
	flex-shrink: 0;
}

.bptk-mm-link.has-children { position: relative; }

.bptk-mm-link-direct {
	position: absolute;
	top: 0;
	right: 0;
	height: 100%;
	width: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: transparent; /* hidden but tappable — accessibility-only */
	text-decoration: none;
	z-index: 1;
	display: none; /* hidden in v1; planned UX feature */
}

/* ─── Heading (section label) ─────────────────────────── */

.bptk-mm-heading {
	font-size: var( --bptk-mm-h-size, 11px );
	color: var( --bptk-mm-heading, #64748b );
	text-transform: uppercase;
	letter-spacing: 0.07em;
	font-weight: 700;
	padding: 18px var( --bptk-mm-pad-h, 20px ) 6px;
	background: transparent;
	border-bottom: 0;
}

/* ─── Divider ─────────────────────────────────────────── */

.bptk-mm-divider {
	padding: 6px var( --bptk-mm-pad-h, 20px );
	border-bottom: 0;
}

.bptk-mm-divider-line {
	display: block;
	height: 1px;
	background: var( --bptk-mm-border, #e2e8f0 );
}

/* ─── Rich text + HTML blocks ─────────────────────────── */

.bptk-mm-richtext, .bptk-mm-html {
	padding: var( --bptk-mm-pad-v, 14px ) var( --bptk-mm-pad-h, 20px );
}

.bptk-mm-richtext-body p { margin: 0 0 8px; }
.bptk-mm-richtext-body p:last-child { margin-bottom: 0; }
.bptk-mm-richtext-body a { color: var( --bptk-mm-accent, #F38400 ); }

/* ─── Image ───────────────────────────────────────────── */

.bptk-mm-image {
	padding: 12px var( --bptk-mm-pad-h, 20px );
}

.bptk-mm-image .bptk-mm-image-img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 6px;
}

.bptk-mm-image .bptk-mm-image-link {
	display: block;
	line-height: 0;
}

/* ─── Search ──────────────────────────────────────────── */

.bptk-mm-search {
	padding: 12px var( --bptk-mm-pad-h, 20px );
}

.bptk-mm-search-form {
	display: flex;
	gap: 6px;
	align-items: center;
}

.bptk-mm-search-input {
	flex: 1;
	font: inherit;
	padding: 8px 12px;
	border: 1px solid var( --bptk-mm-border, #e2e8f0 );
	border-radius: 6px;
	background: rgba( 0, 0, 0, .02 );
	color: inherit;
	min-height: 40px;
}

.bptk-mm-search-input:focus {
	outline: 2px solid var( --bptk-mm-accent, #F38400 );
	outline-offset: -2px;
	border-color: transparent;
}

.bptk-mm-search-btn {
	background: var( --bptk-mm-accent, #F38400 );
	color: #fff;
	border: 0;
	border-radius: 6px;
	min-width: 40px;
	min-height: 40px;
	font-size: 1.2em;
	cursor: pointer;
}

/* ─── Scroll lock for body while a menu is open ───────── */

body.bptk-mm-locked {
	overflow: hidden;
	touch-action: none;
}

/* ─── Reduced motion preference ───────────────────────── */

@media ( prefers-reduced-motion: reduce ) {
	.bptk-mm-drawer,
	.bptk-mm-panel,
	.bptk-mm-backdrop,
	.bptk-mm-hamburger span {
		transition-duration: 0ms !important;
	}
}
