/* ============================================
   Enveloppe visuelle commune (toutes les pages)
   Logo 4.png + coins 5bisbis / 6bis + feuilles SVG
   ============================================ */

body.has-brand-shell .wrapper.style1 {
	background: var(--color-bg, #f3eae3);
	background-image: none;
}

.page-brand {
	overflow: hidden;
	width: 100%;
	background: linear-gradient(
		165deg,
		var(--color-bg, #f3eae3) 0%,
		#faf6f2 50%,
		var(--color-bg-gradient-end, #e8d5c4) 100%
	);
}

.page-brand::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 0;
	background:
		radial-gradient(ellipse 80% 50% at 8% 25%, rgba(var(--color-primary-light-rgb), 0.18) 0%, transparent 55%),
		radial-gradient(ellipse 55% 45% at 92% 75%, rgba(219, 199, 201, 0.22) 0%, transparent 50%);
	pointer-events: none;
}

/* Feuilles décoratives (mask + primary, angle signature −8°) */
body.has-brand-shell #main #content.page-content-block .page-leaves,
body.has-brand-shell .page-content-block .page-leaves,
.page-brand--home .page-leaves {
	position: absolute;
	inset: 0;
	z-index: 0;
	pointer-events: none;
	overflow: hidden;
}

body.has-brand-shell #main #content.page-content-block .page-leaf,
body.has-brand-shell .page-content-block .page-leaf,
.page-brand--home .page-leaf {
	--leaf-tilt: -8deg;
	--leaf-target-opacity: 0.1;
	position: absolute;
	display: block;
	background-color: var(--color-primary, #5a7a5a);
	opacity: var(--leaf-target-opacity);
	mask-repeat: no-repeat;
	mask-size: contain;
	-webkit-mask-repeat: no-repeat;
	-webkit-mask-size: contain;
	transform-origin: center center;
}

/* Contenu : feuille centrale fixe au scroll (filigrane viewport) */
body.has-brand-shell #main #content.page-content-block .page-leaf--center,
body.has-brand-shell .page-content-block .page-leaf--center {
	--leaf-target-opacity: 0.06;
	position: fixed;
	z-index: 0;
	width: min(88vw, 680px);
	height: min(78vh, 820px);
	left: 48%;
	top: 52%;
	transform: translate(-50%, -50%) rotate(var(--leaf-tilt));
	mask-image: url(../../images/leaf-1.svg);
	mask-position: center;
	-webkit-mask-image: url(../../images/leaf-1.svg);
	-webkit-mask-position: center;
}

body.has-brand-shell #main #content.page-content-block .page-leaves,
body.has-brand-shell .page-content-block .page-leaves {
	position: static;
	inset: auto;
	height: 0;
	overflow: visible;
}

/* Accueil : deux feuilles asymétriques en bas (hors centre hero) */
.page-brand--home .page-leaf--1 {
	--leaf-target-opacity: 0.11;
	width: min(34vw, 220px);
	height: min(60vh, 420px);
	left: clamp(-5vw, -1.5rem, 0);
	bottom: 4%;
	transform: rotate(var(--leaf-tilt));
	mask-image: url(../../images/leaf-1.svg);
	mask-position: bottom left;
	-webkit-mask-image: url(../../images/leaf-1.svg);
	-webkit-mask-position: bottom left;
}

.page-brand--home .page-leaf--2 {
	--leaf-target-opacity: 0.09;
	width: min(30vw, 200px);
	height: min(52vh, 380px);
	right: clamp(-5vw, -1.75rem, 0);
	bottom: 10%;
	transform: rotate(var(--leaf-tilt));
	mask-image: url(../../images/leaf-2.svg);
	mask-position: bottom right;
	-webkit-mask-image: url(../../images/leaf-2.svg);
	-webkit-mask-position: bottom right;
}

.page-corner {
	position: absolute;
	top: 0;
	width: min(72vw, 420px);
	height: 100%;
	pointer-events: none;
	z-index: 0;
	overflow: hidden;
}

.page-corner img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.page-corner--tl {
	left: 0;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	align-items: flex-start;
}

.page-corner--tl img {
	height: auto;
	max-height: 100%;
	object-position: bottom left;
}

.page-corner--tr {
	right: 0;
}

.page-corner--tr img {
	object-position: top right;
}

/* Pages internes : logo 4.png superposé au décor 6bis (coin haut-droit) */
.page-brand--inner .page-brand__tr-stack {
	position: absolute;
	top: calc(5.556em + 0.35rem);
	right: clamp(-2vw, 0vw, 0);
	z-index: 1;
	width: min(72vw, 380px);
	height: min(52vw, 400px);
	max-width: 100%;
	pointer-events: none;
}

.page-brand--inner .page-brand__tr-stack .page-corner--tr {
	position: absolute;
	inset: 0;
	top: 0;
	right: 0;
	left: auto;
	width: 100%;
	height: 100%;
	min-height: 0;
	overflow: visible;
	z-index: 0;
}

.page-brand--inner .page-brand__tr-stack .page-corner--tr img {
	width: 100%;
	height: 100%;
	max-height: none;
	object-fit: contain;
	object-position: top right;
}

.page-brand--inner .page-brand__logo {
	position: absolute;
	z-index: 2;
	top: 6%;
	right: 8%;
	left: 12%;
	width: auto;
	max-width: 78%;
	height: auto;
	max-height: 58%;
	margin: 0;
	padding: 0;
	background: none;
	border-radius: 0;
	box-shadow: none;
	pointer-events: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	line-height: 0;
	transition: transform 0.25s ease, filter 0.25s ease;
}

.page-brand--inner .page-brand__logo img {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
	filter: drop-shadow(0 6px 20px rgba(90, 80, 70, 0.22));
}

.page-brand--inner .page-brand__logo:hover,
.page-brand--inner .page-brand__logo:focus-visible {
	transform: scale(1.02);
}

.page-brand--inner .page-brand__logo:focus-visible {
	outline: 2px solid var(--color-primary, #5a7a5a);
	outline-offset: 4px;
	border-radius: 4px;
}

@media (prefers-reduced-motion: no-preference) {
	.page-leaf {
		animation: page-leaf-in 0.5s ease-out forwards;
		opacity: 0;
	}

	@keyframes page-leaf-in {
		from {
			opacity: 0;
		}
		to {
			opacity: var(--leaf-target-opacity, 0.13);
		}
	}

	.page-corner {
		animation: page-corner-in 1.1s ease-out forwards;
		opacity: 0;
	}

	@keyframes page-corner-in {
		from {
			opacity: 0;
			transform: scale(0.97);
		}
		to {
			opacity: 1;
			transform: scale(1);
		}
	}
}

@media screen and (max-width: 639px) {
	body.has-brand-shell #main #content.page-content-block .page-leaf--center,
	body.has-brand-shell .page-content-block .page-leaf--center {
		width: min(92vw, 440px);
		height: min(58vh, 520px);
		min-height: 320px;
		left: 50%;
		top: 48%;
		--leaf-target-opacity: 0.1;
	}

	.page-brand--home .page-leaf--1 {
		width: min(42vw, 160px);
		height: min(46vh, 320px);
		left: -6vw;
		bottom: 2%;
		--leaf-target-opacity: 0.09;
	}

	.page-brand--home .page-leaf--2 {
		width: min(38vw, 150px);
		height: min(40vh, 300px);
		right: -7vw;
		bottom: 6%;
		--leaf-target-opacity: 0.07;
	}

	.page-corner {
		width: min(58vw, 240px);
	}

	.page-corner--tl {
		left: -5vw;
	}

	.page-corner--tr {
		right: -5vw;
	}
}

@media screen and (min-width: 1024px) {
	body.has-brand-shell #main #content.page-content-block .page-leaf--center,
	body.has-brand-shell .page-content-block .page-leaf--center {
		width: min(82vw, 760px);
		height: min(82vh, 900px);
		--leaf-target-opacity: 0.065;
	}

	.page-brand--home .page-leaf--1 {
		width: min(28vw, 260px);
		height: min(62vh, 480px);
		left: -1%;
		bottom: 5%;
	}

	.page-brand--home .page-leaf--2 {
		width: min(24vw, 230px);
		height: min(56vh, 440px);
		right: -1%;
		bottom: 8%;
	}

	.page-corner {
		width: min(34vw, 400px);
	}
}

/* --- Pages internes --- */
.page-brand--inner {
	padding: calc(5.556em + 1.25rem) clamp(1rem, 4vw, 2rem) clamp(2rem, 5vw, 3rem);
}

@media screen and (max-width: 600px) {
	.page-brand--inner {
		padding-top: calc(var(--header-mobile-h, 3.25rem) + env(safe-area-inset-top, 0px) + 0.75rem);
	}

	.page-brand--inner .page-brand__tr-stack {
		top: calc(var(--header-mobile-h, 3.25rem) + env(safe-area-inset-top, 0px) + 0.35rem);
		right: -3vw;
		width: min(48vw, 200px);
		height: min(38vw, 180px);
	}

	.page-brand--inner .page-brand__logo {
		top: 2%;
		right: 4%;
		left: 10%;
		max-width: 78%;
		max-height: 55%;
	}

	.page-brand--inner .page-brand__body > .wrapper.style2:first-child h2,
	.page-brand--inner .page-brand__body > #main > .wrapper.style2:first-child h2,
	.page-brand--inner .page-brand__body > h2:first-child {
		padding-right: min(42vw, 9rem);
	}
}

@media screen and (min-width: 601px) and (max-width: 639px) {
	.page-brand--inner .page-brand__tr-stack {
		top: calc(5.556em + 0.25rem);
		right: -4vw;
		width: min(62vw, 280px);
		height: min(48vw, 260px);
	}

	.page-brand--inner .page-brand__logo {
		top: 4%;
		right: 6%;
		left: 8%;
		max-width: 82%;
		max-height: 62%;
	}
}

@media screen and (min-width: 1024px) {
	.page-brand--inner .page-brand__tr-stack {
		width: min(34vw, 400px);
		height: min(38vw, 420px);
		right: 0;
	}

	.page-brand--inner .page-brand__logo {
		top: 8%;
		right: 10%;
		left: 14%;
		max-width: 72%;
		max-height: 52%;
	}
}

.page-brand__body {
	position: relative;
	z-index: 1;
	width: 100%;
}

@media screen and (min-width: 768px) {
	.page-brand--inner .page-brand__body {
		padding-right: min(32vw, 14rem);
	}
}

/* Contenu interne : fond transparent sur le dégradé */
body.has-brand-shell.page-gradient {
	background: var(--color-bg, #f3eae3);
}

body.has-brand-shell #main,
body.has-brand-shell .page-brand__body #main,
body.has-brand-shell .page-brand__body .wrapper.style2 {
	position: relative;
	z-index: 1;
	background: transparent;
}

body.has-brand-shell .site-footer {
	position: relative;
	z-index: 2;
}

body.has-brand-shell .page-brand__body .wrapper.style2 {
	padding-top: 0;
}

@media (prefers-reduced-motion: reduce) {
	.page-leaf {
		animation: none !important;
		opacity: var(--leaf-target-opacity) !important;
	}

	.page-corner {
		animation: none !important;
		opacity: 1 !important;
	}
}
