/**
 * Ingredient directory, article and product-card styling.
 *
 * The active-ingredients block follows the owner's Figma product page; see docs/design-system.md in
 * the hub. Values are exposed as custom properties with the measured fallback, so a theme can
 * retheme the block by defining the properties once.
 */

.slavic-ingredients-directory,
.slavic-active-ingredients,
.slavic-ingredient-products,
.slavic-ingredient-author {
	--si-ink: var(--slavic-ink, #04384d);
	--si-surface: var(--slavic-surface, #f9f9f9);
	--si-line: var(--slavic-line, #cfcfcf);
	--si-page: var(--slavic-page, #ffffff);
	--si-font: var(--slavic-font-body, "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif);
	--si-display: var(--slavic-font-display, "Nata Sans", var(--si-font));
	--si-radius: var(--slavic-radius-small, 10px);
	--si-radius-large: var(--slavic-radius-large, 20px);
	--si-radius-media: var(--slavic-radius-exception, 7px);
	font-family: var(--si-font);
	color: var(--si-ink);
}

/* Directory and related products -------------------------------------------- */

/* Lengths are in pixels, never rem: a plugin's layout must not depend on the host theme's root
   font size, and these values come from a pixel design. */
.slavic-ingredients-directory { max-width: 1200px; margin: 32px auto; padding: 0 20px; }
.slavic-ingredients-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 20px; margin-block: 24px; }
.slavic-ingredient-tile,
.slavic-ingredient-product {
	padding: 8px;
	border: 0.5px solid var(--si-line);
	border-radius: var(--si-radius);
	background: var(--si-page);
}
.slavic-ingredient-tile h2,
.slavic-ingredient-product h3 { margin: 12px 0 4px; padding: 0 8px; font-size: 16px; font-weight: 700; line-height: 20px; }
.slavic-ingredient-tile p { margin: 0 0 8px; padding: 0 8px; font-size: 14px; font-weight: 300; line-height: 21px; }
.slavic-ingredients-grid img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: var(--si-radius-media); }
.slavic-ingredient-link { color: inherit; text-decoration: underline; text-underline-offset: .15em; }

/* Active ingredients on a product page --------------------------------------- */

.slavic-active-ingredients {
	margin-block: 24px;
	padding: 46px 20px 24px;
	border: 0;
	border-radius: var(--si-radius-large);
	background: var(--si-surface);
}

.slavic-active-ingredients > h2 {
	margin: 0 0 36px;
	font-family: var(--si-display);
	font-size: 36px;
	font-weight: 700;
	line-height: 1.2;
	color: var(--si-ink);
}

/* The design pairs the heading with an optional intro: 26px between the two, then 36px to the cards.
   Browsers without :has() simply keep the 36px heading gap, which is the no-intro layout. */
.slavic-active-ingredients > h2:has(+ .slavic-active-ingredients-intro) {
	margin-bottom: 26px;
}

.slavic-active-ingredients-intro {
	max-width: 620px;
	margin: 0 0 36px;
	font-size: 16px;
	font-weight: 300;
	line-height: 20px;
	color: var(--si-ink);
}

.slavic-ingredient-cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
	gap: 20px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.slavic-ingredient-card {
	display: flex;
	flex-direction: column;
	gap: 22px;
	padding: 8px;
	border: 0.5px solid var(--si-line);
	border-radius: var(--si-radius);
	background: var(--si-page);
}

.slavic-ingredient-card-image {
	display: block;
	line-height: 0;
}

.slavic-ingredient-card-image img {
	width: 100%;
	height: auto;
	aspect-ratio: 330 / 274;
	object-fit: cover;
	border-radius: var(--si-radius-media);
}

.slavic-ingredient-card-body {
	display: flex;
	flex-direction: column;
	gap: 20px;
	padding: 10px 22px 10px 16px;
}

.slavic-ingredient-card-title {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	line-height: 24px;
}

.slavic-ingredient-card-title .slavic-ingredient-link {
	display: inline-flex;
	align-items: baseline;
	gap: 8px;
	text-decoration: none;
}

.slavic-ingredient-card-title .slavic-ingredient-link::after {
	content: "↗";
	font-size: 0.85em;
	line-height: 1;
}

.slavic-ingredient-card-title .slavic-ingredient-link:hover,
.slavic-ingredient-card-title .slavic-ingredient-link:focus-visible {
	text-decoration: underline;
}

.slavic-ingredient-card-latin {
	margin: -12px 0 0;
	font-size: 14px;
	font-weight: 300;
	line-height: 19px;
	color: var(--si-ink);
}

.slavic-ingredient-benefits {
	display: flex;
	flex-direction: column;
	gap: 16px;
	margin: 0;
	padding-inline-start: 20px;
	font-size: 14px;
	font-weight: 400;
	line-height: 19px;
}

/* Article footer and pagination ---------------------------------------------- */

.slavic-ingredient-author { display: flex; align-items: center; gap: 16px; margin-block-start: 32px; padding-block-start: 16px; border-top: 0.5px solid var(--si-line); }
.slavic-ingredient-author img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; }
.slavic-ingredient-author-name { font-weight: 700; }
.slavic-ingredients-pagination ul { display: flex; flex-wrap: wrap; gap: 16px; padding: 0; list-style: none; }
.slavic-ingredients-directory a:focus-visible,
.slavic-active-ingredients a:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
