/* Critical layout — синхронно до async style.css (CLS + первый кадр) */
:root {
	--a-font: 'Manrope', system-ui, -apple-system, 'Segoe UI', 'Roboto', sans-serif;
	--crimea-tabbar-clearance: calc(96px + env(safe-area-inset-bottom, 0px));
	--appstorrent-sidebar-w: 220px;
}
body.dark {
	--bg-page: #1a1d23;
	--text-muted: #9aa3ad;
	--glass-bg: rgba(38, 42, 52, 0.55);
	--glass-border: rgba(255, 255, 255, 0.12);
	--glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
	--glass-blur: blur(12px);
	--sidebar-bg: #11141a;
	--sidebar-border: rgba(255, 255, 255, 0.06);
}
body.dark, body.light {
	min-height: 100vh;
	background: var(--bg-page, #1a1d23) !important;
	color: var(--text-muted, #9aa3ad) !important;
	font-family: var(--a-font) !important;
}
.glass-panel {
	background: var(--glass-bg);
	backdrop-filter: var(--glass-blur);
	-webkit-backdrop-filter: var(--glass-blur);
	border: 1px solid var(--glass-border);
	border-radius: 14px;
	box-shadow: var(--glass-shadow);
}
body.has-tabbar { padding-bottom: var(--crimea-tabbar-clearance); }
body.has-tabbar main { padding-bottom: 0; }

/* Мобильный таббар — синхронно в critical.css (не ждём site.js и async style.css) */
@media (max-width: 767.98px), ((orientation: landscape) and (max-height: 500px) and (max-width: 932px) and (hover: none) and (pointer: coarse)) {
	body.has-tabbar,
	body.crimea-mobile-tabbar {
		--crimea-tabbar-clearance: calc(112px + env(safe-area-inset-bottom, 0px));
		--crimea-mobile-tabbar-radius: 20px;
		--crimea-mobile-tabbar-strip-height: 66px;
		--crimea-mobile-tabbar-strip-offset: 6px;
	}

	body.has-tabbar .tab-bar,
	body.crimea-mobile-tabbar .tab-bar {
		left: 0;
		right: 0;
		width: 100%;
		padding-left: max(0px, env(safe-area-inset-left, 0px));
		padding-right: max(0px, env(safe-area-inset-right, 0px));
		padding-bottom: max(0px, env(safe-area-inset-bottom, 0px));
		justify-content: stretch;
	}

	body.has-tabbar .tab-bar__start,
	body.has-tabbar .tab-bar.tab-bar--compact .tab-bar__start,
	body.crimea-mobile-tabbar .tab-bar__start,
	body.crimea-mobile-tabbar .tab-bar.tab-bar--compact .tab-bar__start {
		position: relative;
		width: 100% !important;
		max-width: none !important;
		flex-wrap: nowrap !important;
		justify-content: space-between !important;
		align-items: flex-end !important;
		gap: 3px !important;
		padding: 14px 4px 10px !important;
		border-radius: var(--crimea-mobile-tabbar-radius, 20px) !important;
		transform: none !important;
	}

	body.has-tabbar .tab-bar__start::before,
	body.has-tabbar .tab-bar.tab-bar--compact .tab-bar__start::before,
	body.crimea-mobile-tabbar .tab-bar__start::before,
	body.crimea-mobile-tabbar .tab-bar.tab-bar--compact .tab-bar__start::before {
		display: block !important;
		content: '' !important;
		position: absolute;
		top: auto;
		bottom: var(--crimea-mobile-tabbar-strip-offset, 6px);
		left: 0;
		right: 0;
		height: var(--crimea-mobile-tabbar-strip-height, 66px);
		border-radius: var(--crimea-mobile-tabbar-radius, 20px);
		border: 1px solid rgba(255, 255, 255, 0.14) !important;
		background: rgba(22, 24, 28, 0.62) !important;
		backdrop-filter: blur(28px) saturate(180%) !important;
		-webkit-backdrop-filter: blur(28px) saturate(180%) !important;
		box-shadow: 0 10px 28px rgba(2, 8, 18, 0.28) !important;
		z-index: 0;
	}

	body.light.has-tabbar .tab-bar__start::before,
	body.light.has-tabbar .tab-bar.tab-bar--compact .tab-bar__start::before,
	body.light.crimea-mobile-tabbar .tab-bar__start::before,
	body.light.crimea-mobile-tabbar .tab-bar.tab-bar--compact .tab-bar__start::before {
		border-color: rgba(0, 0, 0, 0.08) !important;
		background: rgba(255, 255, 255, 0.72) !important;
		box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08) !important;
	}

	body.dark.has-tabbar .tab-bar__start::before,
	body.dark.has-tabbar .tab-bar.tab-bar--compact .tab-bar__start::before,
	body.dark.crimea-mobile-tabbar .tab-bar__start::before,
	body.dark.crimea-mobile-tabbar .tab-bar.tab-bar--compact .tab-bar__start::before {
		border-color: rgba(255, 255, 255, 0.14) !important;
		background: rgba(22, 24, 28, 0.62) !important;
		box-shadow: 0 10px 28px rgba(2, 8, 18, 0.28) !important;
	}

	body.light.has-tabbar .tab-bar__secondary,
	body.light.has-tabbar .tab-bar__scroll,
	body.light.crimea-mobile-tabbar .tab-bar__secondary,
	body.light.crimea-mobile-tabbar .tab-bar__scroll {
		color: #000 !important;
	}

	body.dark.has-tabbar .tab-bar__secondary,
	body.dark.has-tabbar .tab-bar__scroll,
	body.dark.crimea-mobile-tabbar .tab-bar__secondary,
	body.dark.crimea-mobile-tabbar .tab-bar__scroll {
		color: #fff !important;
	}

	body.has-tabbar .tab-bar__start::after,
	body.crimea-mobile-tabbar .tab-bar__start::after {
		display: none !important;
		content: none !important;
	}

	body.has-tabbar .tab-bar__start > *,
	body.crimea-mobile-tabbar .tab-bar__start > * {
		flex: 1 1 0;
		min-width: 0;
		position: relative;
		z-index: 1;
	}

	body.has-tabbar .tab-bar__secondary,
	body.has-tabbar .tab-bar__scroll,
	body.crimea-mobile-tabbar .tab-bar__secondary,
	body.crimea-mobile-tabbar .tab-bar__scroll {
		width: 100%;
		max-width: 58px;
		min-width: 0;
		min-height: 54px;
		height: auto;
		aspect-ratio: 1;
		margin: 0 auto;
		border-radius: 16px;
		background: transparent;
		border: 0;
		box-shadow: none;
	}

	body.has-tabbar .tab-bar__logo,
	body.crimea-mobile-tabbar .tab-bar__logo {
		flex: 0 0 68px;
		width: 68px;
		max-width: 68px;
		min-width: 68px;
		height: 68px;
		min-height: 68px;
		margin: 0 auto;
		transform: translateY(-8px);
		border-radius: 20px;
	}

	body.has-tabbar .tab-bar .tab-bar__secondary .icon-tab,
	body.has-tabbar .tab-bar__scroll-icon,
	body.has-tabbar .tab-bar__profile-icon,
	body.crimea-mobile-tabbar .tab-bar .tab-bar__secondary .icon-tab,
	body.crimea-mobile-tabbar .tab-bar__scroll-icon,
	body.crimea-mobile-tabbar .tab-bar__profile-icon {
		width: 28px;
		height: 28px;
	}

	body.has-tabbar .tab-bar__logo .icon-tab,
	body.crimea-mobile-tabbar .tab-bar__logo .icon-tab {
		width: 38px;
		height: 38px;
	}

	body.has-tabbar .mobile-menu-fab,
	body.crimea-mobile-tabbar .mobile-menu-fab {
		display: none !important;
	}

	/* Старый Crimea Dock: не показывать legacy-полоску таббара */
	body.has-tabbar .tab-bar::before,
	body.dark.has-tabbar .tab-bar::before,
	body.light.has-tabbar .tab-bar::before {
		display: none !important;
		content: none !important;
		background: none !important;
	}
}
.tab-bar {
	position: fixed;
	z-index: 999;
	left: 0;
	right: 0;
	bottom: 0;
	pointer-events: none;
}
@media (min-width: 768px) {
	body.has-tabbar .sidebar-desktop {
		position: fixed !important;
		top: 0;
		left: 0;
		height: 100vh;
		max-width: var(--appstorrent-sidebar-w);
		z-index: 2;
		background: var(--sidebar-bg, #11141a);
		border-right: 1px solid var(--sidebar-border, #2e2e2e);
	}
	body.has-tabbar .container > .row > main,
	body.has-tabbar .container > .row > .col-lg-7 {
		margin-left: var(--appstorrent-sidebar-w);
	}
}
@media (orientation: landscape) and (max-height: 500px) and (max-width: 932px) and (hover: none) and (pointer: coarse) and (min-width: 768px) {
	body.has-tabbar .sidebar-desktop {
		display: none !important;
	}
	body.has-tabbar .container > .row > main,
	body.has-tabbar .container > .row > .col-lg-7 {
		margin-left: 0 !important;
	}
}
.simple-carousel { position: relative; }
.simple-carousel__viewport { overflow: hidden; border-radius: 14px; }
.news-slide {
	position: relative;
	flex: 0 0 100%;
	min-height: 50vh;
	overflow: hidden;
}
.news-slide__bg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.news-layout__hero {
	position: relative;
	flex: 3 1 0;
	min-height: 0;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}
body.home-page section[aria-labelledby="sec-news"] .news-layout { display: block; min-height: 50vh; }
body.home-page section[aria-labelledby="sec-news"] .news-layout__main {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	grid-template-rows: minmax(0, 3fr) minmax(0, 2fr);
	grid-template-areas: "hero aside" "teasers aside";
	gap: 1rem;
	min-height: 50vh;
}
body.home-page section[aria-labelledby="sec-news"] .news-layout__hero { grid-area: hero; }
body.home-page section[aria-labelledby="sec-news"] .news-latest-panel { grid-area: aside; }
body.home-page section[aria-labelledby="sec-news"] .news-teasers { grid-area: teasers; }

/* ——— Загрузка страницы (первый кадр + переходы) ——— */
html.is-page-loading,
html.is-page-loading body {
	overflow: hidden;
}

.page-loader {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px));
	background: rgba(12, 16, 24, 0.94);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	opacity: 1;
	visibility: visible;
	transition: opacity 0.34s ease, visibility 0.34s ease;
}

.page-loader.is-hiding {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.page-loader__panel {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: clamp(1rem, 3vw, 1.4rem);
}

.page-loader__logo {
	width: clamp(88px, 22vw, 112px);
	height: clamp(88px, 22vw, 112px);
	object-fit: contain;
	animation: page-loader-pulse 1.05s ease-in-out infinite;
}

.page-loader__track {
	width: clamp(168px, 42vw, 228px);
	height: clamp(4px, 1vw, 5px);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.12);
	overflow: hidden;
}

.page-loader__track > span {
	display: block;
	height: 100%;
	width: 42%;
	border-radius: inherit;
	background: linear-gradient(90deg, #1688ed, #2dd4bf);
	animation: page-loader-slide 0.95s ease-in-out infinite;
}

@keyframes page-loader-pulse {
	0%, 100% { transform: scale(1); opacity: 0.82; }
	50% { transform: scale(1.08); opacity: 1; }
}

@keyframes page-loader-slide {
	0% { transform: translateX(-115%); }
	100% { transform: translateX(260%); }
}

html.is-page-loading body.light .page-loader,
body.light .page-loader {
	background: rgba(248, 251, 255, 0.96);
}

html.is-page-loading body.light .page-loader__track,
body.light .page-loader__track {
	background: rgba(15, 23, 42, 0.1);
}

@media (prefers-reduced-motion: reduce) {
	.page-loader__logo,
	.page-loader__track > span {
		animation: none;
	}
}

/* Mobile fluid typography — синхронно (не ждём async style.css, обход immutable-кэша) */
@media (max-width: 767.98px), ((orientation: landscape) and (max-height: 500px) and (max-width: 932px) and (hover: none) and (pointer: coarse)) {
	html {
		font-size: clamp(14px, 11.5px + 0.72vw, 16px);
		-webkit-text-size-adjust: 100%;
		text-size-adjust: 100%;
	}

	:root {
		--m-fs-micro: clamp(0.625rem, 0.58rem + 0.24vw, 0.75rem);
		--m-fs-caption: clamp(0.6875rem, 0.64rem + 0.26vw, 0.8125rem);
		--m-fs-sm: clamp(0.75rem, 0.69rem + 0.3vw, 0.875rem);
		--m-fs-base: clamp(0.8125rem, 0.75rem + 0.34vw, 0.9375rem);
		--m-fs-md: clamp(0.875rem, 0.8rem + 0.38vw, 1rem);
		--m-fs-h2: clamp(1.125rem, 1rem + 0.68vw, 1.45rem);
		--m-fs-h1: clamp(1.25rem, 1.06rem + 0.95vw, 1.65rem);
		--m-fs-post: clamp(1rem, 0.93rem + 0.32vw, 1.0625rem);
		--m-fs-feed: clamp(0.8125rem, 0.74rem + 0.4vw, 0.9375rem);
		--m-fs-meta: clamp(0.6875rem, 0.63rem + 0.24vw, 0.8125rem);
	}

	body {
		font-size: var(--m-fs-base);
		line-height: 1.5;
	}

	.post-page__content {
		font-size: var(--m-fs-post) !important;
		line-height: 1.6 !important;
	}

	.post-page__title,
	.news-page-pagehead__title h2,
	.news-page-pagehead__title h1.post-page__title,
	.section-head h2,
	.mobile-pagehead-bar__title {
		font-size: var(--m-fs-h2) !important;
	}

	.news-teaser__line,
	.news-feed__line {
		font-size: var(--m-fs-feed) !important;
	}

	.post-page__meta,
	.post-page__meta time,
	.page-breadcrumbs {
		font-size: var(--m-fs-meta) !important;
	}
}

@media (max-width: 360px) {
	html {
		font-size: clamp(13.5px, 12.5px + 0.55vw, 14.5px);
	}
}

@media (min-width: 414px) and (max-width: 767.98px) {
	html {
		font-size: clamp(15px, 14px + 0.35vw, 16px);
	}
}
