/*
 * Brochures, front end.
 * Colours and fonts come from the Elementor site kit (--e-global-*), so the tiles follow the
 * brand automatically. The values after each comma are only fallbacks, copied from the live
 * product tiles on the category pages.
 */
.flab {
	--flab-cols: 3;
	--flab-col-gap: 6rem;
	--flab-row-gap: 40px;
	--flab-cover-w: 200px;
}

.flab__heading {
	margin: 8px 0 16px;
	color: var(--e-global-color-primary, #404040);
	font-family: var(--e-global-typography-primary-font-family, "Lato"), sans-serif;
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.2;
}

.flab__grid {
	display: grid;
	grid-template-columns: repeat(var(--flab-cols), minmax(0, 1fr));
	column-gap: var(--flab-col-gap);
	row-gap: var(--flab-row-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.flab__item { margin: 0; padding: 0; }
.flab__item::before { content: none; } /* in case a theme adds list bullets */

.flab__tile {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	color: inherit;
	text-decoration: none;
}
.flab__tile:hover,
.flab__tile:focus { text-decoration: none; }
.flab__tile:focus-visible {
	outline: 3px solid var(--e-global-color-accent, #E72B2D);
	outline-offset: 4px;
}

/* A4 portrait cover with a hairline border so white covers still read as a page. */
.flab__cover {
	display: block;
	width: var(--flab-cover-w);
	max-width: 100%;
	aspect-ratio: 1 / 1.414;
	overflow: hidden;
	background: #f3f3f4;
	box-shadow: 0 0 0 1px #d8d9db;
	transition: box-shadow .2s ease;
}
.flab__cover img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: top center;
}
.flab__tile:hover .flab__cover { box-shadow: 0 0 0 1px #d8d9db, 0 6px 18px rgba(0, 0, 0, .12); }
.flab__cover--empty {
	display: grid;
	place-items: center;
	color: var(--e-global-color-secondary, #626262);
}

/* Same style as .woocommerce-loop-product__title on the category pages. */
.flab__title {
	display: block;
	padding: 7px 0;
	margin-top: 8px;
	color: var(--e-global-color-secondary, #626262);
	font-family: var(--e-global-typography-secondary-font-family, "Roboto"), sans-serif;
	font-size: 0.875rem;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 1.8px;
	text-transform: capitalize;
}

/* Same style as the red underlined "Learn more" link on the product tiles. */
.flab__more {
	display: inline-block;
	color: var(--e-global-color-accent, #E72B2D);
	font-family: var(--e-global-typography-accent-font-family, "Lato"), sans-serif;
	font-size: var(--e-global-typography-accent-font-size, 1rem);
	font-weight: var(--e-global-typography-accent-font-weight, 700);
	text-decoration: underline;
}
.flab__tile:hover .flab__more { color: var(--e-global-color-text, #000000); }

/* Fallbacks for the [brochures] shortcode (the Elementor widget sets these itself). */
@media (max-width: 1024px) { .flab { --flab-col-gap: 16px; } }
@media (max-width: 767px)  { .flab { --flab-cols: 2; --flab-col-gap: 22px; --flab-row-gap: 22px; --flab-cover-w: 80%; } }

/*
 * Give the Elementor container that holds the "Brochures" heading and the widget the CSS class
 * "flab-section". If no list is ticked for the page, the whole container hides, so the heading
 * never shows on its own. Not applied inside the Elementor editor, so the section stays editable.
 */
body:not(.elementor-editor-active) .flab-section:not(:has(.flab__tile)) { display: none !important; }
