/*
 * Simple Wysiwyg Tables
 * Only tables with the class "wysiwyg-table" are affected.
 */

/* ---------- Base look ----------
 * Wrapped in :where() = zero specificity, so any theme rule overrides it easily. */
:where(table.wysiwyg-table) {
	width: 100%;
	border-collapse: collapse;
	margin: 0 0 1.5em;
}
:where(table.wysiwyg-table) :where(td, th) {
	border: 1px solid #ccc;
	padding: .5em .75em;
	text-align: left;
	vertical-align: top;
}
:where(table.wysiwyg-table) :where(th) {
	background: #f5f5f5;
	font-weight: 600;
}

/* ---------- Column-fit presets ----------
 * A cell with width:1% + nowrap shrinks to its content; columns without a width share the rest.
 * "> * > tr > *" targets only this table's own cells, not nested tables.
 * On narrow screens the cells may wrap again so the table does not overflow. */
@media (min-width: 601px) {
	/* All columns except the last shrink; the last takes the remaining width. */
	table.wysiwyg-table--fit-content > * > tr > :not(:last-child),
	/* First column shrinks. */
	table.wysiwyg-table--fit-first > * > tr > :first-child,
	/* First two columns shrink. */
	table.wysiwyg-table--fit-first-2 > * > tr > :nth-child(-n+2) {
		width: 1%;
		white-space: nowrap;
	}
}

/* Every column hugs its content; table is not stretched to full width. */
table.wysiwyg-table--fit-all {
	width: auto;
}
