@use "styleboost/utilities/functions";
@use "styleboost/utilities/mixins";

@layer utilities {
	$accent_rgba: functions.themePropertyVar('color', 'accent-rgb', 'divider');

	:root {
		--divider-width: 1px;
	}

	.divider {
		display: flex;
		align-items: center;
		align-self: stretch;
		white-space: nowrap;

		&::before,
		&::after {
			content: "";
			background-color: rgba(#{$accent_rgba}, 0.2);
		}

		&:not(:empty) {
			gap: 0.55rem;
		}
	}

	@include mixins.in-vertical-context(".divider", true) {
		margin-top: 1rem;
		margin-bottom: 1rem;
		height: 1rem;

		&::before,
		&::after {
			flex-grow: 0;
			height: var(--divider-width);
			width: 100%;
		}
	}

	@include mixins.in-horizontal-context(".divider") {
		margin-left: 1rem;
		margin-right: 1rem;
		margin-top: 0;
		margin-bottom: 0;
		height: auto;
		width: 1rem;
		flex-direction: column;

		&::before,
		&::after {
			height: 100%;
			width: var(--divider-width);
		}
	}
}