/**
 * Winter decoration (enabled in Customizer > Decoration > Winter decoration).
 */

/* Snow canvas: on top of everything, never blocks clicks. */
.winter-snow {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	pointer-events: none;
	z-index: 9999;
}

/* Snowy buttons: button colours unchanged, a neutral shadow,
   and a white wavy "snow cap" on the top edge only.
   Calendar session pills (carte_cadeau plugin) are left untouched. */
.decoration-winter :is(.btn, button, .wp-block-button__link, .product__add-basket):not(.codec-atelier-session-pill) {
	box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
}

/* Zero specificity: any element already positioned (absolute/fixed/sticky) by the
   theme or a plugin keeps its own position. */
:where(.decoration-winter) :where(.btn, button, .wp-block-button__link) {
	position: relative;
}

/* Snow cap: buttons, product cards and the calendar header (Samedi / Dimanche). */
.decoration-winter :is(.btn, button, .wp-block-button__link, .product__add-basket):not(.codec-atelier-session-pill)::after,
.decoration-winter .product__div::after,
.decoration-winter .codec-atelier-calendar:has(.codec-atelier-calendar__table)::before {
	content: "";
	position: absolute;
	top: -4px;
	left: -3px;
	right: -3px;
	height: 10px;
	box-sizing: border-box;
	padding: 0 8px; /* room for the two rounded ends */
	pointer-events: none;
	/* A lumpy strip of snow, wavy on every side:
	   - left / right: rounded end caps (drawn in the 8px padding);
	   - middle: heaps on top, small drips below, repeated ("round" fits a whole
	     number of waves so the pattern always meets the right cap cleanly). */
	background:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 10' preserveAspectRatio='none'%3E%3Cpath d='M8 3 C6 0.5 2 1 1 4 C0 6 1.5 8 4 7.5 C6 7.2 7 7 8 7 Z' fill='white'/%3E%3C/svg%3E") left top / 8px 10px no-repeat padding-box,
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 10' preserveAspectRatio='none'%3E%3Cpath d='M0 3 C2 0.5 6 1 7 4 C8 6 6.5 8 4 7.5 C2 7.2 1 7 0 7 Z' fill='white'/%3E%3C/svg%3E") right top / 8px 10px no-repeat padding-box,
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 10' preserveAspectRatio='none'%3E%3Cpath d='M0 3 C3 0 9 0 12 2 C15 0 21 0 24 3 L24 7 C21 7 20 10 17 10 C14 10 14 7 12 7.5 C10 8 9 9 6 8.5 C3 8 2 7 0 7 Z' fill='white'/%3E%3C/svg%3E") left top / 24px 10px round no-repeat content-box;
	/* Thin outline all around the snow shape (top, sides and wavy edge):
	   four 1px shadows, one per direction, trace the contour. */
	--snow-outline: rgba(110, 125, 140, 0.55);
	filter:
		drop-shadow(1px 0 0 var(--snow-outline))
		drop-shadow(-1px 0 0 var(--snow-outline))
		drop-shadow(0 1px 0 var(--snow-outline))
		drop-shadow(0 -1px 0 var(--snow-outline));
}

/* Product card: keep the snow above the product images and the basket button. */
.decoration-winter .product__div::after {
	z-index: 3;
}

/* Calendar header: the header sits at the top of a scrolling box that would
   cut off anything above it, so the snow is attached to the calendar's outer
   box instead (its first child is that scrolling box). It rests on top of the
   header from outside, as one strip, and the calendar itself is unchanged. */
.decoration-winter .codec-atelier-calendar:has(.codec-atelier-calendar__table) {
	position: relative;
}

.decoration-winter .codec-atelier-calendar:has(.codec-atelier-calendar__table)::before {
	z-index: 2; /* above the sticky header (z-index 1) */
}
