/* ==========================================================================
   PRODUCT INGREDIENTS — tiered grid (hero / feature / tag)
   Consumes the el-* token system.
   ========================================================================== */
.product-ingredients {
	--ing-media-bg: var(--el-color-bg-warm, #efe9da);
	--ing-line: var(--el-color-border, #ece7da);
}

.product-ingredients .ingredients__intro {
	margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}

.product-ingredients .ingredients__eyebrow {
	margin: 0 0 var(--el-space-3);
}

/* Matches the section headings around it (homepage + PDP). */
.product-ingredients .ingredients__title {
	margin: 0 0 var(--el-space-3);
	font-family: var(--el-font-display);
	font-size: clamp(2rem, 4vw, 3rem);
	font-weight: var(--el-weight-bold);
	line-height: var(--el-leading-tight);
	letter-spacing: var(--el-tracking-tight);
	color: var(--el-color-text);
}

.product-ingredients .ingredients__lead {
	max-width: 60ch;
	margin: 0;
	font-size: var(--el-text-base);
	line-height: var(--el-leading-body);
	color: var(--el-color-text-soft);
}

/* --- grid --------------------------------------------------------------- */
.product-ingredients .ingredient-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: clamp(1rem, 2vw, 1.5rem);
}

.product-ingredients .ingredient {
	display: flex;
	flex-direction: column;
	min-width: 0;
	background: var(--ing-card, var(--el-color-bg-warm, #efe9da));
	border-radius: var(--el-radius-lg);
	overflow: hidden;
}

.product-ingredients .ingredient__media {
	aspect-ratio: 16 / 10;
	background: var(--ing-media-bg);
	overflow: hidden;
}

.product-ingredients .ingredient__img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none;
	object-fit: cover;
}

.product-ingredients .ingredient__body {
	padding: var(--el-space-4) var(--el-space-4) var(--el-space-5);
}

.product-ingredients .ingredient__name {
	margin: 0;
	font-family: var(--el-font-display);
	font-size: var(--el-text-lg);
	font-weight: var(--el-weight-bold);
	letter-spacing: var(--el-tracking-tight);
	color: var(--el-color-text);
}

.product-ingredients .ingredient__kicker {
	display: block;
	margin-bottom: var(--el-space-1);
	font-family: var(--el-font-display);
	font-size: var(--el-text-xs);
	font-weight: var(--el-weight-bold);
	letter-spacing: var(--el-tracking-eyebrow);
	text-transform: uppercase;
	color: var(--el-color-eyebrow, var(--el-ember-text, #b34628));
}

.product-ingredients .ingredient__detail {
	margin: var(--el-space-1) 0 0;
	font-size: var(--el-text-sm);
	font-weight: var(--el-weight-semibold);
	color: var(--el-color-eyebrow, var(--el-ember-text, #b34628));
}

.product-ingredients .ingredient__desc {
	margin: var(--el-space-2) 0 0;
	font-size: var(--el-text-sm);
	line-height: var(--el-leading-snug);
	color: var(--el-color-text-soft);
}

.product-ingredients .ingredient__desc p,
.product-ingredients .chip__tip p {
	margin: 0;
	font: inherit;
	color: inherit;
}

.product-ingredients .ingredient__desc p + p,
.product-ingredients .chip__tip p + p {
	margin-top: var(--el-space-2);
}

/* --- feature: image beside text --------------------------------------- */
.product-ingredients .ingredient--feature {
	display: grid;
	grid-template-columns: minmax(0, 42%) minmax(0, 1fr);
	min-height: 220px;
}

.product-ingredients .ingredient--feature.ingredient--no-image {
	grid-template-columns: minmax(0, 1fr);
}

.product-ingredients .ingredient--feature .ingredient__media {
	position: relative;
	aspect-ratio: auto;
	min-height: 100%;
}

/* Absolute so the photo's own height never stretches the card. */
.product-ingredients .ingredient--feature .ingredient__img {
	position: absolute;
	inset: 0;
}

.product-ingredients .ingredient--feature .ingredient__body {
	align-self: center;
	padding: var(--el-space-5);
}

/* --- hero: the image fills the card, text sits on a panel ------------- */
.product-ingredients .ingredient--hero {
	position: relative;
	min-height: 460px;
}

.product-ingredients .ingredient--hero .ingredient__media {
	position: absolute;
	inset: 0;
	aspect-ratio: auto;
}

.product-ingredients .ingredient--hero .ingredient__body {
	position: relative;
	margin: auto var(--el-space-5) var(--el-space-5);
	padding: var(--el-space-5) clamp(1.25rem, 2.4vw, 1.75rem);
	background: rgba(255, 255, 255, 0.94);
	border-radius: var(--el-radius);
}

/* Fit the overlay panel to its copy while retaining the image-edge inset. */
@media (min-width: 821px) {
	.product-ingredients .ingredient--hero:not(.ingredient--no-image) .ingredient__body {
		align-self: flex-start;
		width: fit-content;
		max-width: calc(100% - var(--el-space-5) * 2);
		box-sizing: border-box;
	}
}

.product-ingredients .ingredient--hero.ingredient--no-image {
	min-height: 0;
}

.product-ingredients .ingredient--hero.ingredient--no-image .ingredient__body {
	margin: 0;
	background: none;
	padding: clamp(1.5rem, 3vw, 2.25rem);
}

.product-ingredients .ingredient--hero .ingredient__name {
	font-size: clamp(22px, 2.6vw, 28px);
}

.product-ingredients .ingredient--hero .ingredient__desc {
	max-width: 52ch;
	font-size: var(--el-text-base);
	line-height: var(--el-leading-body);
}

/* --- layouts ------------------------------------------------------------
   split:      hero on the left spanning two rows, features stacked right;
               a 3rd/4th feature wraps underneath.
   hero-only:  one wide hero.
   (default):  features in two columns. */
.product-ingredients .ingredient-grid--split {
	grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
}

.product-ingredients .ingredient-grid--split .ingredient--hero {
	grid-row: span 2;
}

.product-ingredients .ingredient-grid--split.ingredient-grid--one-feature .ingredient--hero {
	grid-row: auto;
	min-height: 380px;
}

.product-ingredients .ingredient-grid--hero-only {
	grid-template-columns: minmax(0, 1fr);
}

.product-ingredients .ingredient-grid--hero-only .ingredient--hero {
	min-height: 420px;
}

/* --- tag row: "also contains" ------------------------------------------- */
.product-ingredients .ingredient-also {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--el-space-2);
	margin-top: clamp(1rem, 2vw, 1.5rem);
	padding: var(--el-space-4) var(--el-space-5);
	background: var(--el-color-surface, #fff);
	border: 1px solid var(--ing-line);
	border-radius: var(--el-radius-lg);
}

.product-ingredients .ingredient-also__lead {
	margin-right: var(--el-space-2);
	font-family: var(--el-font-mono, var(--el-font-display));
	font-size: var(--el-text-xs);
	letter-spacing: var(--el-tracking-eyebrow);
	text-transform: uppercase;
	color: var(--el-color-text-muted);
}

.product-ingredients .ingredient-also .chip {
	position: relative;
	padding: var(--el-space-1) var(--el-space-3);
	background: var(--el-color-bg-warm, #efe9da);
	border: 1px solid transparent;
	border-radius: var(--el-radius-pill);
	font-size: var(--el-text-sm);
	color: var(--el-color-text);
}

/* chips carrying a description */
.product-ingredients .chip--has-tip {
	cursor: help;
}

.product-ingredients .chip--has-tip:focus-visible {
	outline: 2px solid var(--el-pine-deep);
	outline-offset: 2px;
}

.product-ingredients .chip__tip {
	display: none;
	position: absolute;
	bottom: calc(100% + 10px);
	left: 50%;
	transform: translateX(-50%);
	z-index: 5;
	width: max-content;
	max-width: min(260px, 70vw);
	padding: var(--el-space-3) var(--el-space-4);
	background: var(--el-color-text, #1c1b17);
	color: var(--el-color-surface, #fcfbf7);
	font-size: var(--el-text-sm);
	line-height: var(--el-leading-snug);
	letter-spacing: normal;
	text-transform: none;
	white-space: normal;
	border-radius: var(--el-radius-sm, 8px);
	box-shadow: var(--el-shadow-hover);
	pointer-events: none;
}

.product-ingredients .chip__tip::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 6px solid transparent;
	border-top-color: var(--el-color-text, #1c1b17);
}

/* Reveal only where a real hover exists — touch devices get an inert chip. */
@media (hover: hover) and (pointer: fine) {
	.product-ingredients .chip--has-tip:hover .chip__tip,
	.product-ingredients .chip--has-tip:focus-visible .chip__tip {
		display: block;
	}
}

/* --- responsive --------------------------------------------------------- */
@media (max-width: 820px) {
	.product-ingredients .ingredient-grid,
	.product-ingredients .ingredient-grid--split {
		grid-template-columns: minmax(0, 1fr);
	}

	.product-ingredients .ingredient-grid--split .ingredient--hero {
		grid-row: auto;
	}

	/* Phones: hero image on top, text below it (no overlay). */
	.product-ingredients .ingredient--hero,
	.product-ingredients .ingredient-grid--hero-only .ingredient--hero,
	.product-ingredients .ingredient-grid--split.ingredient-grid--one-feature .ingredient--hero {
		min-height: 0;
	}

	.product-ingredients .ingredient--hero .ingredient__media {
		position: relative;
		inset: auto;
		aspect-ratio: 16 / 9;
	}

	.product-ingredients .ingredient--hero .ingredient__body {
		margin: 0;
		background: none;
		border-radius: 0;
	}

	.product-ingredients .ingredient--feature {
		min-height: 160px;
	}

	.product-ingredients .ingredient--feature.ingredient--no-image {
		min-height: 0;
	}

	.product-ingredients .ingredient--feature .ingredient__body {
		padding: var(--el-space-4);
	}
}

@media (max-width: 480px) {
	.product-ingredients .ingredient--hero .ingredient__media {
		aspect-ratio: 4 / 3;
	}
}

@media (prefers-reduced-motion: reduce) {
	.product-ingredients * {
		transition: none !important;
	}
}
