/* SEO и производительность оптимизации для LordFilm 2025
 * Улучшение Core Web Vitals (LCP, CLS, INP)
 * Адаптивность и современный дизайн
 */

/* =================================================
   1. ОПТИМИЗАЦИЯ ПРОИЗВОДИТЕЛЬНОСТИ
   ================================================= */

/* Оптимизация шрифтов - уменьшение CLS */
@font-face {
	font-family: 'Open Sans';
	font-display: swap;
	font-weight: 400 600;
}

/* Резервирование места под изображения - предотвращение CLS */
.th-img, .fposter {
	aspect-ratio: 2/3;
	background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
	position: relative;
}

.th-img img, .fposter img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Плавная загрузка изображений */
img[loading="lazy"] {
	opacity: 0;
	transition: opacity 0.3s ease-in;
}

img[loading="lazy"].loaded,
img[loading="lazy"]:not([src]) {
	opacity: 1;
}

/* Оптимизация для iframe плеера - улучшение LCP */
.video-box iframe {
	aspect-ratio: 16/9;
	width: 100%;
	height: auto;
	min-height: 400px;
}

/* =================================================
   2. УЛУЧШЕНИЕ ДОСТУПНОСТИ И UX
   ================================================= */

/* Фокус для клавиатурной навигации */
a:focus-visible,
button:focus-visible,
input:focus-visible {
	outline: 3px solid #bfdb04;
	outline-offset: 2px;
}

/* Улучшение контраста для лучшей читаемости */
.th-title, .frels-title {
	color: #fff;
	text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Анимация наведения - плавные переходы */
.th-item {
	transition: transform 0.3s ease, box-shadow 0.3s ease;
	will-change: transform;
}

.th-item:hover {
	transform: translateY(-5px) scale(1.02);
	box-shadow: 0 10px 30px rgba(191, 219, 4, 0.3);
}

/* =================================================
   3. ИНТЕРАКТИВНЫЕ ЭЛЕМЕНТЫ
   ================================================= */

/* Скелетон для загрузки контента */
.skeleton {
	background: linear-gradient(90deg, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%);
	background-size: 200% 100%;
	animation: loading 1.5s infinite;
}

@keyframes loading {
	0% { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* Индикатор прокрутки страницы */
.scroll-progress {
	position: fixed;
	top: 0;
	left: 0;
	width: 0;
	height: 3px;
	background: linear-gradient(90deg, #bfdb04, #8fb903);
	z-index: 9999;
	transition: width 0.1s ease;
}

/* Кнопка "Наверх" */
.back-to-top {
	position: fixed;
	bottom: 30px;
	right: 30px;
	width: 50px;
	height: 50px;
	background: #bfdb04;
	color: #000;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transition: all 0.3s ease;
	box-shadow: 0 4px 15px rgba(191, 219, 4, 0.4);
	z-index: 1000;
}

.back-to-top.show {
	opacity: 1;
	visibility: visible;
}

.back-to-top:hover {
	transform: translateY(-5px);
	box-shadow: 0 6px 20px rgba(191, 219, 4, 0.6);
}

/* =================================================
   4. АДАПТИВНОСТЬ И МОБИЛЬНАЯ ОПТИМИЗАЦИЯ
   ================================================= */

/* Оптимизация для планшетов */
@media (max-width: 1024px) {
	.th-item {
		flex: 0 0 calc(25% - 15px);
	}

	.video-box iframe {
		min-height: 350px;
	}
}

/* Оптимизация для мобильных устройств */
@media (max-width: 768px) {
	.th-item {
		flex: 0 0 calc(33.333% - 10px);
	}

	.video-box iframe {
		min-height: 250px;
	}

	/* Увеличение области нажатия для мобильных */
	button, a {
		min-height: 44px;
		min-width: 44px;
	}

	/* Оптимизация текста для мобильных */
	h1 { font-size: 24px; }
	h2 { font-size: 20px; }
	h3 { font-size: 18px; }
}

@media (max-width: 480px) {
	.th-item {
		flex: 0 0 calc(50% - 8px);
	}

	.back-to-top {
		bottom: 20px;
		right: 20px;
		width: 45px;
		height: 45px;
	}
}

/* =================================================
   5. DARK MODE ПОДДЕРЖКА (опционально)
   ================================================= */

@media (prefers-color-scheme: dark) {
	/* Уже реализовано темная тема по умолчанию */
}

/* =================================================
   6. УЛУЧШЕНИЯ ДЛЯ ПОИСКА
   ================================================= */

/* Выделение результатов поиска */
.search-highlight {
	background: rgba(191, 219, 4, 0.3);
	padding: 2px 4px;
	border-radius: 2px;
}

/* Автодополнение поиска */
.search-autocomplete {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background: #222;
	border: 1px solid #333;
	border-top: none;
	border-radius: 0 0 4px 4px;
	max-height: 300px;
	overflow-y: auto;
	z-index: 1000;
	box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.search-autocomplete-item {
	padding: 12px 15px;
	cursor: pointer;
	transition: background 0.2s ease;
	border-bottom: 1px solid #2a2a2a;
}

.search-autocomplete-item:hover,
.search-autocomplete-item.active {
	background: #2a2a2a;
}

/* =================================================
   7. АНИМАЦИИ ДЛЯ УЛУЧШЕНИЯ UX
   ================================================= */

/* Плавное появление элементов при прокрутке */
.fade-in {
	opacity: 0;
	transform: translateY(30px);
	transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
	opacity: 1;
	transform: translateY(0);
}

/* Пульсация для важных элементов */
@keyframes pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.7; }
}

.pulse {
	animation: pulse 2s infinite;
}

/* =================================================
   8. ОПТИМИЗАЦИЯ РЕЙТИНГОВ
   ================================================= */

.frate, .th-rate {
	position: relative;
	overflow: hidden;
}

.frate::before, .th-rate::before {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
	transition: left 0.5s ease;
}

.frate:hover::before, .th-rate:hover::before {
	left: 100%;
}

/* =================================================
   9. УВЕДОМЛЕНИЯ И ТОСТЫ
   ================================================= */

.toast-notification {
	position: fixed;
	bottom: 30px;
	left: 50%;
	transform: translateX(-50%) translateY(100px);
	background: #bfdb04;
	color: #000;
	padding: 15px 25px;
	border-radius: 8px;
	box-shadow: 0 4px 20px rgba(191, 219, 4, 0.5);
	opacity: 0;
	transition: all 0.3s ease;
	z-index: 10000;
	font-weight: 600;
}

.toast-notification.show {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* =================================================
   10. ОПТИМИЗАЦИЯ ПРОИЗВОДИТЕЛЬНОСТИ АНИМАЦИЙ
   ================================================= */

/* Использование GPU ускорения */
.th-item,
.th-mask,
.back-to-top,
.toast-notification {
	transform: translateZ(0);
	backface-visibility: hidden;
	perspective: 1000px;
}

/* Отключение анимаций для пользователей с настройками доступности */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}

	.th-item:hover {
		transform: none;
	}
}

/* =================================================
   11. PRELOAD И КРИТИЧЕСКИЙ CSS
   ================================================= */

/* Критические стили для above-the-fold контента */
.header {
	contain: layout style;
}

.th-item {
	contain: layout;
}

/* Оптимизация перерисовки */
.fx-row, .fx-col {
	contain: layout;
}
