/* ==========================================================================
   COMMAR Project Tiles
   ========================================================================== */

/* ---------- Reset tegen thema/kit-knopstijlen ---------- */

.cpt-grid .cpt-tile,
.cpt-popup .cpt-popup__close,
.cpt-popup .cpt-popup__arrow,
.cpt-popup .cpt-popup__thumb,
.cpt-popup .cpt-popup__btn {
	all: unset;
	box-sizing: border-box;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.cpt-grid .cpt-tile:focus-visible,
.cpt-popup .cpt-popup__close:focus-visible,
.cpt-popup .cpt-popup__arrow:focus-visible,
.cpt-popup .cpt-popup__thumb:focus-visible,
.cpt-popup .cpt-popup__btn:focus-visible {
	outline: 2px solid var(--cpt-accent, #a68a6d);
	outline-offset: 2px;
}

/* ---------- Grid + tegels ---------- */

/* In een flex-container krijgt een widget zonder eigen breedte 0px; dan heeft
   de grid geen ruimte en worden de tegels (aspect-ratio) onzichtbaar. */
.elementor-widget-commar_project_tiles,
.elementor-widget-commar_concept_select {
	width: 100%;
	flex-basis: 100%;
	min-width: 0;
}

.elementor-widget-commar_project_tiles .cpt-grid,
.elementor-widget-commar_concept_select .cpt-grid {
	width: 100%;
	min-width: 0;
}

.cpt-grid {
	--cpt-cols: 4;
	--cpt-gap: 16px;
	display: grid;
	grid-template-columns: repeat(var(--cpt-cols), minmax(0, 1fr));
	gap: var(--cpt-gap);
}

.cpt-grid .cpt-tile {
	--cpt-ratio: 0.87;
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: var(--cpt-ratio);
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 8px;
	overflow: hidden;
	background: #2a2c2a;
	cursor: pointer;
	text-align: left;
	font: inherit;
	color: inherit;
	-webkit-appearance: none;
	appearance: none;
}

.cpt-grid .cpt-tile:focus-visible {
	outline: 3px solid #fff;
	outline-offset: -3px;
}

/* Hoge specificiteit: Elementor zet zelf `.elementor img { height: auto }`
   en dat won van `.cpt-tile__img`, waardoor de foto niet de hele tegel vulde. */
.cpt-grid .cpt-tile img.cpt-tile__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	object-fit: cover;
	display: block;
	transition: transform .6s ease;
}

.cpt-zoom-yes .cpt-tile:hover .cpt-tile__img,
.cpt-zoom-yes .cpt-tile:focus-visible .cpt-tile__img {
	transform: scale(1.04);
}

.cpt-tile__bar {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 14px 18px 16px;
	background: rgba(20, 22, 20, .82);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.cpt-tile__title {
	font-weight: 700;
	font-size: 1.05em;
	line-height: 1.3;
	color: #fff;
}

.cpt-tile__sub {
	font-size: .9em;
	line-height: 1.4;
	color: rgba(255, 255, 255, .8);
}

/* ---------- Concept selectie (tegel met label-pill) ---------- */

.cpt-grid .cpt-ctile {
	--cpt-label-offset: 36px;
	background: #e8e4dd;
}

.cpt-grid .cpt-ctile .cpt-ctile__label {
	position: absolute;
	top: var(--cpt-label-offset);
	left: var(--cpt-label-offset);
	z-index: 2;
	display: inline-block;
	max-width: calc(100% - 2 * var(--cpt-label-offset));
	padding: 9px 16px;
	border-radius: 999px;
	background: #fff;
	color: #1a1a1a;
	font-size: .95em;
	font-weight: 600;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	pointer-events: none;
}

.cpt-label-top-right .cpt-ctile .cpt-ctile__label {
	left: auto;
	right: var(--cpt-label-offset);
}

.cpt-label-bottom-left .cpt-ctile .cpt-ctile__label {
	top: auto;
	bottom: var(--cpt-label-offset);
}

.cpt-label-bottom-right .cpt-ctile .cpt-ctile__label {
	top: auto;
	left: auto;
	right: var(--cpt-label-offset);
	bottom: var(--cpt-label-offset);
}

/* Melding in de Elementor-editor (niet op de site) */
.cpt-editor-note {
	padding: 14px 18px;
	border: 1px dashed rgba(0, 0, 0, .25);
	border-radius: 8px;
	font-size: .9rem;
	color: #555;
	background: rgba(0, 0, 0, .03);
}

/* ---------- Popup ---------- */

.cpt-popup {
	--cpt-max-w: 1240px;
	--cpt-radius: 12px;
	--cpt-overlay: rgba(15, 17, 15, .78);
	--cpt-panel-bg: #f5f3ef;
	--cpt-text: #1a1a1a;
	--cpt-accent: #a68a6d;
	--cpt-btn-bg: #2f3e34;
	--cpt-btn-text: #fff;
	--cpt-btn-radius: 8px;

	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
	font-family: inherit;
	color: var(--cpt-text);
	opacity: 0;
	transition: opacity .25s ease;
}

.cpt-popup[hidden] {
	display: none;
}

.cpt-popup.is-open {
	opacity: 1;
}

.cpt-popup *,
.cpt-popup *::before,
.cpt-popup *::after {
	box-sizing: border-box;
}

.cpt-popup__backdrop {
	position: absolute;
	inset: 0;
	background: var(--cpt-overlay);
}

.cpt-popup__dialog {
	position: relative;
	display: grid;
	grid-template-columns: minmax(320px, var(--cpt-panel-w, 40%)) 1fr;
	width: 100%;
	max-width: var(--cpt-max-w);
	height: min(760px, calc(100vh - 48px));
	height: min(760px, calc(100dvh - 48px));
	background: var(--cpt-panel-bg);
	border-radius: var(--cpt-radius);
	overflow: hidden;
	box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
	transform: translateY(12px) scale(.985);
	transition: transform .3s cubic-bezier(.2, .7, .2, 1);
}

.cpt-popup.is-open .cpt-popup__dialog {
	transform: none;
}

/* Sluiten */
.cpt-popup .cpt-popup__close {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 5;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .92);
	color: #1a1a1a;
	cursor: pointer;
	display: grid;
	place-items: center;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
	transition: background .2s ease, transform .2s ease;
}

.cpt-popup .cpt-popup__close:hover,
.cpt-popup .cpt-popup__close:focus-visible {
	background: #fff;
	transform: scale(1.06);
}

.cpt-popup .cpt-popup__close svg {
	width: 18px;
	height: 18px;
}

/* Paneel */
.cpt-popup__panel {
	overflow-y: auto;
	background: var(--cpt-panel-bg);
}

.cpt-popup__panel-inner {
	padding: 40px 36px 32px;
	display: flex;
	flex-direction: column;
	min-height: 100%;
}

.cpt-popup__label {
	display: block;
	margin-bottom: 10px;
	font-size: .72rem;
	font-weight: 600;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--cpt-accent);
}

.cpt-popup__title {
	margin: 0 0 16px;
	font-size: clamp(1.35rem, 1.8vw, 1.75rem);
	font-weight: 700;
	line-height: 1.15;
	color: var(--cpt-text);
}

.cpt-popup__desc {
	margin: 0 0 22px;
	font-size: .875rem;
	line-height: 1.6;
	color: var(--cpt-text);
	opacity: .85;
}

/* Specificaties */
.cpt-popup__specs {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 14px 20px;
	margin: 0 0 28px;
	padding: 20px 0 0;
	border-top: 1px solid rgba(0, 0, 0, .1);
}

.cpt-popup__specs--cols-1 {
	grid-template-columns: 1fr;
}

.cpt-popup__specs--cols-2 .cpt-spec--wide {
	grid-column: 1 / -1;
}

.cpt-spec {
	position: relative;
	margin: 0;
	padding-left: 30px;
}

.cpt-popup__specs--no-icons .cpt-spec {
	padding-left: 0;
}

.cpt-popup .cpt-spec__label {
	margin: 0 0 2px;
	font-size: .74rem;
	font-weight: 500;
	line-height: 1.3;
	color: var(--cpt-text);
	color: color-mix(in srgb, var(--cpt-text) 60%, transparent);
}

.cpt-popup .cpt-spec__value {
	margin: 0;
	font-size: .9rem;
	font-weight: 600;
	line-height: 1.4;
	color: var(--cpt-text);
}

.cpt-spec__icon {
	position: absolute;
	top: 50%;
	left: 0;
	width: 20px;
	height: 20px;
	display: grid;
	place-items: center;
	transform: translateY(-50%);
	color: var(--cpt-accent);
	font-size: 15px;
}

.cpt-spec__icon svg {
	width: 17px;
	height: 17px;
	fill: currentColor;
}

.cpt-spec__icon i {
	font-size: 16px;
	line-height: 1;
	color: var(--cpt-accent);
}

.cpt-popup .cpt-popup__btn {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin-top: auto;
	align-self: flex-start;
	padding: 13px 22px;
	border: 0;
	border-radius: var(--cpt-btn-radius);
	background: var(--cpt-btn-bg);
	color: var(--cpt-btn-text);
	font: inherit;
	font-size: .92rem;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
	transition: filter .2s ease, transform .2s ease;
}

.cpt-popup .cpt-popup__btn:hover,
.cpt-popup .cpt-popup__btn:focus-visible {
	filter: brightness(1.12);
	color: var(--cpt-btn-text);
	text-decoration: none;
}

.cpt-popup .cpt-popup__btn svg {
	width: 16px;
	height: 16px;
}

/* Media */
.cpt-popup__media {
	position: relative;
	background: #111;
	min-height: 0;
}

.cpt-popup__stage {
	position: absolute;
	inset: 0;
}

.cpt-popup img.cpt-popup__slide {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	opacity: 0;
	transition: opacity .35s ease;
}

.cpt-popup img.cpt-popup__slide.is-active {
	opacity: 1;
}

.cpt-popup .cpt-popup__arrow {
	position: absolute;
	top: 50%;
	z-index: 3;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .18);
	color: #fff;
	cursor: pointer;
	display: grid;
	place-items: center;
	transform: translateY(-50%);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	transition: background .2s ease;
}

.cpt-popup .cpt-popup__arrow:hover,
.cpt-popup .cpt-popup__arrow:focus-visible {
	background: rgba(255, 255, 255, .4);
}

.cpt-popup .cpt-popup__arrow svg {
	width: 20px;
	height: 20px;
}

.cpt-popup .cpt-popup__arrow--prev { left: 18px; }
.cpt-popup .cpt-popup__arrow--next { right: 18px; }

.cpt-popup__thumbs {
	position: absolute;
	left: 16px;
	right: 16px;
	bottom: 16px;
	z-index: 3;
	display: flex;
	gap: 8px;
	overflow-x: auto;
	scrollbar-width: none;
}

.cpt-popup__thumbs::-webkit-scrollbar {
	display: none;
}

.cpt-popup .cpt-popup__thumb {
	display: block;
	flex: 0 0 auto;
	width: 96px;
	height: 64px;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 6px;
	overflow: hidden;
	background: #000;
	cursor: pointer;
	opacity: .75;
	transition: opacity .2s ease, border-color .2s ease;
}

.cpt-popup .cpt-popup__thumb img {
	max-width: none;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cpt-popup .cpt-popup__thumb:hover,
.cpt-popup__thumb.is-active {
	opacity: 1;
}

.cpt-popup__thumb.is-active {
	border-color: var(--cpt-accent);
}

/* Fullscreen-galerij (knop zonder link) */
.cpt-popup.is-fullscreen .cpt-popup__dialog {
	grid-template-columns: 1fr;
	max-width: none;
	height: calc(100vh - 48px);
	height: calc(100dvh - 48px);
}

.cpt-popup.is-fullscreen .cpt-popup__panel {
	display: none;
}

.cpt-popup.is-fullscreen img.cpt-popup__slide {
	object-fit: contain;
}

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
	.cpt-popup__panel-inner {
		padding: 36px 28px 28px;
	}
}

@media (max-width: 767px) {
	.cpt-popup {
		padding: 0;
	}
	.cpt-popup__dialog {
		grid-template-columns: 1fr;
		grid-template-rows: 46vh 1fr;
		height: 100vh;
		height: 100dvh;
		border-radius: 0;
	}
	.cpt-popup__media {
		order: 1;
	}
	.cpt-popup__panel {
		order: 2;
	}
	.cpt-popup__panel-inner {
		padding: 28px 22px 32px;
	}
	.cpt-popup__title {
		font-size: 1.4rem;
	}
	.cpt-popup .cpt-popup__thumb {
		width: 72px;
		height: 48px;
	}
	.cpt-popup .cpt-popup__arrow {
		width: 38px;
		height: 38px;
	}
	.cpt-popup .cpt-popup__close {
		top: 12px;
		right: 12px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cpt-popup,
	.cpt-popup__dialog,
	.cpt-popup img.cpt-popup__slide,
	.cpt-grid .cpt-tile img.cpt-tile__img {
		transition: none;
	}
}
