/**
 * TGJ Image Background Block Styles
 * Mobile-first responsive design
 *
 * Uses shared variables from journal-blocks-variables.css
 */

@import url('journal-blocks-variables.css');

/* Base styles - Mobile first */
.jc-block.tgj-image-background {
	position: relative;
	display: block;
	width: 100%;
}

/* Full Screen Modifier - Mobile (applies only below 640px) */
@media (max-width: 639px) {
	.jc-block.tgj-image-background.tgj-image-background--full-screen-mobile {
		width: 100lvw;
		height: 100lvh;
		min-height: 100lvh;
	}

	.jc-block.tgj-image-background.tgj-image-background--full-screen-mobile .tgj-image-background__image {
		height: 100%;
	}

	.jc-block.tgj-image-background.tgj-image-background--full-screen-mobile .tgj-image-background__image img {
		height: 100%;
		object-fit: cover;
		object-position: center;
	}
}

/* Background image layer */
.jc-block.tgj-image-background .tgj-image-background__image {
	position: relative;
	width: 100%;
	z-index: 1;
}

.jc-block.tgj-image-background .tgj-image-background__image img {
	display: block;
	width: 100%;
	height: auto;
}

/* Dark overlay for text legibility */
.jc-block.tgj-image-background .tgj-image-background__dark-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.4);
	z-index: 2;
	display: none;
}

.jc-block.tgj-image-background.tgj-image-background--has-overlay .tgj-image-background__dark-overlay {
	display: block;
}

/* Overlay layer for content positioning */
.jc-block.tgj-image-background .tgj-image-background__overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 3;
	display: flex;
}

/* Content container */
.jc-block.tgj-image-background .tgj-image-background__container {
	max-width: 1440px;
	width: 100%;
	margin: 0 auto;
	box-sizing: border-box;
}

.jc-block.tgj-image-background .tgj-image-background__content {
	padding-left: 0;
	padding-right: 0;
}

/* Typography */
.jc-block.tgj-image-background .tgj-image-background__content h2 {
	font-feature-settings: 'liga' off, 'clig' off;
	font-family: "Tiempos Headline";
	font-size: 48px;
	font-style: normal;
	font-weight: 300;
	line-height: 56px; /* 116.667% */
	text-wrap: pretty;
}

.jc-block.tgj-image-background .tgj-image-background__content h3 {
	font-feature-settings: 'liga' off, 'clig' off;
	font-family: "Tiempos Headline";
	font-size: 24px;
	font-style: italic;
	font-weight: 300;
	line-height: 150%; /* 36px */
	text-wrap: pretty;
}

.jc-block.tgj-image-background .tgj-image-background__content p {
	font-feature-settings: 'liga' off, 'clig' off;
	font-family: "Tiempos Text";
	font-size: 15px;
	font-style: normal;
	font-weight: 400;
	line-height: 160%; /* 24px */
	text-wrap: pretty;
}

/* Horizontal Positioning - Left */
.jc-block.tgj-image-background.tgj-image-background--h-left .tgj-image-background__overlay {
	justify-content: flex-start;
}

.jc-block.tgj-image-background.tgj-image-background--h-left .tgj-image-background__content {
	text-align: left;
}

.jc-block.tgj-image-background.tgj-image-background--h-left .tgj-image-background__container {
	padding-left: 20px;
	padding-right: 20px;
}

/* Horizontal Positioning - Center */
.jc-block.tgj-image-background.tgj-image-background--h-center .tgj-image-background__overlay {
	justify-content: center;
}

.jc-block.tgj-image-background.tgj-image-background--h-center .tgj-image-background__content {
	text-align: center;
}

.jc-block.tgj-image-background.tgj-image-background--h-center .tgj-image-background__container {
	padding-left: 20px;
	padding-right: 20px;
}

/* Horizontal Positioning - Right */
.jc-block.tgj-image-background.tgj-image-background--h-right .tgj-image-background__overlay {
	justify-content: flex-end;
}

.jc-block.tgj-image-background.tgj-image-background--h-right .tgj-image-background__content {
	text-align: left;
}

.jc-block.tgj-image-background.tgj-image-background--h-right .tgj-image-background__container {
	padding-left: 20px;
	padding-right: 20px;
}

/* Vertical Positioning - Top */
.jc-block.tgj-image-background.tgj-image-background--v-top .tgj-image-background__overlay {
	align-items: flex-start;
}

.jc-block.tgj-image-background.tgj-image-background--v-top .tgj-image-background__container {
	padding-top: 20px;
	padding-bottom: 20px;
}

/* Vertical Positioning - Center */
.jc-block.tgj-image-background.tgj-image-background--v-center .tgj-image-background__overlay {
	align-items: center;
}

.jc-block.tgj-image-background.tgj-image-background--v-center .tgj-image-background__container {
	padding-top: 20px;
	padding-bottom: 20px;
}

/* Vertical Positioning - Bottom */
.jc-block.tgj-image-background.tgj-image-background--v-bottom .tgj-image-background__overlay {
	align-items: flex-end;
}

.jc-block.tgj-image-background.tgj-image-background--v-bottom .tgj-image-background__container {
	padding-top: 20px;
	padding-bottom: 20px;
}

/* Tablet styles */
@media (min-width: 640px) and (max-width: 1023px) {
	/* Content padding - Tablet */
	.jc-block.tgj-image-background .tgj-image-background__content {
		padding-left: 40px;
		padding-right: 40px;
	}

	/* Full Screen Modifier - Tablet (applies only 640px-1023px) */
	.jc-block.tgj-image-background.tgj-image-background--full-screen-tablet {
		width: 100lvw;
		height: 100lvh;
		min-height: 100lvh;
	}

	.jc-block.tgj-image-background.tgj-image-background--full-screen-tablet .tgj-image-background__image {
		height: 100%;
	}

	.jc-block.tgj-image-background.tgj-image-background--full-screen-tablet .tgj-image-background__image img {
		height: 100%;
		object-fit: cover;
		object-position: center;
	}
}

/* Desktop styles */
@media (min-width: 1024px) {
	/* Full Screen Modifier - Desktop */
	.jc-block.tgj-image-background.tgj-image-background--full-screen-desktop {
		width: 100lvw;
		height: 100lvh;
		min-height: 100lvh;
	}

	.jc-block.tgj-image-background.tgj-image-background--full-screen-desktop .tgj-image-background__image {
		height: 100%;
	}

	.jc-block.tgj-image-background.tgj-image-background--full-screen-desktop .tgj-image-background__image img {
		height: 100%;
		object-fit: cover;
		object-position: center;
	}

	/* Increase padding on desktop for non-center positions */
	.jc-block.tgj-image-background.tgj-image-background--h-left .tgj-image-background__container,
	.jc-block.tgj-image-background.tgj-image-background--h-right .tgj-image-background__container {
		padding-left: 60px;
		padding-right: 60px;
	}

	.jc-block.tgj-image-background.tgj-image-background--h-center .tgj-image-background__container {
		padding-left: 60px;
		padding-right: 60px;
	}

	.jc-block.tgj-image-background.tgj-image-background--v-top .tgj-image-background__container,
	.jc-block.tgj-image-background.tgj-image-background--v-bottom .tgj-image-background__container {
		padding-top: 60px;
		padding-bottom: 60px;
	}

	.jc-block.tgj-image-background.tgj-image-background--v-center .tgj-image-background__container {
		padding-top: 60px;
		padding-bottom: 60px;
	}

	/* Content padding - Desktop */
	.jc-block.tgj-image-background .tgj-image-background__content {
		padding-left: 130px;
		padding-right: 130px;
	}

	/* Typography - Desktop */
	.jc-block.tgj-image-background .tgj-image-background__content h3 {
		font-size: 36px;
		line-height: 150%; /* 54px */
	}

	.jc-block.tgj-image-background .tgj-image-background__content p {
		font-family: "Tiempos Headline";
		font-size: 26px;
		font-weight: 300;
		line-height: 32px;
	}
}

/* Editor-specific styles */
.wp-block[data-type="journal-blocks/tgj-image-background"] .tgj-image-background {
	min-height: 400px;
}

/* Disable pointer events on overlay so clicks pass through to button */
.wp-block[data-type="journal-blocks/tgj-image-background"] .tgj-image-background__overlay {
	pointer-events: none;
}

/* Re-enable pointer events on container and content */
.wp-block[data-type="journal-blocks/tgj-image-background"] .tgj-image-background__container {
	pointer-events: auto;
	max-height: 400px;
	overflow-y: auto;
}

.wp-block[data-type="journal-blocks/tgj-image-background"] .tgj-image-background__content {
	pointer-events: auto;
	position: relative;
	z-index: 3;
}

/* Smaller h3 font size in editor */
.wp-block[data-type="journal-blocks/tgj-image-background"] .tgj-image-background__content h3 {
	font-size: 20px;
	line-height: 140%;
}
