@import '../../../../../static/sass/frontend/common-frontend/functions';
@import '../../../../../static/sass/frontend/common-frontend/mixins';

.ct-trending-block {
	padding: var(--padding, 30px) 0;

	> div {
		display: grid;
		grid-template-columns: var(--grid-template-columns);
		grid-column-gap: 30px;
		grid-row-gap: 20px;
		margin-bottom: 5px;

		@include media-breakpoint-only(md) {
			--grid-template-columns: repeat(2, 1fr);
		}

		@include media-breakpoint-up(lg) {
			--grid-template-columns: repeat(4, 1fr);
		}

		&.ct-leave-active,
		&.ct-leave {
			> a {
				transition: opacity 0.3s ease, 
							transform 0.3s ease;

				&:nth-of-type(1) {
					transition-delay: 0s;
				}

				&:nth-of-type(2) {
					transition-delay: 0.15s;
				}

				&:nth-of-type(3) {
					transition-delay: 0.25s;
				}

				&:nth-of-type(4) {
					transition-delay: 0.35s;
				}
			}
		}

		&.ct-leave-active {
			> a {
				opacity: 1;
				transform: translateY(0);
			}
		}

		&.ct-leave {
			> a {
				opacity: 0;
				transform: translateY(3px);
			}
		}

		&.ct-enter-active,
		&.ct-active {
			> a {
				transition: opacity 0.3s ease, 
							transform 0.3s ease;

				&:nth-of-type(1) {
					transition-delay: 0s;
				}

				&:nth-of-type(2) {
					transition-delay: 0.15s;
				}

				&:nth-of-type(3) {
					transition-delay: 0.25s;
				}

				&:nth-of-type(4) {
					transition-delay: 0.35s;
				}
			}
		}

		&.ct-enter-active {
			> a {
				opacity: 0;
				transform: translateY(3px);
			}
		}

		&.ct-active {
			> a {
				opacity: 1;
				transform: translateY(0);
			}
		}
	}

	.ct-block-title {
		grid-column: 1/-1;
		display: flex;
		align-items: center;
		margin-bottom: 10px;

		> svg {
			margin-inline-start: 10px;
		}
	}

	a {
		display: flex;
		align-items: center;
		--theme-link-initial-color: var(--theme-text-color);
	}

	.ct-media-container {
		flex: 0 0 60px;
		border-radius: 100%;
		margin-inline-end: 20px;
		-webkit-mask-image: -webkit-radial-gradient(white, black);
	}

	.ct-post-title {
		word-break: break-word;
	}

	// arrows
	[class*='ct-arrow'] {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 23px;
		height: 23px;
		cursor: pointer;
		background: transparent;
		border-radius: 2px;
		opacity: 0.5;
		color: var(--theme-text-color);
		border: 1px solid currentColor;
		transition: var(--theme-transition);

		&:before {
			content: '';
			width: 5px;
			height: 5px;
			border: 1px solid currentColor;
			border-right: none;
			border-bottom: none;
		}

		&:hover {
			opacity: 1;
			color: #fff;
			border-color: var(--theme-link-hover-color);
			background: var(--theme-link-hover-color);
		}
	}

	.ct-arrow-left {
		margin-inline-start: auto;
		margin-inline-end: 8px;
		padding-inline-start: 1px;

		&:before {
			transform: rotate(-45deg);
		}
	}

	.ct-arrow-right {
		padding-inline-end: 1px;

		&:before {
			transform: rotate(135deg);
		}
	}

	// disable arrows
	[data-page='1'] .ct-arrow-left,
	[data-page*="last"] .ct-arrow-right {
		opacity: 0.2;
		pointer-events: none;
	}
}