/* ABI POLYGON – front end */
.abip {
	--abip-gap: 16px;
	position: relative;
	width: 100%;
	max-width: 100%;
	margin: 0 0 1.5em;
	container-type: inline-size;
	container-name: abip;
	box-sizing: border-box;
}
.abip *, .abip *::before, .abip *::after { box-sizing: border-box; }

.abip__inner {
	display: flex;
	gap: var(--abip-gap);
	align-items: flex-start;
}
.abip--layout-left .abip__inner { flex-direction: row; }
.abip--layout-right .abip__inner { flex-direction: row-reverse; }
.abip--layout-top .abip__inner { flex-direction: column; align-items: stretch; }
.abip--layout-bottom .abip__inner { flex-direction: column-reverse; align-items: stretch; }
.abip--layout-lightbox .abip__inner,
.abip--layout-tooltip .abip__inner,
.abip--links-only .abip__inner { display: block; }

/* ---------- Stage (image + svg) ---------- */
.abip__stage {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
	line-height: 0;
	background: var(--abip-img-bg, #efefef);
}
.abip__stage .abip__img {
	display: block;
	width: 100% !important;
	max-width: 100% !important;
	height: auto !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	box-shadow: none !important;
	-webkit-user-select: none;
	user-select: none;
}
.abip__svg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	overflow: visible;
	-webkit-tap-highlight-color: transparent;
}
.abip-area { cursor: pointer; outline: none; }
.abip-shape {
	fill: var(--f);
	fill-opacity: var(--fo);
	stroke: var(--s);
	stroke-opacity: var(--so);
	stroke-width: var(--abip-bw, 2px);
	stroke-linejoin: round;
	vector-effect: non-scaling-stroke;
	transition: fill-opacity .18s ease, stroke-opacity .18s ease, fill .18s ease;
}
.abip-area:hover .abip-shape,
.abip-area.is-hover .abip-shape,
.abip-area.is-active .abip-shape {
	fill: var(--hf);
	fill-opacity: var(--hfo);
	stroke: var(--hs);
	stroke-opacity: var(--hso);
}
.abip-area:focus-visible .abip-shape {
	fill: var(--hf);
	fill-opacity: var(--hfo);
	stroke: var(--hs);
	stroke-opacity: 1;
	stroke-width: calc(var(--abip-bw, 2px) + 2px);
}

/* ---------- Panel ---------- */
.abip__panel {
	flex: 0 0 var(--abip-panel-w, 35%);
	width: var(--abip-panel-w, 35%);
	background: var(--abip-info-bg, #fff);
	color: var(--abip-text, #333);
	padding: 20px;
	align-self: stretch;
	overflow: auto;
	line-height: 1.55;
}
.abip--layout-top .abip__panel,
.abip--layout-bottom .abip__panel { width: 100%; flex-basis: auto; }

/* Stack side panels on narrow containers */
@container abip (max-width: 640px) {
	.abip--layout-left .abip__inner,
	.abip--layout-right .abip__inner { flex-direction: column-reverse; align-items: stretch; }
	.abip--layout-left .abip__panel,
	.abip--layout-right .abip__panel { width: 100%; flex-basis: auto; }
}
@supports not (container-type: inline-size) {
	@media (max-width: 700px) {
		.abip--layout-left .abip__inner,
		.abip--layout-right .abip__inner { flex-direction: column-reverse; align-items: stretch; }
		.abip--layout-left .abip__panel,
		.abip--layout-right .abip__panel { width: 100%; flex-basis: auto; }
	}
}

/* ---------- Info blocks ---------- */
.abip-info { color: var(--abip-text, #333); }
.abip-info:focus { outline: none; }
.abip-info__title {
	color: var(--abip-title, #111);
	margin: 0 0 .5em;
	font-size: 1.35em;
	line-height: 1.25;
}
.abip-info__image { margin: 0 0 1em; line-height: 0; }
.abip-info__image img { display: block; max-width: 100%; height: auto; }
.abip-info__content > :first-child { margin-top: 0; }
.abip-info__content > :last-child { margin-bottom: 0; }
.abip-info__content a { color: inherit; text-decoration: underline; }
.abip-info__content iframe, .abip-info__content video { max-width: 100%; }

/* Without JS every info block stays visible under the image (accessible / SEO). */
.abip__store { margin-top: var(--abip-gap); }
.abip__store .abip-info {
	background: var(--abip-info-bg, #fff);
	padding: 16px 20px;
	margin-bottom: 8px;
}
.abip.abip--js .abip__store { display: none; }
.abip--js .abip__panel-body > .abip-info { display: none; }
.abip--js .abip__panel-body > .abip-info.is-visible { display: block; animation: abip-fade .2s ease; }
.abip__panel-body > .abip-info { background: none; padding: 0; margin: 0; }

@keyframes abip-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Hover label ---------- */
.abip-label {
	position: absolute;
	z-index: 30;
	pointer-events: none;
	padding: 5px 10px;
	border-radius: 4px;
	background: rgba(20, 20, 20, .88);
	color: #fff;
	font-size: 13px;
	line-height: 1.3;
	white-space: nowrap;
	max-width: 260px;
	overflow: hidden;
	text-overflow: ellipsis;
	transform: translate(-50%, calc(-100% - 12px));
	opacity: 0;
	transition: opacity .12s ease;
}
.abip-label.is-visible { opacity: 1; }

/* ---------- Tooltip popup ---------- */
.abip-pop {
	position: absolute;
	z-index: 40;
	width: min(360px, calc(100% - 16px));
	max-height: 80%;
	overflow: auto;
	padding: 18px 20px;
	background: var(--abip-info-bg, #fff);
	color: var(--abip-text, #333);
	border-radius: 6px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
	line-height: 1.5;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity .16s ease, transform .16s ease;
	pointer-events: none;
}
.abip-pop.is-open { opacity: 1; transform: none; pointer-events: auto; }
.abip-pop .abip-info__title { padding-right: 24px; font-size: 1.15em; }
.abip-pop__close,
.abip-lb__close {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 32px;
	height: 32px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--abip-title, #111);
	font: 400 24px/32px sans-serif;
	text-align: center;
	cursor: pointer;
	box-shadow: none;
}
.abip-pop__close:hover, .abip-pop__close:focus-visible,
.abip-lb__close:hover, .abip-lb__close:focus-visible { background: rgba(127, 127, 127, .2); outline: none; }
.abip--trigger-hover .abip-pop__close { display: none; }

/* ---------- Lightbox ---------- */
html.abip-lb-open { overflow: hidden; }
.abip-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}
.abip-lb[hidden] { display: none; }
.abip-lb__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .72);
	animation: abip-fade .2s ease;
}
.abip-lb__box {
	position: relative;
	width: min(820px, 100%);
	max-height: calc(100vh - 40px);
	overflow: auto;
	padding: 28px 30px;
	background: var(--abip-info-bg, #fff);
	color: var(--abip-text, #333);
	border-radius: 8px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, .4);
	line-height: 1.55;
	animation: abip-fade .22s ease;
}
.abip-lb__box .abip-info__title { padding-right: 30px; }
.abip-lb__box .abip-info__image img { margin: 0 auto; max-height: 60vh; width: auto; }

/* Block editor preview (no front-end JS there) */
.abip-block-preview .abip__store { display: none; }
.abip-block-preview .abip-area { pointer-events: none; }

.abip-notice { padding: 10px 14px; background: #fff8e5; border-left: 4px solid #dba617; }

@media (prefers-reduced-motion: reduce) {
	.abip-shape, .abip-pop, .abip-label { transition: none; }
	.abip-lb__backdrop, .abip-lb__box, .abip--js .abip__panel-body > .abip-info.is-visible { animation: none; }
}
