/**
 * Falls back to HolzLand brand values where the theme does not define its own
 * custom properties.
 */

.hpf-family {
	margin: 16px 0 32px 0;
}

.hpf-family__label {
	display: block;
	margin-bottom: 8px;
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--color-brown);
}

.hpf-family__options {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
}

.hpf-family__option {
	display: inline-flex;
	align-items: center;
	padding: 8px 14px;
	border: 2px solid var( --color-grey-lighter, #e5e3e0 );
	border-radius: 2px;
	background: #fff;
	color: var( --color-blue-dark, #05163c );
	font-size: 0.9rem;
	line-height: 1.2;
	text-decoration: none;
	transition: border-color 0.15s, background 0.15s;
}

a.hpf-family__option:hover,
a.hpf-family__option:focus {
	border-color: var( --color-blue-dark, #05163c );
	text-decoration: none;
}

.hpf-family__option.is-current {
	border-color: var( --color-red-main, #e2001a );
	background: var( --color-beige, #f5efe6 );
	font-weight: 600;
	cursor: default;
}

.hpf-family__option.is-out-of-stock {
	opacity: 0.75;
}

/* --- Thumbnail variant (buttons style only) ---
   The border moves from the option to the image itself, so the selected
   state reads on the thumbnail rather than around the whole tile. */

.hpf-family--with-thumbs .hpf-family__options {
	gap: 8px;
}

.hpf-family--with-thumbs .hpf-family__option {
	flex-direction: column;
	align-items: center;
	gap: 2px;
	padding: 0;
	border: none;
	background: none;
	text-align: center;
	/* Capped at a third of the row (minus two gaps) so at least three tiles
	   always fit, while narrow tiles still allow more per row when there's space. */
	width: 60px;
	max-width: calc( ( 100% - 24px ) / 3 );
}

.hpf-family__thumb {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border: 2px solid var( --color-grey-lighter, #e5e3e0 );
	border-radius: 5px;
	background: #fff;
	transition: border-color 0.15s;
}

.hpf-family__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	margin: 0;
}

a.hpf-family__option:hover .hpf-family__thumb,
a.hpf-family__option:focus .hpf-family__thumb {
	border-color: var( --color-blue-dark, #05163c );
}

.hpf-family--with-thumbs .hpf-family__option.is-current {
	border: none;
	background: none;
}

.hpf-family--with-thumbs .hpf-family__option.is-current .hpf-family__thumb {
	border-color: var( --color-red-main, #e2001a );
}

.hpf-family--with-thumbs .hpf-family__text {
	font-size: 0.7rem;
	line-height: 1.2;
	/* Long attribute values ("1507x234x5mm") must wrap rather than widen
	   the tile and break the row. */
	overflow-wrap: anywhere;
}

.hpf-family__select {
	width: 100%;
	max-width: 320px;
	padding: 10px 12px;
	border: 2px solid var( --color-grey-lighter, #e5e3e0 );
	border-radius: 2px;
	background: #fff;
	font-size: 0.95rem;
}

@media ( max-width: 640px ) {
	.hpf-family__option {
		padding: 10px 12px;
	}

	.hpf-family--with-thumbs .hpf-family__options {
		gap: 8px;
	}

	.hpf-family--with-thumbs .hpf-family__option {
		width: 64px;
		max-width: calc( ( 100% - 16px ) / 3 );
		padding: 0;
	}
}
