/* Product Pair Gallery */
.ppg {
	--ppg-cols: 3;
	--ppg-gap: .625rem;     /* space between the entries */
	--ppg-ratio: 1 / 1;     /* shape of a single picture, e.g. 4 / 5 */
	--ppg-st-available: #2f9e5b;     /* Status colours */
	--ppg-st-seasonal: #f1c232;
	--ppg-st-discontinued: #e8736c;
	--ppg-st-unknown: #8a8f98;
	--ppg-accent: #8fcbf3;           /* light blue: slider, checkbox, button hover */
	--ppg-accent-ink: #0b2a40;
	--ppg-youtube: #ff0000;
	margin: 1.5em 0;
}

/* Controls need JavaScript – hide them if it is missing. */
.ppg:not(.ppg-js) .ppg-toolbar { display: none; }

.ppg-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .6rem 1.4rem;
	margin: 0 0 1rem;
	font-size: .9rem;
}
.ppg-ctl { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0; }
.ppg-ctl select { max-width: 100%; }
.ppg-size { width: 8rem; margin: 0; }
.ppg .ppg-size,
.ppg .ppg-caps { accent-color: var(--ppg-accent); }
.ppg .ppg-dir:not(:disabled):hover, .ppg .ppg-dir:not(:disabled):focus-visible,
.ppg .ppg-reset:not(:disabled):hover, .ppg .ppg-reset:not(:disabled):focus-visible {
	background: var(--ppg-accent);
	border-color: var(--ppg-accent);
	color: var(--ppg-accent-ink);
}
/* Buttons keep exactly the same box in every state, so themes' hover/focus styles cannot resize the toolbar. */
.ppg .ppg-dir,
.ppg .ppg-reset {
	box-sizing: border-box;
	cursor: pointer;
	margin: 0;
	border-width: 1px;
	line-height: 1.2;
	transform: none;
	flex: none;
}
.ppg .ppg-dir { width: 2.25rem; padding: .15rem 0; font-size: 1em; text-align: center; }
.ppg .ppg-reset { padding: .15rem .6rem; font-size: .85em; }
.ppg .ppg-dir:hover, .ppg .ppg-dir:focus, .ppg .ppg-dir:active,
.ppg .ppg-reset:hover, .ppg .ppg-reset:focus, .ppg .ppg-reset:active {
	margin: 0;
	border-width: 1px;
	line-height: 1.2;
	transform: none;
}
.ppg .ppg-dir:hover, .ppg .ppg-dir:focus, .ppg .ppg-dir:active { width: 2.25rem; padding: .15rem 0; font-size: 1em; }
.ppg .ppg-reset:hover, .ppg .ppg-reset:focus, .ppg .ppg-reset:active { padding: .15rem .6rem; font-size: .85em; }
.ppg .ppg-dir:disabled,
.ppg .ppg-reset:disabled { cursor: default; opacity: .45; }
.ppg-count { margin-left: auto; opacity: .65; font-variant-numeric: tabular-nums; }

/* Grid: every item is one PAIR, so a pair can never be split across rows. */
.ppg-grid {
	display: grid;
	grid-template-columns: repeat(var(--ppg-cols), minmax(0, 1fr));
	gap: var(--ppg-gap);
}
.ppg-item { position: relative; margin: 0; min-width: 0; container: ppg-item / inline-size; }
.ppg-item[hidden] { display: none; }
.ppg-item:hover,
.ppg-item:focus-within { z-index: 10; } /* a tooltip may overlap the neighbours */

.ppg-pics { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.ppg-pics > * { min-width: 0; margin: 0; }
.ppg-pics figure { margin: 0; }
/* No background on pictures, so transparent PNGs stay transparent. Only empty slots are grey. */
.ppg-pics img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: var(--ppg-ratio);
	object-fit: cover;
	margin: 0;
	background: none;
}
.ppg-ph {
	display: block;
	aspect-ratio: var(--ppg-ratio);
	background: #e6e6e6;
}

/* ---- Caption below the pair ---- */
.ppg-caption {
	container: ppg-cap / inline-size;
	padding: .45rem 0 0;
	font-size: .85em;
	line-height: 1.35;
	text-align: left;
}
/* Name + Firma use the full width. Below: Herkunft + Datum, with the icons at the lower right of the text area.
   The icons share that row when there is room; otherwise they drop below the text (still at the right).
   Without a Herkunft/Datum line they move up and sit beside the name line. */
.ppg-cap { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .1rem .75rem; }
.ppg-l1 { display: flex; flex-direction: column; min-width: 0; flex: 1 0 100%; }
.ppg-no-l2 .ppg-l1 { flex: 1 1 auto; }
.ppg-row2 { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .25rem .75rem; min-width: 0; flex: 1 1 100%; }
.ppg-no-l2 .ppg-row2 { display: contents; }
.ppg-l2 { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.ppg-name { font-weight: 600; overflow-wrap: anywhere; }
.ppg-producer,
.ppg-origin,
.ppg-date { opacity: .8; overflow-wrap: anywhere; }
.ppg-icons { display: flex; align-items: center; justify-content: flex-end; gap: .65rem; flex: 1 1 100%; margin-top: .15rem; } /* always on a line of their own, at the right */
.ppg-status { display: inline-flex; cursor: pointer; }
.ppg-st-available { color: var(--ppg-st-available); }
.ppg-st-seasonal { color: var(--ppg-st-seasonal); }
.ppg-st-discontinued { color: var(--ppg-st-discontinued); }
.ppg-st-unknown { color: var(--ppg-st-unknown); }
.ppg-icons a {
	display: inline-flex;
	color: inherit;
	opacity: .75;
	text-decoration: none;
	border: 0;
	box-shadow: none;
}
.ppg-icons a.ppg-yt { color: var(--ppg-youtube); opacity: 1; }
.ppg-icons a:hover,
.ppg-icons a:focus-visible { opacity: 1; }

/* Slider at the maximum (1 pair per row): larger text. */
.ppg-max .ppg-caption { font-size: 1.1em; }

/* Enough room (caption at least 18rem = about 290px wide): Name + Firma on one line, Herkunft + Datum on one line. */
@container ppg-cap (min-width: 18rem) {
	.ppg-l1,
	.ppg-l2 { flex-direction: row; flex-wrap: wrap; align-items: baseline; column-gap: .5em; }
	.ppg-name:not(:last-child)::after,
	.ppg-origin:not(:last-child)::after { content: "\00b7"; margin-left: .5em; font-weight: 400; opacity: .6; }
}

/* ---- Captions off: only pictures; the same info appears as a (wider) tooltip on hover/focus ---- */
.ppg-nocap .ppg-caption {
	position: absolute;
	left: 50%;
	bottom: 0;
	z-index: 2;
	box-sizing: border-box;
	width: max(100%, 26rem);
	max-width: min(36rem, calc(100vw - 1rem));
	padding: .6rem .8rem;
	background: rgba(20, 20, 20, .94);
	color: #fff;
	border-radius: .35rem;
	box-shadow: 0 4px 18px rgba(0, 0, 0, .35);
	opacity: 0;
	visibility: hidden;
	transform: translate(calc(-50% + var(--ppg-shift, 0px)), 4px);
}
/* The fade-in only runs on hover, so switching captions off never flashes the tooltips. */
.ppg-nocap .ppg-item:hover .ppg-caption,
.ppg-nocap .ppg-item:focus-within .ppg-caption {
	transition: opacity .15s ease, transform .15s ease, visibility .15s;
	opacity: 1;
	visibility: visible;
	transform: translate(calc(-50% + var(--ppg-shift, 0px)), 0);
}
.ppg-nocap .ppg-producer,
.ppg-nocap .ppg-origin,
.ppg-nocap .ppg-date { opacity: .85; }
.ppg-nocap .ppg-icons a { opacity: .9; color: #fff; }
.ppg-nocap .ppg-icons a.ppg-yt { color: var(--ppg-youtube); opacity: 1; }

/* Small pairs (many per row): a narrow, tall tooltip instead of a wide one. */
@container ppg-item (max-width: 300px) {
	.ppg-nocap .ppg-caption { display: flex; flex-direction: column; width: 9.5rem; min-height: 10.5rem; }
	.ppg-nocap .ppg-cap { flex: 1 1 auto; align-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
	.ppg-nocap .ppg-item:hover .ppg-caption,
	.ppg-nocap .ppg-item:focus-within .ppg-caption { transition: none; }
}

/* No lightbox while captions are off: hide the enlarge button and the zoom cursor. */
.ppg-nocap .ppg-pics .lightbox-trigger { display: none; }
.ppg-nocap .ppg-pics img { cursor: default; }
