@import '@resources/index.css';

%card-prices-plan-hover {
	.supt-card-prices-plan__image {
		clip-path: inset(
			0% 0% var(--hover-image-clip-path-bottom) 0% round 14px
		);

		.supt-figure {
			transform: translateY(var(--hover-excerpt-translate));
		}
	}

	.supt-card-prices-plan__excerpt {
		transform: translateY(0);
	}

	.supt-card-prices-plan__arrow {
		transform: rotate(45deg);
	}
}

%card-prices-plan-list-hover {
	.supt-card-prices-plan__head {
		transform: translateY(calc(-1 * var(--excerpt-height)));
	}
	.supt-card-prices-plan__arrow {
		background-color: var(--card-background-color);
	}
}

.supt-card-prices-plan {
	@mixin with-background-color;

	position: relative;
	padding: 20px 20px 24px;
	border-radius: 16px;
	display: flex;
	flex-direction: column;
	gap: 24px;
	height: 100%;
	justify-content: space-between;
	z-index: 1;

	@media (min-width: $sm-breakpoint) {
		padding: 32px;
		border-radius: 32px;
	}

	&__body {
		text-decoration: none;
		outline: none;

		display: flex;
		flex-direction: column;
		gap: 8px;

		@media (min-width: $sm-breakpoint) {
			gap: 24px;
		}
	}

	&__title {
		@extend %t-m;
	}

	&__price-chf {
		@extend %t-ml-medium;
		line-height: 133%;
		margin: 0;
	}
	&__price-cycle {
		@extend %t-s-normal-medium;
		display: block;
		letter-spacing: -0.2px;
	}

	&__price-description {
		@extend %t-s-normal;
		display: block;
		letter-spacing: -0.2px;
		margin-top: 16px;

		& + & {
			margin-top: 0;
		}
	}

	&__price-details p {
		@extend %t-s-normal-medium;
		display: block;
		letter-spacing: -0.2px;
		margin-top: 16px;
		&:first-of-type {
			margin-top: 0px;
		}
	}

	&__price-details ul {
		@extend %t-s-normal;
		display: block;
		list-style: none;
		margin: 8px 0 16px;

		li {
			cursor: default;
			margin-left: 24px;

			.info-tooltip {
				display: inline-flex;
				vertical-align: middle;
				margin: -1px 0 0 -2px;
			}

			.subtitle {
				display: block;
				@extend %t-xs-normal;
			}
		}

		&.-features {
			li::before {
				content: url('data:image/svg+xml,%3Csvg%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2012%2012%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%3Cg%3E%3Cpath%20d%3D%22M4.77502%207.39995L1.52502%204.14995L2.65002%203.02495L4.77502%205.14995L9.35002%200.57495L10.475%201.69995L4.77502%207.39995Z%22%20fill%3D%22currentColor%22/%3E%3C/g%3E%3C/svg%3E');
				margin: 2px 8px 0 -24px;
				vertical-align: top;
				background-color: $color-pink;
				border-radius: 50%;
				height: 16px;
				width: 16px;
				padding: 0 2px;
				display: inline-block;
			}
		}
		&.-options {
			li {
				white-space: nowrap;
				> * {
					white-space: normal;
				}
				&::before {
					content: url('data:image/svg+xml,%3Csvg%20width%3D%2214%22%20height%3D%2214%22%20viewBox%3D%220%200%2014%2014%22%20fill%3D%22none%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%3E%0A%3Cg%3E%0A%3Cpath%20d%3D%22M6.88335%207.00011L4.20001%204.31678L5.48335%203.03345L9.45001%207.00011L5.48335%2010.9668L4.20001%209.68345L6.88335%207.00011Z%22%20fill%3D%22currentColor%22/%3E%0A%3C/g%3E%0A%3C/svg%3E%0A');
					margin: 0 8px 0 -24px;
					width: 12px;
					vertical-align: middle;
				}
			}
		}

		li:focus .tooltip__wrapper {
			display: block;
			width: calc(100% - 40px);
		}
		@media (min-width: $sm-breakpoint) {
			li:focus .tooltip__wrapper {
				display: none;
			}
			li:hover .tooltip__wrapper {
				display: block;
				width: calc(100% - 40px);

				.close {
					display: none;
				}
			}
		}
	}

	hr {
		border: none;
		border-top: solid 1px $color-interface-grey-30;
		width: 100%;
		height: 0px;
		margin: 0;
	}
	.supt-button {
		width: 100%;
	}
	&__favorite {
		position: absolute;
		top: 0;
		right: 0;
		border-radius: 32px;
		svg {
			color: $color-pink;
		}
		.desktop {
			display: none;
		}
		@media (min-width: $sm-breakpoint) {
			.mobile {
				display: none;
			}
			.desktop {
				display: inherit;
			}
		}
	}

	/* States */
	@mixin desktop-only {
		&:hover {
			@extend %card-prices-plan-hover;
		}
	}
	&:focus-within {
		@extend %card-prices-plan-hover;
	}
}
