/* Таблица цен: шапка медью, подзаголовки групп курсивом, цены по правому краю */

/* Если таблица всё же шире колонки, она прокручивается внутри блока, а не страница целиком */
.price-table {
	max-width: 100%;
	overflow-x: auto;
}

/* Название таблицы над ней: шрифтом заголовков карточек */
.price-table__title {
	margin: 0 0 0.875rem;
	color: var(--color-ink);
	font-family: var(--font-display);
	font-size: var(--fs-card-title);
	font-weight: 400;
	line-height: var(--lh-heading);
	letter-spacing: var(--ls-display);
	text-transform: uppercase;
}

.price-table__table {
	width: 100%;
	border: 1px solid var(--color-table-border);
	border-collapse: collapse;
	background: var(--color-table-bg);
	font-variant-numeric: tabular-nums;
}

.price-table thead th {
	padding: var(--table-cell-pad);
	border: 1px solid var(--color-table-line);
	border-bottom-color: var(--color-table-head-line);
	background: var(--color-table-head-bg);
	color: var(--color-brass-deep);
	font-size: var(--fs-table-head-lg);
	font-weight: 600;
	line-height: 1.35;
	letter-spacing: var(--ls-table-head);
	text-align: left;
	text-transform: uppercase;
	vertical-align: bottom;
}

/* Названия столбцов переносятся, иначе широкая таблица выходит за край колонки */
.price-table thead th.price-table__cell {
	white-space: normal;
}

/* Короткие столбцы (сорт, возраст, единица): 90, без переноса */
.price-table__cell {
	width: 5.625rem;
	white-space: nowrap;
}

/* Цены: 120, по правому краю */
.price-table__cell.price-table__cell--num {
	width: 7.5rem;
	text-align: right;
}

/* Самый длинный столбец забирает свободное место и переносит текст */
.price-table__cell.price-table__cell--flex {
	width: auto;
	white-space: normal;
}

.price-table__group-title {
	padding: 0.625rem 1rem;
	border: 1px solid var(--color-table-line);
	background: var(--color-table-label-bg);
	color: var(--color-brass-deep);
	font-size: var(--fs-nav-item);
	font-style: italic;
	font-weight: 400;
	line-height: var(--lh-lead);
	text-align: left;
}

.price-table__row > * {
	padding: var(--table-cell-pad);
	border: 1px solid var(--color-table-line);
	font-size: var(--fs-table);
	font-weight: 500;
	line-height: var(--lh-text);
	text-align: left;
	vertical-align: top;
}

.price-table__row > .price-table__cell--flex {
	font-weight: 400;
}

.price-table__row:hover > * {
	background: var(--color-row-hover);
}

.price-table__note {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
	margin-top: 0.75rem;
	color: var(--color-ink-soft);
	font-size: var(--fs-caption);
	line-height: 1.125rem;
}

.price-table__note p {
	margin: 0;
}

.price-table__since {
	font-weight: 500;
}

/* Широкая таблица (от 8 столбцов, как прейскурант сухих пиломатериалов): поля ячеек меньше,
   короткие столбцы переносят текст, цены не переносятся. Шрифт тот же */
@media (min-width: 48rem) {
	.price-table--wide thead th,
	.price-table--wide .price-table__row > *,
	.price-table--wide .price-table__group-title {
		padding-inline: 0.5rem;
	}

	.price-table--wide .price-table__cell {
		width: auto;
		white-space: normal;
	}

	.price-table--wide .price-table__row > .price-table__cell--num {
		width: auto;
		white-space: nowrap;
	}

	.price-table--wide thead th.price-table__cell {
		width: auto;
		hyphens: auto;
		white-space: normal;
	}
}

/* Телефон: строка таблицы становится карточкой, у каждой ячейки своя подпись */
@media (max-width: 47.9375rem) {
	.price-table__table,
	.price-table tbody,
	.price-table__group-row,
	.price-table__group-title {
		display: block;
	}

	.price-table thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}

	.price-table__group-title {
		padding: 0.5rem 0.875rem;
		border: 0;
		border-bottom: 1px solid var(--color-table-line);
	}

	/* Главная ячейка строки — заголовок карточки, под ней каждая цена своей строкой:
	   подпись слева, значение справа. Так читается при любом числе столбцов */
	.price-table__row {
		display: grid;
		grid-template-columns: minmax(0, 1fr);
		gap: 0.375rem;
		padding: var(--table-cell-pad-mobile);
		border-bottom: 1px solid var(--color-table-line);
	}

	.price-table__row > *,
	.price-table__row > .price-table__cell--num {
		width: auto;
		padding: 0;
		border: 0;
		font-size: var(--fs-table-mobile);
		text-align: left;
		white-space: normal;
	}

	.price-table__row > .price-table__cell--flex {
		order: -1;
		margin-bottom: 0.25rem;
		font-weight: 500;
	}

	.price-table__row > :not(.price-table__cell--flex) {
		display: flex;
		align-items: baseline;
		justify-content: space-between;
		gap: 1rem;
	}

	/* Название в первом столбце понятно без подписи («Сосна обыкновенная») */
	.price-table__row > .price-table__cell--flex:first-child::before {
		display: none;
	}

	.price-table__row > ::before {
		content: attr(data-label);
		display: block;
		flex: 1 1 auto;
		color: var(--color-brass-deep);
		font-size: var(--fs-table-head);
		font-style: normal;
		font-weight: 600;
		line-height: var(--lh-text);
		letter-spacing: var(--ls-table-head);
		text-transform: uppercase;
	}

	/* Подпись над главной ячейкой (если она не первая) — блоком, как раньше */
	.price-table__row > .price-table__cell--flex::before {
		margin-bottom: 0.125rem;
	}

	.price-table__row:hover > * {
		background: none;
	}
}
