/* ==========================================================================
   AI42 Accordion (Nested)
   Kop (.ai42-acc__header) = ingevouwen, klikbaar. Paneel (.ai42-acc__panel) =
   uitgevouwen inhoud die in de widget zelf met Elementor-widgets is gebouwd
   (nested container binnen .ai42-acc__reveal). Elk item heeft een eigen
   achtergrond (.ai42-acc__item-bg) die kop en paneel delen. Oriëntatie via
   --acc-dir; JS zet .is-horizontal / .is-vertical.
   ========================================================================== */

.ai42-acc {
	--acc-dir: row;
	--acc-height: 420px;
	--acc-radius: 14px;
	--acc-dur: 0.7s;
	--acc-ease: cubic-bezier(0.16, 1, 0.3, 1);
	--acc-active-grow: 4;
	--acc-hover-grow: 1.5;
	--acc-hover-bump: 16px;
	--acc-accent: #22b27e;

	position: relative;
	border-radius: var(--acc-radius);
	isolation: isolate;
}

.ai42-acc__track {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: var(--acc-dir);
	gap: 6px;
	width: 100%;
	height: 100%;
}

/* ---- Item + eigen achtergrond ------------------------------------------- */
.ai42-acc__item {
	position: relative;
	overflow: hidden;
	min-width: 0;
	min-height: 0;
	display: flex;
	flex-direction: column;
	transition: flex-grow var(--acc-dur) var(--acc-ease);
}
.ai42-acc__track > .ai42-acc__item:first-child { border-radius: var(--acc-radius) var(--acc-radius) 0 0; }
.ai42-acc__track > .ai42-acc__item:last-child  { border-radius: 0 0 var(--acc-radius) var(--acc-radius); }
.ai42-acc.is-horizontal .ai42-acc__track > .ai42-acc__item:first-child { border-radius: var(--acc-radius) 0 0 var(--acc-radius); }
.ai42-acc.is-horizontal .ai42-acc__track > .ai42-acc__item:last-child  { border-radius: 0 var(--acc-radius) var(--acc-radius) 0; }

.ai42-acc__item-bg {
	position: absolute;
	inset: 0;
	z-index: 0;
	background-size: cover;
	background-position: center center;
	background-repeat: no-repeat;
	will-change: transform;
}
.ai42-acc[data-parallax="1"] .ai42-acc__item-bg { top: -18%; bottom: -18%; height: auto; }

.ai42-acc__item-overlay { position: absolute; inset: 0; z-index: 1; pointer-events: none; }

/* ---- Kop (ingevouwen) ---------------------------------------------------- */
.ai42-acc__header {
	position: relative;
	z-index: 2;
	display: block;
	width: 100%;
	margin: 0;
	border: 0;
	/* Reset thema-knopstijlen: de kop is een <button> en mag geen eigen ronding
	   of schaduw van het thema overnemen (de ronding hoort van het item te komen). */
	border-radius: 0;
	box-shadow: none;
	padding: 0;
	background: rgba(0, 0, 0, 0.15);
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	flex: 0 0 auto;
	transition: background var(--acc-dur) var(--acc-ease);
}
.ai42-acc__header-inner {
	position: relative;
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	height: 100%;
	padding: 22px 24px;
}
.ai42-acc__icon { display: inline-flex; flex: 0 0 auto; font-size: 22px; line-height: 1; }
.ai42-acc__icon svg { width: 1em; height: 1em; }
.ai42-acc__labels { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ai42-acc__subtitle {
	font-size: 0.72em;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	opacity: 0.85;
}
.ai42-acc__title {
	font-size: 1.25rem;
	font-weight: 600;
	line-height: 1.15;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Marker (+/-) */
.ai42-acc__marker {
	position: relative;
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	margin-left: auto;
	color: #fff;
	opacity: 0.9;
}
.ai42-acc__marker::before,
.ai42-acc__marker::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 18px;
	height: 2px;
	background: currentColor;
	border-radius: 2px;
	transform: translate(-50%, -50%);
	transition: transform var(--acc-dur) var(--acc-ease), opacity var(--acc-dur) var(--acc-ease);
}
.ai42-acc__marker::after { transform: translate(-50%, -50%) rotate(90deg); }
.ai42-acc__item.is-open .ai42-acc__marker::after { transform: translate(-50%, -50%) rotate(0deg); opacity: 0; }

.ai42-acc__header:focus-visible { outline: 2px solid var(--acc-accent); outline-offset: -2px; }

/* Kop (titel/subtitel/icoon/marker) verdwijnt bij openen; de inhoud vult dan
   het hele vlak. Sluiten kan door op het vlak te klikken. */
.ai42-acc__item.is-open .ai42-acc__header { display: none; }

/* ---- Paneel (uitgevouwen inhoud) ---------------------------------------- */
.ai42-acc__panel {
	position: relative;
	z-index: 2;
	display: grid;
	grid-template-rows: 0fr;
	background: rgba(0, 0, 0, 0.35);
	transition: grid-template-rows var(--acc-dur) var(--acc-ease);
	min-height: 0;
}
.ai42-acc__panel-inner { overflow: hidden; min-height: 0; }
.ai42-acc__reveal { padding: 24px 28px 28px; }

/* Onthul-animatie van de inhoud. */
.ai42-acc__reveal {
	opacity: 0;
	transition: opacity var(--acc-dur) var(--acc-ease),
		transform var(--acc-dur) var(--acc-ease),
		filter var(--acc-dur) var(--acc-ease),
		clip-path var(--acc-dur) var(--acc-ease);
}
.ai42-acc[data-reveal="rise"] .ai42-acc__reveal { transform: translateY(18px); }
.ai42-acc[data-reveal="blur"] .ai42-acc__reveal { filter: blur(8px); }
.ai42-acc[data-reveal="clip"] .ai42-acc__reveal { clip-path: inset(0 0 100% 0); }

.ai42-acc__item.is-open > .ai42-acc__panel { grid-template-rows: 1fr; }
.ai42-acc__item.is-open .ai42-acc__reveal {
	opacity: 1;
	transform: none;
	filter: none;
	clip-path: inset(0 0 0 0);
	transition-delay: var(--acc-reveal-delay, 0.12s);
}

/* ==========================================================================
   VERTICAAL — gestapeld; hoogte-onthulling via grid-template-rows.
   ========================================================================== */
.ai42-acc.is-vertical .ai42-acc__item { width: 100%; flex: 0 0 auto; }
.ai42-acc.is-vertical .ai42-acc__header-inner { min-height: var(--acc-v-height, 96px); }

/* Verticale hover-herverdeling: de JS zet de track op een vaste hoogte en de
   klasse .v-flex; de items delen die hoogte, zodat het item onder de muis
   groeit en de rest krimpt terwijl de totale hoogte gelijk blijft. Bij een
   open item (has-active) vervalt dit en mag het blok groeien. */
.ai42-acc.is-vertical.v-flex .ai42-acc__item { flex: 1 1 0; }
.ai42-acc.is-vertical.v-flex .ai42-acc__header-inner { min-height: 0; }
.ai42-acc.is-vertical.v-flex .ai42-acc__item:not(.is-open):hover { flex-grow: var(--acc-hover-grow, 1.5); }

/* ==========================================================================
   HORIZONTAAL — items vullen de breedte; actief wordt breder.
   ========================================================================== */
.ai42-acc.is-horizontal { min-height: var(--acc-height); }
.ai42-acc.is-horizontal .ai42-acc__track { height: var(--acc-height); align-items: stretch; }

.ai42-acc.is-horizontal .ai42-acc__item { flex: 1 1 0; flex-direction: row; height: 100%; }
.ai42-acc.is-horizontal .ai42-acc__item.is-open { flex-grow: var(--acc-active-grow); }

.ai42-acc.is-horizontal .ai42-acc__header {
	flex: 0 0 auto;
	width: auto;
	max-width: 100%;
	height: 100%;
}
.ai42-acc.is-horizontal .ai42-acc__header-inner { height: 100%; }

.ai42-acc.is-horizontal .ai42-acc__panel {
	flex: 1 1 auto;
	display: block;
	grid-template-rows: none;
	min-width: 0;
	overflow: hidden;
	opacity: 0;
	transition: opacity var(--acc-dur) var(--acc-ease);
}
.ai42-acc.is-horizontal .ai42-acc__item.is-open .ai42-acc__panel { opacity: 1; }
.ai42-acc.is-horizontal .ai42-acc__panel-inner { position: absolute; inset: 0; overflow: auto; }

/* Verticale "rug"-titel op ingevouwen items in horizontale stand. Absoluut
   zodat de vertical writing-mode de hoogte niet opblaast. */
.ai42-acc.is-horizontal[data-vertical-title="1"] .ai42-acc__item:not(.is-open) .ai42-acc__header-inner {
	position: absolute;
	inset: 0;
	writing-mode: vertical-rl;
	transform: rotate(180deg);
	justify-content: var(--acc-rug-justify, center);
	align-items: center;
	gap: 18px;
}
/* Op de rug lijnt de volledige inhoud (incl. marker) als groep uit. */
.ai42-acc.is-horizontal[data-vertical-title="1"] .ai42-acc__item:not(.is-open) .ai42-acc__marker { margin: 0; }

/* Horizontale stand ZONDER verticale rug: titel horizontaal en linksboven,
   icoon boven de tekst, en lange titels breken af i.p.v. clippen. */
.ai42-acc.is-horizontal[data-vertical-title="0"] .ai42-acc__item:not(.is-open) .ai42-acc__header {
	width: 100%;
	height: 100%;
}
.ai42-acc.is-horizontal[data-vertical-title="0"] .ai42-acc__item:not(.is-open) .ai42-acc__header-inner {
	flex-direction: column;   /* icoon boven de tekst */
	align-items: flex-start;
	justify-content: flex-start;
	gap: 10px;
	height: 100%;
	text-align: left;
}
.ai42-acc.is-horizontal[data-vertical-title="0"] .ai42-acc__item:not(.is-open) .ai42-acc__title {
	white-space: normal;      /* afbreken i.p.v. clippen */
	overflow: visible;
	text-overflow: clip;
	max-width: var(--acc-title-width, none); /* vast afbreekpunt */
}
/* Marker rechtsboven, buiten de tekststroom, zodat de tekst alle ruimte krijgt. */
.ai42-acc.is-horizontal[data-vertical-title="0"] .ai42-acc__item:not(.is-open) .ai42-acc__marker {
	position: absolute;
	top: 0;
	right: 0;
	margin: 0;
}

/* ==========================================================================
   HOVER — blok wordt iets breder (horizontaal) of hoger (verticaal).
   ========================================================================== */
/* Hover-verbreding alleen wanneer er GEEN item open is, zodat een open item
   niet krimpt als je over de andere items heen gaat. */
.ai42-acc.is-horizontal:not(.has-active) .ai42-acc__item:not(.is-open):hover { flex-grow: var(--acc-hover-grow); }
/* Verticaal: geen hoogte-verandering bij hover, zodat de totale hoogte gelijk
   blijft (net als horizontaal). De hover-feedback loopt via het niet-layout
   effect hieronder (achtergrond licht op + marker groeit). Openen mag wél groeien. */

/* Altijd-actieve hover op ingevouwen items — werkt óók als er een item open is
   en verstoort de maat van het open item niet (niet-layout). Parallax-veilig:
   we gebruiken filter (niet transform) op .item-bg, want de parallax zet zelf
   een transform op die laag. */
.ai42-acc__item-bg { transition: transform 0.9s var(--acc-ease), filter 0.45s var(--acc-ease); }
.ai42-acc__item:not(.is-open):hover .ai42-acc__item-bg { filter: brightness(1.16) saturate(1.06); }
.ai42-acc__marker { transition: transform 0.35s var(--acc-ease), opacity 0.35s var(--acc-ease); }
.ai42-acc__item:not(.is-open):hover .ai42-acc__marker { transform: scale(1.28); opacity: 1; }

.ai42-acc[data-hover="zoom"] .ai42-acc__item-bg { transition: transform 0.9s var(--acc-ease), filter 0.45s var(--acc-ease); }
.ai42-acc[data-hover="zoom"] .ai42-acc__item:hover .ai42-acc__item-bg { transform: scale(1.06); }
.ai42-acc[data-hover="zoom"] .ai42-acc__item.is-open .ai42-acc__item-bg { transform: scale(1.03); }

.ai42-acc[data-hover="glow"] .ai42-acc__item::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 3;
	pointer-events: none;
	box-shadow: inset 0 0 0 0 var(--acc-accent);
	opacity: 0;
	transition: box-shadow 0.4s var(--acc-ease), opacity 0.4s var(--acc-ease);
}
.ai42-acc[data-hover="glow"] .ai42-acc__item:hover::after {
	box-shadow: inset 0 0 0 2px var(--acc-accent), 0 0 24px -2px var(--acc-accent);
	opacity: 0.9;
}

/* ==========================================================================
   EDITOR — toon alle items gestapeld en geopend zodat je ze kunt vullen.
   ========================================================================== */
.ai42-acc--editor .ai42-acc__track { flex-direction: column !important; height: auto !important; }
.ai42-acc--editor .ai42-acc__item { width: 100% !important; flex: 0 0 auto !important; height: auto !important; }
.ai42-acc--editor .ai42-acc__header { width: 100% !important; }
.ai42-acc--editor .ai42-acc__header-inner {
	position: static !important;
	writing-mode: horizontal-tb !important;
	transform: none !important;
	min-height: 0 !important;
}
.ai42-acc--editor .ai42-acc__panel {
	position: static !important;
	display: block !important;
	grid-template-rows: none !important;
	opacity: 1 !important;
}
.ai42-acc--editor .ai42-acc__panel-inner { position: static !important; overflow: visible !important; height: auto !important; }
.ai42-acc--editor .ai42-acc__reveal { opacity: 1 !important; transform: none !important; filter: none !important; clip-path: none !important; }

/* ==========================================================================
   TOEGANKELIJKHEID
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
	.ai42-acc *,
	.ai42-acc *::before,
	.ai42-acc *::after {
		transition-duration: 0.001ms !important;
		animation-duration: 0.001ms !important;
	}
	.ai42-acc__item-bg { transform: none !important; }
}
