/* === Glacier Motion — premium polish, performance-conscious ===
   Loaded after main paint, respects prefers-reduced-motion.
   Adds React-feel micro-interactions without JS framework overhead.
=================================================================== */

/* Smooth scroll on anchor jumps */
html { scroll-behavior: smooth; }

/* Brass italic accent inside headings — WP block sanitizer strips inline styles on <em>, so we re-apply via CSS */
h1 em, h2 em, h3 em, h4 em,
.wp-block-heading em,
.wp-block-cover .wp-block-heading em,
.wp-block-cover h1 em,
.wp-block-cover h2 em {
	color: var(--wp--preset--color--brass) !important;
	font-style: italic;
	font-weight: 600;
}

/* === Footer color cascade ===
   WP doesn't cascade textColor from parent group into nested paragraphs.
   Force limestone on all text inside the navy-deep footer, brass on hover for links. */
.wp-site-blocks > footer,
footer.wp-block-template-part,
.wp-block-template-part footer {
	color: var(--wp--preset--color--limestone);
}
.wp-site-blocks > footer p,
.wp-site-blocks > footer li,
.wp-site-blocks > footer strong,
.wp-site-blocks > footer span:not([style*="color"]) {
	color: var(--wp--preset--color--limestone);
}
.wp-site-blocks > footer a {
	color: var(--wp--preset--color--limestone);
	text-decoration: none;
	transition: color 0.2s ease;
}
.wp-site-blocks > footer a:hover,
.wp-site-blocks > footer a:focus {
	color: var(--wp--preset--color--brass);
}

/* Footer headings keep their brass column-label color (already inline-styled) */

/* Footer logo: force white rendering regardless of source logo color
   filter: brightness(0) inverts any non-transparent pixel to black, then invert(1) flips to white */
.wp-site-blocks > footer .wp-block-site-logo img {
	filter: brightness(0) invert(1);
	opacity: 0.95;
}

/* "Elevated By Design" italic accent in footer stays brass */
.wp-site-blocks > footer p.has-brass-color,
.wp-site-blocks > footer .has-brass-color {
	color: var(--wp--preset--color--brass) !important;
}

/* Sticky header offset so anchored sections don't hide under it */
:target { scroll-margin-top: 140px; }

/* === Flush header-to-hero — kill the WP blockGap between <header> and <main>
   so the cream body background doesn't peek through above the hero photo. === */
.wp-site-blocks > main {
	margin-top: 0 !important;
}
.wp-site-blocks > main > .wp-block-cover:first-child,
.wp-site-blocks > main > .wp-block-group:first-child,
.wp-site-blocks > main > .alignfull:first-child {
	margin-top: 0 !important;
}
/* Belt-and-suspenders: collapse any flow-layout gap before the first main child. */
.wp-site-blocks > main > :first-child {
	margin-block-start: 0 !important;
}

/* ===== Sticky header — shrinks shadow on scroll ===== */
.wp-site-blocks > header {
	position: sticky;
	top: 0;
	z-index: 100;
	transition: box-shadow 0.3s cubic-bezier(0.22, 1, 0.36, 1);
	will-change: box-shadow;
}
body.is-scrolled .wp-site-blocks > header {
	box-shadow: 0 2px 24px rgba(27, 57, 96, 0.18);
}
/* Trust strip stays full-size on scroll — collapsing it caused a layout-shift
   oscillation when scroll position hovered near the threshold. Box-shadow alone
   is the visual signal that the header is now sticky. */

/* ===== Reveal on scroll ===== */
.glacier-reveal {
	opacity: 0;
	transform: translateY(28px);
	transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
	will-change: opacity, transform;
}
.glacier-reveal.is-revealed {
	opacity: 1;
	transform: translateY(0);
}

/* Stagger reveal for column children (cards animate in one-by-one) */
.glacier-reveal .wp-block-columns > .wp-block-column {
	opacity: 0;
	transform: translateY(16px);
	transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1), transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.glacier-reveal.is-revealed .wp-block-columns > .wp-block-column { opacity: 1; transform: translateY(0); }
.glacier-reveal.is-revealed .wp-block-columns > .wp-block-column:nth-child(1) { transition-delay: 0.05s; }
.glacier-reveal.is-revealed .wp-block-columns > .wp-block-column:nth-child(2) { transition-delay: 0.12s; }
.glacier-reveal.is-revealed .wp-block-columns > .wp-block-column:nth-child(3) { transition-delay: 0.19s; }
.glacier-reveal.is-revealed .wp-block-columns > .wp-block-column:nth-child(4) { transition-delay: 0.26s; }
.glacier-reveal.is-revealed .wp-block-columns > .wp-block-column:nth-child(5) { transition-delay: 0.33s; }
.glacier-reveal.is-revealed .wp-block-columns > .wp-block-column:nth-child(6) { transition-delay: 0.40s; }

/* ===== Card hover lift ===== */
.wp-block-columns > .wp-block-column > .wp-block-cover {
	transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s cubic-bezier(0.22, 1, 0.36, 1);
	will-change: transform, box-shadow;
}
.wp-block-columns > .wp-block-column > .wp-block-cover:hover {
	transform: translateY(-6px);
	box-shadow: 0 24px 56px rgba(27, 57, 96, 0.24);
}

/* ===== Image zoom on hover (gallery + service cards) ===== */
.wp-block-cover .wp-block-cover__image-background,
.wp-block-gallery .wp-block-image img {
	transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
	will-change: transform;
}
.wp-block-columns > .wp-block-column > .wp-block-cover:hover .wp-block-cover__image-background,
.wp-block-gallery .wp-block-image:hover img {
	transform: scale(1.05);
}

/* Clip image overflow inside containers so zoom looks clean */
.wp-block-gallery .wp-block-image,
.wp-block-columns > .wp-block-column > .wp-block-cover {
	overflow: hidden;
}

/* ===== Button hover refinement ===== */
.wp-block-button .wp-block-button__link {
	transition: transform 0.2s ease, background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease !important;
	will-change: transform, box-shadow;
}
.wp-block-button .wp-block-button__link:hover {
	transform: translateY(-1px);
	box-shadow: 0 8px 20px rgba(201, 162, 74, 0.32);
}

/* ===== Skeleton shimmer for above-the-fold images that haven't loaded ===== */
.wp-block-cover:not(.has-image-loaded) .wp-block-cover__image-background {
	background: linear-gradient(90deg, rgba(232, 226, 213, 0.5) 0%, rgba(232, 226, 213, 0.8) 50%, rgba(232, 226, 213, 0.5) 100%);
	background-size: 200% 100%;
	animation: glacier-shimmer 1.6s linear infinite;
}
@keyframes glacier-shimmer {
	0%   { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* ===== Nav link underline animation ===== */
.wp-block-navigation .wp-block-navigation-item__content {
	position: relative;
	transition: color 0.2s ease;
}
.wp-block-navigation .wp-block-navigation-item__content::after {
	content: '';
	position: absolute;
	left: 0;
	bottom: -4px;
	width: 100%;
	height: 2px;
	background-color: #C9A24A;
	transform: scaleX(0);
	transform-origin: left center;
	transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.wp-block-navigation .wp-block-navigation-item:hover > .wp-block-navigation-item__content::after,
.wp-block-navigation .wp-block-navigation-item.current-menu-item > .wp-block-navigation-item__content::after {
	transform: scaleX(1);
}

/* ===== Subtle parallax on hero — desktop only ===== */
@media (min-width: 1024px) and (hover: hover) {
	.wp-site-blocks > main > .wp-block-cover.alignfull:first-of-type .wp-block-cover__image-background {
		transform: translate3d(0, 0, 0);
		will-change: transform;
	}
	body.has-parallax .wp-site-blocks > main > .wp-block-cover.alignfull:first-of-type .wp-block-cover__image-background {
		transform: translate3d(0, calc(var(--scroll-y, 0) * 0.25), 0);
	}
}

/* ===== Section transitions — View Transitions API ===== */
@view-transition { navigation: auto; }
::view-transition-old(root) {
	animation: glacier-fade-out 0.28s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
::view-transition-new(root) {
	animation: glacier-fade-in 0.36s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes glacier-fade-out {
	to { opacity: 0; transform: translateY(-8px); }
}
@keyframes glacier-fade-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ===== Better focus visibility for keyboard users ===== */
*:focus-visible {
	outline: 2px solid #C9A24A;
	outline-offset: 3px;
	border-radius: 2px;
}

/* ===== Respect accessibility preferences ===== */
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after {
		animation-duration: 0.001s !important;
		animation-delay: 0s !important;
		transition-duration: 0.001s !important;
		transition-delay: 0s !important;
	}
	.glacier-reveal, .glacier-reveal.is-revealed,
	.glacier-reveal .wp-block-columns > .wp-block-column {
		opacity: 1 !important;
		transform: none !important;
	}
	::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
}
