/* Content tables (editor content, product descriptions, variation descriptions) */

.editor-content table,
.woocommerce-variation-description table {
	--table-rule: var(--grey-4);
	--table-stripe: var(--grey-5);
	--table-head-bg: var(--grey-6);
	--table-head-rule: var(--grey-3);
	width: 100% !important;
	/* Old editor tables carry inline heights that stretch the rows */
	height: auto !important;
	margin: 0 0 24px;
	border: 1px solid var(--table-rule);
	border-collapse: collapse;
	font-size: inherit;
	line-height: 1.5;
}

:is(.clrs-dark, .clrs-grey-1, .clrs-grey-2, .clrs-red, .clrs-secondary-3, .clrs-green-1) .editor-content table {
	--table-rule: rgba(255, 255, 255, 0.2);
	--table-stripe: rgba(255, 255, 255, 0.05);
	--table-head-bg: rgba(255, 255, 255, 0.1);
	--table-head-rule: rgba(255, 255, 255, 0.35);
}

.editor-content *+table,
.woocommerce-variation-description *+table {
	margin-top: 16px;
}

.editor-content table:last-child,
.woocommerce-variation-description table:last-child {
	margin-bottom: 0;
}

:is(.editor-content, .woocommerce-variation-description) table :is(th, td) {
	padding: 10px 14px;
	border: 0;
	border-bottom: 1px solid var(--table-rule);
	text-align: left;
	vertical-align: top;
	overflow-wrap: break-word;
}

/* Columns */
:is(.editor-content, .woocommerce-variation-description) table :is(th, td)+:is(th, td) {
	border-left: 1px solid var(--table-rule);
}

/* Rows */
:is(.editor-content, .woocommerce-variation-description) table tbody tr:nth-child(even) :is(th, td) {
	background: var(--table-stripe);
}

/* Header: a real thead, a th row, or the first row of a multi-column table with no thead */
:is(.editor-content, .woocommerce-variation-description) table thead :is(th, td),
:is(.editor-content, .woocommerce-variation-description) table:not(:has(thead)) tbody tr:first-child th,
:is(.editor-content, .woocommerce-variation-description) table:not(:has(thead)):has(td+td) tbody tr:first-child td {
	background: var(--table-head-bg);
	border-bottom: 2px solid var(--table-head-rule);
	font-family: 'Montserrat-Bold';
}

/* Header row is the first tbody row, so shift the stripes to start under it */
:is(.editor-content, .woocommerce-variation-description) table:not(:has(thead)):has(td+td) tbody tr:nth-child(even) td {
	background: none;
}

:is(.editor-content, .woocommerce-variation-description) table:not(:has(thead)):has(td+td) tbody tr:nth-child(odd):not(:first-child) td {
	background: var(--table-stripe);
}

/* Row headers down the side */
:is(.editor-content, .woocommerce-variation-description) table tbody tr:not(:first-child) th {
	font-family: 'Montserrat-Bold';
}
