/* PenTestIT "Fact sheet" table style (Table block > Styles > Fact sheet).
 * Two columns: label on the left, value on the right, no header row.
 * :is() keeps one selector for the site (.entry-content) and the block editor
 * (.editor-styles-wrapper) and gives enough weight to override the theme's
 * zebra striping, hover tint and cell borders without !important. */

:is(.entry-content, .editor-styles-wrapper) .wp-block-table.is-style-pti-facts {
	--pti-facts-rule: var(--pentestit-accent-strong, #cc342d);
	--pti-facts-label-bg: #f3f4f6;
	--pti-facts-label: #222;
	--pti-facts-line: #e3e6ea;
	--pti-facts-hover: rgba(204, 52, 45, 0.05);
	overflow-x: visible;
}

:is(.entry-content, .editor-styles-wrapper) .wp-block-table.is-style-pti-facts table {
	width: 100%;
	border: 0;
	border-left: 4px solid var(--pti-facts-rule);
	border-collapse: collapse;
	background: transparent;
	table-layout: auto;
}

:is(.entry-content, .editor-styles-wrapper) .wp-block-table.is-style-pti-facts tr,
:is(.entry-content, .editor-styles-wrapper) .wp-block-table.is-style-pti-facts tbody tr:nth-child(even),
:is(.entry-content, .editor-styles-wrapper) .wp-block-table.is-style-pti-facts tbody tr:hover {
	background: transparent;
}

:is(.entry-content, .editor-styles-wrapper) .wp-block-table.is-style-pti-facts :is(th, td) {
	padding: 0.8rem 1rem;
	border: 0;
	border-bottom: 1px solid var(--pti-facts-line);
	background: transparent;
	color: inherit;
	text-align: left;
	vertical-align: top;
	line-height: 1.55;
	overflow-wrap: anywhere;
}

:is(.entry-content, .editor-styles-wrapper) .wp-block-table.is-style-pti-facts tr:last-child > * {
	border-bottom: 0;
}

/* Label column: works for <th scope="row"> (site) and plain <td> (editor). */
:is(.entry-content, .editor-styles-wrapper) .wp-block-table.is-style-pti-facts tr > :first-child {
	width: 11.5rem;
	background: var(--pti-facts-label-bg);
	color: var(--pti-facts-label);
	font-family: 'Titillium Web', Arial, sans-serif;
	font-weight: 700;
	font-size: 0.95em;
}

:is(.entry-content, .editor-styles-wrapper) .wp-block-table.is-style-pti-facts tbody tr:hover > :last-child {
	background: var(--pti-facts-hover);
}

/* Phones: label on its own line, value full width under it. */
@media only screen and (max-width: 600px) {
	:is(.entry-content, .editor-styles-wrapper) .wp-block-table.is-style-pti-facts :is(table, tbody, tr, th, td) {
		display: block;
		width: auto;
	}

	:is(.entry-content, .editor-styles-wrapper) .wp-block-table.is-style-pti-facts tr {
		border-bottom: 1px solid var(--pti-facts-line);
	}

	:is(.entry-content, .editor-styles-wrapper) .wp-block-table.is-style-pti-facts tr:last-child {
		border-bottom: 0;
	}

	:is(.entry-content, .editor-styles-wrapper) .wp-block-table.is-style-pti-facts :is(th, td) {
		border-bottom: 0;
	}

	:is(.entry-content, .editor-styles-wrapper) .wp-block-table.is-style-pti-facts tr > :first-child {
		width: auto;
		padding: 0.45rem 1rem;
		font-size: 0.85em;
		letter-spacing: 0.02em;
	}

	:is(.entry-content, .editor-styles-wrapper) .wp-block-table.is-style-pti-facts tr > :last-child {
		padding-top: 0.55rem;
	}
}

@media (prefers-color-scheme: dark) {
	:is(.entry-content, .editor-styles-wrapper) .wp-block-table.is-style-pti-facts {
		--pti-facts-label-bg: #26282c;
		--pti-facts-label: #f1f2f4;
		--pti-facts-line: #393c42;
		--pti-facts-hover: rgba(232, 85, 78, 0.08);
	}
}
