/*
 * IBD Projektgalerie — Frontend-CSS
 *
 * - Schriftarten erbt das Plugin vom Theme. Keine font-family-Deklaration ausser `inherit`.
 * - Kein Section-Background, kein Wrapper-Padding — der Shortcode rendert nur das Akkordeon,
 *   die umgebende Komposition (Spaltenbreite, Vorabstand, Headline) macht der Builder.
 * - Mobile-First: horizontal Scroll-Snap. Ab 1024px Desktop-Akkordeon.
 * - IBD-Brand: Akzent #e20e18 (rot), Karten-Overlay neutral dunkel ueber Foto.
 */

.ibd-projekte {
	--ibd-fg: #ffffff;
	--ibd-accent: #e20e18;
	--ibd-meta: rgba(255, 255, 255, 0.85);
	--ibd-card-h: clamp(440px, 56vw, 620px);
	--ibd-easing: cubic-bezier(0.16, 1, 0.3, 1);
	--ibd-radius: 6px;
	--ibd-gradient-active: linear-gradient(180deg, rgba(33, 35, 38, 0.05) 0%, rgba(33, 35, 38, 0.92) 100%);
	--ibd-gradient-inactive: linear-gradient(180deg, rgba(33, 35, 38, 0.35) 0%, rgba(33, 35, 38, 0.92) 100%);
	--ibd-pill-bg: rgba(255, 255, 255, 0.18);
	--ibd-pill-hover-bg: #e20e18;
	--ibd-pill-hover-fg: #ffffff;

	box-sizing: border-box;
	background: transparent;
	padding: 0;
	margin: 0;
	color: inherit;
	font-family: inherit;
}

.ibd-projekte *,
.ibd-projekte *::before,
.ibd-projekte *::after {
	box-sizing: border-box;
	font-family: inherit;
}

/* ---------- Optional Header (nur wenn explizit per Shortcode-Attribut gesetzt) ---------- */

.ibd-projekte__header {
	margin: 0 0 clamp(24px, 4vw, 48px);
}

.ibd-projekte__eyebrow {
	font-size: 11px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--ibd-accent);
	margin-bottom: 1rem;
	font-weight: 600;
}

.ibd-projekte__headline {
	font-size: clamp(28px, 4vw, 64px);
	line-height: 1.1;
	margin: 0;
	color: inherit;
	font-weight: inherit;
}

.ibd-projekte__headline em {
	font-style: italic;
}

.ibd-projekte__intro {
	margin: 1.25rem 0 0;
	font-size: clamp(15px, 1.2vw, 18px);
	line-height: 1.5;
	color: inherit;
	max-width: 60ch;
}

/* ---------- Grid (Mobile = Scroll-Snap) ---------- */

.ibd-projekte__grid {
	display: flex;
	gap: 12px;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	-ms-overflow-style: none;
	padding: 0;
	margin: 0;
}

.ibd-projekte__grid::-webkit-scrollbar {
	display: none;
}

.ibd-projekte__spacer {
	flex: 0 0 4px;
	display: block;
}

.ibd-projekte__card {
	position: relative;
	flex: 0 0 clamp(280px, 80vw, 360px);
	aspect-ratio: 4 / 5;
	scroll-snap-align: start;
	overflow: hidden;
	border-radius: var(--ibd-radius);
	cursor: pointer;
	outline: none;
	background: #212326;
}

.ibd-projekte__card:focus-visible {
	box-shadow: 0 0 0 2px rgba(226, 14, 24, 0.55);
}

/* ---------- Media + Overlay ---------- */

.ibd-projekte__media {
	position: absolute;
	inset: 0;
	overflow: hidden;
}

.ibd-projekte__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	filter: saturate(0.95);
	transition: transform 1000ms var(--ibd-easing);
	display: block;
}

.ibd-projekte__card:hover .ibd-projekte__img {
	transform: scale(1.02);
}

.ibd-projekte__overlay {
	position: absolute;
	inset: 0;
	background: var(--ibd-gradient-active);
	transition: opacity 700ms var(--ibd-easing), background 700ms var(--ibd-easing);
}

/* ---------- Body / Vertical Label ---------- */

.ibd-projekte__vlabel {
	display: none;
}

.ibd-projekte__body {
	position: absolute;
	left: clamp(20px, 4vw, 28px);
	right: clamp(20px, 4vw, 28px);
	bottom: clamp(20px, 4vw, 28px);
	display: flex;
	flex-direction: column;
	gap: 8px;
	color: var(--ibd-fg);
	z-index: 2;
	transition: opacity 500ms var(--ibd-easing);
}

/*
 * Karten-Texte mit !important gegen Theme-Overrides absichern (Avada hat z. B.
 * `.entry-content h3 { color: #333 }`-Regeln, die unsere Standard-Styles
 * specificity-maessig schlagen wuerden — Lesbarkeit ueber dem Bildoverlay
 * ist aber zwingend).
 */

.ibd-projekte__badge {
	display: inline-block !important;
	align-self: flex-start;
	padding: 4px 10px !important;
	border-radius: 999px !important;
	background: var(--ibd-accent) !important;
	color: #ffffff !important;
	font-size: 10.5px !important;
	letter-spacing: 0.12em !important;
	text-transform: uppercase !important;
	font-weight: 700 !important;
	line-height: 1.4 !important;
	margin: 10px 0 0 !important;
	text-decoration: none !important;
}

.ibd-projekte__title {
	font-size: clamp(22px, 2vw, 32px) !important;
	line-height: 1.15 !important;
	margin: 0 !important;
	padding: 0 !important;
	color: var(--ibd-fg) !important;
	font-weight: 700 !important;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.ibd-projekte__desc {
	margin: 6px 0 0 !important;
	padding: 0 !important;
	font-size: 13px !important;
	line-height: 1.45 !important;
	color: var(--ibd-meta) !important;
	font-weight: 400 !important;
	max-width: 52ch;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.ibd-projekte__meta {
	display: flex;
	align-items: flex-end;
	justify-content: flex-end;
	gap: 12px;
	margin-top: 10px;
	flex-wrap: wrap;
}

.ibd-projekte__pill {
	display: inline-flex !important;
	align-items: center;
	gap: 6px;
	padding: 7px 14px !important;
	border-radius: 999px !important;
	background: var(--ibd-pill-bg) !important;
	color: var(--ibd-fg) !important;
	font-size: 11px !important;
	font-weight: 600 !important;
	text-decoration: none !important;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	transition: background-color 250ms ease, color 250ms ease;
	white-space: nowrap;
	border: 0;
}

.ibd-projekte__pill:hover,
.ibd-projekte__pill:focus-visible {
	background: var(--ibd-pill-hover-bg) !important;
	color: var(--ibd-pill-hover-fg) !important;
	outline: none;
}

/* ---------- CTA ---------- */

.ibd-projekte__footer {
	margin: clamp(32px, 5vw, 56px) 0 0;
	display: flex;
	justify-content: center;
}

.ibd-projekte__cta {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 14px 22px;
	border-radius: 999px;
	border: 1px solid var(--ibd-accent);
	color: var(--ibd-accent);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	transition: background-color 300ms var(--ibd-easing), color 300ms var(--ibd-easing);
}

.ibd-projekte__cta:hover,
.ibd-projekte__cta:focus-visible {
	background: var(--ibd-accent);
	color: #ffffff;
	outline: none;
}

/* ============================================================
 * Desktop ≥ 1024px — Akkordeon
 * ============================================================ */

@media (min-width: 1024px) {
	.ibd-projekte__grid {
		overflow: hidden;
		scroll-snap-type: none;
		gap: 8px;
		height: var(--ibd-card-h);
	}

	.ibd-projekte__spacer {
		display: none;
	}

	.ibd-projekte__card {
		flex: 1 1 0;
		aspect-ratio: auto;
		min-width: 60px;
		height: 100%;
		scroll-snap-align: none;
		transition: flex-grow 700ms var(--ibd-easing), min-width 700ms var(--ibd-easing);
	}

	.ibd-projekte__card[data-active="true"] {
		flex-grow: 8;
		min-width: 360px;
	}

	.ibd-projekte__card[data-active="false"] {
		flex-grow: 1;
		min-width: 48px;
	}

	/* Inactive: heavier gradient */
	.ibd-projekte__card[data-active="false"] .ibd-projekte__overlay {
		background: var(--ibd-gradient-inactive);
	}

	/* Inactive: hide body, show vertical label */
	.ibd-projekte__card[data-active="false"] .ibd-projekte__body {
		opacity: 0;
		pointer-events: none;
	}

	.ibd-projekte__card[data-active="false"] .ibd-projekte__vlabel {
		display: block !important;
		position: absolute;
		left: 50%;
		bottom: 28px;
		transform: translateX(-50%) rotate(180deg);
		writing-mode: vertical-rl;
		font-size: 10.5px !important;
		letter-spacing: 0.18em !important;
		text-transform: uppercase;
		color: rgba(255, 255, 255, 0.95) !important;
		font-weight: 600 !important;
		white-space: nowrap;
		z-index: 2;
		pointer-events: none;
		text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
	}

	.ibd-projekte__card[data-active="true"] .ibd-projekte__body {
		opacity: 1;
	}
}

/* ============================================================
 * Reduced motion
 * ============================================================ */

@media (prefers-reduced-motion: reduce) {
	.ibd-projekte__card,
	.ibd-projekte__img,
	.ibd-projekte__overlay,
	.ibd-projekte__body,
	.ibd-projekte__pill,
	.ibd-projekte__cta {
		transition-duration: 0.01ms !important;
	}

	.ibd-projekte__card:hover .ibd-projekte__img {
		transform: none;
	}
}
