/**
 * Compensate for the WordPress admin bar in the editor and while logged in.
 */

:root {
	--prism-admin-bar-offset: 0px;
}

body.admin-bar {
	--prism-admin-bar-offset: var(--wp-admin--admin-bar--height, 32px);
}

html:has(body.admin-bar) {
	scroll-padding-top: calc(var(--prism-site-header-height, 80px) + var(--prism-admin-bar-offset));
}

@media screen and (max-width: 782px) {
	body.admin-bar {
		--prism-admin-bar-offset: 46px;
	}
}

body.admin-bar .prism-site-header.uk-position-fixed.uk-position-top {
	top: var(--prism-admin-bar-offset);
}

body.admin-bar .prism-fullpage-section,
body.admin-bar.prism-fullpage-active .prism-fullpage-section {
	box-sizing: border-box;
	height: calc(100svh - var(--prism-admin-bar-offset));
	max-height: calc(100svh - var(--prism-admin-bar-offset));
	min-height: calc(100svh - var(--prism-admin-bar-offset));
}

@media (max-width: 959px) {
	body.admin-bar .prism-fullpage-section,
	body.admin-bar.prism-fullpage-active .prism-fullpage-section {
		height: auto;
		max-height: none;
		min-height: 0;
	}
}

/* Block editor preview — use the same viewport math as the logged-in front end. */
.editor-styles-wrapper,
.acf-block-preview,
.block-editor-block-list__block {
	--prism-admin-bar-offset: 32px;
}

@media screen and (max-width: 782px) {
	.editor-styles-wrapper,
	.acf-block-preview,
	.block-editor-block-list__block {
		--prism-admin-bar-offset: 46px;
	}
}

.editor-styles-wrapper .prism-fullpage-section,
.block-editor-block-list__block .prism-fullpage-section,
.acf-block-preview .prism-fullpage-section {
	min-height: calc(70vh - var(--prism-admin-bar-offset));
}

.editor-styles-wrapper .prism-fullpage-section__viewport,
.block-editor-block-list__block .prism-fullpage-section__viewport,
.acf-block-preview .prism-fullpage-section__viewport,
.editor-styles-wrapper .prism-block__viewport,
.acf-block-preview .prism-block__viewport {
	min-height: calc(70vh - var(--prism-admin-bar-offset));
}

.editor-styles-wrapper .prism-banner--height-full .prism-banner__frame,
.block-editor-block-list__block .prism-banner--height-full .prism-banner__frame,
.acf-block-preview .prism-banner--height-full .prism-banner__frame {
	min-height: calc(70vh - var(--prism-admin-bar-offset));
}
