@use "../kit-deps" as *;
@use "typography" as *;

.accordion {
	display: grid;
	width: 100%;
	max-width: 760px;
	border: $border-width-base solid $border-color-muted;
	border-left-width: $border-width-accent;
	background: $surface-panel-muted;
}

.accordion-item {
	border-bottom: $border-width-base solid rgba($color-text-light, 0.08);
	overflow: hidden;

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

	&[open] {
		.accordion-summary {
			color: $color-black;
			background: $color-primary;
		}

		.accordion-icon {
			transform: rotate(180deg);
		}
	}
}

.accordion-summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: $space-3;
	min-height: $control-height-md;
	padding: $space-3 $space-4;
	color: $color-text-light;
	cursor: pointer;
	font-size: $font-size-sm;
	font-weight: $font-weight-bold;
	line-height: $line-height-base;
	text-transform: uppercase;
	transition-duration: $motion-base;
	transition-timing-function: $motion-ease;
	transition-property: color, background;

	&::-webkit-details-marker {
		display: none;
	}

	&::marker {
		content: "";
	}

	&:focus-visible {
		@include focus_ring;
	}

	@include hover_touch {
		color: $color-black;
		background: $color-secondary;
	}
}

.accordion-summary-content {
	display: flex;
	align-items: center;
	gap: $space-2;
	min-width: 0;
}

.accordion-icon {
	flex: 0 0 auto;
	font-size: $icon-size-sm;
	transition-duration: $motion-base;
	transition-property: transform;
}

.accordion-panel {
	overflow: hidden;
	padding: $space-4;
	color: $color-text-medium;
	font-size: $font-size-sm;
	line-height: $line-height-relaxed;
	transition-duration: $motion-slow;
	transition-timing-function: $motion-ease;
	transition-property: height, opacity, transform;

	p {
		margin-top: 0;
	}

	p:last-child {
		margin-bottom: 0;
	}
}

.disclosure {
	max-width: 520px;
	border: $border-width-base solid $border-color-muted;
	background: $surface-panel-muted;

	.accordion-summary {
		min-height: $control-height-sm;
		padding: $space-2 $space-3;
	}

	.accordion-panel {
		padding: $space-3;
	}
}
