/**
 * Global front-end styles.
 */

/* -------------------------------------------------------------------------
 * 1. Titles
 *
 * One style for every title on the site: same font, same size, same weight.
 * Colors are intentionally NOT set here, so each block keeps its own color
 * (purple brand titles, dark card titles, gradient hero).
 *
 * The repeated class is deliberate: the GenerateBlocks/NFD utility classes
 * (nfd-text-lg, nfd-text-huge) set font-size and weight with !important, so a
 * plain `.wp-block-heading` rule loses. Repeating the class raises specificity
 * without touching the theme.
 * ------------------------------------------------------------------------- */
html body .wp-block-heading.wp-block-heading.wp-block-heading.wp-block-heading,
html body p[class*="wp-elements-"] {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
	font-size: clamp(26px, 2.4vw, 32px) !important;
	font-weight: 800 !important;
	line-height: 1.2 !important;
	letter-spacing: -0.01em !important;
}

/* -------------------------------------------------------------------------
 * 2. Season tabs ("Meet Your ... Pals")
 *
 * Every panel is a wrapper with a columns block (text | image). Some panels
 * also have a gallery under the columns, and some keep the title as a direct
 * child. `display: contents` promotes the two columns to grid items, so the
 * wrapper can place text, thumbnails and image in one grid:
 *
 *   Halloween (no gallery)      Christmas / Tooth Friends (gallery)
 *   ┌───────────┬───────┐       ┌───────────┬───────┐
 *   │ text      │ image │       │ title     │ image │
 *   │           │       │       │ text      │       │
 *   │           │       │       │ thumbs    │       │
 *   └───────────┴───────┘       └───────────┴───────┘
 *
 * The image is a CSS background on a gb-element div and its depth changes
 * between tabs (direct child on Christmas, one level deeper on Halloween), so
 * both levels get the radius / overflow treatment.
 * ------------------------------------------------------------------------- */
[id^="tabs_2-tab-"] div:has(> .wp-block-columns) {
	display: grid !important;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
	grid-template-areas: "text image";
	gap: 24px !important;
	align-items: stretch !important;
}

/* Panel with thumbnails under the text. */
[id^="tabs_2-tab-"] div:has(> .wp-block-columns):has(> .wp-block-gallery) {
	grid-template-areas:
		"text image"
		"thumbs image";
}

/* Panel whose title is a direct child (not inside the text column). */
[id^="tabs_2-tab-"] div:has(> .wp-block-columns):has(> p) {
	grid-template-areas:
		"title image"
		"text image";
}

/* Panel with both. */
[id^="tabs_2-tab-"] div:has(> .wp-block-columns):has(> p):has(> .wp-block-gallery) {
	grid-template-areas:
		"title image"
		"text image"
		"thumbs image";
	row-gap: 12px !important;
}

[id^="tabs_2-tab-"] div:has(> .wp-block-columns) > .wp-block-columns {
	display: contents !important;
}

[id^="tabs_2-tab-"] div:has(> .wp-block-columns) .wp-block-column:first-child {
	grid-area: text;
	min-width: 0;
}

[id^="tabs_2-tab-"] div:has(> .wp-block-columns) .wp-block-column:last-child {
	grid-area: image;
	min-width: 0;
}

[id^="tabs_2-tab-"] div:has(> .wp-block-columns) .wp-block-gallery {
	grid-area: thumbs;
}

[id^="tabs_2-tab-"] div:has(> .wp-block-columns) > p {
	grid-area: title;
	margin: 0;
}

/* Image wrapper: fill the grid height and keep rounded corners. */
[id^="tabs_2-tab-"] .wp-block-column:last-child > div,
[id^="tabs_2-tab-"] .wp-block-column:last-child > div > div {
	border-radius: 20px !important;
	overflow: hidden !important;
	background-size: cover !important;
	background-position: center !important;
}

[id^="tabs_2-tab-"] .wp-block-column:last-child > div {
	height: 100% !important;
}

[id^="tabs_2-tab-"] .wp-block-column:last-child > div > div {
	width: 100% !important;
	height: 100% !important;
}

/* Thumbnails: four per row. */
[id^="tabs_2-tab-"] .wp-block-gallery {
	display: grid !important;
	grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
	gap: 12px !important;
}

[id^="tabs_2-tab-"] .wp-block-gallery figure {
	flex: 0 0 auto !important;
	width: auto !important;
	margin: 0 !important;
}

[id^="tabs_2-tab-"] .wp-block-gallery img {
	width: 100% !important;
	height: auto !important;
	aspect-ratio: 107 / 237;
	object-fit: cover;
	border-radius: 8px !important;
}

/* Mobile: everything stacks. */
@media (max-width: 781px) {
	[id^="tabs_2-tab-"] div:has(> .wp-block-columns) {
		grid-template-columns: minmax(0, 1fr) !important;
		grid-template-areas:
			"image"
			"text";
	}

	[id^="tabs_2-tab-"] div:has(> .wp-block-columns):has(> .wp-block-gallery) {
		grid-template-areas:
			"image"
			"text"
			"thumbs";
	}

	[id^="tabs_2-tab-"] div:has(> .wp-block-columns):has(> p):has(> .wp-block-gallery) {
		grid-template-areas:
			"title"
			"image"
			"text"
			"thumbs";
	}

	[id^="tabs_2-tab-"] div:has(> .wp-block-columns):has(> p) {
		grid-template-areas:
			"title"
			"image"
			"text";
	}

	[id^="tabs_2-tab-"] .wp-block-column:last-child > div {
		aspect-ratio: 3 / 2;
		height: auto !important;
	}
}
