/*
Theme Name: Millwater
Theme URI: https://millwaterpartners.com
Description: Child theme of Twenty Twenty-Five for Millwater Partners. Colours, fonts and layout live in theme.json; this file holds the styles theme.json cannot express (overlay header, cards, animations).
Author: Joachim Tecklenburg
Author URI: https://joachimtecklenburg.net
Template: twentytwentyfive
Version: 1.0.0
Requires at least: 7.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: millwater
*/

/* ---------------------------------------------------------------- header */

.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 100;
}

.wp-site-blocks > main,
.wp-site-blocks > footer {
	margin-block-start: 0;
}

.site-header {
	transition: background-color 0.35s ease, box-shadow 0.35s ease;
}

.site-header .wp-block-navigation a {
	text-decoration: none;
}

.site-header .wp-block-navigation-item__content {
	position: relative;
}

.site-header .wp-block-navigation-item__content::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: -0.3em;
	height: 2px;
	background: var(--wp--preset--color--accent-1);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0.3s ease;
}

.site-header .wp-block-navigation-item__content:hover::after,
.site-header .wp-block-navigation-item__content:focus-visible::after {
	transform: scaleX(1);
}

.site-header .wp-block-site-logo img {
	width: clamp(180px, 20vw, 250px);
	height: auto;
}

/* Front page: the header lies over the hero until the page is scrolled. */
.home .wp-site-blocks > header.wp-block-template-part {
	position: fixed;
	left: 0;
	right: 0;
}

.home .site-header {
	background-color: transparent !important;
}

.home .site-header .wp-block-site-logo {
	opacity: 0;
	transform: translateY(-6px);
	transition: opacity 0.35s ease, transform 0.35s ease;
	pointer-events: none;
}

.home .site-header.is-scrolled {
	background-color: var(--wp--preset--color--contrast) !important;
	box-shadow: 0 6px 24px rgb(0 0 0 / 0.18);
}

.home .site-header.is-scrolled .wp-block-site-logo {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}

/* Logo stays visible without JS. */
html:not(.js) .home .site-header .wp-block-site-logo {
	opacity: 1;
	transform: none;
}

.home .site-header:not(.is-scrolled) {
	text-shadow: 0 1px 8px rgb(0 0 0 / 0.35);
}

/* Anchor targets clear the sticky header. */
:where(h1, h2, h3, section, .wp-block-group)[id] {
	scroll-margin-top: calc(var(--wp-admin--admin-bar--height, 0px) + 6.5rem);
}

/* ---------------------------------------------------------------- content */

.mw-rule.wp-block-separator {
	width: 70px;
	max-width: 70px;
	border: 0;
	border-top: 2px solid currentColor;
	opacity: 1;
	margin-top: var(--wp--preset--spacing--30);
	margin-bottom: var(--wp--preset--spacing--50);
}

.mw-hero h1 {
	text-wrap: balance;
}

.mw-statement p,
.mw-statement blockquote p {
	text-wrap: balance;
}

.mw-statement blockquote {
	border: 0;
	padding: 0;
	margin: 0 auto;
}

.mw-services .wp-block-column {
	text-align: center;
}

.mw-services .wp-block-image img {
	transition: transform 0.4s ease;
}

.mw-services .wp-block-column:hover .wp-block-image img {
	transform: translateY(-4px) scale(1.06);
}

/* Toggles (Details blocks) */
.mw-toggles .wp-block-details {
	border-bottom: 1px solid var(--wp--preset--color--accent-5);
	padding: 0.15rem 0;
	margin: 0;
}

.mw-toggles .wp-block-details summary {
	list-style: none;
	cursor: pointer;
	position: relative;
	padding: 0.85rem 2.5rem 0.85rem 0;
	font-weight: 600;
	transition: color 0.2s ease;
}

.mw-toggles .wp-block-details summary::-webkit-details-marker {
	display: none;
}

.mw-toggles .wp-block-details summary::after {
	content: "";
	position: absolute;
	right: 0.6rem;
	top: 50%;
	width: 0.6rem;
	height: 0.6rem;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: translateY(-70%) rotate(45deg);
	transition: transform 0.3s ease;
}

.mw-toggles .wp-block-details[open] summary::after {
	transform: translateY(-30%) rotate(-135deg);
}

.mw-toggles .wp-block-details summary:hover {
	color: var(--wp--preset--color--accent-3);
}

.mw-toggles .wp-block-details > :not(summary) {
	margin-top: 0;
	padding-bottom: 0.9rem;
}

/* Partner cards */
.mw-card {
	height: 100%;
	transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.mw-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 14px 32px rgb(9 9 9 / 0.12);
}

.mw-card .wp-block-image {
	overflow: hidden;
}

.mw-card .wp-block-image img {
	transition: transform 0.6s ease;
}

.mw-card:hover .wp-block-image img {
	transform: scale(1.04);
}

.mw-card .mw-card__body {
	flex-grow: 1;
}

/* Buttons and icons lift slightly */
.wp-block-button__link {
	transition: background-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.wp-block-button__link:hover {
	transform: translateY(-2px);
	box-shadow: 0 8px 18px rgb(9 9 9 / 0.18);
}

.wp-block-social-links .wp-social-link {
	transition: transform 0.25s ease;
}

.wp-block-social-links .wp-social-link:hover {
	transform: translateY(-2px) scale(1.08);
}

/* Inner pages: white card on the mist background (as before) */
.mw-page-card img.alignleft,
.mw-page-card .alignleft {
	margin-right: var(--wp--preset--spacing--40);
}

.mw-page-card .alignright {
	margin-left: var(--wp--preset--spacing--40);
}

@media (max-width: 600px) {
	.mw-page-card .alignleft,
	.mw-page-card .alignright {
		float: none;
		margin-left: 0;
		margin-right: 0;
	}
}

/* Footer */
.site-footer a {
	text-decoration: none;
}

.site-footer a:hover {
	text-decoration: underline;
}

/* Back to top */
.mw-to-top {
	position: fixed;
	right: 1.25rem;
	bottom: 1.25rem;
	z-index: 90;
	width: 2.75rem;
	height: 2.75rem;
	border: 0;
	border-radius: 3px;
	background: var(--wp--preset--color--accent-1);
	color: var(--wp--preset--color--contrast);
	cursor: pointer;
	display: grid;
	place-items: center;
	opacity: 0;
	transform: translateY(12px);
	pointer-events: none;
	transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s ease;
}

.mw-to-top.is-visible {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}

.mw-to-top:hover {
	background: color-mix(in srgb, var(--wp--preset--color--accent-1) 82%, white);
}

.mw-to-top:focus-visible {
	outline: 2px solid var(--wp--preset--color--contrast);
	outline-offset: 2px;
}

/* ---------------------------------------------------------------- motion */

@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}

	/* Hero text comes in once on load. */
	.mw-hero .wp-block-cover__inner-container > * {
		animation: mw-rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
	}

	.mw-hero .wp-block-cover__inner-container > :nth-child(2) {
		animation-delay: 0.15s;
	}

	.mw-hero .wp-block-cover__inner-container > :nth-child(3) {
		animation-delay: 0.3s;
	}

	.mw-hero .wp-block-cover__image-background,
	.mw-hero.has-parallax {
		animation: mw-settle 1.6s ease-out both;
	}

	/* Scroll reveal: only once site.js has marked the page, so content never hides without JS. */
	.has-reveal .reveal {
		opacity: 0;
		transform: translateY(24px);
		transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
		transition-delay: var(--reveal-delay, 0ms);
	}

	.has-reveal .reveal.is-visible {
		opacity: 1;
		transform: none;
	}

	.has-reveal .mw-rule.reveal {
		transform: scaleX(0);
	}

	.has-reveal .mw-rule.reveal.is-visible {
		transform: none;
	}

	/* Details content fades in when opened. */
	.mw-toggles .wp-block-details[open] > :not(summary) {
		animation: mw-fade 0.35s ease both;
	}
}

@keyframes mw-rise {
	from {
		opacity: 0;
		transform: translateY(18px);
	}
}

@keyframes mw-settle {
	from {
		transform: scale(1.06);
	}
}

@keyframes mw-fade {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}
}

/* Maria's photo is a crop with the face high up. */
.mw-portrait-top img {
	object-position: 50% 15%;
}

/* Hero tagline (a paragraph, not a heading) */
.mw-tagline {
	font-weight: 600;
	line-height: 1.3;
	margin-top: 0.4em;
}

/* Long legal/CV texts: calmer heading sizes inside the content card */
.mw-page-card h2 {
	font-size: var(--wp--preset--font-size--x-large);
	margin-top: 1.6em;
}

.mw-page-card h3 {
	font-size: var(--wp--preset--font-size--large);
}

/* Phones: long centred paragraphs are hard to read, align them left (headings and short texts stay centred). */
@media (max-width: 600px) {
	.wp-block-post-content > .wp-block-group > p.has-text-align-center {
		text-align: left;
	}
}

/* Phones: less frame around the content card so the text column keeps its width. */
@media (max-width: 600px) {
	main > .wp-block-group.has-accent-2-background-color {
		padding-left: 0.75rem !important;
		padding-right: 0.75rem !important;
	}

	.mw-page-card {
		padding: var(--wp--preset--spacing--40) 1.25rem !important;
	}
}

/* Phones: smaller inner-page hero image (preloaded in functions.php); fixed backgrounds don't apply there anyway. */
@media (max-width: 781px) {
	.mw-page-hero .wp-block-cover__image-background {
		background-image: url(/wp-content/uploads/2020/03/landscape-1802337_1920-1024x578.webp) !important;
	}
}
