/**
 * Compare Table block.
 *
 * Plain CSS, auto-enqueued by inc/blocks.php (front end when the block is
 * present, always in the editor canvas).
 *
 * Two logos and the feature rows — the heading and intro are authored as
 * ordinary blocks above the table.
 *
 * Layout is `table-layout: fixed` with two fixed value columns, so both product
 * columns are the same width whatever the logos measure and the feature column
 * takes the rest. The width is declared on the header AND the body cells: fixed
 * layout reads its tracks from the first row, and stating it in both places
 * means the table cannot drift if a thead is ever dropped again.
 * Nothing collapses or reflows on mobile — only the description line is dropped.
 *
 * CLASS PREFIX IS `vmg-compare`, NOT `compare-table`. A GenerateBlocks global
 * class of that name already exists — it is stored in the DB, not this theme
 * (`wp_options.generateblocks_style_css`), and it drives the older GB-built
 * comparison on Base 32335, Brightpearl, Cin7, Extensiv, Fishbowl, Sellercloud
 * and Veeqo:
 *
 *     .compare-table { display:grid; grid-template-columns:auto 1fr 1fr; margin-top:3rem }
 *
 * Naming this block's wrapper `compare-table` put that grid on it and squashed
 * the table into the first column. Grep the theme for a class before claiming it
 * — GB global classes are invisible to a codebase search.
 *
 * @package Voveo_Starter
 */

.vmg-compare {
	--compare-col: 200px;
	--compare-chip: 40px;
	--compare-glyph: 20px;
}

.vmg-compare__table {
	table-layout: fixed;
	width: 100%;
	border-collapse: collapse;
}

/* Header row — the two logos. --------------------------------------------- */

.vmg-compare__corner {
	/* Width left to auto so the feature column absorbs the remainder. */
	border: 0;
	padding: 0;
}

.vmg-compare__col {
	width: var(--compare-col);
	padding: 0 var(--spacing-12) var(--spacing-16);
	text-align: center;
	vertical-align: bottom;
}

/* The logo is sized by element, not by `.vmg-compare__logo`. Imagify's WebP
   delivery ("picture" method — the only one that works on WP Engine's nginx)
   wraps the <img> in a <picture> AND moves the img's class onto it, so the
   class can end up on either element. That matters here because the cap is a
   max-height: on a <picture> it constrains nothing, and the inner img would
   render at its intrinsic height and burst through the header row.

   So: the <picture>, when there is one, is a transparent pass-through, and the
   sizing lives on whatever <img> is inside it. Same fix as
   .carousel-slide__inner__image and .case-visual__logo. */
.vmg-compare__col picture {
	display: block;
	max-width: 100%;
	margin: 0 auto;
}

.vmg-compare__col img {
	display: block;
	max-width: 100%;
	max-height: 34px;
	width: auto;
	height: auto;
	margin: 0 auto;
	object-fit: contain;
	/* The reset rounds `picture img`; a logo has no box of its own to round. */
	border-radius: 0;
}

/* The blue rule spans the whole table, so it sits on the row rather than the
   cells — a border on the empty corner cell would break the line where
   border-collapse merges the edges. */
.vmg-compare__table thead tr {
	border-bottom: 1px solid var(--wp--preset--color--gray);
}

/* Feature rows. ----------------------------------------------------------- */

.vmg-compare__table tbody tr {
	border-bottom: 1px solid var(--wp--preset--color--light-gray);
}

.vmg-compare__feature {
	padding: var(--spacing-24) var(--spacing-24) var(--spacing-24) 0;
	text-align: left;
	vertical-align: middle;
	font-weight: var(--weight-regular, 400);
}

.vmg-compare__name {
	display: block;
	color: var(--wp--preset--color--dark-blue);
	font-size: 22px;
	font-weight: var(--weight-bold, 700);
	line-height: 1.25;
	text-wrap: pretty;
}

.vmg-compare__desc {
	display: block;
	margin-top: var(--spacing-4);
	color: var(--wp--preset--color--gray);
	font-size: 15px;
	font-weight: var(--weight-regular, 400);
	line-height: 1.4;
	text-wrap: pretty;
}

.vmg-compare__cell {
	width: var(--compare-col);
	padding: var(--spacing-24) var(--spacing-12);
	text-align: center;
	vertical-align: middle;
}

/* The marks — a scaled-down .icon-chip (50/24); rows are dense here. ------- */

.vmg-compare__mark {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--compare-chip);
	height: var(--compare-chip);
	border-radius: var(--wp--custom--radius--sm);
}

.vmg-compare__mark svg {
	width: var(--compare-glyph);
	height: var(--compare-glyph);
}

.vmg-compare__mark--yes {
	background-color: var(--wp--preset--color--green);
	color: var(--wp--preset--color--white);
}

.vmg-compare__mark--no {
	background-color: var(--wp--preset--color--light-gray);
	color: var(--wp--preset--color--gray);
}

/* Mobile — smaller, but still a table. ------------------------------------ */

@media (max-width: 781.98px) {

	.vmg-compare {
		--compare-col: 100px;
		--compare-chip: 32px;
		--compare-glyph: 16px;
	}

	.vmg-compare__col {
		padding: 0 var(--spacing-4) var(--spacing-12);
	}

	.vmg-compare__col img {
		max-height: 22px;
	}

	.vmg-compare__feature {
		padding: var(--spacing-16) var(--spacing-12) var(--spacing-16) 0;
	}

	.vmg-compare__name {
		font-size: 17px;
	}

	/* The second line goes; the columns stay. */
	.vmg-compare__desc {
		display: none;
	}

	.vmg-compare__cell {
		padding: var(--spacing-16) var(--spacing-4);
	}
}
