/**
 * KuLaDu Text Bubble Component (Version 3.1)
 *
 * Sauber und konsistent - nutzt vorhandene image-bubble.css Styles
 */

/* ==========================================================================
   Container - Full Width
   ========================================================================== */

.kuladu-text-bubble {
	position: relative;
	width: 100%;
	display: block;
}

/* Bubble wrapper - always full container width */
.kuladu-text-bubble__bubble {
	width: 100%;
}

/* ==========================================================================
   Text Alignment Options (Flexbox für korrektes Zentrieren)
   ========================================================================== */

.kuladu-text-bubble__blocks {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
}

@media (min-width: 768px) {
	.kuladu-text-bubble__blocks {
		gap: var(--space-5);
	}
}

@media (min-width: 1024px) {
	.kuladu-text-bubble__blocks {
		gap: var(--space-6);
	}
}

/* Left alignment */
.kuladu-text-bubble--align-left .kuladu-text-bubble__blocks {
	align-items: flex-start;
}

/* Center alignment */
.kuladu-text-bubble--align-center .kuladu-text-bubble__blocks {
	align-items: center;
	text-align: left;
}

/* Text blocks should inherit center alignment */
.kuladu-text-bubble--align-center .kuladu-text-bubble__text-block {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center; /* Fallback für Fließtext in description */
}

/* ==========================================================================
   Block Wrapper with Padding Options
   ========================================================================== */

.kuladu-text-bubble__block-wrapper {
	width: 100%;
	/* Base wrapper - no padding by default */
}

/* Padding Top */
.kuladu-text-bubble__block-wrapper--pt-sm {
	padding-top: var(--space-2); /* 8px */
}

.kuladu-text-bubble__block-wrapper--pt-md {
	padding-top: var(--space-4); /* 16px */
}

.kuladu-text-bubble__block-wrapper--pt-lg {
	padding-top: var(--space-6); /* 24px */
}

/* Padding Bottom */
.kuladu-text-bubble__block-wrapper--pb-sm {
	padding-bottom: var(--space-2); /* 8px */
}

.kuladu-text-bubble__block-wrapper--pb-md {
	padding-bottom: var(--space-4); /* 16px */
}

.kuladu-text-bubble__block-wrapper--pb-lg {
	padding-bottom: var(--space-6); /* 24px */
}

/* ==========================================================================
   Text Content Block
   ========================================================================== */

.kuladu-text-bubble__text-block {
	width: 100%;
}

/* Kicker (Typography via Utility-Classes) */
.kuladu-text-bubble__kicker {
	display: block;
	color: var(--color-black);
	margin-bottom: 0.375rem; /* 6px - Extra enger Abstand zur Headline */
}

/* Heading (Typography via Utility-Classes) */
.kuladu-text-bubble__heading {
	margin: 0 0 var(--space-4) 0;
	color: var(--color-black);
}

@media (min-width: 768px) {
	.kuladu-text-bubble__heading {
		margin-bottom: var(--space-5);
	}
}

@media (min-width: 1024px) {
	.kuladu-text-bubble__heading {
		margin-bottom: var(--space-6);
	}
}

/* Description - Nutzt native <p> Styles für Typografie (Single Source of Truth) */
.kuladu-text-bubble__description {
	margin: 0;
	max-width: 65ch; /* Optimale Lesbarkeit */
}

.kuladu-text-bubble__description p {
	margin: 0 0 var(--space-4) 0;
	/* Alle Styles von globalem <p> geerbt */
}

.kuladu-text-bubble__description p:last-child {
	margin-bottom: 0;
}

/* ==========================================================================
   Wavy Divider (uses kuladu_wavy_divider() helper)
   ========================================================================== */

.kuladu-text-bubble__divider {
	width: 100%;
	margin: var(--space-2) 0;
}

/* Override helper's default margin when inside text-bubble */
.kuladu-text-bubble__divider .kuladu-wavy-divider {
	margin: 0;
}

/* Override helper's SVG fill color to use currentColor */
.kuladu-text-bubble__divider .kuladu-wavy-divider svg {
	height: 3px; /* Force 3px height */
}

.kuladu-text-bubble__divider .kuladu-wavy-divider svg path {
	fill: currentColor;
}

/* Black background variant - make divider more visible */
.kuladu-speech-bubble--bg-black .kuladu-wavy-divider svg path {
	fill: var(--color-white);
	opacity: 0.5;
}

/* ==========================================================================
   Date & Location (Flexibles Layout - nebeneinander/untereinander)
   ========================================================================== */

.kuladu-text-bubble__datetime {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-4);
	align-items: flex-start;
}

@media (min-width: 768px) {
	.kuladu-text-bubble__datetime {
		gap: var(--space-6);
	}
}

/* Meta Blocks (Date & Location) - Uses Mono Font for Data Display */
.kuladu-text-bubble__meta {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	color: var(--color-black);
	flex: 0 1 auto; /* Flexibel: Nebeneinander wenn Platz, sonst untereinander */
}

/* Icon styling */
.kuladu-text-bubble__icon {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	color: currentColor;
	align-self: flex-start;
}

@media (min-width: 768px) {
	.kuladu-text-bubble__icon {
		width: 24px;
		height: 24px;
	}
}

/* Black background - ensure icons are white */
.kuladu-speech-bubble--bg-black .kuladu-text-bubble__meta,
.kuladu-speech-bubble--bg-black .kuladu-text-bubble__icon {
	color: var(--color-white);
}

/* Center alignment für Datum & Ort */
.kuladu-text-bubble--align-center .kuladu-text-bubble__datetime {
	align-items: center;
	justify-content: center;
	text-align: center;
}

/* Meta-Blöcke: inline-block damit sie nur so breit sind wie ihr Inhalt */
.kuladu-text-bubble--align-center .kuladu-text-bubble__meta {
	display: inline-block;
	text-align: center;
}

/* Icon inline mit Text - vertikal zentriert */
.kuladu-text-bubble--align-center .kuladu-text-bubble__icon {
	vertical-align: middle;
}

/* ==========================================================================
   Image Blocks - STYLES AUS image-bubble.css WIEDERVERWENDET
   ========================================================================== */

/* Media (Image) Container */
.kuladu-text-bubble__media {
	position: relative;
	width: 100%;
	height: auto;
	line-height: 0;
}

.kuladu-text-bubble__image {
	display: block;
	width: 100%;
	height: auto;
	object-fit: cover;
	border: 2px solid var(--color-black);
	vertical-align: top;
}

/* Aspect Ratio Variants */
.kuladu-text-bubble__image--ratio-auto {
	width: 100%;
	height: auto;
}

.kuladu-text-bubble__image--ratio-1-1 {
	aspect-ratio: 1 / 1;
	object-fit: cover;
}

.kuladu-text-bubble__image--ratio-4-3 {
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

.kuladu-text-bubble__image--ratio-3-2 {
	aspect-ratio: 3 / 2;
	object-fit: cover;
}

.kuladu-text-bubble__image--ratio-16-9 {
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

.kuladu-text-bubble__image--ratio-2-3 {
	aspect-ratio: 2 / 3;
	object-fit: cover;
}

.kuladu-text-bubble__image--ratio-3-4 {
	aspect-ratio: 3 / 4;
	object-fit: cover;
}

/* ==========================================================================
   Note: Border-radius, shadow, and spacing styles moved to bubble-media-shadow.css
   Components now use .kuladu-bubble-media classes for unified shadow system
   ========================================================================== */

/* ==========================================================================
   CTA Button
   ========================================================================== */

.kuladu-text-bubble__bubble .kuladu-button {
	margin-top: var(--space-2);
}

/* Center alignment für Button */
.kuladu-text-bubble--align-center .kuladu-button {
	margin-left: auto;
	margin-right: auto;
	display: table; /* Trick: table behält intrinsische Breite, erlaubt aber margin: auto */
}

/* ==========================================================================
   Black Background Compatibility
   ========================================================================== */

.kuladu-speech-bubble--bg-black .kuladu-text-bubble__kicker,
.kuladu-speech-bubble--bg-black .kuladu-text-bubble__heading,
.kuladu-speech-bubble--bg-black .kuladu-text-bubble__description,
.kuladu-speech-bubble--bg-black .kuladu-text-bubble__description p {
	color: var(--color-white);
}

/* ==========================================================================
   Last Child Cleanup
   ========================================================================== */

.kuladu-text-bubble__bubble > *:last-child,
.kuladu-text-bubble__blocks > *:last-child {
	margin-bottom: 0;
}
