/**
 * The following styles get applied both on the front of your site
 * and in the editor.
 *
 * Replace them with your own styles or remove the file completely.
 */

.hover-highlight {
	&-block {
		margin: 2rem auto;
		position: relative;
		max-width: 1200px;
		padding: 0;

		@media (max-width: 768px) {
			padding: 0 1rem;
		}

		&.hide-images-on-mobile {
			@media (max-width: 950px) {
				.hover-highlight-image-container {
					display: none;
				}

				.hover-highlight-container {
					gap: 0;
				}

				.hover-highlight-text-list {
					max-width: 100%;
					width: 100%;
				}

				// Toujours montrer les paragraphes pour tous les items en mobile
				.hover-highlight-text-item p {
					opacity: 0.5;
					visibility: visible;
				}

				// Paragraphe pour item actif en mobile
				.hover-highlight-text-item.active p {
					opacity: 1;
				}
			}
		}
	}

	&-container {
		display: flex;
		align-items: center;
		gap: 4rem;
		justify-content: space-between;
		height: 100%;

		// Desktop version
		&.desktop {
			@media (max-width: 950px) {
				display: none;
			}
		}

		// Mobile version
		&.mobile {
			display: none;
			flex-direction: column;
			gap: 1.5rem;

			@media (max-width: 950px) {
				display: flex;
			}

			.hover-highlight-mobile-items {
				width: 100%;
			}

			.hover-highlight-mobile-content-holder {
				display: none; // Caché car géré par JavaScript
			}

			.hover-highlight-mobile-item-wrapper {
				width: 100%;
				margin-bottom: 2rem;
				border-bottom: 1px solid rgba(0, 0, 0, 0.1);
				padding-bottom: 1.5rem;

				&:last-child {
					border-bottom: none;
				}
			}
		}

		@media (max-width: 950px) {
			flex-direction: column;
			align-items: center;
			min-height: auto;
			gap: 1.5rem;
		}
	}

	// Style pour les items mobiles
	&-mobile-item {
		margin-bottom: 0.5rem;
		padding: 1rem 0;

		.mobile-item-link {
			display: flex;
			flex-direction: column;
			text-decoration: none;
			color: inherit;

			&:hover,
			&:focus {
				text-decoration: none;
				color: inherit;
			}
		}

		.title-wrapper {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-bottom: 0.5rem;
			gap: 15px;

			h3 {
				margin: 0;
				font-weight: 700;
				line-height: 1.2;
				font-size: 1.25rem;
			}

			.hover-highlight-arrow {
				display: inline-flex;
				flex-shrink: 0;
				width: 24px;
				height: 24px;

				svg {
					width: 100%;
					height: 100%;
				}
			}
		}

		p {
			margin: 0;
			font-size: 1rem;
			line-height: 1.5;
			opacity: 0.7;
		}
	}

	&-mobile-item-content {
		margin-top: 1.5rem;

		.wp-block-orphic-ui-hover-highlights2-unit {
			margin: 0;
			padding: 0;
		}

		.hover-highlight-image {
			opacity: 1 !important;
			visibility: visible !important;
			position: static !important;
			transform: none !important;
			display: block;
			width: 100%;

			img {
				width: 100%;
				height: auto;
				position: static;
				transform: none;
			}
		}

		img,
		figure,
		.wp-block-image {
			width: 100%;
			height: auto;
			margin: 0;
			display: block;
		}
	}

	&-text-list {
		flex: 0 0 35%;
		display: flex;
		flex-direction: column;
		gap: 1rem;
		align-self: center;
		max-height: var(--image-height, 50vh);

		@media (max-width: 950px) {
			flex: none;
			width: 100%;
			max-height: none;
			overflow-y: visible;
			order: 2;
		}
	}

	&-text-item {
		cursor: pointer;
		padding: 1rem 0;

		.text-item-link {
			text-decoration: none;
			color: inherit;
			display: block;
			display: flex;
			flex-direction: column;
			justify-content: start;
			align-items: start;

			&:hover,
			&:focus {
				text-decoration: none;
				color: inherit;
			}
		}

		.title-wrapper {
			display: flex;
			align-items: center;
			margin-bottom: 0.5rem;
			gap: 10px;

			h3 {
				margin: 0;
				font-weight: 700;
				opacity: 0.4;
				transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
				transform: scale(0.9);
				transform-origin: left center;
				min-width: 0;
				line-height: 1.2;
				word-wrap: break-word;
				overflow-wrap: break-word;
			}

			.hover-highlight-arrow {
				opacity: 0;
				transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
				transform: translateX(-10px);
				flex-shrink: 0;
				width: 24px;
				height: 24px;
				padding-top: 0.25em;

				svg {
					height: 1em;
					width: auto;
					vertical-align: middle;
					margin-left: 0.5em;
				}
			}
		}

		p {
			margin: 0;
			font-size: 1rem;
			line-height: 1.5;
			opacity: 0;
			visibility: hidden;
			transition:
				opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
				visibility 0.5s cubic-bezier(0.4, 0, 0.2, 1);

			// En mobile, les paragraphes sont toujours visibles
			@media (max-width: 950px) {
				opacity: 0.5;
				visibility: visible;
			}
		}

		&.active {
			.title-wrapper {
				h3 {
					opacity: 1;
					transform: scale(1);
				}

				.hover-highlight-arrow {
					opacity: 1;
					transform: translateX(0);
				}
			}

			p {
				opacity: 0.7;
				visibility: visible;

				@media (max-width: 950px) {
					opacity: 1;
				}
			}
		}

		&:hover:not(.active) {
			.hover-highlight-arrow {
				opacity: 1;
				transform: translateX(0);
			}

			h3 {
				opacity: 0.7;
				transform: scale(1.05) translateX(2.5%);
			}

			p {
				opacity: 0.5;
				visibility: visible;
			}
		}

		@media (max-width: 768px) {
			padding: 0.75rem 0;

			.title-wrapper h3 {
				font-size: 1.25rem;
			}

			p {
				font-size: 0.9rem;
			}
		}
	}

	&-image-container {
		position: relative;
		height: 100%;
		width: 100%;

		@media (max-width: 950px) {
			width: 100% !important;
			margin-left: 0;
			order: 1;
		}
	}

	&-image {
		opacity: 0;
		visibility: hidden;
		transition:
			opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
			visibility 0.5s cubic-bezier(0.4, 0, 0.2, 1),
			transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
		will-change: transform, opacity;
		width: 100%;
		transform: translateY(-50%);
		position: absolute;
		top: 50%;
		left: 0;

		&.active {
			opacity: 1;
			visibility: visible;
			z-index: 2;
		}

		&.exit-up {
			transform: translateY(calc(-50% - 20px));
			z-index: 1;
			opacity: 0.5;
		}

		&.enter-up {
			transform: translateY(calc(-50% - 20px));
			z-index: 3;
			opacity: 0.5;
		}

		&.exit-down {
			transform: translateY(calc(-50% + 20px));
			z-index: 1;
			opacity: 0.5;
		}

		&.enter-down {
			transform: translateY(calc(-50% + 20px));
			z-index: 3;
			opacity: 0.5;
		}

		@media (max-width: 950px) {
			width: 100% !important;
			transform: none;
			top: 0;
			right: auto;
			margin-bottom: 0;

			&.active,
			&.exit-up,
			&.enter-up,
			&.exit-down,
			&.enter-down {
				transform: none;
				position: absolute;
				left: 0;
				top: auto;
				bottom: 0;
			}
		}
	}

	&-block {
		&.has-custom-colors {
			.hover-highlight-text-item {
				.title-wrapper {
					h3 {
						color: var(--title-color);
					}

					.hover-highlight-arrow {
						color: var(--arrow-color);

						svg {
							fill: var(--arrow-color);
						}
					}
				}

				p {
					color: var(--text-color);
				}

				&.active {
					.title-wrapper {
						h3 {
							color: var(--title-color);
						}

						.hover-highlight-arrow {
							color: var(--arrow-color);
						}
					}

					p {
						color: var(--text-color);
					}
				}

				&:hover:not(.active) {
					.title-wrapper {
						h3 {
							color: var(--title-color);
						}

						.hover-highlight-arrow {
							color: var(--arrow-color);
						}
					}

					p {
						color: var(--text-color);
					}
				}
			}
		}
	}
}

.word-arrow-no-wrap {
	white-space: nowrap;
}
