@import '../variables.less';
@import '../mixins.less';

@widthLG: 58.5rem; // 936px
@widthMD: 42.5rem; // 680px
@widthSM: 30rem; // 480px
@widthXS: 21.25rem; // 340px

.orion-aside {
	// will-change: opacity, transform; // rendering flou sous Chrome
	transition: box-shadow 0.3s;
	// z-index: @zIndexOrionPopable;
	position: fixed;
	top: var(--fluid-20px);
	right: var(--fluid-20px);
	bottom: var(--fluid-20px);
	border-radius: var(--radius-aside);
	max-width: calc(100vw - 2.5rem);
	display: none;
	flex-direction: column;
	background: white;
	backface-visibility: hidden;

	@media @tablet {
		max-width: calc(100vw - 5.5rem);
	}

	[data-orion-theme='dark'] & {
		background: var(--grey-lighter);
	}

	> .orion-loader {
		border-radius: var(--radius-aside);
	}

	&:focus {
		outline: none;
	}

	&__poster {
		flex: none;
		border-radius: var(--radius-aside) var(--radius-aside) 0 0;
	}

	&__header {
		order: 1;
		position: absolute;
		right: calc(100% + 1rem);
		top: 2rem;
		display: flex;
		flex-direction: column;
	}

	&__logo {
		width: 6.25rem;
		height: 6.25rem;
		box-shadow: 0 0.0625rem 0.1875rem fade(black, 10);
		border-radius: 0.5rem;
		background: white;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-bottom: 1rem;
		margin-right: unset;

		[data-orion-theme='dark'] & {
			background-color: var(--grey-lighter);
			box-shadow: 0 0.0625rem 0.1875rem black;
		}
	}

	&__actions {
		display: flex;
		flex-direction: column;
		position: relative;
		align-items: flex-start;
		gap: 1rem;

		.orion-button {
			width: unset;
			box-shadow: 0 0.3rem 1rem -0.3rem fade(black, 40);
		}
	}

	&__body,
	&__footer {
		overflow: auto;
		overscroll-behavior: contain;
	}

	&__body {
		order: 2;
		position: relative;
		flex: 1 1 auto;
		border-radius: var(--radius-aside);
		padding: var(--fluid-30px);
		max-width: 100%;
		max-height: 100%;

		/* .orion-aside__footer:not(:empty) + & {
			padding-bottom: var(--fluid-15px);
		} */

		// #region Pure CSS scroll shadow
		background:
			linear-gradient(white 30%, rgba(255, 255, 255, 0)),
			linear-gradient(rgba(255, 255, 255, 0), white 70%) 0 100%,
			radial-gradient(
				farthest-side at 50% 0,
				rgba(0, 0, 0, 0),
				rgba(0, 0, 0, 0)
			),
			radial-gradient(
					farthest-side at 50% 100%,
					rgba(0, 0, 0, 0.2),
					rgba(0, 0, 0, 0)
				)
				0 100%;
		background-repeat: no-repeat;
		background-color: white;
		background-size:
			100% 2.5rem,
			100% 2.5rem,
			100% 0,
			100% 0.5rem;
		background-attachment: local, local, scroll, scroll;

		[data-orion-theme='dark'] & {
			background:
				linear-gradient(var(--grey-lighter) 30%, rgba(255, 255, 255, 0)),
				linear-gradient(rgba(255, 255, 255, 0), var(--grey-lighter) 70%) 0 100%,
				radial-gradient(
					farthest-side at 50% 0,
					rgba(0, 0, 0, 0),
					rgba(0, 0, 0, 0)
				),
				radial-gradient(
						farthest-side at 50% 100%,
						rgba(0, 0, 0, 0.5),
						rgba(0, 0, 0, 0)
					)
					0 100%;
			background-repeat: no-repeat;
			background-size:
				100% 2.5rem,
				100% 2.5rem,
				100% 0,
				100% 0.5rem;
			background-attachment: local, local, scroll, scroll;
			background-color: var(--grey-lighter);
		}
		// #endregion

		@media @tablet {
			padding: var(--fluid-60px);
		}

		.orion-aside--sm & {
			padding: var(--fluid-45px);
		}
		.orion-aside--xs & {
			padding: var(--fluid-20px);
		}
	}

	&__footer {
		order: 3;
		flex: 0 0 auto;
		padding: var(--fluid-20px) var(--fluid-30px);

		@media @tablet {
			padding: var(--fluid-20px) var(--fluid-60px);
		}

		.orion-aside--sm & {
			padding: var(--fluid-20px) var(--fluid-45px);
		}
		.orion-aside--xs & {
			padding: var(--fluid-20px);
		}

		&:empty {
			display: none;
		}
	}

	&__close {
		.close(1.5rem);
		z-index: 1;
		position: fixed;
		top: var(--fluid-8px);
		right: var(--fluid-8px);
		background: var(--base);

		@media @tablet {
			top: var(--fluid-15px);
			right: var(--fluid-15px);
		}
	}

	&--visible {
		display: flex;
		box-shadow: 0 0 7.5rem fade(black, 50);

		[data-orion-theme='dark'] & {
			box-shadow: 0 0 7.5rem black;
		}
	}

	&--xs {
		width: @widthXS;
	}

	&--sm {
		width: @widthSM;
	}

	&--md {
		width: @widthMD;
	}

	&--lg {
		width: @widthLG;
	}
}
