@import "../common/mixin.scss";

@include b(descriptions) {
	box-sizing: border-box;
	font-size: $--font-size-base;
	color: $--color-text-primary;

	@include e(header) {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: $--descriptions-header-margin-bottom;

		@include e(title) {
			font-size: $--descriptions-title-font-size;
			font-weight: bold;
		}
	}

	@include e(body) {
		color: $--color-text-primary;

		tr,
		th,
		td {
			border: none;
		}

		.tu-descriptions__table {
			border-collapse: collapse;
			width: 100%;
			table-layout: fixed;

			.tu-descriptions-item__cell {
				box-sizing: border-box;
				text-align: left;
				font-weight: normal;
				line-height: 1.5;

				@include when(left) {
					text-align: left;
				}

				@include when(center) {
					text-align: center;
				}

				@include when(right) {
					text-align: right;
				}
			}
		}
	}

	.is-bordered {
		table-layout: auto;
		.tu-descriptions-item__cell {
			border: $--descriptions-table-border;
			padding: 12px 10px;
		}
	}

	:not(.is-bordered) {
		.tu-descriptions-item__cell {
			padding-bottom: 12px;
		}
	}

	@include m(large) {
		&.is-bordered {
			.tu-descriptions-item__cell {
				padding: 16px 14px;
			}
		}

		&:not(.is-bordered) {
			.tu-descriptions-item__cell {
				padding-bottom: 14px;
			}
		}
	}

	@include m(small) {
		font-size: 12px;

		&.is-bordered {
			.tu-descriptions-item__cell {
				padding: 8px 10px;
			}
		}

		&:not(.is-bordered) {
			.tu-descriptions-item__cell {
				padding-bottom: 8px;
			}
		}
	}

	@include m(mini) {
		font-size: 12px;

		&.is-bordered {
			.tu-descriptions-item__cell {
				padding: 6px 10px;
			}
		}

		&:not(.is-bordered) {
			.tu-descriptions-item__cell {
				padding-bottom: 6px;
			}
		}
	}
}

@include b(descriptions-item) {
	vertical-align: top;

	@include e(container) {
		display: flex;

		.tu-descriptions-item__label,
		.tu-descriptions-item__content {
			display: inline-flex;
			align-items: baseline;
		}
		.tu-descriptions-item__content {
			flex: 1;
		}
	}

	@include e(label) {
		color: $--color-text-primary;
		&.has-colon {
			&::after {
				content: ":";
				position: relative;
				top: -0.5px;
			}
		}
		&.is-bordered-label {
			font-weight: bold;
		}
		&:not(.is-bordered-label) {
			margin-right: 10px;
		}
	}

	@include e(content) {
		word-break: break-word;
		overflow-wrap: break-word;
	}
}
