/* Diwan Canada – Book Titles */

/* Book cards: every card keeps the same space for the title (two lines) and for the
   author (one line), so authors and prices line up across each row whatever the
   length of the title. A longer title is cut with "…" and shown in full on hover and
   on the book page. Titles stay centred in every language. */
.woocommerce ul.products li.product .woocommerce-loop-product__link > .woocommerce-loop-product__title,
ul.products li.product .woocommerce-loop-product__link > .woocommerce-loop-product__title {
	--dwt-lh: 1.4;
	line-height: var(--dwt-lh);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;
	height: calc(2em * var(--dwt-lh));
	margin-bottom: 0;
	text-align: center;
	overflow-wrap: anywhere;
}

.woocommerce ul.products li.product .woocommerce-loop-product__link > .cs-card-authors,
ul.products li.product .woocommerce-loop-product__link > .cs-card-authors {
	display: block;
	min-height: 1.5em;
	line-height: 1.5;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	text-align: center;
}

/* Narrow cards (phones, and the four-column grid beside the filters): three lines
   before the title is cut. Every card in a row has the same width, so they all
   keep the same space and still line up. */
ul.products li.product > .woocommerce-loop-product__link {
	container: dwt-card / inline-size;
}
@container dwt-card (max-width: 230px) {
	.woocommerce ul.products li.product .woocommerce-loop-product__link > .woocommerce-loop-product__title,
	ul.products li.product .woocommerce-loop-product__link > .woocommerce-loop-product__title {
		-webkit-line-clamp: 3;
		line-clamp: 3;
		height: calc(3em * var(--dwt-lh));
	}
}

/* A single column (some phone layouts) has no row to line up with: no reserved
   space, the title just stops after two lines (three on narrow cards). */
.woocommerce ul.products[data-dwt-cols="1"] li.product .woocommerce-loop-product__link > .woocommerce-loop-product__title,
ul.products[data-dwt-cols="1"] li.product .woocommerce-loop-product__link > .woocommerce-loop-product__title {
	height: auto;
}
.woocommerce ul.products[data-dwt-cols="1"] li.product .woocommerce-loop-product__link > .cs-card-authors,
ul.products[data-dwt-cols="1"] li.product .woocommerce-loop-product__link > .cs-card-authors {
	min-height: 0;
}

/* Book page and Quick View: direction comes from the title's own text; the
   alignment the theme gives these headings is kept. */
.single-product__title[dir],
[class*="product-modal__title"][dir] {
	unicode-bidi: isolate;
}
