/* Calendrier de l'avent JF-WEB
   Portes bleu nuit, une seule animation qui compte : la porte du jour qui s'ouvre. */

.jfca {
	--jfca-night: #1E5673;      /* bleu JF-WEB : les portes */
	--jfca-night-deep: #163F55; /* ombre des portes, fond de la fenêtre */
	--jfca-ink: #12384C;        /* texte */
	--jfca-rose: #B5116A;       /* accent accessible sur blanc */
	--jfca-rose-vif: #E91E8C;   /* accent d'affichage (lueur, filets) */
	--jfca-cyan: #00B8D4;       /* focus clavier */
	--jfca-paper: #FFFFFF;
	--jfca-mist: #F3F3F5;
	--jfca-radius: 0.75rem;

	max-width: 72rem;
	margin: 0 auto;
	padding-bottom: clamp(3rem, 2rem + 4vw, 6rem); /* de l'air avant le pied de page */
	color: var(--jfca-ink);
}

.jfca-test {
	margin: 0 0 1.5rem;
	padding: 0.75rem 1rem;
	border-left: 4px solid var(--jfca-rose);
	background: var(--jfca-mist);
	font-size: 0.9rem;
}

.jfca-intro {
	max-width: 40rem;
	margin: 0 auto 2rem;
	text-align: center;
	font-size: 1.05rem;
	line-height: 1.6;
}

/* ---------- Grille ----------
   3 colonnes sur mobile, 4 sur tablette, 6 sur grand écran.
   Le 1er prend deux places, le 24 toute une ligne : la grille tombe juste
   dans les trois cas, sans réordonner les cases. */

.jfca-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	grid-auto-rows: 8.5rem;
	gap: 0.75rem;
	counter-reset: none;
}
.jfca-day { position: relative; margin: 0; min-width: 0; }
.jfca-day.is-first { grid-column: span 2; }
.jfca-day.is-last  { grid-column: 1 / -1; }

@media (min-width: 40rem) {
	.jfca-grid { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 9.5rem; gap: 1rem; }
}
@media (min-width: 64rem) {
	.jfca-grid { grid-template-columns: repeat(6, 1fr); grid-auto-rows: 10.5rem; }
}

/* ---------- La porte ---------- */

.jfca-door {
	position: absolute;
	inset: 0;
	display: block;
	border-radius: var(--jfca-radius);
	background:
		linear-gradient(155deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0) 45%),
		var(--jfca-night);
	color: #fff;
	box-shadow: inset 0 -3px 0 var(--jfca-night-deep);
	overflow: hidden;
}
/* Le cadre fin intérieur, comme une porte découpée dans le carton. */
.jfca-door::before {
	content: "";
	position: absolute;
	inset: 0.5rem;
	border: 1px solid rgba(255, 255, 255, 0.16);
	border-radius: calc(var(--jfca-radius) - 0.3rem);
	pointer-events: none;
}

.jfca-num {
	position: absolute;
	left: 1rem;
	bottom: 0.6rem;
	font-size: clamp(2.25rem, 1.6rem + 2vw, 3.25rem);
	font-weight: 700;
	line-height: 1;
	font-variant-numeric: lining-nums tabular-nums;
	letter-spacing: -0.02em;
}
.is-last .jfca-num { font-size: clamp(3rem, 2rem + 4vw, 5rem); left: 1.5rem; }

.jfca-lock {
	position: absolute;
	top: 1rem;
	right: 1rem;
	opacity: 0.45;
}
.is-locked .jfca-num { opacity: 0.55; }

.jfca-door.is-empty { background: var(--jfca-mist); color: var(--jfca-ink); box-shadow: none; }
.jfca-door.is-empty::before { border-color: rgba(18, 56, 76, 0.12); }
.jfca-door.is-empty .jfca-num { opacity: 0.35; }

/* ---------- Case ouverte : le bouton ---------- */

.jfca-open {
	all: unset;
	box-sizing: border-box;
	position: absolute;
	inset: 0;
	display: block;
	cursor: pointer;
	border-radius: var(--jfca-radius);
	perspective: 900px;
}
.jfca-open:focus-visible {
	outline: 3px solid var(--jfca-cyan);
	outline-offset: 3px;
}

.jfca-inside {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	gap: 0.4rem;
	padding: 0.9rem 1rem;
	border-radius: var(--jfca-radius);
	background: var(--jfca-paper);
	box-shadow: inset 0 0 0 1px rgba(18, 56, 76, 0.12);
	transition: box-shadow 0.2s ease;
}
.jfca-open:hover .jfca-inside { box-shadow: inset 0 0 0 2px var(--jfca-rose); }

.jfca-inside-num {
	position: absolute;
	top: 0.7rem;
	left: 1rem;
	font-size: 0.95rem;
	font-weight: 700;
	color: var(--jfca-rose);
}
.jfca-inside-logo {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding-top: 1.2rem;
}
.jfca-inside-logo img {
	max-width: 70%;
	max-height: 3.25rem;
	width: auto;
	height: auto;
	object-fit: contain;
}
.jfca-inside-title {
	font-size: 0.85rem;
	font-weight: 700;
	line-height: 1.25;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
@media (min-width: 40rem) { .jfca-inside-title { font-size: 0.9rem; } }

/* ---------- Ouverture des portes ----------
   Toutes les cases disponibles (jours passés et jour J) restent fermées
   jusqu'au clic du visiteur. La porte se déverrouille, puis pivote sur sa
   charnière gauche en s'assombrissant, et dévoile l'intérieur. */

.jfca-open .jfca-door {
	transform-origin: left center;
	transform-style: preserve-3d;
	transition: transform 0.35s ease;
	z-index: 1;
}
/* Survol : la porte s'entrouvre à peine, pour inviter au clic. */
.jfca-day:not(.is-opened) .jfca-open:hover .jfca-door,
.jfca-day:not(.is-opened) .jfca-open:focus-visible .jfca-door { transform: rotateY(-12deg); }

/* Ombre portée sur l'intérieur pendant l'ouverture. */
.jfca-open .jfca-inside::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: linear-gradient(90deg, rgba(18, 56, 76, 0.45), rgba(18, 56, 76, 0) 70%);
	opacity: 0;
	transition: opacity 0.9s ease 0.15s;
	pointer-events: none;
}

.jfca-day.is-opening .jfca-door { animation: jfca-swing 1.05s cubic-bezier(0.3, 0.6, 0.2, 1) forwards; }
.jfca-day.is-opening .jfca-inside::after { opacity: 1; }
.jfca-day.is-opening .jfca-inside { animation: jfca-reveal 1.05s ease-out; }

@keyframes jfca-swing {
	0%   { transform: rotateY(0); filter: brightness(1); }
	14%  { transform: rotateY(-9deg); }          /* elle se décroche */
	24%  { transform: rotateY(-6deg); }
	100% { transform: rotateY(-104deg); filter: brightness(0.62); }
}
@keyframes jfca-reveal {
	from { transform: scale(0.97); }
	to   { transform: scale(1); }
}

/* Porte ouverte (après l'animation, ou au retour du visiteur). */
.jfca-day.is-opened .jfca-door {
	transform: rotateY(-104deg);
	filter: brightness(0.62);
	animation: none;
}
.jfca-day.is-opened:not(.is-opening) .jfca-door { transition: none; }
.jfca-day.is-opened .jfca-door > * { visibility: hidden; }
.jfca-day.is-opened .jfca-inside::after { opacity: 0.55; }
.jfca-day.is-opened .jfca-open:hover .jfca-inside { box-shadow: inset 0 0 0 2px var(--jfca-rose); }

/* ---------- La case du jour : bordure rose et lueur lente ---------- */

.is-today .jfca-door {
	box-shadow:
		inset 0 -3px 0 var(--jfca-night-deep),
		0 0 0 2px var(--jfca-rose-vif);
	animation: jfca-glow 3.2s ease-in-out infinite;
}
.is-today .jfca-door::before { border-color: rgba(233, 30, 140, 0.55); }
.is-today.is-opened .jfca-door { box-shadow: inset 0 -3px 0 var(--jfca-night-deep); }

.jfca-hint {
	position: absolute;
	top: 0.9rem;
	right: 1rem;
	font-size: 0.8rem;
	font-weight: 700;
	padding: 0.2rem 0.6rem;
	border-radius: 999px;
	background: var(--jfca-paper);
	color: var(--jfca-rose);
}

@keyframes jfca-glow {
	0%, 100% { box-shadow: inset 0 -3px 0 var(--jfca-night-deep), 0 0 0 2px var(--jfca-rose-vif), 0 0 0 0 rgba(233, 30, 140, 0); }
	50%      { box-shadow: inset 0 -3px 0 var(--jfca-night-deep), 0 0 0 2px var(--jfca-rose-vif), 0 0 22px 2px rgba(233, 30, 140, 0.35); }
}

/* ---------- Fenêtre de détail ---------- */

.jfca-dialog {
	width: min(34rem, calc(100vw - 2rem));
	max-height: calc(100dvh - 2rem);
	padding: 0;
	border: 0;
	border-radius: 1rem;
	background: var(--jfca-paper);
	color: var(--jfca-ink);
	box-shadow: 0 24px 60px -20px rgba(18, 56, 76, 0.55);
	overflow: auto;
}
.jfca-dialog[open] { animation: jfca-pop 0.22s ease-out; }
.jfca-dialog::backdrop {
	background: rgba(22, 63, 85, 0.6);
	backdrop-filter: blur(3px);
}
@keyframes jfca-pop {
	from { opacity: 0; transform: translateY(8px) scale(0.98); }
	to   { opacity: 1; transform: none; }
}

.jfca-d-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.9rem 1rem 0.9rem 1.5rem;
	background: var(--jfca-night);
	color: #fff;
}
.jfca-d-head form { margin: 0; }
.jfca-d-date { margin: 0; font-weight: 700; font-size: 0.95rem; }
.jfca-d-date::first-letter { text-transform: uppercase; }

.jfca-d-close {
	all: unset;
	display: grid;
	place-items: center;
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 50%;
	cursor: pointer;
	color: #fff;
}
.jfca-d-close:hover { background: rgba(255, 255, 255, 0.12); }
.jfca-d-close:focus-visible { outline: 3px solid var(--jfca-cyan); outline-offset: 2px; }

.jfca-d-body { padding: 1.5rem; }
.jfca-d-body > :first-child { margin-top: 0; }

.jfca-d-logo-wrap { margin-bottom: 1rem; }
.jfca-d-logo { max-height: 4rem; width: auto; height: auto; }

.jfca-d-title {
	margin: 0 0 0.5rem;
	font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem);
	line-height: 1.2;
	color: var(--jfca-ink);
}

.jfca-d-type {
	display: inline-block;
	margin: 0 0 1.25rem;
	padding: 0.3rem 0.75rem;
	border-radius: 999px;
	font-size: 0.85rem;
	font-weight: 700;
}
.jfca-d-type.is-tirage { background: #FBE7F1; color: var(--jfca-rose); }
.jfca-d-type.is-promo  { background: #E3EEF3; color: var(--jfca-night-deep); }

.jfca-d-content { line-height: 1.6; }
.jfca-d-content > :last-child { margin-bottom: 0; }

.jfca-d-cond {
	margin: 1rem 0 0;
	font-size: 0.9rem;
	line-height: 1.5;
	color: #3C5A6B;
}

.jfca-d-partner {
	margin-top: 1.5rem;
	padding-top: 1.25rem;
	border-top: 1px solid rgba(18, 56, 76, 0.12);
}
.jfca-d-partner p { margin: 0 0 0.3rem; }
.jfca-d-partner-label { font-size: 0.85rem; color: #3C5A6B; }
.jfca-d-partner-name { font-weight: 700; }
.jfca-d-partner-contact { font-size: 0.9rem; }
.jfca-d-partner-link { color: var(--jfca-rose); font-weight: 700; text-underline-offset: 0.2em; }

/* ---------- Mouvement réduit ---------- */

@media (prefers-reduced-motion: reduce) {
	.is-today .jfca-door { animation: none; }
	.jfca-open .jfca-door { transition: none; }
	.jfca-day:not(.is-opened) .jfca-open:hover .jfca-door,
	.jfca-day:not(.is-opened) .jfca-open:focus-visible .jfca-door { transform: none; }
	.jfca-day.is-opening .jfca-door,
	.jfca-day.is-opening .jfca-inside { animation: none; }
	.jfca-day.is-opened .jfca-door { display: none; }
	.jfca-dialog[open] { animation: none; }
}

/* =================================================================
   Esprit de Noël, version chic
   Un ciel d'hiver étoilé sur les portes, la neige qui tombe
   uniquement derrière la porte du jour, et un ruban sur le 24.
   ================================================================= */

/* Ciel étoilé : un même motif, décalé d'une porte à l'autre
   (--sx / --sy calculés côté PHP), pour qu'aucune porte ne se ressemble. */
.jfca-door:not(.is-empty) {
	background:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260' viewBox='0 0 260 260'%3E%3Cg fill='%23fff'%3E%3Ccircle cx='18' cy='26' r='1' opacity='.55'/%3E%3Ccircle cx='71' cy='12' r='.7' opacity='.4'/%3E%3Ccircle cx='132' cy='44' r='1.1' opacity='.6'/%3E%3Ccircle cx='204' cy='19' r='.8' opacity='.45'/%3E%3Ccircle cx='242' cy='78' r='1' opacity='.5'/%3E%3Ccircle cx='38' cy='104' r='.8' opacity='.35'/%3E%3Ccircle cx='96' cy='131' r='1.2' opacity='.55'/%3E%3Ccircle cx='170' cy='112' r='.7' opacity='.4'/%3E%3Ccircle cx='221' cy='158' r='1' opacity='.45'/%3E%3Ccircle cx='12' cy='190' r='1.1' opacity='.5'/%3E%3Ccircle cx='64' cy='226' r='.7' opacity='.35'/%3E%3Ccircle cx='121' cy='204' r='.9' opacity='.5'/%3E%3Ccircle cx='183' cy='238' r='1' opacity='.4'/%3E%3Ccircle cx='250' cy='212' r='.7' opacity='.45'/%3E%3C/g%3E%3Cg fill='%23fff' opacity='.75'%3E%3Cpath d='M150 160l1.3 4.7 4.7 1.3-4.7 1.3-1.3 4.7-1.3-4.7-4.7-1.3 4.7-1.3z'/%3E%3Cpath d='M46 52l1 3.4 3.4 1-3.4 1-1 3.4-1-3.4-3.4-1 3.4-1z' opacity='.7'/%3E%3C/g%3E%3C/svg%3E") var(--sx, 0) var(--sy, 0) / 260px 260px,
		linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 50%),
		linear-gradient(180deg, #23617F 0%, var(--jfca-night) 55%, var(--jfca-night-deep) 100%);
}

/* La neige, seulement derrière la porte du jour. Deux couches de flocons
   qui descendent à des vitesses différentes : discret, mais vivant. */
.jfca-snow {
	position: absolute;
	inset: 0;
	border-radius: inherit;
	pointer-events: none;
	background-image:
		radial-gradient(circle, rgba(255, 255, 255, 0.9) 0 1.4px, transparent 1.6px),
		radial-gradient(circle, rgba(255, 255, 255, 0.55) 0 1px, transparent 1.2px);
	background-size: 46px 46px, 29px 29px;
	background-position: 0 0, 13px 7px;
	animation: jfca-snow 14s linear infinite;
	opacity: 0.8;
}
@keyframes jfca-snow {
	from { background-position: 0 0, 13px 7px; }
	to   { background-position: 12px 460px, 5px 297px; }
}
.jfca-day.is-opening .jfca-snow, .jfca-day.is-opened .jfca-snow { display: none; }

/* Le 24 : un ruban fin qui traverse la porte, et un nœud dessiné au trait. */
.is-last .jfca-door:not(.is-empty)::after {
	content: "";
	position: absolute;
	inset: 0;
	background:
		linear-gradient(90deg, transparent calc(68% - 3px), rgba(233, 30, 140, 0.85) calc(68% - 3px), rgba(233, 30, 140, 0.85) calc(68% + 3px), transparent calc(68% + 3px)),
		linear-gradient(180deg, transparent calc(50% - 3px), rgba(233, 30, 140, 0.85) calc(50% - 3px), rgba(233, 30, 140, 0.85) calc(50% + 3px), transparent calc(50% + 3px));
	pointer-events: none;
}
.jfca-bow {
	position: absolute;
	left: 68%;
	top: 50%;
	width: 4.5rem;
	height: auto;
	transform: translate(-50%, -58%);
	color: #F25AAA;
	z-index: 1;
}
.jfca-tag {
	position: absolute;
	left: 1.5rem;
	top: 1.1rem;
	font-size: 0.9rem;
	font-weight: 700;
	color: rgba(255, 255, 255, 0.85);
}
.is-last .jfca-lock { right: 1.5rem; }

/* Intérieur des cases ouvertes : un pictogramme au trait selon le type. */
.jfca-inside-icon {
	position: absolute;
	top: 0.65rem;
	right: 0.8rem;
	width: 1.5rem;
	height: 1.5rem;
	color: var(--jfca-rose);
	opacity: 0.85;
}
/* Sans logo, l'intérieur reçoit une étoile fine en filigrane. */
.jfca-inside.no-logo::before {
	content: "";
	position: absolute;
	right: -0.75rem;
	bottom: -0.75rem;
	width: 6.5rem;
	height: 6.5rem;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' fill='none' stroke='%23B5116A' stroke-width='1.2'%3E%3Cpath d='M50 6l6 32 32 12-32 12-6 32-6-32-32-12 32-12z'/%3E%3Cpath d='M50 30l3 17 17 3-17 3-3 17-3-17-17-3 17-3z' opacity='.6'/%3E%3C/svg%3E") center / contain no-repeat;
	opacity: 0.14;
	pointer-events: none;
}
.jfca-inside { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
	.jfca-snow { animation: none; }
}

/* Le texte de la porte passe toujours au-dessus du ruban et de la neige. */
.jfca-num, .jfca-tag, .jfca-lock, .jfca-hint, .jfca-bow { z-index: 2; }

/* =================================================================
   Les lutins JF-WEB
   Trois personnages, chacun avec un seul geste : l'un se balance assis
   sur la case du jour, l'autre surgit derrière une case fermée, le
   dernier tire sur le ruban du 24.
   ================================================================= */

.jfca-elf {
	position: absolute;
	z-index: 4;
	line-height: 0;
	pointer-events: none;
	transform-origin: 50% 100%;
}
.jfca-elf svg { display: block; overflow: visible; }
@media (max-width: 39.99rem) { .jfca-elf { scale: 0.8; } }

/* Les yeux clignent de temps en temps. */
.jfca-elf-eyes {
	transform-box: fill-box;
	transform-origin: center;
	animation: jfca-blink 5.2s infinite;
}
.jfca-elf-peek .jfca-elf-eyes { animation-delay: 1.7s; }
.jfca-elf-tug .jfca-elf-eyes { animation-delay: 3.1s; }
@keyframes jfca-blink {
	0%, 93%, 100% { transform: scaleY(1); }
	95%           { transform: scaleY(0.1); }
}

/* 1. Assis sur le haut de la case du jour. */
.jfca-elf-sit {
	top: -3.1rem;
	right: 0.9rem;
}
.jfca-elf-legs {
	transform-box: view-box;
	transform-origin: 32px 50px;
	animation: jfca-swing-legs 1.9s ease-in-out infinite alternate;
}
@keyframes jfca-swing-legs {
	from { transform: rotate(-9deg); }
	to   { transform: rotate(9deg); }
}
/* Quand la porte s'ouvre sous lui, il saute pour ne pas tomber. */
.jfca-day.is-opening .jfca-elf-sit { animation: jfca-hop 0.75s cubic-bezier(0.3, 0.7, 0.4, 1); }
@keyframes jfca-hop {
	0%   { transform: translateY(0); }
	35%  { transform: translateY(-1.5rem) rotate(-6deg); }
	70%  { transform: translateY(0.15rem); }
	100% { transform: translateY(0); }
}

/* 2. Il surgit derrière le haut d'une case fermée, puis redescend. */
.jfca-elf-peek {
	left: 1rem;
	bottom: calc(100% - 6px);
	width: 64px;
	height: 44px;
	overflow: hidden;
}
.jfca-elf-peek-in {
	display: block;
	transform: translateY(100%);
	animation: jfca-peek 11s ease-in-out infinite 2s;
}
@keyframes jfca-peek {
	0%, 38%   { transform: translateY(100%); }
	46%       { transform: translateY(4%); }
	52%       { transform: translateY(4%) rotate(-7deg); }
	62%       { transform: translateY(4%) rotate(5deg); }
	70%       { transform: translateY(4%); }
	78%, 100% { transform: translateY(100%); }
}
/* Si on approche la souris, il se cache aussitôt. */
.jfca-day:hover .jfca-elf-peek-in {
	animation: none;
	transform: translateY(100%);
	transition: transform 0.18s ease-in;
}

/* 3. Il tire sur le ruban du 24. */
.jfca-elf-tug {
	left: calc(68% + 2px);
	bottom: 0.35rem;
	transition: opacity 0.4s ease;
}
.jfca-elf-lean {
	transform-box: view-box;
	transform-origin: 34px 72px;
	animation: jfca-tug 2.6s ease-in-out infinite;
}
@keyframes jfca-tug {
	0%, 100% { transform: rotate(2deg); }
	45%      { transform: rotate(11deg); }
	55%      { transform: rotate(9deg); }
}
.is-last.is-opening .jfca-elf-tug,
.is-last.is-opened .jfca-elf-tug { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
	.jfca-elf-eyes, .jfca-elf-legs, .jfca-elf-lean, .jfca-elf-peek-in,
	.jfca-day.is-opening .jfca-elf-sit { animation: none; }
	.jfca-elf-peek-in { transform: translateY(8%); }
}

/* 4. Dans la fiche : il apparaît en bas à droite et fait coucou. */
.jfca-d-body { position: relative; }
.jfca-d-foot {
	display: flex;
	justify-content: flex-end;
	margin: 0.5rem -0.5rem -1.5rem 0;
	height: 80px;
	overflow: hidden; /* il monte depuis le bord bas de la fiche */
}
.jfca-elf-wave { display: block; line-height: 0; }
.jfca-elf-wave .jfca-elf-eyes { transform-box: fill-box; transform-origin: center; animation: jfca-blink 4.6s infinite 1.2s; }
.jfca-dialog[open] .jfca-elf-wave { animation: jfca-rise 0.55s cubic-bezier(0.3, 0.7, 0.3, 1.2) 0.25s both; }
.jfca-elf-arm {
	transform-box: view-box;
	transform-origin: 42px 44px;
}
.jfca-dialog[open] .jfca-elf-arm { animation: jfca-wave 0.5s ease-in-out 0.8s 4 alternate; }
@keyframes jfca-rise {
	from { transform: translateY(100%); }
	to   { transform: translateY(0); }
}
@keyframes jfca-wave {
	from { transform: rotate(0); }
	to   { transform: rotate(-28deg); }
}
@media (prefers-reduced-motion: reduce) {
	.jfca-dialog[open] .jfca-elf-wave, .jfca-dialog[open] .jfca-elf-arm, .jfca-elf-wave .jfca-elf-eyes { animation: none; }
}

/* ---------- Porte refermée après lecture : entrouverte, avec une lueur ----------
   Un clic sur une porte ouverte la referme presque. Il reste un jour sur le
   côté, d'où filtre une lumière chaude : on voit d'un coup d'œil les cases
   déjà découvertes. */

.jfca-day.is-ajar .jfca-door {
	transform: rotateY(-32deg);
	filter: brightness(0.94);
	animation: none;
	transition: transform 0.8s cubic-bezier(0.3, 0.6, 0.2, 1), filter 0.8s ease;
}
.jfca-day.is-ajar .jfca-door > * { visibility: visible; }
.jfca-day.is-ajar .jfca-snow { display: none; }
.is-today.is-ajar .jfca-door { box-shadow: inset 0 -3px 0 var(--jfca-night-deep), 0 0 0 2px var(--jfca-rose-vif); }
.jfca-day.is-ajar .jfca-open:hover .jfca-door,
.jfca-day.is-ajar .jfca-open:focus-visible .jfca-door { transform: rotateY(-40deg); }

/* L'intérieur s'éclaire, comme une pièce allumée derrière la porte. */
.jfca-day.is-ajar .jfca-inside {
	background: radial-gradient(130% 100% at 100% 50%, #FFE7B3 0%, #FFF6E3 40%, #FFFFFF 75%);
}
.jfca-day.is-ajar .jfca-inside::after { opacity: 0; }

/* La lueur qui déborde par l'entrebâillement. */
.jfca-open::before {
	content: "";
	position: absolute;
	top: 10%;
	bottom: 10%;
	right: -6px;
	width: 26px;
	border-radius: 50%;
	background: rgba(255, 196, 102, 0.85);
	filter: blur(12px);
	opacity: 0;
	transition: opacity 0.8s ease 0.2s;
	pointer-events: none;
}
.jfca-day.is-ajar .jfca-open::before {
	opacity: 1;
	animation: jfca-ember 4.5s ease-in-out infinite 1s;
}
@keyframes jfca-ember {
	0%, 100% { opacity: 0.85; }
	50%      { opacity: 0.55; }
}

/* Réouverture depuis l'entrebâillement : la porte pivote sans repartir de zéro. */
.jfca-day.is-opened.is-reopening .jfca-door {
	transition: transform 0.8s cubic-bezier(0.3, 0.6, 0.2, 1), filter 0.8s ease;
}

@media (prefers-reduced-motion: reduce) {
	.jfca-day.is-ajar .jfca-door, .jfca-day.is-opened.is-reopening .jfca-door { transition: none; }
	.jfca-day.is-ajar .jfca-open::before { animation: none; }
	.jfca-day.is-ajar .jfca-open:hover .jfca-door { transform: rotateY(-32deg); }
}

/* Liseré blanc autour des lutins : ils restent lisibles sur les portes bleu nuit
   comme sur le blanc, avec un petit air d'autocollant. */
.jfca-elf svg {
	filter:
		drop-shadow(1.5px 0 0 #fff) drop-shadow(-1.5px 0 0 #fff)
		drop-shadow(0 1.5px 0 #fff) drop-shadow(0 -1.5px 0 #fff)
		drop-shadow(0 4px 6px rgba(18, 56, 76, 0.25));
}

/* 5. La sieste sur le haut d'une case. */
.jfca-elf-sleep {
	top: -3.25rem;
	left: 0.4rem;
}
.jfca-elf-z text { opacity: 0; animation: jfca-z 4.2s ease-out infinite; }
.jfca-elf-z text:nth-child(2) { animation-delay: 0.7s; }
.jfca-elf-z text:nth-child(3) { animation-delay: 1.4s; }
@keyframes jfca-z {
	0%   { opacity: 0; transform: translate(0, 6px); }
	25%  { opacity: 1; }
	80%  { opacity: 0; transform: translate(4px, -6px); }
	100% { opacity: 0; }
}
.jfca-elf-kick {
	transform-box: view-box;
	transform-origin: 66px 44px;
	animation: jfca-kick 3.4s ease-in-out infinite alternate;
}
@keyframes jfca-kick {
	from { transform: rotate(-6deg); }
	to   { transform: rotate(10deg); }
}
/* Si on ouvre sa case, il se réveille en sursaut. */
.jfca-day.is-opening .jfca-elf-sleep { animation: jfca-hop 0.75s cubic-bezier(0.3, 0.7, 0.4, 1); }

/* 6. La lanterne, au pied d'une case. */
.jfca-elf-lantern {
	left: 0.35rem;
	bottom: 0.25rem;
}
.jfca-elf-halo {
	transform-box: fill-box;
	transform-origin: center;
	animation: jfca-halo 2.8s ease-in-out infinite;
}
@keyframes jfca-halo {
	0%, 100% { transform: scale(1); opacity: 0.55; }
	50%      { transform: scale(1.25); opacity: 0.3; }
}
.jfca-elf-lamp {
	transform-box: view-box;
	transform-origin: 54px 50px;
	animation: jfca-lamp 3.6s ease-in-out infinite alternate;
}
@keyframes jfca-lamp {
	from { transform: rotate(-5deg); }
	to   { transform: rotate(5deg); }
}
/* Il laisse le numéro lisible : sur les cases où il se tient, le numéro passe à droite. */
.jfca-day:has(.jfca-elf-lantern) .jfca-door .jfca-num { left: auto; right: 1rem; }

@media (prefers-reduced-motion: reduce) {
	.jfca-elf-z text { animation: none; opacity: 0.8; }
	.jfca-elf-kick, .jfca-elf-halo, .jfca-elf-lamp,
	.jfca-day.is-opening .jfca-elf-sleep { animation: none; }
}

/* ---------- Participation ---------- */

.jfca-p {
	margin-top: 1.5rem;
	padding: 1.1rem 1.1rem 1rem;
	border-radius: 0.75rem;
	background: #FBF1F6;
}
.jfca-p.is-closed { background: var(--jfca-mist); }
.jfca-p p { margin: 0; }
.jfca-p-label { display: block; margin-bottom: 0.4rem; font-weight: 700; font-size: 0.95rem; }
.jfca-p-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.jfca-p-input {
	flex: 1 1 13rem;
	min-width: 0;
	padding: 0.65rem 0.8rem;
	border: 1px solid #8AA1AE;
	border-radius: 0.5rem;
	background: #fff;
	font: inherit;
	color: var(--jfca-ink);
}
.jfca-p-input:focus-visible { outline: 3px solid var(--jfca-cyan); outline-offset: 1px; border-color: var(--jfca-night); }
.jfca-p-btn {
	flex: 0 0 auto;
	padding: 0.65rem 1.2rem;
	border: 0;
	border-radius: 0.5rem;
	background: var(--jfca-rose);
	color: #fff;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
	transition: background 0.2s ease;
}
.jfca-p-btn:hover { background: #950D57; }
.jfca-p-btn:focus-visible { outline: 3px solid var(--jfca-cyan); outline-offset: 2px; }
.jfca-p-btn:disabled { opacity: 0.7; cursor: wait; }
.jfca-p-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.jfca-p-msg { margin-top: 0.6rem !important; font-size: 0.92rem; line-height: 1.45; }
.jfca-p-msg:empty { display: none; }
.jfca-p[data-state="ok"] .jfca-p-msg { color: #11643A; font-weight: 700; }
.jfca-p[data-state="error"] .jfca-p-msg { color: #A1123D; }
.jfca-p-signup {
	display: inline-block;
	margin-top: 0.5rem;
	color: var(--jfca-rose);
	font-weight: 700;
	text-underline-offset: 0.2em;
}
.jfca-p-help { margin-top: 0.7rem !important; font-size: 0.85rem; color: #3C5A6B; }
.jfca-p-help a { color: var(--jfca-rose); }
.jfca-p.is-done .jfca-p-help { display: none; }
.jfca-p-winners { font-size: 1rem; }
.jfca-p-winners-label { font-weight: 700; color: var(--jfca-rose); }

/* Une fois inscrit au tirage, le lutin de la fiche saute de joie. */
.jfca-dialog.is-joined .jfca-elf-wave { animation: jfca-hop 0.7s cubic-bezier(0.3, 0.7, 0.4, 1) 2; }
@media (prefers-reduced-motion: reduce) {
	.jfca-dialog.is-joined .jfca-elf-wave { animation: none; }
}

/* ---------- Invitation à s'inscrire, en haut du calendrier ---------- */

.jfca-invite {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem 2rem;
	margin: 0 0 2rem;
	padding: 1.25rem 1.5rem;
	border-radius: 1rem;
	background:
		radial-gradient(120% 140% at 100% 0%, rgba(255, 210, 122, 0.28), rgba(255, 210, 122, 0) 55%),
		#FBF1F6;
	box-shadow: inset 0 0 0 1px rgba(181, 17, 106, 0.14);
}
.jfca-invite-text { flex: 1 1 26rem; min-width: 0; }
.jfca-invite-title {
	margin: 0 0 0.35rem;
	font-size: clamp(1.15rem, 1rem + 0.8vw, 1.5rem);
	line-height: 1.25;
	color: var(--jfca-ink);
}
.jfca-invite-sub { margin: 0; line-height: 1.55; max-width: 44rem; }
.jfca-invite-btn {
	flex: 0 0 auto;
	display: inline-block;
	padding: 0.8rem 1.4rem;
	border-radius: 0.6rem;
	background: var(--jfca-rose);
	color: #fff;
	font-weight: 700;
	text-decoration: none;
	transition: background 0.2s ease;
}
.jfca-invite-btn:hover { background: #950D57; color: #fff; }
.jfca-invite-btn:focus-visible { outline: 3px solid var(--jfca-cyan); outline-offset: 3px; }

/* Visiteur déjà inscrit depuis ce navigateur : un simple mot d'accueil. */
.jfca-invite.is-known .jfca-invite-btn { display: none; }
.jfca-invite.is-known { padding-block: 1rem; }

/* Plus d'espace entre les lignes : les lutins assis ou allongés sur le haut
   d'une case ont leur place, sans mordre sur la case du dessus. */
.jfca-grid { row-gap: 2.6rem; }
@media (min-width: 40rem) { .jfca-grid { row-gap: 3.1rem; } }

/* Le lutin assis se met à gauche : le badge « Ouvrir » (en haut à droite) reste visible. */
.jfca-elf-sit { right: auto; left: 0.9rem; }
.is-first .jfca-elf-sit { left: 2rem; }

/* ---------- Photo du cadeau ---------- */

/* Dans la case ouverte : la photo en fond, le titre lisible sur un dégradé. */
.jfca-inside.has-photo { padding: 0; }
.jfca-inside-photo {
	position: absolute; inset: 0;
	width: 100%; height: 100%;
	object-fit: cover;
	border-radius: inherit;
}
.jfca-inside.has-photo::before { display: none; }
.jfca-inside.has-photo .jfca-inside-num,
.jfca-inside.has-photo .jfca-inside-icon { z-index: 2; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.jfca-inside.has-photo .jfca-inside-title {
	position: relative; z-index: 2;
	margin-top: auto;
	padding: 1.8rem 1rem 0.9rem;
	color: #fff;
	background: linear-gradient(to top, rgba(18, 56, 76, 0.92), rgba(18, 56, 76, 0));
	border-radius: 0 0 var(--jfca-radius) var(--jfca-radius);
}

/* Dans la fiche : la photo en tête, pleine largeur. */
.jfca-d-photo { margin: -1.5rem -1.5rem 1.25rem; }
.jfca-d-photo img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.jfca-d-partner-logo { margin-bottom: 0.6rem; }
.jfca-d-partner-logo img { max-height: 3rem; width: auto; height: auto; }

/* Correctif : l'intérieur forme son propre empilement, pour que la photo et le
   titre restent toujours derrière la porte fermée. */
.jfca-open .jfca-inside { z-index: 0; isolation: isolate; }

/* Petit paquet cadeau sur les portes déjà découvertes (à la place du cadenas). */
.jfca-door-gift {
	position: absolute;
	top: 0.85rem;
	right: 0.9rem;
	width: 1.35rem;
	height: 1.35rem;
	color: #FFD27A;
	opacity: 0;
	transition: opacity 0.6s ease 0.4s;
	z-index: 2;
}
.jfca-day.is-ajar .jfca-door-gift { opacity: 0.95; }
.jfca-day.is-ajar .jfca-hint { display: none; }
.is-last .jfca-door-gift { right: 1.5rem; }
@media (prefers-reduced-motion: reduce) { .jfca-door-gift { transition: none; } }

/* ---------- Avant le 1er décembre : l'invitation en paquet cadeau ---------- */

.jfca-teaser {
	position: relative;
	display: block;
	padding: 2.25rem clamp(1.25rem, 4vw, 2.5rem);
	padding-right: clamp(1.25rem, 30%, 20rem);
	margin-top: 3.5rem;
	color: #fff;
	background:
		radial-gradient(90% 130% at 88% 0%, rgba(255, 210, 122, 0.18), rgba(255, 210, 122, 0) 55%),
		linear-gradient(160deg, #23617F 0%, var(--jfca-night) 55%, var(--jfca-night-deep) 100%);
	box-shadow: inset 0 -3px 0 var(--jfca-night-deep);
}
/* Le ruban : une bande oblique qui traverse le paquet d'un bord à l'autre,
   à droite du texte, avec le nœud en son milieu. */
.jfca-teaser-ribbon {
	position: absolute;
	inset: 0;
	border-radius: inherit;
	overflow: hidden;
	pointer-events: none;
}
.jfca-teaser-ribbon::before {
	content: "";
	position: absolute;
	left: calc(84% - 5px);
	top: -40%;
	width: 10px;
	height: 180%;
	background: #D1007A;
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
	transform: rotate(22deg);
}
.jfca-teaser-bow {
	position: absolute;
	left: 84%;
	top: 50%;
	width: 6rem;
	height: auto;
	transform: translate(-50%, -62%) rotate(8deg);
	color: #F25AAA;
	pointer-events: none;
}
.jfca-teaser-bow path:not(:nth-child(3)) { fill: #D1007A; }
.jfca-teaser-bow path:nth-child(3) { stroke: #D1007A; stroke-width: 4; }
/* Le lutin, debout sur le haut du paquet, juste à côté du ruban, fait coucou. */
.jfca-teaser-elf {
	position: absolute;
	left: calc(84% + 1.5rem);
	bottom: 100%;
	margin-bottom: -0.35rem;
	width: 4rem;
	pointer-events: none;
}
.jfca-teaser-elf .jfca-elf-arm { animation: jfca-wave 0.5s ease-in-out 1s 6 alternate; }
.jfca-teaser .jfca-invite-text { position: relative; z-index: 1; }
.jfca-teaser-kicker {
	margin: 0 0 0.5rem;
	font-size: 0.85rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #FFD27A;
}
.jfca-teaser .jfca-invite-title { color: #fff; font-size: clamp(1.35rem, 1.1rem + 1.1vw, 1.85rem); line-height: 1.15; margin-bottom: 0.6rem; }
.jfca-teaser .jfca-invite-sub { color: #D8E6EE; }
/* Le titre peut s'avancer un peu vers le ruban, pour tenir sur une ligne. */
@media (min-width: 64rem) { .jfca-teaser .jfca-invite-title { margin-right: -9rem; } }
.jfca-teaser-note { margin: 0.6rem 0 1.25rem; font-size: 0.9rem; color: #B9CDD8; }
.jfca-teaser .jfca-invite-btn { background: #FFD27A; color: var(--jfca-ink); }
.jfca-teaser .jfca-invite-btn:hover { background: #fff; color: var(--jfca-ink); }
.jfca-teaser .jfca-invite-btn:focus-visible { outline-color: #fff; }
.jfca-teaser.is-known .jfca-teaser-note { margin-bottom: 0; }

/* Sur petit écran : le ruban barre le coin en haut à droite, en oblique. */
@media (max-width: 40rem) {
	.jfca-teaser { padding: 3.5rem 1.25rem 1.75rem; }
	.jfca-teaser-ribbon::before { left: auto; right: 3.2rem; top: -3rem; height: 9rem; width: 7px; transform: rotate(-45deg); transform-origin: center; }
	.jfca-teaser-bow { left: auto; right: 1.4rem; top: 1.4rem; width: 4.2rem; transform: translate(0, -50%) rotate(-45deg); }
	.jfca-teaser-elf { left: 1.25rem; width: 3.4rem; }
}
@media (prefers-reduced-motion: reduce) {
	.jfca-teaser-elf .jfca-elf-arm { animation: none; }
}
