/* ==========================================================================
   Kinotheatre — карточки фильмов (shortstory.tpl)
   Компактная сетка, постеры не растягиваются на весь экран
   ========================================================================== */

.kt-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
	gap: 14px 10px;
	width: 100%;
	max-width: 100%;
	min-width: 0;
}

@media (min-width: 480px) {
	.kt-grid {
		grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
		gap: 18px 12px;
	}
}

@media (min-width: 768px) {
	.kt-grid {
		grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
		gap: 22px 14px;
	}
}

@media (min-width: 1200px) {
	.kt-grid {
		grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
	}
}

/* Типы страниц — явные классы вместо :has() */
.kt-content--full {
	overflow-x: clip;
	max-width: 100%;
	min-width: 0;
}

.kt-content--hub,
.kt-content--genre,
.kt-content--home,
.kt-content--list,
.kt-content--static,
.kt-content--form,
.kt-content--search,
.kt-content--user,
.kt-content--pm {
	display: block;
	width: 100%;
}

.kt-content--list .kt-grid {
	display: grid;
}

/* --- Карточка --- */
.kt-card {
	position: relative;
	margin: 0;
	min-width: 0;
	max-width: 100%;
}

.kt-card__box {
	position: relative;
}

.kt-card__link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.kt-card__link:hover {
	color: inherit;
}

.kt-card__link:hover .kt-card__title {
	color: var(--kt-text);
}

.kt-card__link:hover .kt-card__poster::after {
	opacity: 1;
}

.kt-card__link:hover .kt-card__img {
	transform: scale(1.05);
}

.kt-card__link:hover .kt-card__play {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

/* Постер 2:3 — фиксированные пропорции, картинка не раздувается */
.kt-card__poster {
	position: relative;
	width: 100%;
	aspect-ratio: 2 / 3;
	max-height: 280px;
	overflow: hidden;
	border-radius: var(--kt-radius);
	background: var(--kt-bg-surface);
}

/* Fallback для старых браузеров без aspect-ratio */
@supports not (aspect-ratio: 2 / 3) {
	.kt-card__poster {
		height: 0;
		padding-bottom: 150%;
		max-height: none;
	}
}

.kt-card__poster::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	background: linear-gradient(180deg, transparent 50%, rgba(0, 0, 0, 0.85) 100%);
	opacity: 0.65;
	transition: opacity var(--kt-transition);
	pointer-events: none;
}

.kt-card__img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.35s ease;
}

/* Бейджи */
.kt-card__badges {
	position: absolute;
	top: 6px;
	left: 6px;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
	max-width: calc(100% - 12px);
	pointer-events: none;
}

.kt-card__badges--bottom {
	top: auto;
	bottom: 6px;
}

.kt-card__badge {
	display: inline-block;
	padding: 2px 6px;
	font-size: 0.625rem;
	font-weight: 600;
	line-height: 1.3;
	color: #fff;
	background: rgba(0, 0, 0, 0.72);
	border-radius: var(--kt-radius-sm);
	white-space: nowrap;
}

.kt-card__badge--accent {
	background: var(--kt-accent);
}

.kt-card__age {
	position: absolute;
	top: 6px;
	right: 6px;
	z-index: 2;
	padding: 2px 5px;
	font-size: 0.625rem;
	font-weight: 700;
	color: #fff;
	border: 1px solid rgba(255, 255, 255, 0.5);
	border-radius: var(--kt-radius-sm);
}

/* Иконка play при наведении */
.kt-card__play {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	color: #fff;
	background: rgba(229, 9, 20, 0.9);
	border-radius: 50%;
	opacity: 0;
	transform: translate(-50%, -50%) scale(0.85);
	transition: opacity var(--kt-transition), transform var(--kt-transition);
	pointer-events: none;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.kt-card__play svg {
	width: 26px;
	height: 26px;
}

/* Текст под постером */
.kt-card__body {
	padding-top: 8px;
}

.kt-card__title {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	margin: 0;
	font-size: 0.8125rem;
	font-weight: 600;
	line-height: 1.3;
	color: var(--kt-text-muted);
	transition: color var(--kt-transition);
}

.kt-card__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin-top: 4px;
	font-size: 0.6875rem;
	color: var(--kt-text-dim);
}

.kt-card__year {
	font-weight: 500;
}

.kt-card__rating {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	color: #f5c518;
	font-weight: 600;
}

.kt-card__rating svg {
	width: 12px;
	height: 12px;
}

.kt-card__genre {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 1;
	overflow: hidden;
	margin: 3px 0 0;
	font-size: 0.6875rem;
	color: var(--kt-text-dim);
}

.kt-page-title {
	margin: 0 0 1.25rem;
	font-size: 1.5rem;
	font-weight: 700;
}

/* --- Всплывающая карточка при наведении (shortstory, TOP-10) --- */
.kt-hover-popup {
	position: fixed;
	z-index: 10045;
	width: min(480px, calc(100vw - 24px));
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.16s ease, visibility 0.16s ease;
}

.kt-hover-popup.is-visible {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.kt-hover-popup__card {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 14px;
	background: var(--kt-bg-elevated, #14141a);
	border: 1px solid rgba(157, 124, 255, 0.18);
	border-radius: var(--kt-radius-lg, 12px);
	box-shadow:
		0 18px 52px rgba(0, 0, 0, 0.72),
		0 0 24px rgba(157, 124, 255, 0.08);
}

.kt-hover-popup__hero {
	display: flex;
	gap: 14px;
}

.kt-hover-popup__poster {
	position: relative;
	flex: 0 0 96px;
	width: 96px;
	overflow: hidden;
	border-radius: var(--kt-radius, 8px);
	background: var(--kt-bg-surface, #1c1c24);
}

.kt-hover-popup__poster img {
	display: block;
	width: 100%;
	height: 144px;
	object-fit: cover;
}

.kt-hover-popup__kp {
	position: absolute;
	top: 6px;
	left: 6px;
	z-index: 1;
	padding: 2px 6px;
	font-size: 0.6875rem;
	font-weight: 700;
	line-height: 1.3;
	color: #fff;
	background: #3bb33b;
	border-radius: 4px;
}

.kt-hover-popup__head {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.kt-hover-popup__title {
	font-size: 1.0625rem;
	font-weight: 700;
	line-height: 1.25;
	color: var(--kt-text, #f5f5f7);
	text-decoration: none;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.kt-hover-popup__title:hover {
	color: var(--kt-accent, #e50914);
}

.kt-hover-popup__original {
	margin: 0;
	font-size: 0.75rem;
	font-weight: 500;
	line-height: 1.35;
	color: var(--kt-text-muted, #9a9aa8);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.kt-hover-popup__genres {
	margin: 0;
	font-size: 0.8125rem;
	line-height: 1.4;
	color: var(--kt-text-muted, #9a9aa8);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.kt-hover-popup__genres a,
.kt-hover-popup__genres a:hover {
	color: inherit !important;
	text-decoration: none !important;
	pointer-events: none !important;
	cursor: default !important;
}

.kt-hover-popup__genres {
	-webkit-line-clamp: 3;
}

.kt-hover-popup__watch {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	align-self: flex-start;
	padding: 8px 16px;
	font-size: 0.8125rem;
	font-weight: 700;
	color: #fff;
	text-decoration: none;
	background: var(--kt-accent, #e50914);
	border-radius: 999px;
	transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.kt-hover-popup__watch:hover {
	color: #fff;
	background: #ff1a1a;
	transform: translateY(-1px);
	box-shadow: 0 0 16px rgba(229, 9, 20, 0.35);
}

.kt-hover-popup__scores {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	width: 100%;
}

.kt-hover-popup__score {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 88px;
	flex: 1 1 88px;
	padding: 8px 10px;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.08);
}

.kt-hover-popup__score-label,
.kt-hover-popup__score-brand {
	font-size: 0.625rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--kt-text-dim, #6b6b78);
}

.kt-hover-popup__score-value {
	font-size: 1.125rem;
	font-weight: 800;
	line-height: 1.1;
	color: #fff;
}

.kt-hover-popup__score-votes {
	font-size: 0.6875rem;
	line-height: 1.3;
	color: var(--kt-text-dim, #6b6b78);
}

.kt-hover-popup__score--site {
	border-color: rgba(157, 124, 255, 0.28);
	background: linear-gradient(145deg, rgba(157, 124, 255, 0.12), rgba(234, 51, 64, 0.08));
}

.kt-hover-popup__score--site .kt-hover-popup__score-label {
	color: #c9b8ff;
}

.kt-hover-popup__score--site .kt-hover-popup__score-value {
	background: linear-gradient(90deg, #ff6b6b, #9d7cff);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.kt-hover-popup__score--kp {
	border-color: rgba(59, 179, 59, 0.35);
	background: linear-gradient(145deg, rgba(59, 179, 59, 0.14), rgba(0, 0, 0, 0.2));
}

.kt-hover-popup__score--kp .kt-hover-popup__score-label {
	color: #7ddf7d;
}

.kt-hover-popup__score--kp .kt-hover-popup__score-value {
	color: #3bb33b;
}

.kt-hover-popup__score--imdb {
	border-color: rgba(245, 197, 24, 0.38);
	background:
		linear-gradient(145deg, rgba(245, 197, 24, 0.16), rgba(0, 0, 0, 0.35)),
		radial-gradient(circle at 100% 0%, rgba(245, 197, 24, 0.12), transparent 55%);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.kt-hover-popup__score--imdb .kt-hover-popup__score-brand {
	font-size: 0.8125rem;
	font-style: italic;
	font-weight: 900;
	letter-spacing: -0.03em;
	text-transform: none;
	color: #f5c518;
	text-shadow: 0 0 12px rgba(245, 197, 24, 0.35);
}

.kt-hover-popup__score--imdb .kt-hover-popup__score-value {
	color: #fff7d6;
}

.kt-hover-popup__section {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.kt-hover-popup__label {
	font-size: 0.6875rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--kt-text-dim, #6b6b78);
}

.kt-hover-popup__cast,
.kt-hover-popup__director {
	display: flex;
	flex-wrap: nowrap;
	align-items: flex-end;
	gap: 6px;
	overflow-x: auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.kt-hover-popup__cast::-webkit-scrollbar,
.kt-hover-popup__director::-webkit-scrollbar {
	display: none;
}

.kt-hover-popup__cast .kt-person-card:nth-child(n+6),
.kt-hover-popup__director .kt-person-card:nth-child(n+2) {
	display: none;
}

.kt-hover-popup .kt-person-popup {
	display: none !important;
}

.kt-hover-popup__cast .kt-cast-chip__name,
.kt-hover-popup__director .kt-cast-chip__name {
	display: none;
}

.kt-hover-popup__cast .kt-cast-chip__link,
.kt-hover-popup__director .kt-cast-chip__link,
.kt-hover-popup__face {
	display: block;
	flex: 0 0 auto;
	padding: 0;
	text-decoration: none;
	background: transparent;
	border: 0;
	border-radius: 6px;
	overflow: hidden;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kt-hover-popup__cast .kt-cast-chip__link:hover,
.kt-hover-popup__director .kt-cast-chip__link:hover,
.kt-hover-popup__face:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45);
}

.kt-hover-popup__cast .kt-cast-chip__img,
.kt-hover-popup__director .kt-cast-chip__img,
.kt-hover-popup__face img {
	display: block;
	width: 40px;
	height: 52px;
	border-radius: 6px;
	object-fit: cover;
}

.kt-hover-popup__desc {
	margin: 0;
	font-size: 0.8125rem;
	line-height: 1.5;
	color: var(--kt-text-muted, #9a9aa8);
	display: -webkit-box;
	-webkit-line-clamp: 4;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

@media (hover: none), (max-width: 767px) {
	.kt-hover-popup {
		display: none !important;
	}
}
