/* Doors the Pro adds to the Free's Tradition doors: varied sizes, four more opening styles, three more today styles. */

/* ---------- varied sizes: the span marker a door carries, read by its box ---------- */
@container (width > 640px) {
	.lwsp-sizes .lws-advent-calendar__box:has(.lwsp-dw2) {
		grid-column: span 2;
	}

	.lwsp-sizes .lws-advent-calendar__box:has(.lwsp-dh2) {
		grid-row: span 2;
	}

	.lwsp-sizes .lws-advent-calendar__box:has(.lwsp-dw2.lwsp-dh2) .lwsp-face .lws-advent-calendar__label {
		font-size: clamp(2rem, 6cqi, 3.2rem);
	}
}

@container (width <= 640px) {
	.lwsp-sizes .lws-advent-calendar__box:has(.lwsp-mw2) {
		grid-column: span 2;
	}

	.lwsp-sizes .lws-advent-calendar__box:has(.lwsp-mh2) {
		grid-row: span 2;
	}

	.lwsp-sizes .lws-advent-calendar__box:has(.lwsp-mw2.lwsp-mh2) .lwsp-face .lws-advent-calendar__label {
		font-size: clamp(1.8rem, 9cqi, 2.6rem);
	}
}

/* ---------- Volets écartés: two shutters swung outwards, no sill ---------- */
.lwsp-open-shutters .lwsp-leaf {
	top: 0;
	bottom: 0;
	width: 50%;
	background: repeating-linear-gradient(0deg, var(--lwsp-leaf) 0 7px, color-mix(in srgb, var(--lwsp-leaf), #000 18%) 7px 9px);
	box-shadow: inset 0 0 0 2px var(--lwsp-trim);
}

.lwsp-open-shutters .lwsp-leaf--a {
	left: 0;
	border-radius: var(--lwsp-r) 0 0 var(--lwsp-r);
	transform-origin: left center;
}

.lwsp-open-shutters .lwsp-leaf--b {
	right: 0;
	border-radius: 0 var(--lwsp-r) var(--lwsp-r) 0;
	transform-origin: right center;
}

.lwsp-open-shutters .lwsp-face .lws-advent-calendar__label {
	display: grid;
	place-items: center;
	min-width: 1.8em;
	height: 1.8em;
	padding: 0 0.2em;
	border-radius: 0.9em;
	background: var(--lwsp-trim);
	color: var(--lwsp-leaf);
	font-size: clamp(1.1rem, 3.6cqi, 1.6rem);
}

.lwsp-open-shutters .lwsp-face .lwsp-ico {
	display: none;
}

.lwsp-open-shutters .lws-advent-calendar__box--opened .lwsp-leaf--a {
	transform: rotateY(-72deg);
}

.lwsp-open-shutters .lws-advent-calendar__box--opened .lwsp-leaf--b {
	transform: rotateY(72deg);
}

@keyframes lwsp-open-shutters {
	to {
		transform: rotateY(-72deg);
	}
}

@keyframes lwsp-open-shutters-b {
	to {
		transform: rotateY(72deg);
	}
}

/* ---------- Enveloppe ouverte: flap and wax seal; opened, a card rises from the pocket ---------- */
.lwsp-open-envelope .lwsp-leaf--a {
	inset: 0;
	background: var(--lwsp-leaf);
	box-shadow: inset 0 0 0 1px #0002;
	clip-path: polygon(0 0, 50% 0, 100% 0, 100% 100%, 0 100%);
}

.lwsp-open-envelope .lwsp-leaf--a::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background:
		linear-gradient(to top right, transparent 49.5%, #0000001a 50%, transparent 51%),
		linear-gradient(to top left, transparent 49.5%, #0000001a 50%, transparent 51%);
}

.lwsp-open-envelope .lwsp-leaf--b {
	left: 0;
	right: 0;
	top: 0;
	height: 46%;
	z-index: 2;
	border-radius: var(--lwsp-r) var(--lwsp-r) 0 0;
	background: color-mix(in srgb, var(--lwsp-leaf), #000 24%);
	clip-path: polygon(0 0, 100% 0, 50% 100%);
	transform-origin: top center;
}

.lwsp-open-envelope .lwsp-leaf--b::after {
	content: "";
	position: absolute;
	left: 50%;
	bottom: 4%;
	width: 20px;
	height: 20px;
	margin-left: -10px;
	border-radius: 50%;
	background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--lwsp-trim), #fff 25%), var(--lwsp-trim));
}

.lwsp-open-envelope .lwsp-face {
	justify-content: flex-end;
	padding-bottom: 9%;
}

.lwsp-open-envelope .lwsp-face .lwsp-ico {
	display: none;
}

.lwsp-open-envelope .lwsp-inside {
	inset: 6% 9% 8%;
	justify-content: flex-start;
	padding-top: 7%;
	border-radius: 4px;
	box-shadow: 0 2px 6px #0003;
	transform: translateY(30%);
}

.lwsp-open-envelope .lwsp-inside .lwsp-gift {
	order: -1;
}

.lwsp-open-envelope .lwsp-inside .lwsp-ico {
	width: 22%;
}

.lwsp-open-envelope .lws-advent-calendar__box--opened .lwsp-leaf--b {
	display: none;
}

.lwsp-open-envelope .lws-advent-calendar__box--opened .lwsp-leaf--a {
	clip-path: polygon(0 38%, 50% 70%, 100% 38%, 100% 100%, 0 100%);
}

.lwsp-open-envelope .lws-advent-calendar__box--opened .lwsp-inside {
	transform: none;
}

@keyframes lwsp-open-envelope {
	to {
		transform: rotateX(90deg);
		opacity: 0;
	}
}

@keyframes lwsp-open-envelope-pocket {
	to {
		clip-path: polygon(0 38%, 50% 70%, 100% 38%, 100% 100%, 0 100%);
	}
}

@keyframes lwsp-open-envelope-card {
	to {
		transform: none;
	}
}

/* ---------- Boîte ouverte: lid and bow, numbered badge; opened, the lid is gone and a card sticks out ---------- */
.lwsp-open-box .lwsp-leaf--a {
	left: 4%;
	right: 4%;
	top: 34%;
	bottom: 0;
	border-radius: 0 0 var(--lwsp-r) var(--lwsp-r);
	background: linear-gradient(90deg, transparent 44%, var(--lwsp-trim) 44% 56%, transparent 56%), var(--lwsp-leaf);
}

.lwsp-open-box .lwsp-leaf--b {
	left: 0;
	right: 0;
	top: 16%;
	height: 22%;
	z-index: 2;
	border-radius: var(--lwsp-r) var(--lwsp-r) 3px 3px;
	background: linear-gradient(90deg, transparent 44%, var(--lwsp-trim) 44% 56%, transparent 56%), color-mix(in srgb, var(--lwsp-leaf), #000 14%);
	box-shadow: 0 2px 4px #0003;
	transform-origin: 0 100%;
}

.lwsp-open-box .lwsp-leaf--b::before,
.lwsp-open-box .lwsp-leaf--b::after {
	content: "";
	position: absolute;
	top: -12px;
	width: 18px;
	height: 14px;
	border: 4px solid var(--lwsp-trim);
	border-radius: 50% 50% 0 50%;
}

.lwsp-open-box .lwsp-leaf--b::before {
	left: calc(50% - 20px);
	transform: rotate(-20deg);
}

.lwsp-open-box .lwsp-leaf--b::after {
	left: calc(50% + 2px);
	transform: scaleX(-1) rotate(-20deg);
}

.lwsp-open-box .lwsp-face {
	top: 34%;
}

.lwsp-open-box .lwsp-face .lwsp-ico {
	display: none;
}

.lwsp-open-box .lwsp-face .lws-advent-calendar__label {
	display: grid;
	place-items: center;
	min-width: 1.75em;
	height: 1.75em;
	padding: 0 0.2em;
	border-radius: 0.875em;
	background: #fff;
	color: color-mix(in srgb, var(--lwsp-leaf), #000 35%);
	box-shadow: 0 0 0 3px var(--lwsp-trim), 0 2px 4px #0003;
	font-size: clamp(1.05rem, 3.4cqi, 1.5rem);
}

.lwsp-open-box .lwsp-inside {
	inset: 4% 12% 30%;
	justify-content: flex-start;
	padding-top: 5%;
	border-radius: 4px;
	box-shadow: 0 2px 6px #0003;
}

.lwsp-open-box .lws-advent-calendar__box:not(.lws-advent-calendar__box--opened):not(.lws-advent-calendar__box--just-opened) .lwsp-inside {
	visibility: hidden;
}

.lwsp-open-box .lwsp-inside .lwsp-gift {
	order: -1;
}

.lwsp-open-box .lwsp-inside .lwsp-ico {
	display: none;
}

.lwsp-open-box .lws-advent-calendar__box--opened .lwsp-leaf--b {
	display: none;
}

.lwsp-open-box .lws-advent-calendar__box--opened .lwsp-leaf--a {
	top: 46%;
}

.lwsp-open-box .lwsp-leaf--a::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	height: 9px;
	border-radius: 2px;
	background: color-mix(in srgb, var(--lwsp-leaf), #000 32%);
	opacity: 0;
}

.lwsp-open-box .lws-advent-calendar__box--opened .lwsp-leaf--a::before {
	opacity: 1;
}

@keyframes lwsp-open-box {
	to {
		transform: translateY(-25%);
		opacity: 0;
	}
}

@keyframes lwsp-open-box-body {
	to {
		top: 46%;
	}
}

/* ---------- Simple coche: the door fades, a check shows ---------- */
.lwsp-open-check .lwsp-leaf--a {
	inset: 0;
	background: var(--lwsp-leaf);
	box-shadow: inset 0 0 0 2px var(--lwsp-trim);
}

.lwsp-open-check .lwsp-leaf--b {
	display: none;
}

.lwsp-open-check .lws-advent-calendar__box--opened .lwsp-leaf--a {
	opacity: 0.25;
}

.lwsp-open-check .lws-advent-calendar__box--opened .lwsp-inside {
	background: transparent;
	box-shadow: none;
	color: var(--lwsp-scene-fg);
}

.lwsp-open-check .lws-advent-calendar__box--opened .lwsp-inside::before {
	content: "\2713";
	display: grid;
	flex: none;
	place-items: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: var(--lwsp-trim);
	color: var(--lwsp-leaf);
	font-size: 20px;
	font-weight: 800;
}

.lwsp-open-check .lws-advent-calendar__box--opened .lwsp-inside .lwsp-ico {
	display: none;
}

@keyframes lwsp-open-check {
	to {
		opacity: 0.25;
	}
}

/* ---------- the opening, played on the box the Free marks just opened, ending on the opened pose ---------- */
@media (prefers-reduced-motion: no-preference) {
	.lwsp-open-shutters .lws-advent-calendar__box--just-opened .lwsp-leaf--a {
		animation: lwsp-open-shutters var(--lws-advent-calendar-open-duration) ease-in-out forwards;
	}

	.lwsp-open-shutters .lws-advent-calendar__box--just-opened .lwsp-leaf--b {
		animation: lwsp-open-shutters-b var(--lws-advent-calendar-open-duration) ease-in-out forwards;
	}

	.lwsp-open-envelope .lws-advent-calendar__box--just-opened .lwsp-leaf--b {
		animation: lwsp-open-envelope var(--lws-advent-calendar-open-duration) ease-in-out forwards;
	}

	.lwsp-open-envelope .lws-advent-calendar__box--just-opened .lwsp-leaf--a {
		animation: lwsp-open-envelope-pocket var(--lws-advent-calendar-open-duration) ease-in-out forwards;
	}

	.lwsp-open-envelope .lws-advent-calendar__box--just-opened .lwsp-inside {
		animation: lwsp-open-envelope-card var(--lws-advent-calendar-open-duration) ease-in-out forwards;
	}

	.lwsp-open-box .lws-advent-calendar__box--just-opened .lwsp-leaf--b {
		animation: lwsp-open-box var(--lws-advent-calendar-open-duration) ease-in-out forwards;
	}

	.lwsp-open-box .lws-advent-calendar__box--just-opened .lwsp-leaf--a {
		animation: lwsp-open-box-body var(--lws-advent-calendar-open-duration) ease-in-out forwards;
	}

	.lwsp-open-check .lws-advent-calendar__box--just-opened .lwsp-leaf--a {
		animation: lwsp-open-check var(--lws-advent-calendar-open-duration) ease-in-out forwards;
	}
}

/* ---------- today's box: the Free draws the ribbon, every other style has a static ring too, motion only adds to it ---------- */
.lwsp-today-halo .lws-advent-calendar__box--openable {
	box-shadow: 0 0 0 3px var(--lwsp-halo), 0 0 18px 5px var(--lwsp-halo);
}

.lwsp-today-grow .lws-advent-calendar__box--openable {
	box-shadow: 0 10px 26px #0006, 0 0 0 3px var(--lwsp-halo);
	transform: scale(1.1);
}

/* A box over several cells grows less, or it would cover the gap to its neighbours. */
.lwsp-today-grow .lws-advent-calendar__box--openable:has(.lwsp-size) {
	transform: scale(1.04);
}

.lwsp-today-grow .lws-advent-calendar__box:not(.lws-advent-calendar__box--openable) {
	opacity: 0.82;
}

.lwsp-today-hop .lws-advent-calendar__box--openable {
	box-shadow: 0 0 0 3px var(--lwsp-halo);
}

@keyframes lwsp-today-halo {
	0%,
	100% {
		box-shadow: 0 0 0 3px var(--lwsp-halo), 0 0 12px 3px var(--lwsp-halo);
	}
	50% {
		box-shadow: 0 0 0 3px var(--lwsp-halo), 0 0 30px 10px var(--lwsp-halo);
	}
}

@keyframes lwsp-today-hop {
	0%,
	100% {
		transform: translateY(0);
	}
	50% {
		transform: translateY(-7px);
	}
}

@media (prefers-reduced-motion: no-preference) {
	.lwsp-today-halo .lws-advent-calendar__box--openable {
		animation: lwsp-today-halo 2s ease-in-out infinite;
	}

	.lwsp-today-hop .lws-advent-calendar__box--openable {
		animation: lwsp-today-hop 1.5s ease-in-out infinite;
	}
}

/* Repeated from the Free after the shutters and box labels, which the merchant's text overrides as it did before. */
.lwsp .lwsp-face--caption .lws-advent-calendar__label {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	min-width: 0;
	height: auto;
	max-width: 100%;
	overflow: hidden;
	padding: 0.25em 0.45em;
	font-size: 0.78rem;
	line-height: 1.15;
}
