/* Generic editorial pages inherit the Figma gate/text two-track composition.
 * Dedicated page compositions, directories and people grids retain their own
 * layouts. Real prose and long URLs must never disappear behind the artwork. */
.hr-page:not(.hr-page--figma-layout) > .hr-entry-content a {
	overflow-wrap: anywhere;
}

.hr-page:not(.hr-page--figma-layout) > .hr-entry-content .hr-download-tail {
	white-space: normal;
	overflow-wrap: anywhere;
}

/* Headings and document labels must not stretch between words at any width. */
.hr-page:not(.hr-page--figma-layout) > .hr-entry-content :is(h2, h3, h4, h5, h6),
.hr-page:not(.hr-page--figma-layout) > .hr-entry-content [style*="justify"] {
	text-align: start !important;
}

/* Approved directory treatment: a solid brand outline, never a pale border. */
.hr-page-directory a {
	border: 1px solid var(--hr-green);
	background: #fff;
}

.hr-page--spolky :is(.wpb-content-wrapper > p, .hr-entry-content > p):has(> a) a {
	border: 1px solid var(--hr-green);
	background: #fff;
}

.hr-page:not(.hr-page--figma-layout) > .hr-entry-content:has(.alignleft, .alignright):not(.hr-matrika-content):not(.hr-forms-content):not(.hr-service-content):not(:has(.c-gallery, .wp-block-gallery, .hr-block--people-grid)) {
	/* Imported floated photographs must contribute to the article height. */
	display: flow-root;
}

@media (min-width: 64rem) {
	.hr-page:has(> .hr-page__illustration):not(.hr-page--figma-layout):not(.hr-page--matrika-a-svatby):not(.hr-page--formulare):not(:has(> .hr-service-content, .hr-page-directory, .hr-block--people-grid, .c-gallery, .wp-block-gallery)) {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		grid-template-rows: auto 1fr;
		column-gap: 2rem;
		align-content: start;
	}

	.hr-page:has(> .hr-page__illustration):not(.hr-page--figma-layout):not(.hr-page--matrika-a-svatby):not(.hr-page--formulare):not(:has(> .hr-service-content, .hr-page-directory, .hr-block--people-grid, .c-gallery, .wp-block-gallery)) > .hr-page__header {
		grid-column: 1;
		grid-row: 1;
		min-width: 0;
	}

	.hr-page:has(> .hr-page__illustration):not(.hr-page--figma-layout):not(.hr-page--matrika-a-svatby):not(.hr-page--formulare):not(:has(> .hr-service-content, .hr-page-directory, .hr-block--people-grid, .c-gallery, .wp-block-gallery)) > .hr-page__illustration {
		position: sticky;
		top: var(--hr-anchor-offset);
		grid-column: 2;
		grid-row: 1 / span 2;
		align-self: start;
		width: 100%;
		height: auto;
		max-height: calc(100svh - var(--hr-anchor-offset) - 1rem);
		object-fit: contain;
		object-position: center top;
		margin: 0;
		opacity: 1;
	}

	.hr-page:has(> .hr-page__illustration):not(.hr-page--figma-layout):not(.hr-page--matrika-a-svatby):not(.hr-page--formulare):not(:has(> .hr-service-content, .hr-page-directory, .hr-block--people-grid, .c-gallery, .wp-block-gallery)) > .hr-entry-content {
		grid-column: 1;
		grid-row: 2;
		min-width: 0;
		max-width: 100%;
	}

	.hr-page:has(> .hr-page__illustration):not(.hr-page--figma-layout):not(.hr-page--matrika-a-svatby):not(.hr-page--formulare):not(:has(> .hr-service-content, .hr-page-directory, .hr-block--people-grid, .c-gallery, .wp-block-gallery)) > .hr-entry-content :is(.alignwide, .alignfull) {
		width: 100%;
		max-width: 100%;
	}
}

@media (max-width: 63.99rem) {
	.hr-page:has(> .hr-page__illustration):not(.hr-page--figma-layout):not(.hr-page--matrika-a-svatby):not(.hr-page--formulare):not(:has(> .hr-service-content, .hr-page-directory, .hr-block--people-grid, .c-gallery, .wp-block-gallery)) > .hr-page__illustration {
		position: static;
		width: min(100%, 24rem);
		height: auto;
		margin: 0 auto 2rem;
	}

	.hr-page:has(> .hr-page__illustration):not(.hr-page--figma-layout):not(.hr-page--matrika-a-svatby):not(.hr-page--formulare):not(:has(> .hr-service-content, .hr-page-directory, .hr-block--people-grid, .c-gallery, .wp-block-gallery)) > .hr-entry-content {
		max-width: 100%;
	}
}

@media (max-width: 47.99rem) {
	/* Generic page titles reduce to 28 px on mobile. Their section headings
	 * must not retain the desktop 30–31 px minimum and outrank the title.
	 * Dedicated Figma compositions and component headings remain untouched. */
	.hr-page:not(.hr-page--figma-layout) > .hr-entry-content h2,
	.hr-page:not(.hr-page--figma-layout) > .hr-page-directory h2 {
		font-size: 1.5rem;
		line-height: 1.25;
	}

	.hr-page:not(.hr-page--figma-layout) > .hr-entry-content :is(.alignleft, .alignright) {
		float: none;
		max-width: 100%;
		margin-inline: 0;
	}

	/* Legacy editor justification makes narrow Czech prose unreadably spaced. */
	.hr-page:not(.hr-page--figma-layout) > .hr-entry-content [style*="justify"] {
		text-align: start !important;
	}
}
