/**
 * Shared Master UI chrome — admin bar clearance + Tajawal enforcement.
 * Font faces: master-ui/css/tajawal.css via Kutby\Assets\SiteFonts.
 *
 * @package Kutby
 */

/* ------------------------------------------------------------------ */
/* WordPress admin bar                                                */
/* ------------------------------------------------------------------ */

html:has(body.admin-bar) {
	margin-top: 32px !important;
}

@media screen and (max-width: 782px) {
	html:has(body.admin-bar) {
		margin-top: 46px !important;
	}
}

body.admin-bar .site-sticky-header {
	top: var(--wp-admin--admin-bar--height, 32px) !important;
}

body.admin-bar .blog-sidebar {
	top: calc(72px + var(--wp-admin--admin-bar--height, 32px));
}

@media screen and (max-width: 782px) {
	body.admin-bar .site-sticky-header {
		top: var(--wp-admin--admin-bar--height, 46px) !important;
	}

	body.admin-bar .blog-sidebar {
		top: calc(72px + var(--wp-admin--admin-bar--height, 46px));
	}
}

/*
 * Below 600px WordPress sets #wpadminbar { position: absolute }, so the bar
 * scrolls away. Sticky top offset must be 0 or a gap appears above the header.
 */
@media screen and (max-width: 600px) {
	body.admin-bar .site-sticky-header {
		top: 0 !important;
	}

	body.admin-bar .blog-sidebar {
		top: 72px;
	}
}

/* Keep sticky header opaque so scrolled content never shows through. */
.site-sticky-header {
	background: var(--bg-card, #fff);
	width: 100%;
	isolation: isolate;
}

/* ------------------------------------------------------------------ */
/* Force Tajawal stack site-wide (faces come from tajawal.css)        */
/* ------------------------------------------------------------------ */

:root {
	--font-tajawal: "Tajawal", sans-serif;
	--font-inter: "Tajawal", sans-serif;
	--kutby-font: "Tajawal", Tahoma, sans-serif;
}

html,
body,
body.__className_e1299a,
.__className_e1299a,
button,
input,
select,
textarea,
.site-sticky-header,
.site-footer,
main,
.edu-page-title,
.edu-breadcrumb,
.edu-page-desc,
.home-panel,
.blog-page,
.hub-archive-page {
	font-family: Tajawal, Tahoma, system-ui, sans-serif !important;
}

/* ------------------------------------------------------------------ */
/* Mobile drawer (shared chrome — keep lean, no extra assets)         */
/* ------------------------------------------------------------------ */

.site-nav-overlay {
	position: fixed;
	inset: 0;
	z-index: 250;
	background: rgba(15, 23, 42, 0.42);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.site-nav-overlay.is-open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.site-mobile-nav {
	position: fixed;
	top: 0;
	right: 0;
	width: min(300px, 86vw);
	height: 100dvh;
	z-index: 300;
	display: flex;
	flex-direction: column;
	background: #fff;
	border-left: 1px solid #e8edf3;
	box-shadow: -12px 0 32px rgba(15, 23, 42, 0.12);
	transform: translateX(104%);
	visibility: hidden;
	font-family: Tajawal, Tahoma, system-ui, sans-serif;
}

.site-mobile-nav.is-open {
	transform: translateX(0);
	visibility: visible;
}

/* Animate only after JS marks the shell ready — avoids slide-out FOUC on load. */
html.site-nav-anim .site-nav-overlay {
	transition: opacity .2s ease, visibility .2s ease;
}

html.site-nav-anim .site-mobile-nav {
	transition: transform .24s cubic-bezier(.32, .72, 0, 1), visibility .24s;
}

.site-mobile-nav__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 16px;
	border-bottom: 1px solid #eef2f7;
	background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}

.site-mobile-nav__brand {
	display: flex;
	align-items: center;
	min-width: 0;
	text-decoration: none;
}

.site-mobile-nav__brand img {
	height: 36px;
	width: auto;
	max-width: 132px;
	object-fit: contain;
	display: block;
}

.site-mobile-nav__close {
	width: 34px;
	height: 34px;
	border-radius: 10px;
	border: 1px solid #e2e8f0;
	background: #fff;
	color: #64748b;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	flex-shrink: 0;
	transition: background .12s ease, color .12s ease, border-color .12s ease;
}

.site-mobile-nav__close:hover,
.site-mobile-nav__close:focus-visible {
	background: #f1f5f9;
	color: #0f172a;
	border-color: #cbd5e1;
}

.site-mobile-nav__label {
	margin: 12px 16px 4px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.02em;
	color: #94a3b8;
}

.site-mobile-nav__list {
	list-style: none;
	margin: 0;
	padding: 4px 10px 12px;
	flex: 1;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.site-mobile-nav__link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	border-radius: 12px;
	text-decoration: none;
	color: #334155;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.35;
	transition: background .12s ease, color .12s ease;
}

.site-mobile-nav__link:hover,
.site-mobile-nav__link:focus-visible {
	background: #f8fafc;
	color: #0f172a;
}

.site-mobile-nav__link.is-active {
	background: #eff6ff;
	color: #1d4ed8;
}

.site-mobile-nav__icon {
	width: 34px;
	height: 34px;
	border-radius: 10px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	background: #f1f5f9;
	color: #475569;
}

.site-mobile-nav__link.is-active .site-mobile-nav__icon {
	background: #dbeafe;
	color: #1d4ed8;
}

.site-mobile-nav__text {
	min-width: 0;
}

.site-mobile-nav__foot {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
	border-top: 1px solid #eef2f7;
	background: #f8fafc;
}

.site-mobile-nav__foot a {
	display: inline-flex;
	align-items: center;
	padding: 7px 11px;
	border-radius: 999px;
	border: 1px solid #e2e8f0;
	background: #fff;
	color: #64748b;
	font-size: 12px;
	font-weight: 600;
	text-decoration: none;
	transition: border-color .12s ease, color .12s ease;
}

.site-mobile-nav__foot a:hover,
.site-mobile-nav__foot a:focus-visible {
	border-color: #93c5fd;
	color: #1d4ed8;
}

html.site-nav-open,
html.site-nav-open body {
	overflow: hidden;
}

/* Keep old inline right-offset drawers functional if any remain. */
#mobile-nav.site-mobile-nav {
	right: 0;
}
