/* Product overview: a focused gallery beside a database-driven product summary. */
.kh-breadcrumb li:not( :last-child )::after {
	content: '>';
}

.kh-product-page__hero {
	align-items: stretch;
	gap: clamp( 2rem, 4vw, 4rem );
	grid-template-columns: minmax( 0, 1.08fr ) minmax( 20rem, .92fr );
}

.kh-product-gallery__display {
	align-items: start;
	grid-template-columns: 5.4rem minmax( 0, 1fr );
}

.kh-product-gallery__main {
	background:
		radial-gradient( circle at 86% 9%, rgba( 96, 134, 95, .18 ), transparent 35% ),
		linear-gradient( 145deg, #f6f4eb, #edf2e9 );
	border: 1px solid rgba( 44, 77, 55, .1 );
	border-radius: 1.2rem;
}

.kh-product-gallery__main-image {
	aspect-ratio: 1 / 1;
	transform: scale(1);
	transform-origin: center;
}

.kh-product-gallery__thumbnail {
	align-items: center;
	background: var( --kh-paper ) !important;
	border-radius: .85rem;
	box-sizing: border-box;
	display: flex;
	flex: 0 0 5.4rem;
	justify-content: center;
	min-height: 5.4rem;
	padding: .3rem;
	width: 100%;
}

.kh-product-gallery__thumbnail img {
	display: block;
	height: 100%;
	max-height: 4.75rem;
	max-width: 100%;
	object-fit: contain;
	width: 100%;
}

/* A selected image is communicated by its forest border alone.  This also
 * neutralises the browser/theme focus fill that appears after a click. */
.kh-product-gallery__thumbnail.is-active,
.kh-product-gallery__thumbnail:focus,
.kh-product-gallery__thumbnail:focus-visible {
	background: var( --kh-paper ) !important;
	border-color: var( --kh-forest ) !important;
	box-shadow: none !important;
	outline: 0;
}

.kh-product-gallery__thumbnails {
	align-items: center;
	box-sizing: border-box;
	min-width: 0;
	width: 100%;
}

@media (min-width: 783px) {
	/* Keep the product visual in view while the longer product information is read. */
	.kh-product-gallery {
		align-self: start;
		position: sticky;
		top: 1.5rem;
	}
}

.kh-product-summary {
	align-self: stretch;
	display: flex;
}

.kh-product-summary__inner {
	display: flex;
	flex: 1;
	flex-direction: column;
	padding: clamp( .5rem, 1.5vw, 1.3rem ) 0;
}

.kh-product-summary__category {
	align-self: flex-start;
	background: #edf2e9;
	border-radius: 999px;
	color: var( --kh-forest );
	font-size: .82rem;
	font-weight: 700;
	line-height: 1;
	margin: 0 0 1.1rem;
	padding: .62rem .95rem;
	text-decoration: none;
}

.kh-product-summary__category:hover,
.kh-product-summary__category:focus-visible {
	background: #dfeadd;
	color: var( --kh-forest );
}

.kh-product-summary h1 {
	font-size: clamp( 1.9rem, 3.3vw, 3.2rem );
	line-height: 1.1;
	margin: 0;
}

.kh-product-summary__excerpt {
	border-bottom: 1px solid var( --kh-line );
	color: var( --kh-muted );
	font-size: clamp( 1rem, 1.35vw, 1.13rem );
	line-height: 1.6;
	margin-top: 1rem;
	padding-bottom: 1.45rem;
}

.kh-product-summary__excerpt p {
	margin: 0;
}

.kh-product-summary__details {
	border-bottom: 1px solid var( --kh-line );
	padding-block: 1.25rem;
}

.kh-product-summary__details dl {
	display: grid;
	gap: .72rem;
	margin: 0;
}

.kh-product-summary__details dl > div {
	display: grid;
	gap: 1rem;
	grid-template-columns: minmax( 6.75rem, .34fr ) minmax( 0, 1fr );
}

.kh-product-summary__details dt {
	color: var( --kh-ink );
	font-size: .88rem;
	font-weight: 700;
}

.kh-product-summary__details dd {
	color: var( --kh-muted );
	font-size: .9rem;
	margin: 0;
}

.kh-product-summary__cta {
	margin-top: 1.45rem;
}

.kh-product-summary__cta .wp-block-button__link {
	border-radius: 999px;
	padding: .82rem 1.4rem;
}

.kh-product-summary__mechanism {
	border-bottom: 1px solid var(--kh-line);
	color: var(--kh-muted);
	line-height: 1.65;
	padding-block: 1.25rem;
}

.kh-product-summary__mechanism h2 {
	color: var(--kh-ink);
	font-size: 1.05rem;
	margin: 0 0 .65rem;
}

.kh-product-summary__mechanism :is(p, ul, ol) {
	margin: 0 0 .8rem;
}

.kh-product-summary__mechanism :is(p, ul, ol):last-child {
	margin-bottom: 0;
}

.kh-product-composition__context {
	display: grid;
	gap: 1.4rem;
	margin: 1.5rem 0;
}

.kh-product-composition__context > div {
	border-top: 1px solid var( --kh-line );
	padding-top: 1rem;
}

.kh-product-composition h2.kh-product-composition__section-title {
	color: var(--kh-forest);
	font-size: clamp(1.3rem, 2vw, 1.6rem);
	line-height: 1.2;
	margin: 0 0 .65rem;
}

.kh-product-composition .kh-product-composition__heading--table {
	margin: 2rem 0 0;
}

.kh-product-composition__heading--table .kh-product-composition__section-title {
	margin-bottom: 0;
}

.kh-product-composition__context :is( p, ul, ol ) {
	color: var( --kh-muted );
	line-height: 1.6;
}

.kh-product-composition__context :is( p, ul, ol ):last-child {
	margin-bottom: 0;
}

.kh-product-composition__details {
	border-block: 1px solid var(--kh-line);
	margin: 1.5rem 0;
	padding-block: 1.15rem;
}

.kh-product-composition__details dl {
	display: grid;
	gap: .72rem;
	margin: 0;
}

.kh-product-composition__details dl > div {
	display: grid;
	gap: 1rem;
	grid-template-columns: minmax(7rem, .26fr) minmax(0, 1fr);
}

.kh-product-composition__details dt {
	color: var(--kh-ink);
	font-size: .9rem;
	font-weight: 700;
}

.kh-product-composition__details dd {
	color: var(--kh-muted);
	margin: 0;
}

.kh-product-composition__intro {
	color: var(--kh-muted);
	font-weight: 600;
	margin: 1.5rem 0 .75rem;
}

/* Keep all four composition columns inside the content width, even on phones. */
.kh-product-composition__table-wrap {
	background: linear-gradient(145deg, #fff 0%, #fbfdf9 100%);
	border: 1px solid rgba(46, 106, 79, .18);
	border-radius: 1rem;
	box-shadow: 0 .8rem 2rem rgba(19, 59, 43, .07);
	overflow-x: hidden;
	width: 100%;
}

.kh-product-composition table {
	min-width: 0;
	table-layout: fixed;
	width: 100%;
}

.kh-product-composition :is( th, td ) {
	overflow-wrap: anywhere;
	padding: clamp( .55rem, 2.4vw, 1rem );
	word-break: normal;
}

.kh-product-composition thead th {
	background: linear-gradient(105deg, #eaf3eb 0%, #f7faf5 100%);
	border-bottom: 1px solid rgba(46, 106, 79, .18);
	color: var(--kh-forest);
	font-size: .76rem;
	font-weight: 800;
	letter-spacing: .07em;
	text-transform: uppercase;
}

.kh-product-composition tbody tr {
	transition: background-color .28s ease;
}

.kh-product-composition tbody tr:nth-child(even) {
	background: rgba(234, 243, 235, .42);
}

.kh-product-composition tbody tr:hover {
	background: #eef6ef;
}

.kh-product-composition__scientific {
	color: var(--kh-muted);
	font-style: italic;
}

.kh-product-composition__quantity {
	color: var(--kh-forest);
	font-weight: 700;
	white-space: nowrap;
}

@media ( max-width: 782px ) {
	.kh-product-page__hero {
		grid-template-columns: 1fr;
	}

	.kh-product-summary__inner {
		padding-block: 0;
	}

	.kh-product-gallery__main-image {
		transform: scale( 1.05 );
	}

	/* Keep thumbnails to the left and let that compact rail scroll vertically. */
	.kh-product-gallery__display,
	.kh-product-gallery__display.has-single-image {
		align-items: start;
		grid-template-columns: 4.15rem minmax(0, 1fr);
	}

	.kh-product-gallery__display.has-single-image {
		grid-template-columns: minmax(0, 1fr);
	}

	.kh-product-gallery__thumbnails {
		align-items: stretch;
		flex-direction: column;
		max-height: min(68vw, 24rem);
		overflow-x: hidden;
		overflow-y: auto;
		padding: 0 .2rem 0 0;
	}

	.kh-product-gallery__thumbnail {
		flex: 0 0 4.15rem;
		min-height: 4.15rem;
	}

	.kh-product-composition__details dl > div {
		gap: .45rem;
		grid-template-columns: 1fr;
	}
}

@media ( max-width: 560px ) {
	.kh-product-composition__table-wrap {
		border-radius: .8rem;
		padding: .45rem;
	}

	.kh-product-composition table,
	.kh-product-composition tbody,
	.kh-product-composition tr,
	.kh-product-composition td {
		display: block;
		width: 100%;
	}

	.kh-product-composition thead {
		clip: rect(0 0 0 0);
		clip-path: inset(50%);
		height: 1px;
		overflow: hidden;
		position: absolute;
		white-space: nowrap;
		width: 1px;
	}

	.kh-product-composition tbody tr {
		background: #fff;
		/* Separate mobile composition groups with space, not an outer frame. */
		border: 0;
		border-radius: 0;
		margin: .55rem 0 1.15rem;
		overflow: visible;
	}

	.kh-product-composition tbody tr:nth-child(even) {
		background: #f7fbf7;
	}

	.kh-product-composition td {
		align-items: baseline;
		border-bottom: 1px solid rgba(46, 106, 79, .1);
		display: grid;
		gap: .75rem;
		grid-template-columns: minmax(7.5rem, .8fr) minmax(0, 1.2fr);
		padding: .62rem .7rem;
		text-align: left;
	}

	.kh-product-composition td:last-child {
		border-bottom: 0;
	}

	.kh-product-composition td::before {
		color: var(--kh-forest);
		content: attr(data-label);
		font-size: .68rem;
		font-style: normal;
		font-weight: 800;
		letter-spacing: .045em;
		text-transform: uppercase;
	}
}
