/* Semantic SGGW table. Visual axes mirror the accepted Core Table contract. */

.sggw-elementor-table {
	background-color: var(--sggw-surface-current);
	border-radius: var(--wp--custom--radius--small);
	box-sizing: border-box;
	color: var(--sggw-text);
	inline-size: 100%;
	max-inline-size: 100%;
	overflow-x: auto;
}

.sggw-elementor-table:focus-visible {
	outline: var(--wp--custom--line--focus-ring-width) solid var(--sggw-line-focus);
	outline-offset: var(--wp--custom--line--focus-ring-offset-inset);
}

.sggw-elementor-table__table {
	background-color: transparent;
	border: var(--wp--custom--line--width) solid var(--sggw-line);
	border-collapse: separate;
	border-radius: var(--wp--custom--radius--small);
	border-spacing: 0;
	color: inherit;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--medium);
	font-style: normal;
	font-weight: var(--wp--custom--typography--font-weight--regular);
	line-height: var(--wp--custom--typography--line-height--body);
	margin: 0;
	min-inline-size: 100%;
	text-align: start;
	width: max-content;
}

.sggw-elementor-table--layout-fixed .sggw-elementor-table__table {
	table-layout: fixed;
	width: 100%;
}

.sggw-elementor-table--layout-fixed :is(th, td) {
	overflow-wrap: anywhere;
	word-break: normal;
}

.sggw-elementor-table__table :is(thead, tbody, tfoot) {
	border: 0;
}

.sggw-elementor-table__table :is(th, td) {
	background: transparent;
	border: 0;
	color: inherit;
	font: inherit;
	padding-block: var(--wp--preset--spacing--30);
	padding-inline: var(--wp--preset--spacing--30);
	text-align: start;
	vertical-align: top;
}

.sggw-elementor-table__table th {
	font-weight: var(--wp--custom--typography--font-weight--semibold, 600);
}

.sggw-elementor-table__table tr > :is(th, td) + :is(th, td) {
	border-inline-start: var(--wp--custom--line--width) solid var(--sggw-line);
}

.sggw-elementor-table__table
	:is(thead, tbody, tfoot)
	> tr
	+ tr
	> :is(th, td),
.sggw-elementor-table__table
	> :is(tbody, tfoot):not(:first-child)
	> tr:first-child
	> :is(th, td) {
	border-block-start: var(--wp--custom--line--width) solid var(--sggw-line);
}

.sggw-elementor-table--density-compact .sggw-elementor-table__table :is(th, td) {
	padding-block: var(--wp--preset--spacing--10);
}

.sggw-elementor-table--data-numeric .sggw-elementor-table__table :is(th, td) {
	font-family: var(--wp--preset--font-family--monospace);
	text-align: end;
}

.sggw-elementor-table__table .sggw-elementor-table__cell--align-start {
	text-align: start;
}

.sggw-elementor-table__table .sggw-elementor-table__cell--align-center {
	text-align: center;
}

.sggw-elementor-table__table .sggw-elementor-table__cell--align-end {
	text-align: end;
}

.sggw-elementor-table--text-small .sggw-elementor-table__table {
	font-size: var(--wp--preset--font-size--small);
}

.sggw-elementor-table:is(
	.sggw-elementor-table--borders-minimal,
	.sggw-elementor-table--borders-none
) .sggw-elementor-table__table {
	border: 0;
	border-radius: 0;
}

.sggw-elementor-table:is(
	.sggw-elementor-table--borders-minimal,
	.sggw-elementor-table--borders-none
) .sggw-elementor-table__table tr > :is(th, td) + :is(th, td) {
	border-inline-start: 0;
}

.sggw-elementor-table--borders-none
	.sggw-elementor-table__table
	:is(thead, tbody, tfoot)
	> tr
	+ tr
	> :is(th, td),
.sggw-elementor-table--borders-none
	.sggw-elementor-table__table
	> :is(tbody, tfoot):not(:first-child)
	> tr:first-child
	> :is(th, td) {
	border-block-start: 0;
}

.sggw-elementor-table--rows-stripes
	.sggw-elementor-table__table
	tbody
	tr:nth-child(odd) {
	background-color: var(--sggw-surface-alternating);
}

.sggw-elementor-table__table caption {
	caption-side: bottom;
	color: var(--sggw-text-muted);
	font: inherit;
	padding-block-start: var(--wp--preset--spacing--20);
	text-align: start;
}

.sggw-elementor-table__table a {
	color: var(--sggw-link-foreground);
	text-decoration-color: currentColor;
	text-decoration-line: var(--sggw-inline-link-decoration-rest);
	text-decoration-skip-ink: auto;
	text-decoration-thickness: var(--sggw-link-decoration-thickness);
	text-underline-offset: var(--sggw-link-underline-offset);
}

.sggw-elementor-table__table a:is(:visited, :hover, :active, :focus-visible) {
	color: var(--sggw-link-foreground);
}

.sggw-elementor-table__table a:is(:hover, :active, :focus-visible) {
	text-decoration-line: var(--sggw-link-decoration-interactive);
}

.sggw-elementor-table__table a:focus:not(:focus-visible) {
	outline: none;
}

.sggw-elementor-table__table a:focus-visible {
	border-radius: var(--wp--custom--radius--x-small);
	outline: var(--wp--custom--line--focus-ring-width) solid var(--sggw-line-focus);
	outline-offset: var(--wp--custom--line--focus-ring-offset-compact);
}

@media (forced-colors: active) {
	.sggw-elementor-table {
		border: 1px solid CanvasText;
		forced-color-adjust: none;
	}

	.sggw-elementor-table__table,
	.sggw-elementor-table__table :is(th, td) {
		background: Canvas;
		border-color: CanvasText;
		color: CanvasText;
	}

	.sggw-elementor-table--rows-stripes
		.sggw-elementor-table__table
		tbody
		tr:nth-child(odd) {
		background: Canvas;
	}

	.sggw-elementor-table__table a,
	.sggw-elementor-table__table a:is(:visited, :hover, :active) {
		color: LinkText;
		text-decoration-line: underline;
	}

	.sggw-elementor-table__table a:focus-visible,
	.sggw-elementor-table:focus-visible {
		outline-color: Highlight;
	}
}
