/* =========================================================================
   Contests — Озмунҳо
   ========================================================================= */

.contests-section {
	padding-block: 36px 36px;
	background: #F7F8FA;
}

.contests-grid {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 18px;
}

.contests-grid--empty {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 140px;
	background: var(--toj-white);
	border: 1px dashed var(--toj-border);
	border-radius: 14px;
}

.contest-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-start;
	gap: 14px;
	padding: 22px 14px 20px;
	background: var(--toj-white);
	border-radius: 16px;
	border: 1px solid var(--toj-border);
	box-shadow: 0 4px 16px rgba(31, 39, 51, 0.06);
	text-decoration: none;
	color: inherit;
	transition:
		transform 0.30s ease,
		box-shadow 0.30s ease,
		border-color 0.30s ease;
	min-height: 100%;
	box-sizing: border-box;
}

.contest-card:hover {
	transform: translateY(-4px);
	transition:
		transform 0.30s ease,
		box-shadow 0.30s ease,
		border-color 0.30s ease!important;
	box-shadow: 0 12px 28px rgba(31, 39, 51, 0.12);
	border-color: rgba(77, 134, 177, 0.35);
}

.contest-card__media {
	width: 120px;
	height: 120px;
	padding: 10px;
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 14px;
	overflow: hidden;
}

.contest-card__img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	transition: transform 0.3s ease!important;
}

.contest-card:hover .contest-card__img {
	transform: scale(1.06);
}

.contest-card__img--placeholder {
	padding: 18%;
	opacity: 0.55;
}

.contest-card__title {
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 13px;
	line-height: 1.4;
	text-align: center;
	color: var(--toj-text);
	display: -webkit-box;
	-webkit-line-clamp: 5;
	-webkit-box-orient: vertical;
	overflow: hidden;
	transition: color 0.2s ease;
}

.contest-card:hover .contest-card__title {
	color: var(--toj-blue);
}

/* 4 карточки */
.contests-grid:has(> :nth-child(4):last-child) {
	grid-template-columns: repeat(4, 1fr);
}

/* 3 карточки */
.contests-grid:has(> :nth-child(3):last-child) {
	grid-template-columns: repeat(3, 1fr);
}

/* 1–2 карточки */
.contests-grid:has(> :nth-child(1):last-child),
.contests-grid:has(> :nth-child(2):last-child) {
	grid-template-columns: repeat(auto-fit, minmax(180px, 220px));
	justify-content: center;
}

@media (max-width: 1200px) {
	.contests-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 800px) {
	.contests-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 14px;
	}
}

@media (max-width: 560px) {
	.contests-section {
		padding-block: 24px 12px;
	}

	.contests-grid {
		grid-template-columns: 1fr;
		gap: 12px;
	}

	.contest-card {
		flex-direction: row;
		align-items: center;
		padding: 14px 16px;
		gap: 14px;
		text-align: left;
	}

	.contest-card__media {
		width: 64px;
		height: 64px;
		border-radius: 12px;
		flex-shrink: 0;
	}

	.contest-card__title {
		font-size: 14px;
		text-align: left;
		-webkit-line-clamp: 3;
	}
}
