/* =========================================================================
 * Header categories (RU · knigaotebe) — mega menu (≥1025px) + drawer (≤1024px)
 * -------------------------------------------------------------------------
 * The mega-menu nav replaces the content of the Elementor nav-menu widget in
 * the two header templates (13317 / 13320); the widget keeps its own
 * `elementor-hidden-tablet elementor-hidden-mobile`, so ≤1024px only ever
 * sees the burger, which now opens `#fbnav-drawer` (printed in wp_footer).
 *
 * Panels are moved by nav-ru.js into `.fbnav-megas`, a child of the
 * <header>, so they can span the full page width and sit under the header row.
 * ====================================================================== */

:root {
	--fbnav-ink: #23231E;
	--fbnav-body: #1B1B1B;
	--fbnav-muted: #7B7B70;
	--fbnav-accent: #E05F38;
	--fbnav-accent-dark: #cf5531;
	--fbnav-surface: #F7F7F4;
	--fbnav-tint: #F4F8FE;
	--fbnav-pages: #FDF3EF;
	--fbnav-edge: rgba(123, 123, 112, .20);
	--fbnav-hair: rgba(123, 123, 112, .12);
	--fbnav-r: 12px;
	--fbnav-font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* --- 1 · desktop nav ----------------------------------------------------- */

.fbnav,
.fbnav * { box-sizing: border-box; }

.fbnav { font-family: var(--fbnav-font); }

.fbnav-list {
	display: flex;
	align-items: center;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.fbnav-item { position: static; margin: 0; }

:is(.fbnav, .fbnav-megas) a.fbnav-link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 40px;
	padding: 6px 12px;
	border-radius: 999px;
	color: var(--fbnav-ink);
	font-size: 16px;
	font-weight: 500;
	line-height: 24px;
	letter-spacing: -.2px;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color .15s ease, color .15s ease;
}

:is(.fbnav, .fbnav-megas) a.fbnav-link:hover,
:is(.fbnav, .fbnav-megas) a.fbnav-link:focus-visible,
.fbnav .fbnav-item.is-open > a.fbnav-link {
	color: var(--fbnav-accent);
	background: var(--fbnav-surface);
	outline: none;
}

.fbnav a.fbnav-link:focus-visible { box-shadow: 0 0 0 2px var(--fbnav-accent); }

.fbnav-caret { flex: none; transition: transform .2s ease; }
.fbnav-item.is-open > .fbnav-link .fbnav-caret { transform: rotate(180deg); }

.fbnav .fbnav-accent > a.fbnav-link,
.fbnav .fbnav-accent > a.fbnav-link:hover { color: var(--fbnav-accent); font-weight: 600; }

/* --- 2 · mega panels ------------------------------------------------------ */

header.elementor-location-header { position: relative; z-index: 1000; }

.fbnav-megas {
	position: absolute;
	left: 0;
	right: 0;
	top: 100%; /* set by nav-ru.js to the header row's bottom */
	z-index: 5;
	font-family: var(--fbnav-font);
}

.fbnav-mega {
	display: none;
	width: 100%;
	background: #fff;
	border-top: 1px solid var(--fbnav-hair);
	border-bottom: 1px solid var(--fbnav-hair);
	box-shadow: 0 24px 40px -24px rgba(35, 35, 30, .35);
}

.fbnav-mega.is-open { display: block; animation: fbnav-drop .18s ease-out; }

@keyframes fbnav-drop {
	from { opacity: 0; transform: translateY(-6px); }
	to   { opacity: 1; transform: none; }
}

.fbnav-mega-in {
	display: flex;
	gap: 40px;
	max-width: 1240px;
	margin: 0 auto;
	padding: 32px 20px 36px;
}

.fbnav-col { min-width: 150px; }
.fbnav-col-all { min-width: 190px; }

.fbnav-megas a.fbnav-all {
	display: inline-block;
	color: var(--fbnav-ink);
	font-size: 16px;
	font-weight: 600;
	line-height: 22px;
	text-decoration: none;
}
.fbnav-megas a.fbnav-all:hover { color: var(--fbnav-accent); }

.fbnav-megas h3.fbnav-col-title {
	margin: 0 0 12px;
	color: var(--fbnav-muted);
	font-family: var(--fbnav-font);
	font-size: 12px;
	font-weight: 600;
	line-height: 16px;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.fbnav-col-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.fbnav-col-list li { margin: 0; }

.fbnav-megas .fbnav-col-list a {
	display: block;
	padding: 6px 0;
	color: var(--fbnav-body);
	font-size: 15px;
	font-weight: 400;
	line-height: 20px;
	text-decoration: none;
	transition: color .12s ease;
}
.fbnav-megas .fbnav-col-list a:hover { color: var(--fbnav-accent); }

.fbnav-col-list small {
	display: block;
	margin-top: 1px;
	color: var(--fbnav-muted);
	font-size: 12px;
	line-height: 16px;
}

.fbnav-megas a.fbnav-feature {
	display: flex;
	gap: 16px;
	align-items: center;
	margin-left: auto;
	width: 340px;
	padding: 14px;
	border-radius: var(--fbnav-r);
	background: var(--fbnav-tint);
	color: var(--fbnav-ink);
	text-decoration: none;
	transition: background-color .15s ease;
}
.fbnav-megas a.fbnav-feature:hover { background: var(--fbnav-pages); }

.fbnav-feature-img {
	flex: none;
	width: 112px;
	height: 112px;
	overflow: hidden;
	border-radius: 8px;
	background: #fff;
}
.fbnav-feature-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.fbnav-feature-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.fbnav-eyebrow {
	color: var(--fbnav-accent);
	font-size: 11px;
	font-weight: 600;
	line-height: 14px;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.fbnav-feature-title { font-size: 16px; font-weight: 600; line-height: 21px; letter-spacing: -.01em; }
.fbnav-feature-text { color: var(--fbnav-muted); font-size: 13px; line-height: 17px; }
.fbnav-feature-cta { margin-top: 4px; color: var(--fbnav-accent); font-size: 14px; font-weight: 600; line-height: 18px; }
.fbnav-feature-cta::after { content: " →"; }

/* Page dim behind an open panel (also used by the drawer). */
.fbnav-backdrop {
	position: fixed;
	inset: 0;
	z-index: 999;
	background: rgba(35, 35, 30, .42);
	opacity: 0;
	transition: opacity .2s ease;
}
.fbnav-backdrop.is-on { opacity: 1; }
.fbnav-backdrop[hidden] { display: none; }
.fbnav-backdrop.is-drawer { z-index: 100000; }

/* --- 3 · burger + drawer (≤1024px) -------------------------------------- */

.fbnav-burger { -webkit-tap-highlight-color: transparent; }

.fbnav-drawer {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	z-index: 100001;
	display: flex;
	flex-direction: column;
	width: min(400px, 88vw);
	background: #fff;
	color: var(--fbnav-ink);
	font-family: var(--fbnav-font);
	box-shadow: 24px 0 48px -24px rgba(35, 35, 30, .45);
	transform: translateX(-104%);
	transition: transform .24s cubic-bezier(.2, .7, .2, 1);
	overscroll-behavior: contain;
}
.fbnav-drawer[hidden] { display: none; }
.fbnav-drawer.is-open { transform: none; }

.fbnav-drawer * { box-sizing: border-box; }

/* The theme/kit paints every <button> with the brand button colours; the
   drawer's toggles and close are plain controls. */
.fbnav-drawer button,
.fbnav-drawer button:hover,
.fbnav-drawer button:focus,
.fbnav-drawer button:active {
	background: transparent;
	background-color: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	color: var(--fbnav-ink);
	font-family: var(--fbnav-font);
	text-transform: none;
	letter-spacing: -.2px;
	outline: none;
}
.fbnav-drawer button:focus-visible { box-shadow: inset 0 0 0 2px var(--fbnav-accent); }
.fbnav-drawer button.fbnav-drawer-close:hover { background: var(--fbnav-surface); border-radius: 50%; }
.fbnav-drawer button.fbnav-drawer-toggle[aria-expanded="true"] { color: var(--fbnav-accent); }
.fbnav-drawer a { -webkit-tap-highlight-color: transparent; }

.fbnav-drawer-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 64px;
	padding: 10px 16px 10px 20px;
	border-bottom: 1px solid var(--fbnav-hair);
}
.fbnav-drawer-logo { display: block; width: 76px; }
.fbnav-drawer-logo img { display: block; width: 100%; height: auto; }
.fbnav-drawer-name { font-family: "Comfortaa", var(--fbnav-font); font-weight: 700; color: var(--fbnav-accent); }

.fbnav-drawer-close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--fbnav-ink);
	cursor: pointer;
}
.fbnav-drawer-close:hover { background: var(--fbnav-surface); }

.fbnav-drawer-nav { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }

.fbnav-drawer-list,
.fbnav-drawer-links {
	margin: 0;
	padding: 0;
	list-style: none;
}

.fbnav-drawer-item { border-bottom: 1px solid var(--fbnav-hair); }

.fbnav-drawer .fbnav-drawer-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	min-height: 56px;
	margin: 0;
	padding: 14px 20px;
	border: 0;
	background: transparent;
	color: var(--fbnav-ink);
	font-family: var(--fbnav-font);
	font-size: 17px;
	font-weight: 500;
	line-height: 24px;
	letter-spacing: -.2px;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
}
.fbnav-drawer-row .fbnav-caret { color: var(--fbnav-muted); }
.fbnav-drawer-toggle[aria-expanded="true"] { color: var(--fbnav-accent); }
.fbnav-drawer-toggle[aria-expanded="true"] .fbnav-caret { transform: rotate(180deg); color: var(--fbnav-accent); }

.fbnav-drawer .fbnav-drawer-item.fbnav-accent .fbnav-drawer-row { color: var(--fbnav-accent); font-weight: 600; }

.fbnav-drawer-sub {
	padding: 0 20px 14px;
	background: var(--fbnav-surface);
}
.fbnav-drawer-sub[hidden] { display: none; }

.fbnav-drawer a.fbnav-drawer-all {
	display: block;
	padding: 14px 0 6px;
	color: var(--fbnav-ink);
	font-size: 15px;
	font-weight: 600;
	line-height: 20px;
	text-decoration: none;
}

.fbnav-drawer p.fbnav-drawer-group {
	margin: 14px 0 4px;
	color: var(--fbnav-muted);
	font-size: 12px;
	font-weight: 600;
	line-height: 16px;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.fbnav-drawer .fbnav-drawer-links a {
	display: block;
	padding: 9px 0;
	color: var(--fbnav-body);
	font-size: 15px;
	line-height: 20px;
	text-decoration: none;
}

.fbnav-drawer-foot {
	display: flex;
	gap: 12px;
	align-items: center;
	justify-content: space-between;
	padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--fbnav-hair);
	background: #fff;
}
.fbnav-drawer .fbnav-drawer-foot a {
	color: var(--fbnav-ink);
	font-size: 15px;
	font-weight: 500;
	text-decoration: none;
}
.fbnav-drawer a.fbnav-drawer-cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 8px 16px;
	border-radius: 8px;
	background: var(--fbnav-accent);
	color: #fff !important;
	font-weight: 600;
}
.fbnav-drawer a.fbnav-drawer-cta:hover { background: var(--fbnav-accent-dark); }

body.fbnav-lock { overflow: hidden; }

/* No JS: the drawer opens through the burger's #fbnav-drawer anchor. */
.fbnav-drawer:target { display: flex; transform: none; }

@media (max-width: 1024px) {
	.fbnav-megas { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.fbnav-mega.is-open { animation: none; }
	.fbnav-drawer, .fbnav-backdrop, .fbnav-caret { transition: none; }
}
