/* ======================================================
   PAGE D'ACCUEIL — TROUSSEAU — css/accueil.css
====================================================== */

.trousseau {
	--w: min(36vw, 46vh);        /* taille du trousseau : ajuste ici */
	--anneau: 55%;               /* largeur de l'anneau par rapport au trousseau */
	--accroche: -11%;            /* remonte les clés sous l'anneau (plus négatif = plus haut) */
	--cles-h: 115%;              /* hauteur de la zone des clés */

	position: relative;
	width: var(--w);
	margin: 0 auto;
	user-select: none;
	-webkit-user-select: none;
	-webkit-tap-highlight-color: transparent;
}

/* Tout le trousseau pivote depuis le haut de l'anneau */
.trousseau-balancier {
	position: relative;
	transform-origin: 50% 0;
	will-change: transform;
}

.trousseau-anneau-wrap {
	position: relative;
	z-index: 0;
	width: var(--anneau);
	margin: 0 auto;
}

.trousseau-anneau {
	display: block;
	width: 100%;
	height: auto;
	pointer-events: none;
}

/* ---------- Yeux du cadenas ---------- */
.trousseau-oeil {
	position: absolute;
	top: var(--oy, 42%);
	width: 0;
	height: 0;
	pointer-events: none;
}

/* La pupille : un point qui se déplace (sa taille --pw est calculée par le JS) */
.trousseau-pupille {
	position: absolute;
	left: 0;
	top: 0;
	width: 0;
	height: 0;
	will-change: transform;
}
.trousseau-pupille::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	width: var(--pw, 12px);
	aspect-ratio: 1 / 1.15;
	transform: translate(-50%, -50%);
	border-radius: 50%;
	background: var(--pcol, #3b0f1f);
}
/* petit reflet blanc */
.trousseau-pupille::after {
	content: "";
	position: absolute;
	left: calc(var(--pw, 12px) * .12);
	top: calc(var(--pw, 12px) * -.28);
	width: calc(var(--pw, 12px) * .3);
	aspect-ratio: 1;
	transform: translate(-50%, -50%);
	border-radius: 50%;
	background: #fff;
}

/* Mode réglage (?yeux=reglage) : repères rouges sur les yeux */
.is-reglage .trousseau-oeil::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	width: 30px;
	height: 30px;
	transform: translate(-50%, -50%);
	border: 2px dashed red;
	border-radius: 50%;
	z-index: 2;
}

/* ---------- Clés ---------- */
.trousseau-cles {
	position: relative;
	height: 0;
	padding-bottom: var(--cles-h);
	margin-top: var(--accroche);
}

.trousseau-cle {
	position: absolute;
	left: var(--x);
	top: var(--y);
	width: var(--w);
	margin-left: calc(var(--w) / -2);   /* --x = centre de la clé */
	display: block;
	transform-origin: 50% 0;            /* pivote depuis son anneau */
	will-change: transform;
	cursor: pointer;
	outline: none;
	touch-action: manipulation;
}

.trousseau-cle img {
	display: block;
	width: 100%;
	height: auto;
	pointer-events: none;
	filter: drop-shadow(0 4px 5px rgba(0, 0, 0, .22));
	transition: filter .3s ease;
}

.trousseau-cle.is-hover img,
.trousseau-cle:focus-visible img {
	filter: drop-shadow(0 10px 12px rgba(0, 0, 0, .28));
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
	.trousseau { --w: min(82vw, 58vh); }
}


/* ======================================================
   PETITS DOSSIERS DE TRAVERS
====================================================== */
.accueil-dossiers {
	position: fixed;
	inset: 0;
	z-index: 5;                    /* sous le header, au-dessus du fond */
	pointer-events: none;
}

.accueil-dossier {
	position: absolute;
	left: var(--x);
	top: var(--y);
	width: var(--w);
	display: block;
	line-height: 0;
	pointer-events: auto;
	transform: rotate(var(--r));      /* l'inclinaison reste fixe : la zone de survol ne bouge pas */
	-webkit-tap-highlight-color: transparent;
}

/* C'est l'image qui bouge, pas le lien → plus de tremblement au survol */
.accueil-dossier img {
	display: block;
	width: 100%;
	height: auto;
	pointer-events: none;
	transform: translateY(0) rotate(0);
	filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .2));
	transition:
		transform .9s cubic-bezier(.22, 1, .36, 1),   /* départ vif, arrivée très douce */
		filter .9s cubic-bezier(.22, 1, .36, 1);
	will-change: transform;
}

/* Survol : il se soulève et se redresse doucement */
.accueil-dossier:hover img,
.accueil-dossier:focus-visible img {
	transform: translateY(-6%) rotate(calc(var(--r) * -.5));
	filter: drop-shadow(0 16px 16px rgba(0, 0, 0, .22));
}

/* Petite apparition au chargement, l'un après l'autre
   (fill-mode backwards : l'animation ne bloque plus le survol ensuite) */
@media (prefers-reduced-motion: no-preference) {
	.accueil-dossier {
		animation: dossier-pose .9s cubic-bezier(.22, 1, .36, 1) backwards;
		animation-delay: calc(var(--i) * 110ms + 200ms);
	}
}
@keyframes dossier-pose {
	from { opacity: 0; transform: translateY(30px) rotate(calc(var(--r) * 2)); }
	to   { opacity: 1; transform: rotate(var(--r)); }
}


/* ======================================================
   STYLO À DÉPLACER
====================================================== */
.accueil-stylo {
	position: fixed;
	left: 0;
	top: 0;
	z-index: 8500;                 /* au-dessus de tout, sauf le header et les panneaux */
	width: var(--sw, 170px);
	cursor: grab;
	touch-action: none;            /* indispensable pour le glisser au doigt */
	user-select: none;
	-webkit-user-select: none;
	-webkit-tap-highlight-color: transparent;
	will-change: transform;
	visibility: hidden;            /* affiché par le JS une fois placé */
}
.accueil-stylo.is-pret { visibility: visible; }
.accueil-stylo.is-tenu { cursor: grabbing; }

.accueil-stylo img {
	display: block;
	width: 100%;
	height: auto;
	pointer-events: none;
	filter: drop-shadow(2px 4px 3px rgba(0, 0, 0, .25));
	transition: filter .25s ease;
}
/* Tenu en main : l'ombre s'éloigne, comme s'il était soulevé */
.accueil-stylo.is-tenu img { filter: drop-shadow(10px 18px 10px rgba(0, 0, 0, .22)); }


/* ---------- Mobile ---------- */
@media (max-width: 768px) {
	/* Les dossiers dépassent du bas de l'écran, côte à côte */
	.accueil-dossier {
		left: calc(var(--i) * 24% + 2%) !important;
		top: auto !important;
		bottom: -6vw;
		width: 24vw;
	}
	.accueil-dossier:nth-child(n+5) { display: none; }

	.accueil-stylo { width: calc(var(--sw, 170px) * .7); }
}


/* ======================================================
   ENCRE DU STYLO (dessin sur le fond)
====================================================== */
.accueil-encre {
	position: fixed;
	inset: 0;
	width: 100vw;
	height: 100vh;
	z-index: -1;                   /* sur le fond, derrière tout le reste */
	pointer-events: none;
}

/* ---------- Gomme (même comportement que le stylo) ---------- */
.accueil-gomme {
	position: fixed;
	left: 0;
	top: 0;
	z-index: 8500;
	width: var(--sw, 90px);
	cursor: grab;
	touch-action: none;
	user-select: none;
	-webkit-user-select: none;
	-webkit-tap-highlight-color: transparent;
	will-change: transform;
	visibility: hidden;
}
.accueil-gomme.is-pret { visibility: visible; }
.accueil-gomme.is-tenu { cursor: grabbing; }

.accueil-gomme img {
	display: block;
	width: 100%;
	height: auto;
	pointer-events: none;
	filter: drop-shadow(2px 4px 3px rgba(0, 0, 0, .25));
	transition: filter .25s ease;
}
.accueil-gomme.is-tenu img { filter: drop-shadow(8px 14px 9px rgba(0, 0, 0, .22)); }

@media (max-width: 768px) {
	.accueil-gomme { width: calc(var(--sw, 90px) * .75); }
}