/* ============================================
   Redesign 2026-11-14 (Polycarp, option B): a soft shadow under the menu bar, so the header
   stands apart from white pages such as blog posts. Same rule on ceger.org (in green).
   position + z-index lift the shadow over the banner or content below. z-index 100, above the
   floating Share button (90), so the open phone menu (inside the header) still covers it.
   ============================================ */

.ingenious-header {
	position: relative;
	z-index: 100;
	box-shadow: 0 4px 16px rgba(6, 63, 73, 0.14);
}

/* ============================================
   Smart sticky header (inc/redesign-header.php, assets/js/ingenious-header.js).
   The whole header part sticks with its top set above the screen by the topbar's height, so
   the contact topbar scrolls away and the menu bar stays. Scrolling down adds .is-tucked
   (slides it out of view); scrolling up removes it. --ils-topbar-h is measured by the script
   (0 on phones, where the topbar is hidden).
   ============================================ */

.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: calc(var(--wp-admin--admin-bar--height, 0px) - var(--ils-topbar-h, 0px));
	z-index: 100;
	transition: transform 0.25s ease;
}

.wp-site-blocks > header.wp-block-template-part.is-tucked {
	transform: translateY(-100%);
}

/* Any transform makes the header the containing block of the phone menu (position: fixed),
   which would clip the open menu to the bar. So the shown state has no transform at all, and
   an open menu forces it off at once, without the slide. */
.has-modal-open .wp-site-blocks > header.wp-block-template-part,
.wp-site-blocks > header.wp-block-template-part:has(.is-menu-open) {
	transform: none;
	transition: none;
}

/* The admin bar scrolls with the page on narrow screens, so nothing to clear there. */
@media (max-width: 600px) {
	.wp-site-blocks > header.wp-block-template-part {
		top: calc(-1 * var(--ils-topbar-h, 0px));
	}
}

/* Anchor links (#comments, contents lists) land below the bar, not under it. */
html {
	scroll-padding-top: calc(var(--ils-header-h, 4.5rem) + 1rem);
}

/* ============================================
   Back to top: bottom left, opposite the Share button (bottom right).
   ============================================ */

.ingenious-to-top {
	position: fixed;
	left: 1rem;
	bottom: 1rem;
	z-index: 89;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: 50%;
	background: var(--ing-white);
	color: var(--ing-teal);
	border: 1px solid var(--ing-cloud);
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.ingenious-to-top:hover,
.ingenious-to-top:focus-visible {
	background: var(--ing-teal);
	color: var(--ing-white);
}

.ingenious-to-top:focus-visible {
	outline: 3px solid var(--ing-green);
	outline-offset: 2px;
}

.ingenious-to-top.is-hidden {
	opacity: 0;
	transform: translateY(1rem);
	pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
	.wp-site-blocks > header.wp-block-template-part,
	.ingenious-to-top {
		transition: none;
	}
}

@media print {
	.wp-site-blocks > header.wp-block-template-part {
		position: static;
	}

	.ingenious-to-top {
		display: none;
	}
}
