/* ==========================================================================
   Ludoz, la mascotte de Vertuoz Académie (la méthode d'apprentissage ludique et connectée).
   Poses en SVG : assets/img/ludoz/ et assets/js/ludoz-poses.js, générées par
   mascotte/outils/generer_ludoz_site.py.
   Trois animations douces : Ludoz flotte (.ludoz-boite), cligne des yeux, et parle
   (.ludoz-parle fait alterner ses deux bouches). .ludoz-saute : le petit saut d'un changement de pose.
   ========================================================================== */

.ludoz { display: block; width: 100%; height: auto; overflow: visible; }
.ludoz-boite { transform-origin: 50% 100%; animation: ludoz-flotte 3.4s ease-in-out infinite; }
.ludoz-corps { transform-origin: 50% 100%; }
@keyframes ludoz-flotte { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-5px) rotate(-1.2deg); } }

.ludoz .ludoz-yeux { transform-box: fill-box; transform-origin: 50% 60%; animation: ludoz-cligne 4.8s infinite; }
@keyframes ludoz-cligne { 0%, 93%, 100% { transform: scaleY(1); } 95.5% { transform: scaleY(.08); } }

.ludoz-parle .ludoz-bouche-a { animation: ludoz-bouche-a .34s infinite; }
.ludoz-parle .ludoz-bouche-b { animation: ludoz-bouche-b .34s infinite; }
@keyframes ludoz-bouche-a { 0%, 49% { opacity: 0; } 50%, 100% { opacity: 1; } }
@keyframes ludoz-bouche-b { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.ludoz-saute { animation: ludoz-saute .6s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes ludoz-saute {
  0% { transform: translateY(0) scale(1, 1); }
  22% { transform: translateY(3px) scale(1.07, .9); }
  55% { transform: translateY(-16px) scale(.95, 1.06); }
  100% { transform: translateY(0) scale(1, 1); }
}

/* Une bulle de dialogue, la pointe à gauche (vers Ludoz) */
.ludoz-bulle { position: relative; padding: 18px 24px 20px; border-radius: 24px; background: #fff; box-shadow: 0 1px 0 var(--ligne), 0 22px 40px -30px rgba(23, 42, 58, .55); }
.ludoz-bulle::before { content: ""; position: absolute; left: -11px; top: 38px; width: 24px; height: 24px; border-radius: 4px 0 4px 0; background: #fff; transform: rotate(45deg); }
.ludoz-bulle__main { font-family: var(--main); font-size: 1.45rem; font-weight: 700; line-height: 1.1; color: #C77A00; }

/* --- Fiches formation : la méthode Ludoz, dans « Méthodes et moyens pédagogiques » --- */
.f-ludoz { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 22px; margin-top: 24px; padding: 18px 24px 18px 18px; border-radius: 22px; background: var(--jaune-pale); }
.f-ludoz__perso { width: 96px; }
.f-ludoz__titre { font-family: var(--main); font-size: 1.7rem; font-weight: 700; line-height: 1; transform: rotate(-2deg); transform-origin: left; }
.f-ludoz__titre b { color: #C77A00; }
.f-ludoz p + p { margin-top: 8px; }

/* --- Page 404 --- */
.e404 { padding: clamp(40px, 7vw, 96px) 0 clamp(64px, 9vw, 120px); background: var(--creme); }
.e404__in { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); align-items: center; gap: clamp(28px, 5vw, 72px); }
.e404__ludoz { justify-self: center; width: min(100%, 300px); }
.e404__code { display: inline-block; padding: 5px 11px; border-radius: 5px; background: var(--nuit); color: #fff; font-size: .8rem; font-weight: 600; transform: rotate(-2deg); }
.e404 .q-titre { margin-top: 18px; }
.e404__liens { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

/* --- Ludoz propose le quiz, en bas à droite (ludoz-invite.js) --- */
/* La scène est coupée au ras du bas de l'écran (clip-path) : Ludoz se hisse depuis ce bord, s'y cache et en ressort.
   Sous le menu (z-index 50) : il ne recouvre jamais le menu ouvert. --ludoz-bas : au-dessus du bandeau cookies. */
.ludoz-invite { position: fixed; right: 18px; bottom: calc(var(--ludoz-bas, 0px) + env(safe-area-inset-bottom, 0px)); z-index: 45;
  display: flex; align-items: flex-end; gap: 2px; max-width: calc(100% - 36px); pointer-events: none; transition: bottom .3s ease; }
.ludoz-invite__scene { flex: none; width: 118px; clip-path: inset(-300px -80px 0 -80px); pointer-events: none; }
.ludoz-invite__perso { transform: translateY(108%); transform-origin: 50% 100%; will-change: transform; }
.ludoz-invite:not(.is-sorti) .ludoz-boite { animation: none; }
.ludoz-regarde .ludoz-pupilles { animation: ludoz-regarde 1.5s ease-in-out; }
@keyframes ludoz-regarde { 0%, 8% { transform: translateX(0); } 28%, 45% { transform: translateX(-6px); } 62%, 82% { transform: translateX(6px); } 100% { transform: translateX(0); } }

.ludoz-invite__bulle { position: relative; width: 320px; margin-bottom: 64px; padding: 18px 20px; border-radius: 22px; background: #fff;
  box-shadow: 0 1px 0 var(--ligne), 0 30px 60px -28px rgba(23, 42, 58, .55);
  opacity: 0; transform: translateX(18px) scale(.88); transform-origin: 100% 85%; visibility: hidden;
  transition: opacity .35s ease, transform .55s cubic-bezier(.34, 1.56, .64, 1), visibility 0s .55s; }
.ludoz-invite.is-sorti .ludoz-invite__bulle { opacity: 1; transform: none; visibility: visible; pointer-events: auto; transition-delay: .05s, .05s, 0s; }
.ludoz-invite__bulle::after { content: ""; position: absolute; right: -10px; bottom: 30px; width: 22px; height: 22px; border-radius: 0 4px 0 4px; background: #fff; transform: rotate(45deg); }
.ludoz-invite__fermer { position: absolute; right: 10px; top: 8px; width: 30px; height: 30px; border-radius: 50%; font-size: 1.3rem; line-height: 1; color: var(--gris); transition: background-color .2s, color .2s; }
.ludoz-invite__fermer:hover, .ludoz-invite__fermer:focus-visible { background: var(--creme); color: var(--nuit); }
.ludoz-invite__main { font-family: var(--main); font-size: 1.6rem; font-weight: 700; line-height: 1; color: #C77A00; }
.ludoz-invite__texte { margin-top: 6px; padding-right: 14px; font-size: .95rem; line-height: 1.45; color: var(--nuit); }
.ludoz-invite__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 14px; }
.ludoz-invite__actions .btn { padding: 10px 16px; font-size: .9rem; }
.ludoz-invite__tard { font-size: .88rem; font-weight: 600; color: var(--gris); text-decoration: underline; text-underline-offset: 3px; }
.ludoz-invite__tard:hover { color: var(--nuit); }

@media (max-width: 760px) {
  .ludoz-invite { right: 8px; max-width: calc(100% - 16px); }
  .ludoz-invite__scene { width: 80px; }
  .ludoz-invite__bulle { width: auto; flex: 1; min-width: 0; margin-bottom: 44px; padding: 14px 16px; }
  .ludoz-invite__main { font-size: 1.35rem; }
  .ludoz-invite__texte { font-size: .88rem; }
  .ludoz-invite__bulle::after { bottom: 22px; }
}

@media (max-width: 760px) {
  .f-ludoz { grid-template-columns: 72px minmax(0, 1fr); gap: 14px; padding: 16px; }
  .f-ludoz__perso { width: 72px; }
  .f-ludoz__titre { font-size: 1.5rem; }
  .e404__in { grid-template-columns: minmax(0, 1fr); text-align: center; }
  .e404__ludoz { width: 200px; }
  .e404__liens { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .ludoz-boite, .ludoz .ludoz-yeux, .ludoz-parle .ludoz-bouche-a, .ludoz-parle .ludoz-bouche-b, .ludoz-saute { animation: none !important; }
  .ludoz-invite__bulle { transition: none; }
  .ludoz-invite.is-sorti .ludoz-invite__perso { transform: none; }
  .ludoz-regarde .ludoz-pupilles { animation: none; }
}
