/* =====================================================================
   MASCOTTE YG — assistant-menu flottant (module autonome)
   ===================================================================== */
.ygm {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 150;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* --- le bouton-visage --- */
.ygm-btn {
  position: relative;
  display: block;
  width: 92px;
  height: 92px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.45)) drop-shadow(0 0 14px rgba(40, 210, 234, 0.35));
  animation: ygmFloat 3.6s ease-in-out infinite;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ygm-btn:focus-visible {
  outline: 3px solid #28d2ea;
  outline-offset: 4px;
}
.ygm-face {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
@keyframes ygmFloat {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -6px; }
}
.ygm.is-hover .ygm-btn,
.ygm.is-open .ygm-btn {
  transform: scale(1.08) rotate(-4deg);
}
.ygm.is-jumping .ygm-btn {
  animation: ygmJump 0.55s cubic-bezier(0.3, 0.8, 0.4, 1);
}
@keyframes ygmJump {
  0% { translate: 0 0; }
  35% { translate: 0 -34px; }
  60% { translate: 0 0; }
  75% { translate: 0 -8px; }
  100% { translate: 0 0; }
}

/* --- expressions --- */
.ygm-mouth { display: none; }
.ygm .ygm-m-calm { display: inline; }
.ygm.is-hover .ygm-m-calm,
.ygm.is-open .ygm-m-calm { display: none; }
.ygm.is-hover .ygm-m-smile,
.ygm.is-open .ygm-m-smile { display: inline; }
.ygm.is-talking .ygm-m-calm,
.ygm.is-talking .ygm-m-smile { display: none; }
.ygm.is-talking .ygm-m-talk { display: inline; animation: ygmTalk 0.16s ease-in-out 3 alternate; }
@keyframes ygmTalk {
  from { transform: scaleY(1); }
  to { transform: scaleY(0.45); }
}
.ygm-m-talk { transform-box: fill-box; transform-origin: center; }
.ygm-cheek { opacity: 0; transition: opacity 0.25s ease; }
.ygm.is-hover .ygm-cheek,
.ygm.is-open .ygm-cheek { opacity: 0.45; }
.ygm-brow { transition: transform 0.25s ease; }
.ygm.is-hover .ygm-brow,
.ygm.is-open .ygm-brow { transform: translateY(-1.6px); }
.ygm-pupils { transition: transform 0.15s ease-out; }
.ygm-eyes { transform-box: fill-box; transform-origin: center; transition: transform 0.08s ease; }
.ygm.is-blinking .ygm-eyes { transform: scaleY(0.1); }

/* --- bulle de parole --- */
.ygm-say {
  position: absolute;
  right: 74px;
  bottom: 84px;
  width: max-content;
  max-width: 240px;
  padding: 9px 14px;
  border-radius: 16px 16px 4px 16px;
  background: #ffffff;
  color: #04101f;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.3;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(8px) scale(0.9);
  transform-origin: bottom right;
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  white-space: normal;
}
.ygm.is-saying .ygm-say {
  opacity: 1;
  transform: none;
}
.ygm.is-hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

/* =====================================================================
   CONSTELLATION DE NAVIGATION (plein écran)
   ===================================================================== */
html.ygc-lock,
html.ygc-lock body { overflow: hidden; }

.ygc {
  --S: min(94vw, 90vh);
  position: fixed;
  inset: 0;
  z-index: 190;
  display: grid;
  place-items: center;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #fff;
}
.ygc[hidden] { display: none; }
.ygc-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 46%, rgba(22, 52, 96, 0.96) 0%, rgba(8, 22, 46, 0.97) 42%, rgba(3, 10, 22, 0.985) 100%);
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.ygc.is-open .ygc-backdrop { opacity: 1; }

/* --- boutons d'angle --- */
.ygc-sound,
.ygc-close {
  position: absolute;
  top: 22px;
  z-index: 3;
  border: 1.5px dashed rgba(40, 210, 234, 0.55);
  background: rgba(6, 18, 34, 0.55);
  color: #eaf3fb;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease 0.3s, border-color 0.2s ease, background 0.2s ease;
}
.ygc.is-open .ygc-sound,
.ygc.is-open .ygc-close { opacity: 1; }
.ygc-sound {
  right: 26px;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 0.95rem;
}
.ygc-sound span { margin-right: 6px; }
.ygc-close {
  left: 26px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border-style: solid;
  font-size: 1.6rem;
  line-height: 1;
}
.ygc-sound:hover,
.ygc-close:hover,
.ygc-sound:focus-visible,
.ygc-close:focus-visible {
  border-color: #28d2ea;
  background: rgba(40, 210, 234, 0.14);
  outline: none;
}

/* --- la scène carrée --- */
.ygc-stage {
  position: relative;
  width: var(--S);
  height: var(--S);
  z-index: 2;
}

/* --- Yann en 3D au centre --- */
.ygc-hero {
  position: absolute;
  left: 50%;
  top: 54%;
  height: calc(var(--S) * 0.62);
  aspect-ratio: 520 / 758;
  transform: translate(-50%, -50%);
  transform-origin: 50% 50%;
  pointer-events: none;
  z-index: 3;
}
.ygc-hero img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 24px 40px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 30px rgba(40, 140, 255, 0.18));
  user-select: none;
}
.ygc-hero::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: -2%;
  height: 7%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(40, 210, 234, 0.35), transparent 70%);
  filter: blur(4px);
}
/* il grandit depuis la bulle du coin */
.ygc .ygc-hero {
  transition: transform 0.65s cubic-bezier(0.22, 1.25, 0.36, 1), opacity 0.3s ease;
  transform: translate(calc(-50% + var(--from-x, 40vw)), calc(-50% + var(--from-y, 40vh))) scale(0.14);
  opacity: 0;
}
.ygc.is-open .ygc-hero {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}
.ygc.is-open .ygc-hero img { animation: ygcBreath 4.2s ease-in-out 0.8s infinite; }
@keyframes ygcBreath {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.012); }
}
.ygc-hero.is-talking img { animation: ygcTalk 0.5s ease, ygcBreath 4.2s ease-in-out 0.5s infinite; }
@keyframes ygcTalk {
  0% { transform: translateY(0) rotate(0); }
  30% { transform: translateY(-10px) rotate(-1.5deg); }
  60% { transform: translateY(0) rotate(1deg); }
  100% { transform: translateY(0) rotate(0); }
}

/* bulle de parole du personnage */
.ygc-say {
  position: absolute;
  left: 38%;
  top: -15%;
  width: max-content;
  max-width: calc(var(--S) * 0.42);
  padding: 10px 16px;
  border-radius: 18px 18px 18px 4px;
  background: #ffffff;
  color: #04101f;
  font-weight: 800;
  font-size: clamp(0.85rem, calc(var(--S) * 0.022), 1.1rem);
  line-height: 1.3;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(10px) scale(0.85);
  transform-origin: bottom left;
  transition: opacity 0.2s ease, transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ygc.hero-saying .ygc-say {
  opacity: 1;
  transform: none;
}

/* --- satellites de verre --- */
.ygc-sat {
  --x: 0;
  --y: 0;
  --i: 0;
  --D: calc(var(--S) * 0.22);
  position: absolute;
  z-index: 2;
  left: calc(50% + var(--x) * var(--S));
  top: calc(50% + var(--y) * var(--S));
  width: var(--D);
  height: var(--D);
  margin: calc(var(--D) / -2) 0 0 calc(var(--D) / -2);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--D) * 0.06);
  padding: calc(var(--D) * 0.1);
  text-align: center;
  text-decoration: none;
  color: #ffffff;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.16), transparent 34%),
    radial-gradient(circle at 50% 62%, rgba(30, 110, 190, 0.22), rgba(6, 20, 44, 0.62) 72%);
  border: 2px solid rgba(110, 230, 255, 0.75);
  box-shadow:
    0 0 18px rgba(40, 210, 234, 0.6),
    0 0 52px rgba(40, 150, 255, 0.28),
    inset 0 0 26px rgba(40, 210, 234, 0.38),
    inset 0 -14px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(3px);
  cursor: pointer;
  /* arrivée : depuis le centre, en cascade */
  opacity: 0;
  transform: translate(calc(var(--x) * var(--S) * -1), calc(var(--y) * var(--S) * -1)) scale(0.2);
  transition:
    transform 0.7s cubic-bezier(0.22, 1.35, 0.36, 1) calc(0.28s + var(--i) * 0.07s),
    opacity 0.35s ease calc(0.28s + var(--i) * 0.07s),
    box-shadow 0.25s ease,
    border-color 0.25s ease;
}
/* reflet de verre */
.ygc-sat::before {
  content: "";
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  border-top: 2px solid rgba(255, 255, 255, 0.4);
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  transform: rotate(-28deg);
  pointer-events: none;
}
.ygc.is-open .ygc-sat {
  opacity: 1;
  transform: none;
}
/* lévitation douce une fois arrivés */
.ygc.is-open .ygc-sat .ygc-ico,
.ygc.is-open .ygc-sat .ygc-label {
  animation: ygcFloat calc(3.4s + var(--i) * 0.35s) ease-in-out calc(1s + var(--i) * 0.2s) infinite;
}
@keyframes ygcFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
.ygc-ico {
  font-size: calc(var(--D) * 0.33);
  line-height: 1;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45));
}
.ygc-label {
  font-weight: 800;
  font-size: calc(var(--D) * 0.1);
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}
.ygc-sat:hover,
.ygc-sat:focus-visible {
  outline: none;
  border-color: #b9f6ff;
  box-shadow:
    0 0 26px rgba(40, 210, 234, 0.95),
    0 0 80px rgba(40, 150, 255, 0.45),
    inset 0 0 34px rgba(40, 210, 234, 0.55),
    inset 0 -14px 30px rgba(0, 0, 0, 0.3);
}
.ygc.is-open .ygc-sat:hover,
.ygc.is-open .ygc-sat:focus-visible {
  transform: scale(1.07);
  transition-delay: 0s;
}
.ygc-sat.is-current {
  border-style: dashed;
}
.ygc-sat.is-current .ygc-label::after {
  content: "vous êtes ici";
  display: block;
  margin-top: 4px;
  font-size: 0.7em;
  font-weight: 700;
  color: #8fe9f6;
}
/* départ : le satellite choisi grossit, les autres s'éloignent */
.ygc.is-leaving .ygc-sat:not(.is-chosen) {
  opacity: 0.25;
  transition-delay: 0s;
}
.ygc.is-leaving .ygc-sat.is-chosen {
  transform: scale(1.18);
  transition-delay: 0s;
  border-color: #ffffff;
}

/* --- fermeture --- */
.ygc.is-closing .ygc-sat {
  transition-delay: 0s;
  transition-duration: 0.3s;
}

/* --- mobile : scène un peu plus serrée --- */
@media (max-width: 640px) {
  .ygc { --S: min(98vw, 86vh); }
  .ygc-sat { --D: calc(var(--S) * 0.25); }
  .ygc-label { font-size: calc(var(--D) * 0.115); }
  .ygc-sound { top: 14px; right: 14px; padding: 8px 14px; font-size: 0.8rem; }
  .ygc-close { top: 14px; left: 14px; width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .ygc .ygc-hero,
  .ygc-sat { transition: opacity 0.2s ease; }
  .ygc .ygc-hero { transform: translate(-50%, -50%); }
  .ygc-sat { transform: none; }
  .ygc.is-open .ygc-hero img,
  .ygc.is-open .ygc-sat .ygc-ico,
  .ygc.is-open .ygc-sat .ygc-label { animation: none; }
}

/* --- visage 3D (remplace l'ancien visage dessiné) --- */
.ygm-photo {
  position: relative;
  overflow: hidden;
  border-radius: 50%;
  border: 3px solid #28d2ea;
  background: radial-gradient(circle at 50% 35%, #2a5687, #0d2240 75%);
  box-sizing: border-box;
}
.ygm-photo img {
  display: block;
  width: 108%;
  height: 108%;
  margin: 4% 0 0 -4%;
  object-fit: cover;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: 50% 80%;
}
.ygm.is-hover .ygm-photo img,
.ygm.is-open .ygm-photo img { transform: scale(1.06) translateY(-2px); }
.ygm.is-talking .ygm-photo img { animation: ygmNod 0.18s ease-in-out 3 alternate; }
@keyframes ygmNod { to { transform: scale(1.04) rotate(-3deg); } }

/* 5 planètes (Cowork 04/11) : toujours au-dessus de la mascotte, un peu plus compactes */
.ygc-sat { z-index: 4; --D: calc(var(--S) * 0.2); }

/* Lèvres synchronisées : images « bouche » superposées, même cadrage que l'image de base (Cowork 04/11) */
.ygc-hero { position: absolute; }
.ygc-hero .ygc-b { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.ygc-hero[data-bouche="e"] .ygc-b[data-b="e"],
.ygc-hero[data-bouche="a"] .ygc-b[data-b="a"],
.ygc-hero[data-bouche="o"] .ygc-b[data-b="o"],
.ygc-hero[data-bouche="cligne"] .ygc-b[data-b="cligne"] { opacity: 1; }
.ygc-hero .ygc-b { filter: none !important; }
