/* HB Image Hotspots — frontend */

/* ── Default design tokens ───────────────────────────────── */

body .hbih-visual {
	--hbih-marker-color: #DA002E;
	--hbih-marker-color-hover: #a8002a;
	--hbih-zone-fill: #DA002E;
	--hbih-zone-fill-hover: #DA002E;
	--hbih-zone-fill-opacity: 20;
	--hbih-zone-fill-opacity-hover: 50;
	--hbih-zone-stroke: #DA002E;
	--hbih-panel-bg: #ffffff;
	--hbih-panel-width: 420px;
	--hbih-accent: #DA002E;
}

/* ── Stage (image + overlay container) ───────────────────── */

body .hbih-visual {
	position: relative;
	gap: 5em;
}

body .hbih-stage {
	position: relative;
	display: block;
	text-align: center;
	line-height: 0;
}

body .hbih-stage-img {
	display: block;
	width: 100%;
	height: auto;
}

/* SVG overlay for shape hotspots */
body .hbih-stage-svg {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	overflow: visible;
	pointer-events: none;
}

/* ── Point hotspot buttons ───────────────────────────────── */

body .hbih-hotspot--point {
	position: absolute;
	transform: translate(-50%, -50%);
	background: none;
	border: none;
	padding: 10px;
	margin: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	/* Enlarge click target without growing the visual marker */
	line-height: 0;
}

body .hbih-hotspot--point:focus {
	outline: none;
}

body .hbih-marker {
	display: block;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--hbih-marker-color);
	border: 2px solid #fff;
	box-shadow: 0 0 0 2px var(--hbih-marker-color);
	transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

body .hbih-hotspot--point:hover .hbih-marker,
body .hbih-hotspot--point:focus-visible .hbih-marker,
body .hbih-hotspot--point.is-active .hbih-marker,
body .hbih-hotspot--point.is-hovered .hbih-marker {
	background: var(--hbih-marker-color-hover);
	box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.12), 0 0 0 4px var(--hbih-marker-color-hover);
	transform: scale(1.25);
}

/* Pulse ring on focus for keyboard users */
body .hbih-hotspot--point:focus-visible {
	outline: 2px solid var(--hbih-marker-color-hover);
	outline-offset: 4px;
	border-radius: 50%;
}

/* ── Shape hotspot polygons ──────────────────────────────── */

body .hbih-hotspot--shape {
	fill: var(--hbih-zone-fill);
	fill-opacity: calc(var(--hbih-zone-fill-opacity) / 100);
	stroke: var(--hbih-zone-stroke);
	stroke-width: 2;
	stroke-linejoin: round;
	vector-effect: non-scaling-stroke;
	cursor: pointer;
	pointer-events: all;
	transition: fill-opacity 0.2s ease;
}

body .hbih-hotspot--shape:hover,
body .hbih-hotspot--shape:focus,
body .hbih-hotspot--shape.is-active,
body .hbih-hotspot--shape.is-hovered {
	fill: var(--hbih-zone-fill-hover);
	fill-opacity: calc(var(--hbih-zone-fill-opacity-hover) / 100);
	outline: none;
}

body .hbih-hotspot--shape:focus-visible {
	stroke-width: 3;
	/* outline support on SVG polygons is reliable in modern browsers */
	outline: 2px solid var(--hbih-zone-stroke);
	outline-offset: 3px;
}

/* ── Panel backdrop ──────────────────────────────────────── */

body .hbih-panel-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
	z-index: 99999;
}

body .hbih-panel.is-open .hbih-panel-backdrop {
	opacity: 1;
	visibility: visible;
}

/* ── Panel inner (the actual sliding drawer) ─────────────── */

body .hbih-panel-inner {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(var(--hbih-panel-width), 100vw);
	background: var(--hbih-panel-bg);
	transform: translateX(100%);
	transition: transform 0.3s ease;
	overflow-y: auto;
	font-family: "Source Sans 3", sans-serif;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
}

body .hbih-panel-pos-left .hbih-panel-inner {
	right: auto;
	left: 0;
	transform: translateX(-100%);
	box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

body .hbih-panel.is-open .hbih-panel-inner {
	transform: translateX(0);
}

/* ── Panel close button ──────────────────────────────────── */

body .hbih-panel-close {
	position: absolute;
	top: 16px;
	right: 16px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 6px;
	line-height: 1;
	font-size: 24px;
	color: inherit;
	opacity: 0.6;
	transition: opacity 0.15s ease;
}

body .hbih-panel-close:hover,
body .hbih-panel-close:focus-visible {
	opacity: 1;
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

body .hbih-panel-pos-left .hbih-panel-close {
	right: auto;
	left: 16px;
}

/* ── Panel slides ────────────────────────────────────────── */

body .hbih-panel-slides {
	padding: 56px 28px 28px;
	flex: 1;
}

body .hbih-panel-head {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin-bottom: 16px;
}

body .hbih-panel-icon {
	width: 40px;
	height: 40px;
	object-fit: contain;
	flex-shrink: 0;
	margin-top: 2px;
}

body .hbih-panel-heading {
	margin: 0;
	font-size: 24px !important;
	line-height: 1.3;
	color: #01080B;
}

body .hbih-panel-thumb {
	display: block;
	width: 100%;
	margin-bottom: 20px;
	height: 200px;
	object-fit: cover;
}

body .hbih-panel-content {
	font-size: 0.9375rem;
	line-height: 1.6;
	color: #595959;
}

body .hbih-panel-content > *:first-child {
	margin-top: 0;
}

body .hbih-panel-content > *:last-child {
	margin-bottom: 0;
}

/* ── Legend ──────────────────────────────────────────────── */

body .hbih-legend {
	display: flex;
	flex-direction: column;
	align-items: flex-start !important;
	justify-content: flex-start !important;
	gap: 0.5em !important;
	margin: 0;
	padding: 0;
}

body .hbih-legend-item {
	display: flex;
	align-items: center;
	gap: 10px;
	background: white;
	border: 0px solid transparent;
	padding: 4px 10px;
	cursor: pointer;
	text-align: left;
	font: inherit;
	color: inherit;
	transition: background 0.15s ease, border-color 0.15s ease;
	width: 100%;
}

body .hbih-legend-item:hover,
body .hbih-legend-item.is-hovered {
	background: #595959;
	color: white;
}

body .hbih-legend-item.is-active {
	background: #595959
	color: white;
}

body .hbih-legend-item:focus-visible {
	outline: 2px solid #595959;
	outline-offset: 2px;
}

body .hbih-legend-thumb {
	width: 56px;
	height: 40px;
	object-fit: cover;
	flex-shrink: 0;
	display: block;
}

body .hbih-legend-label {
	font-size: 0.875rem;
	line-height: 1.4;
}

/* Vertical: stage right, legend left */
body .hbih-visual--legend-vertical {
	display: flex;
	align-items: center;
	gap: 0px;
}

body .hbih-visual--legend-vertical .hbih-legend {
	width: 180px;
	flex-shrink: 0;
	order: -1;
	padding-top: 0px;
}

body .hbih-visual--legend-vertical .hbih-stage {
	flex: 1;
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: center;
	min-width: 0;
}

/* Horizontal: legend below stage, items in a row */
body .hbih-visual--legend-horizontal .hbih-legend {
	flex-direction: row;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 12px;
}

body .hbih-visual--legend-horizontal .hbih-legend-item {
	width: auto;
}

/* ── Overview shortcode ──────────────────────────────────── */

/* Ensure [hidden] isn't overridden by theme CSS within the overview wrapper. */
body .hbih-overview [hidden] { display: none !important; }

body .hbih-overview-grid {
	display: grid;
	grid-template-columns: repeat(var(--hbih-overview-cols, 3), 1fr);
	gap: 24px;
}

/* Card */
body .hbih-overview-card {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, 0.08);
	padding: 0;
	cursor: pointer;
	font: inherit;
	color: inherit;
	text-align: left;
	transition: transform 0.18s ease, border-color 0.18s ease;
	overflow: hidden;
	width: 100%;
}

body .hbih-overview-card:hover {
	transform: translateY(-3px);
	border-color: rgba(0, 0, 0, 0.18);
}

body .hbih-overview-card.is-active {
	border-color: var(--hbih-accent);
}

body .hbih-overview-card:focus-visible {
	outline: 2px solid var(--hbih-accent);
	outline-offset: 3px;
}

body .hbih-overview-card-img-wrap {
	display: block;
	line-height: 0;
	overflow: hidden;
	background: #fff;
}

body .hbih-overview-card-img-wrap img {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: contain;
	transition: transform 0.3s ease;
}

body .hbih-overview-card:hover .hbih-overview-card-img-wrap img {
	transform: scale(1.04);
}

body .hbih-overview-card-title {
	display: block;
	padding: 12px 16px 14px;
	font-size: 0.9rem;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0.01em;
	color: #01080B;
	text-align: center;
}

/* Viewer */
body .hbih-overview-viewer {
	margin-top: 0;
}

/* Switcher bar */
body .hbih-overview-switcher {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	margin-bottom: 20px;
	padding-bottom: 16px;
}

body .hbih-overview-back {
	display: inline-flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	background: transparent;
	border: 2px solid #01080B;
	padding: 14px 20px;
	font-family: "Source Sans 3", sans-serif;
	font-size: 16px;
	font-weight: 400;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	cursor: pointer;
	color: #01080B;
	white-space: nowrap;
	flex-shrink: 0;
	text-decoration: none;
	transition: background 0.2s ease, color 0.2s ease;
}

body .hbih-overview-back::before {
	content: '';
	display: block;
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	background-color: #01080B;
	-webkit-mask-image: url('../images/icon-arrow.svg');
	mask-image: url('../images/icon-arrow.svg');
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	transform: rotate(-90deg);
	transition: background-color 0.2s ease, transform 0.3s ease;
}

body .hbih-overview-back:hover,
body .hbih-overview-back:focus-visible {
	background: #01080B;
	color: #fff;
}

body .hbih-overview-back:hover::before,
body .hbih-overview-back:focus-visible::before {
	background-color: #fff;
	transform: rotate(-135deg);
}

/* Loading spinner */
body .hbih-overview-loading {
	width: 32px;
	height: 32px;
	border: 3px solid rgba(0, 0, 0, 0.1);
	border-top-color: var(--hbih-accent);
	border-radius: 50%;
	margin: 40px auto;
	animation: hbih-spin 0.7s linear infinite;
}

@keyframes hbih-spin {
	to { transform: rotate(360deg); }
}

/* Responsive main */
@media (max-width: 1119px) {
	body .hbih-visual,
	body .hbih-visual--legend-vertical {
		display: flex !important;
		flex-direction: column !important;
		align-items: stretch !important;
		justify-content: flex-start !important;
		gap: 2em !important;
	}

	/* Legende boven, items op een rij die doorloopt naar de volgende lijn */
	body .hbih-legend,
	body .hbih-visual--legend-vertical .hbih-legend {
		order: -1;
		width: 100% !important;
		display: flex;
		flex-direction: row !important;
		flex-wrap: wrap !important;
		align-items: flex-start !important;
		justify-content: flex-start !important;
		gap: 0.5em !important;
		margin: 0;
		padding: 0;
	}

	body .hbih-legend-item,
	body .hbih-visual--legend-vertical .hbih-legend-item {
		width: auto !important;
		flex: 0 0 auto;
		max-width: 100%;
	}

	/* Beeld eronder, gecentreerd */
	body .hbih-stage,
	body .hbih-visual--legend-vertical .hbih-stage {
		order: 0;
		width: 100%;
		justify-content: center;
	}
}

/* Responsive grid */
@media (max-width: 900px) {
	body .hbih-overview-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 540px) {
	body .hbih-overview-grid {
		grid-template-columns: 1fr;
	}
}

/* ── Tooltip ─────────────────────────────────────────────── */

body .hbih-tooltip {
	position: absolute;
	left: 0;
	top: 0;
	transform: translate(-50%, calc(-100% - 10px));
	background: rgba(0, 0, 0, 0.78);
	color: #fff;
	font-size: 0.8125rem;
	line-height: 1.3;
	padding: 5px 10px;
	white-space: nowrap;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.15s ease;
	z-index: 10;
}

body .hbih-tooltip::after {
	content: '';
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 5px solid transparent;
	border-top-color: rgba(0, 0, 0, 0.78);
}

body .hbih-tooltip.is-visible {
	opacity: 1;
}

/* ── Panel meta (category / material / function-benefit) ─── */

body .hbih-panel-meta {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 4px 16px;
	margin: 0 0 20px;
	padding: 14px 16px;
	background: rgba(0, 0, 0, 0.04);
	font-size: 0.875rem;
	line-height: 1.4;
}

body .hbih-panel-meta dt {
	text-align: left;
	font-weight: 700;
	color: inherit;
	opacity: 0.65;
}

body .hbih-panel-meta dd {
	margin: 0;
	text-align: left;
}

/* ── Panel CTA ───────────────────────────────────────────── */

body .hbih-panel .hbih-panel-cta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	margin-top: 24px;
	padding: 14px 20px;
	background: var(--hbih-accent);
	color: #fff;
	border: 2px solid var(--hbih-accent);
	text-decoration: none;
	font-family: "Source Sans 3", sans-serif;
	font-size: 16px;
	font-weight: 400;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	transition: background 0.2s ease, color 0.2s ease;
}

body .hbih-panel .hbih-panel-cta::after {
	content: '';
	display: block;
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	background-color: #fff;
	-webkit-mask-image: url('../images/icon-arrow.svg');
	mask-image: url('../images/icon-arrow.svg');
	-webkit-mask-size: contain;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	transition: background-color 0.2s ease, transform 0.3s ease;
}

body .hbih-panel .hbih-panel-cta:hover,
body .hbih-panel .hbih-panel-cta:focus-visible {
	background: transparent;
	color: var(--hbih-accent);
}

body .hbih-panel .hbih-panel-cta:hover::after,
body .hbih-panel .hbih-panel-cta:focus-visible::after {
	background-color: var(--hbih-accent);
	transform: rotate(45deg);
}

/* ── Mobile: bottom sheet ────────────────────────────────── */

@media (max-width: 640px) {
	body .hbih-panel-inner {
		top: auto;
		left: 0 !important;
		right: 0 !important;
		bottom: 0;
		width: 100% !important;
		height: 75vh;
		transform: translateY(100%) !important;
		box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15) !important;
	}

	body .hbih-panel.is-open .hbih-panel-inner {
		transform: translateY(0) !important;
	}

	body .hbih-panel-close {
		right: 16px !important;
		left: auto !important;
	}
}
