/**
 * Thameside global typography — front end + block editor.
 *
 * Scale matches theme.json presets and legacy Thameside `_typography.scss`.
 * Hero bands use plugin rules; footer/header nav use custom.css.
 */

:root {
	--thameside-type-body: 1.6rem;
	--thameside-type-body-mobile: 16px;
	--thameside-type-body-line: 1.65;
	--thameside-type-small: 1.4rem;
	--thameside-type-large: 2rem;
	--thameside-type-xl: 2.8rem;
	--thameside-type-h1: clamp(2.8rem, 4vw, 6.8rem);
	--thameside-type-h2: clamp(2.4rem, 3.5vw, 4.2rem);
	--thameside-type-h3: clamp(2rem, 3vw, 2.8rem);
	--thameside-type-h4: clamp(1.8rem, 2.5vw, 2.4rem);
	--thameside-type-h5: clamp(1.6rem, 2vw, 2rem);
	--thameside-type-h6: clamp(1.4rem, 2vw, 1.6rem);
}

/* --- Body copy (post content, Thameside blocks, editor canvas) --- */

:is(.wp-site-blocks, .editor-styles-wrapper) :where(
	.wp-block-post-content,
	.thameside-main,
	.thameside-content-blocks .block__media-text__content,
	.thameside-content-blocks .th-accordion-panel,
	.thameside-content-blocks .block__contact__content,
	.thameside-content-blocks .block__text .container,
	.th-page-prose,
	.th-legal-prose
) :where(p, li, .wp-block-paragraph, .wp-block-list-item, dd, dt):not(:where(.wp-block-thameside-hero-media *, .block__hero *, .thameside-site-header *, .thameside-site-footer *)) {
	font-family: var(--wp--preset--font-family--body, "Inter Tight", sans-serif);
	font-size: var(--thameside-type-body);
	font-weight: 400;
	line-height: var(--thameside-type-body-line);
}

@media (max-width: 1023px) {
	:is(.wp-site-blocks, .editor-styles-wrapper) :where(
		.wp-block-post-content,
		.thameside-main,
		.thameside-content-blocks .block__media-text__content,
		.thameside-content-blocks .th-accordion-panel,
		.thameside-content-blocks .block__contact__content
	) :where(p, li, .wp-block-paragraph, .wp-block-list-item):not(:where(.wp-block-thameside-hero-media *, .block__hero *)) {
		font-size: var(--thameside-type-body-mobile);
	}
}

/* --- Headings (content + Thameside blocks; heroes excluded) --- */

:is(.wp-site-blocks, .editor-styles-wrapper) :where(
	.wp-block-post-content,
	.thameside-main,
	.thameside-content-blocks .block__media-text__content,
	.thameside-content-blocks .block__text .container,
	.th-page-prose,
	.th-legal-prose
) :where(h1, h2, h3, h4, h5, h6, .wp-block-heading):not(:where(.wp-block-thameside-hero-media *, .block__hero *, .thameside-site-header *, .thameside-site-footer *, .block__contact *, .th-card *, .th-card-group *)) {
	font-family: var(--wp--preset--font-family--heading, "DM Serif Display", serif);
	font-weight: 400;
	line-height: 1.2;
	color: var(--wp--preset--color--primary, #041c49);
}

:is(.wp-site-blocks, .editor-styles-wrapper) :where(
	.wp-block-post-content,
	.thameside-main,
	.thameside-content-blocks .block__media-text__content,
	.thameside-content-blocks .block__contact__content,
	.thameside-content-blocks .block__text .container,
	.th-page-prose,
	.th-legal-prose
) :is(h1, .wp-block-heading[data-level="1"], h1.wp-block-heading):not(:where(.wp-block-thameside-hero-media *, .block__hero *)) {
	font-size: var(--thameside-type-h1);
}

:is(.wp-site-blocks, .editor-styles-wrapper) :where(
	.wp-block-post-content,
	.thameside-main,
	.thameside-content-blocks .block__media-text__content,
	.thameside-content-blocks .block__contact__content,
	.thameside-content-blocks .block__text .container,
	.th-page-prose,
	.th-legal-prose
) :is(h2, .wp-block-heading[data-level="2"], h2.wp-block-heading):not(:where(.wp-block-thameside-hero-media *, .block__hero *)) {
	font-size: var(--thameside-type-h2);
}

:is(.wp-site-blocks, .editor-styles-wrapper) :where(
	.wp-block-post-content,
	.thameside-main,
	.thameside-content-blocks .block__media-text__content,
	.thameside-content-blocks .block__contact__content,
	.th-page-prose,
	.th-legal-prose
) :is(h3, .wp-block-heading[data-level="3"], h3.wp-block-heading):not(:where(.wp-block-thameside-hero-media *, .block__hero *, .th-card *, .th-card-group *)) {
	font-size: var(--thameside-type-h3);
}

:is(.wp-site-blocks, .editor-styles-wrapper) :where(
	.wp-block-post-content,
	.thameside-main,
	.thameside-content-blocks .block__media-text__content,
	.th-page-prose,
	.th-legal-prose
) :is(h4, .wp-block-heading[data-level="4"], h4.wp-block-heading):not(:where(.wp-block-thameside-hero-media *, .block__hero *)) {
	font-size: var(--thameside-type-h4);
}

:is(.wp-site-blocks, .editor-styles-wrapper) :where(
	.wp-block-post-content,
	.thameside-main,
	.th-page-prose,
	.th-legal-prose
) :is(h5, .wp-block-heading[data-level="5"], h5.wp-block-heading):not(:where(.wp-block-thameside-hero-media *, .block__hero *)) {
	font-size: var(--thameside-type-h5);
}

:is(.wp-site-blocks, .editor-styles-wrapper) :where(
	.wp-block-post-content,
	.thameside-main,
	.th-page-prose,
	.th-legal-prose
) :is(h6, .wp-block-heading[data-level="6"], h6.wp-block-heading):not(:where(.wp-block-thameside-hero-media *, .block__hero *)) {
	font-size: var(--thameside-type-h6);
}

/* Default core/heading (level 2) when tag is generic .wp-block-heading */
:is(.wp-site-blocks, .editor-styles-wrapper) :where(
	.wp-block-post-content,
	.thameside-main,
	.thameside-content-blocks .block__media-text__content
) .wp-block-heading:not([class*="font-size"]):not([style*="font-size"]):not(:where(.wp-block-thameside-hero-media *, .block__hero *, .th-card *, .th-card-group *)) {
	font-size: var(--thameside-type-h2);
}

/* Theme font-size presets → scale (editor + front end) */
:is(.wp-site-blocks, .editor-styles-wrapper) :where(.wp-block-post-content, .thameside-main, .thameside-content-blocks) .has-small-font-size:not(:where(.wp-block-thameside-hero-media *, .block__hero *)) {
	font-size: var(--thameside-type-small) !important;
}

:is(.wp-site-blocks, .editor-styles-wrapper) :where(.wp-block-post-content, .thameside-main, .thameside-content-blocks) .has-medium-font-size:not(:where(.wp-block-thameside-hero-media *, .block__hero *)) {
	font-size: var(--thameside-type-body) !important;
}

:is(.wp-site-blocks, .editor-styles-wrapper) :where(.wp-block-post-content, .thameside-main, .thameside-content-blocks) .has-large-font-size:not(:where(.wp-block-thameside-hero-media *, .block__hero *)) {
	font-size: var(--thameside-type-large) !important;
}

:is(.wp-site-blocks, .editor-styles-wrapper) :where(.wp-block-post-content, .thameside-main, .thameside-content-blocks) .has-x-large-font-size:not(:where(.wp-block-thameside-hero-media *, .block__hero *)) {
	font-size: var(--thameside-type-xl) !important;
}

:is(.wp-site-blocks, .editor-styles-wrapper) :where(.wp-block-post-content, .thameside-main, .thameside-content-blocks) .has-h-1-font-size:not(:where(.wp-block-thameside-hero-media *, .block__hero *)) {
	font-size: var(--thameside-type-h1) !important;
}

:is(.wp-site-blocks, .editor-styles-wrapper) :where(.wp-block-post-content, .thameside-main, .thameside-content-blocks) .has-h-2-font-size:not(:where(.wp-block-thameside-hero-media *, .block__hero *)) {
	font-size: var(--thameside-type-h2) !important;
}

:is(.wp-site-blocks, .editor-styles-wrapper) :where(.wp-block-post-content, .thameside-main, .thameside-content-blocks) .has-h-3-font-size:not(:where(.wp-block-thameside-hero-media *, .block__hero *)) {
	font-size: var(--thameside-type-h3) !important;
}

:is(.wp-site-blocks, .editor-styles-wrapper) :where(.wp-block-post-content, .thameside-main, .thameside-content-blocks) .has-h-4-font-size:not(:where(.wp-block-thameside-hero-media *, .block__hero *)) {
	font-size: var(--thameside-type-h4) !important;
}

/* Dark-band media text: heading colours only (sizes from scale above) */
.thameside-content-blocks.block__media-text--bg .block__media-text__content :where(h1, h2, h3, h4, .wp-block-heading) {
	color: var(--thameside-lightest, #fff);
}

.thameside-content-blocks.block.block__bg--dark-blue .block__media-text__content :where(h1, h2, h3, h4, .wp-block-heading) {
	color: var(--thameside-lightest, #fff);
}
