/* BoseVN Product Comparison — PDP comparison table.
 *
 * The geometry keeps the original Bose-style comparison layout, while
 * typography follows the local BoseVN design tokens.
 */

.bosevn-cmp {
	--cmp-ink: var( --bose-color-text-primary );
	--cmp-name: var( --bose-color-text-secondary );
	--cmp-price: var( --bose-color-text-primary );
	--cmp-list: var( --bose-color-status-error );
	--cmp-save: var( --bose-color-status-success );
	--cmp-rule: var( --bose-color-border-strong );
	--cmp-band: var( --bose-color-surface-subtle );
	--cmp-bg: var( --bose-color-surface-elevated );
	--cmp-swatch-empty: var( --bose-color-neutral-200 );
	--cmp-select-bg: var( --bose-color-surface-default );
	--cmp-select-ink: var( --bose-color-text-secondary );
	--cmp-select-border: var( --bose-color-border-default );
	--cmp-select-border-hover: var( --bose-color-border-strong );
	--cmp-row-label-size: var( --bose-font-size-sm );
	--cmp-row-label-line-height: var( --bose-line-height-normal );
	--cmp-cell-size: var( --bose-font-size-xs );
	--cmp-cell-line-height: var( --bose-line-height-normal );
	--cmp-band-size: var( --bose-font-size-sm );
	--cmp-band-line-height: var( --bose-line-height-normal );
	--cmp-name-size: var( --bose-font-size-lg );
	--cmp-name-line-height: var( --bose-line-height-tight );
	--cmp-price-size: var( --bose-font-size-lg );
	--cmp-price-line-height: var( --bose-line-height-normal );
	--cmp-save-size: var( --bose-font-size-sm );
	--cmp-select-size: var( --bose-font-size-sm );

	/* bose.com's grid inside the 1360px content box:
	 *   label 252 | current 276 | 72 | sibling 236 | 72 | sibling 236 | free
	 * The trailing free space is bose.com's own — its carousel keeps room for
	 * two more products it currently hides. The spacer column reproduces it.
	 */
	--cmp-gutter: calc( var( --bose-space-12 ) + var( --bose-space-6 ) );
	--cmp-card-w: calc( ( var( --bose-space-24 ) * 2 ) + var( --bose-space-12 ) + var( --bose-space-3 ) );
	--cmp-label-w: var( --cmp-card-w );
	--cmp-cur-w: calc( var( --cmp-card-w ) + var( --cmp-gutter ) + var( --bose-space-6 ) );
	--cmp-col-w: calc( var( --cmp-card-w ) + var( --cmp-gutter ) - var( --bose-space-4 ) );
	/* One value cell holds two 20px lines before the row grows — that is what
	   keeps all three columns' rules on the same baseline. */
	--cmp-row-h: calc( var( --bose-space-20 ) + var( --bose-space-2 ) + var( --bose-border-width-strong ) );

	--cmp-font-text: var( --bose-font-family-text );

	box-sizing: border-box;
	position: relative;
	width: 100%;
	max-width: 100%;
	margin: 0;
	padding: 0 var( --bose-space-4 );
	background-color: var( --cmp-bg );
	font-family: var( --cmp-font-text );
	color: var( --cmp-ink );
}

.bosevn-cmp *,
.bosevn-cmp *::before,
.bosevn-cmp *::after {
	box-sizing: border-box;
}

.bosevn-cmp .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect( 1px, 1px, 1px, 1px );
	clip-path: inset( 50% );
	white-space: nowrap;
}

/* ------------------------------------------------------------------ table */

.bosevn-cmp__viewport {
	/* bose.com's carousel wrapper; top matches bottom so the dropdowns don't
	   sit flush against the section edge. */
	padding: 48px 0;
	overflow: hidden;
}

/* `separate` (not `collapse`) so the band row can hold a transparent top
   border for its gap without swallowing the rule above it. */
.bosevn-cmp__table {
	width: 100%;
	table-layout: fixed;
	border-collapse: separate;
	border-spacing: 0;
}

/* Override the theme's faint striped-th tint. */
.bosevn-cmp .bosevn-cmp__table th,
.bosevn-cmp .bosevn-cmp__table td {
	background-color: transparent;
	text-align: left;
	vertical-align: top;
	border: 0;
}

/* Column widths live on the header row — table-layout:fixed reads them there. */
.bosevn-cmp .bosevn-cmp__table thead th {
	/* bose.com's tile carries a 4px lead-in; the gutter belongs to the column,
	   so a sibling card ends up 236px wide and the current one 276px. */
	padding: 4px var( --cmp-gutter ) 0 0;
	/* Elementor's reset.css rules the first header row with the *logical*
	   `border-block-start`, which Chrome resolves against our physical
	   `border: 0` by declaration order rather than specificity — hence the
	   !important. Without it a stray hairline sits above the product cards. */
	border: 0 !important;
}

.bosevn-cmp__corner {
	width: var( --cmp-label-w );
}

.bosevn-cmp__table thead .bosevn-cmp__col.is-current {
	width: var( --cmp-cur-w );
}

.bosevn-cmp__table thead .bosevn-cmp__col {
	width: var( --cmp-col-w );
}

/* No width: table-layout:fixed hands it whatever the fixed columns leave. */
.bosevn-cmp__spacer {
	padding: 0;
}

/* -------------------------------------------------------- attribute rows */

.bosevn-cmp__table tbody tr:not( .bosevn-cmp__band ) {
	height: var( --cmp-row-h );
}

.bosevn-cmp .bosevn-cmp__table tbody th,
.bosevn-cmp .bosevn-cmp__table tbody td {
	/* 17/16 (not 16/16) reproduces bose.com's 90px single-line row pitch. */
	padding: 17px 0 16px;
	border-bottom: 1px solid var( --cmp-rule );
}

.bosevn-cmp .bosevn-cmp__table tbody th.bosevn-cmp__rowlabel {
	padding-right: 12px;
	font-family: var( --cmp-font-text, inherit );
	font-size: var( --cmp-row-label-size );
	line-height: var( --cmp-row-label-line-height );
	font-weight: var( --bose-font-weight-semibold );
	color: var( --cmp-ink );
}

.bosevn-cmp .bosevn-cmp__table td.bosevn-cmp__cell {
	padding-right: var( --cmp-gutter );
	font-family: var( --cmp-font-text, inherit );
	font-size: var( --cmp-cell-size );
	line-height: var( --cmp-cell-line-height );
	font-weight: var( --bose-font-weight-regular );
	text-align: left;
	color: var( --cmp-ink );
}

/* ------------------------------------------------------------ group bands */

.bosevn-cmp .bosevn-cmp__table th.bosevn-cmp__bandcell {
	background-color: var( --cmp-band );
	/* The gap above a band is a transparent border so the tint stops at the
	   padding box and the rule from the row above still shows. */
	border: 0;
	border-top: 16px solid transparent;
	background-clip: padding-box;
	padding: 16px 40px;
	font-size: var( --cmp-band-size );
	line-height: var( --cmp-band-line-height );
	font-weight: var( --bose-font-weight-semibold );
	font-family: var( --cmp-font-text, inherit );
	letter-spacing: var( --bose-tracking-normal );
	text-transform: uppercase;
	color: var( --cmp-ink );
	border-radius: 0;
}

/* The first band clears the product cards by 38px, later ones by 16px. */
.bosevn-cmp__table tbody tr.bosevn-cmp__band:first-child .bosevn-cmp__bandcell {
	border-top-width: 38px;
}

/* Everything but the gap is inherited on purpose: bose.com lets the glyph size
   itself off the band's own font, and that inline box is what gives the band
   its exact height. */
.bosevn-cmp__bandicon {
	margin-right: 16px;
	color: var( --cmp-ink );
}

/* -------------------------------------------------------------- head card */

.bosevn-cmp__card {
	display: block;
	color: var( --cmp-name );
}

.bosevn-cmp__imglink {
	display: block;
}

.bosevn-cmp__slotcard {
	width: 100%;
	max-width: var( --cmp-card-w );
}

/* Two classes deep so it outranks Elementor's `.elementor img { height: auto }`. */
.bosevn-cmp .bosevn-cmp__img {
	display: block;
	width: 100%;
	/* A fixed box, not an aspect ratio: bose.com keeps 189px on desktop *and*
	   tablet even though the card narrows from 252 to 208. */
	height: 189px;
	object-fit: contain;
	margin: 0 0 8px;
}

.bosevn-cmp__name {
	display: block;
	min-height: calc( var( --cmp-name-size ) * var( --cmp-name-line-height ) * 3 );
	margin-top: var( --bose-space-4 );
	font-family: var( --cmp-font-text, inherit );
	font-size: var( --cmp-name-size );
	line-height: var( --cmp-name-line-height );
	font-weight: var( --bose-font-weight-semibold );
	text-align: center;
	text-decoration: none;
	color: var( --cmp-name );
}

.bosevn-cmp__card:hover .bosevn-cmp__name {
	text-decoration: underline;
}

/* WooCommerce emits <del>original</del> <ins>sale</ins>; bose.com shows the
   sale price first, so reorder rather than rebuild the price HTML. */
.bosevn-cmp__price {
	display: flex;
	justify-content: center;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 0 8px;
	/* The price is the last thing in the card. The 50px below is what the
	   removed Shop Now block used to contribute — it sets the distance from the
	   cards down to the first group band. */
	margin: 6px 0 50px;
	font-family: var( --cmp-font-text, inherit );
	font-size: var( --cmp-price-size );
	line-height: var( --cmp-price-line-height );
	letter-spacing: var( --bose-tracking-normal );
	font-weight: var( --bose-font-weight-semibold );
	color: var( --cmp-price );
}

/* Same emphasis as the PDP hero and the sticky bar: the active price is bold
   and carries the primary ink, the original is a lighter red strike. Only the
   scale differs between the three — the relationship must not. */
.bosevn-cmp__price ins,
.bosevn-cmp__price ins .woocommerce-Price-amount {
	order: 1;
	text-decoration: none;
	background: none;
	font-weight: var( --bose-font-weight-semibold );
	color: var( --cmp-ink );
}

.bosevn-cmp__price del,
.bosevn-cmp__price del .woocommerce-Price-amount {
	order: 2;
	margin: 0;
	opacity: 1;
	font-weight: 500;
	color: var( --cmp-list );
	text-decoration-color: var( --cmp-list );
}

/* A column with no discount has no <ins> — WooCommerce prints the amount bare,
   and it is still the active price, so it gets the same weight. */
.bosevn-cmp__price > .woocommerce-Price-amount {
	font-weight: var( --bose-font-weight-semibold );
	color: var( --cmp-ink );
}

.bosevn-cmp__save {
	order: 3;
	font-size: var( --cmp-save-size );
	line-height: var( --cmp-price-line-height );
	font-weight: var( --bose-font-weight-semibold );
	letter-spacing: var( --bose-tracking-normal );
	color: var( --cmp-save );
}

.bosevn-cmp__save-pct {
	font-weight: 400;
}

.bosevn-cmp__save .woocommerce-Price-amount {
	color: inherit;
}

/* Centred like the name and price under it; wraps instead of clipping so a
   product with many colours still shows them all. */
.bosevn-cmp__swatches {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin: 0 auto;
	padding: 8px 0;
}

/* Inner white ring + hairline outer ring, so light colours (white, silver,
   sandstone) still read as a chip on the white card. */
.bosevn-cmp__swatch {
	flex: 0 0 28px;
	width: 28px;
	height: 28px;
	box-sizing: border-box;
	border-radius: 50%;
	border: 2px solid var( --bose-color-surface-default );
	box-shadow: 0 0 0 1px rgba( 0, 0, 0, 0.16 );
	background: var( --cmp-swatch-empty );
}

/* Swatches with a colour image are buttons that swap the card thumbnail. */
button.bosevn-cmp__swatch {
	padding: 0;
	cursor: pointer;
	transition: box-shadow 0.15s ease;
}

button.bosevn-cmp__swatch:hover,
button.bosevn-cmp__swatch:focus-visible {
	box-shadow: 0 0 0 1px var( --cmp-ink );
	outline: none;
}

button.bosevn-cmp__swatch.is-active {
	box-shadow: 0 0 0 2px var( --cmp-ink );
}

/* --------------------------------------------------------- slot dropdowns */

.bosevn-cmp__slotselect {
	position: relative;
	display: block;
	width: 100%;
	max-width: var( --cmp-card-w );
	margin: 0 0 24px;
	min-height: 46px;
}

/* Thin chevron, above the select and the fade. */
.bosevn-cmp__slotselect:not( .bosevn-cmp__slotselect--spacer )::before {
	content: "";
	position: absolute;
	top: 50%;
	right: 12px;
	width: 14px;
	height: 8px;
	transform: translateY( -50% );
	background: url( "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8' viewBox='0 0 13 8'%3E%3Cpath fill='none' stroke='%233e474a' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6.5 6.5 12 1.5'/%3E%3C/svg%3E" ) no-repeat center / contain;
	pointer-events: none;
	z-index: 2;
}

/* Fade long product names out toward the chevron, as bose.com does. */
.bosevn-cmp__slotselect:not( .bosevn-cmp__slotselect--spacer )::after {
	content: "";
	position: absolute;
	top: 1px;
	bottom: 1px;
	right: 2px;
	width: 100px;
	border-radius: 0 4px 4px 0;
	background: linear-gradient( 90deg, rgba( 255, 255, 255, 0 ) 0, #fff 66%, #fff );
	pointer-events: none;
	z-index: 1;
}

.bosevn-cmp__select {
	position: relative;
	z-index: 0;
	display: block;
	width: 100%;
	height: 46px;
	padding: 0 51px 0 16px;
	border: 1px solid var( --cmp-select-border );
	border-radius: 4px;
	background: var( --cmp-select-bg );
	font-family: var( --cmp-font-text );
	font-size: var( --cmp-select-size );
	font-weight: 400;
	font-style: normal;
	color: var( --cmp-select-ink );
	line-height: 26px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: clip;
	cursor: pointer;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	outline: none;
}

.bosevn-cmp__select:hover {
	border-color: var( --cmp-select-border-hover );
}

.bosevn-cmp__select:focus-visible {
	border-color: var( --cmp-select-ink );
	box-shadow: 0 0 0 1px var( --cmp-select-ink );
}

/* ====================================================== tablet (≤991px) ===
 * bose.com drops the dedicated label column: the label stacks above the first
 * product's value, and the sibling columns reserve the same height so every
 * row's rule stays on one line. Columns become equal thirds.
 */

@media ( max-width: 991px ) {

	.bosevn-cmp {
		--cmp-gutter: var( --bose-space-4 );
		margin: 0 0 80px;
		padding: 0 40px;
	}

	/* Below 992 the cards become grid rows and the band's own 44px top border
	   provides the separation, so drop the desktop tail under the price. */
	.bosevn-cmp__price {
		margin-bottom: 0;
	}

	/* Out of table layout entirely: the rows become grids below, and leaving the
	   table algorithm on lets it size itself past the container. */
	.bosevn-cmp__table,
	.bosevn-cmp__table thead,
	.bosevn-cmp__table tbody,
	.bosevn-cmp__table tbody tr.bosevn-cmp__band,
	.bosevn-cmp .bosevn-cmp__table th.bosevn-cmp__bandcell {
		display: block;
		width: 100%;
	}

	.bosevn-cmp__table thead .bosevn-cmp__corner,
	.bosevn-cmp__spacer {
		display: none;
	}

	.bosevn-cmp__table thead tr {
		display: flex;
		gap: 0;
	}

	.bosevn-cmp .bosevn-cmp__table thead .bosevn-cmp__col,
	.bosevn-cmp .bosevn-cmp__table thead .bosevn-cmp__col.is-current {
		flex: 1 1 0;
		min-width: 0;
		width: auto;
		padding: 4px var( --cmp-gutter ) 0 0;
	}

	.bosevn-cmp__slotcard,
	.bosevn-cmp__slotselect {
		max-width: none;
	}

	/* Label on row 1 over the first column; the three values share row 2. The
	   sibling columns simply have no row-1 cell, which is how bose.com keeps
	   every column's rule on the same baseline. */
	.bosevn-cmp__table tbody tr:not( .bosevn-cmp__band ) {
		display: grid;
		grid-template-columns: repeat( 3, 1fr );
		height: auto;
		border-bottom: 1px solid var( --cmp-rule );
	}

	.bosevn-cmp .bosevn-cmp__table tbody th.bosevn-cmp__rowlabel {
		grid-column: 1;
		grid-row: 1;
		padding: 16px 12px 16px 3px;
		border-bottom: 0;
	}

	.bosevn-cmp .bosevn-cmp__table tbody td.bosevn-cmp__cell {
		grid-row: 2;
		/* 76px of text + the 16px below it; border-box makes this the total. */
		min-height: 92px;
		padding: 0 12px 16px 0;
		border-bottom: 0;
	}

	.bosevn-cmp .bosevn-cmp__table th.bosevn-cmp__bandcell {
		display: block;
		border-top-width: 44px;
		padding: var( --bose-space-3, 12px ) 12px;
	}

	.bosevn-cmp__table tbody tr.bosevn-cmp__band:first-child .bosevn-cmp__bandcell {
		border-top-width: 44px;
	}

	.bosevn-cmp__bandicon {
		margin-right: 8px;
	}

	.bosevn-cmp__name {
		min-height: calc( var( --cmp-name-size ) * var( --cmp-name-line-height ) * 2 );
	}

}

/* ====================================================== mobile (≤767px) ===
 * Two columns, 16px gutters, and a lighter type ramp.
 */

@media ( max-width: 767px ) {

	.bosevn-cmp {
		/* bose.com narrows its own gutter to 16px here, matching the shell's. */
		padding: 0 16px;
	}

	.bosevn-cmp__viewport {
		padding: 32px 0;
	}

	/* Third column drops; bose.com compares two products on a phone. */
	.bosevn-cmp__table [data-bosevn-slot="2"] {
		display: none;
	}

	.bosevn-cmp__table tbody tr:not( .bosevn-cmp__band ) {
		grid-template-columns: repeat( 2, 1fr );
	}

	.bosevn-cmp .bosevn-cmp__table tbody th.bosevn-cmp__rowlabel {
		padding: 16px 12px 8px 3px;
	}

	.bosevn-cmp .bosevn-cmp__table tbody td.bosevn-cmp__cell {
		min-height: 80px;
		padding: 0 3px 16px 0;
	}

	.bosevn-cmp .bosevn-cmp__table th.bosevn-cmp__bandcell,
	.bosevn-cmp__table tbody tr.bosevn-cmp__band:first-child .bosevn-cmp__bandcell {
		border-top-width: 32px;
	}

	.bosevn-cmp__select {
		padding: 0 40px 0 16px;
	}

	/* bose.com's phone card is 148px inside a 156px column. */
	.bosevn-cmp__slotcard,
	.bosevn-cmp__slotselect {
		max-width: 148px;
	}

	.bosevn-cmp .bosevn-cmp__img {
		height: 170px;
		margin-bottom: 0;
	}

	.bosevn-cmp__name {
		min-height: calc( var( --cmp-name-size ) * var( --cmp-name-line-height ) * 3 );
		margin-top: 20px;
		letter-spacing: var( --bose-tracking-normal );
		text-align: left;
		color: var( --cmp-ink );
	}

	.bosevn-cmp__price {
		justify-content: flex-start;
		margin-top: 16px;
	}

	.bosevn-cmp__swatch {
		flex: 0 0 22px;
		width: 22px;
		height: 22px;
	}

	/* Name and price go left on phones; the swatches follow them. */
	.bosevn-cmp__swatches {
		justify-content: flex-start;
		gap: 6px;
		padding: 4px 1px;
	}

}

@media ( min-width: 768px ) {

	.bosevn-cmp {
		--cmp-row-label-size: var( --bose-font-size-md );
		--cmp-cell-size: var( --bose-font-size-md );
		--cmp-band-size: var( --bose-font-size-md );
		--cmp-save-size: var( --bose-font-size-md );
		--cmp-select-size: var( --bose-font-size-md );
		padding: 0 40px;
	}

}
