/* =====================================================================
   V6 — icônes animées, mots qui se lèvent, détails découverts, indices.
   Se charge après v5.css. Transform et opacité seulement.
   ===================================================================== */

/* icônes de boutons */
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.ico * { transform-box: fill-box; transform-origin: center; transition: transform 380ms var(--ease-out), opacity 260ms var(--ease-out); }
.has-ico { gap: 8px; position: relative; overflow: hidden; }
.ico-holder { display: inline-flex; }
.top-actions .has-ico { padding-left: 14px; }
.st-skip.has-ico { gap: 6px; }
#tools .has-ico { padding-left: 15px; }

/* au survol ou au focus : chaque icône joue sa petite scène */
@media (hover: hover) and (pointer: fine) {
  .has-ico:hover .ico-gallery rect { animation: tile 560ms var(--ease-out) both; }
  .has-ico:hover .ico-gallery .b { animation-delay: 70ms; } .has-ico:hover .ico-gallery .c { animation-delay: 140ms; } .has-ico:hover .ico-gallery .d { animation-delay: 210ms; }
  .has-ico:hover .ico-spaces .pin { animation: hop 620ms var(--ease-out); }
  .has-ico:hover .ico-spaces .sh { transform: scaleX(.6); }
  .has-ico:hover .ico-restart .spin { transform: rotate(-360deg); transition-duration: 700ms; }
  .has-ico:hover .ico-fs .c1 { transform: translate(-2.5px, -2.5px); } .has-ico:hover .ico-fs .c2 { transform: translate(2.5px, -2.5px); }
  .has-ico:hover .ico-fs .c3 { transform: translate(-2.5px, 2.5px); } .has-ico:hover .ico-fs .c4 { transform: translate(2.5px, 2.5px); }
  .has-ico:hover .ico-tools .k1 { transform: translateX(7px); } .has-ico:hover .ico-tools .k2 { transform: translateX(-7px); }
  .has-ico:hover .ico-compare .dv { animation: slide 900ms var(--ease-out); }
  .has-ico:hover .ico-shoebox .bx { transform: rotate(-14deg) scale(1.1); }
  #btn-light:not([aria-pressed="true"]):hover .sun { transform: rotate(60deg) scale(1.08); }
  .has-ico:hover .ico-skip .c1 { animation: nudgeR 700ms var(--ease-out); } .has-ico:hover .ico-skip .c2 { animation: nudgeR 700ms 90ms var(--ease-out); }
  .ic:hover svg { transform: scale(1.1) rotate(-6deg); }
  #btn-sfx:hover .sfx-w { animation: wave 700ms var(--ease-out); }
}
.has-ico:focus-visible .ico-spaces .pin { animation: hop 620ms var(--ease-out); }
.has-ico:active .ico { transform: scale(.9); }
@keyframes tile { 0% { transform: scale(1); } 40% { transform: scale(.62); } 100% { transform: scale(1); } }
@keyframes hop { 0% { transform: translateY(0); } 35% { transform: translateY(-4px); } 60% { transform: translateY(0); } 78% { transform: translateY(-1.5px); } 100% { transform: translateY(0); } }
@keyframes slide { 0% { transform: translateX(0); } 30% { transform: translateX(-4px); } 70% { transform: translateX(4px); } 100% { transform: translateX(0); } }
@keyframes nudgeR { 0% { transform: translateX(0); } 40% { transform: translateX(3px); } 100% { transform: translateX(0); } }
@keyframes wave { 0% { opacity: 1; } 35% { opacity: .15; } 100% { opacity: 1; } }

/* ambiance : le soleil se change en lune */
#btn-light .moon { opacity: 0; transform: rotate(-70deg) scale(.6); }
#btn-light[aria-pressed="true"] .sun { opacity: 0; transform: rotate(90deg) scale(.4); }
#btn-light[aria-pressed="true"] .moon { opacity: 1; transform: none; }
#btn-light .ico-light { position: relative; }

/* l'icône d'espaces respire de temps en temps : on sait qu'on peut cliquer */
#btn-spaces .ico-spaces .pin { animation: hop 700ms var(--ease-out) 3.2s 1 both; }
.sb-fab .fab-ico { position: absolute; right: -2px; top: 62px; width: 28px; height: 28px; border-radius: 50%; background: #fff; color: var(--red); display: grid; place-items: center; }
.sb-fab .fab-ico .ico { width: 16px; height: 16px; stroke-width: 2; }
.sb-fab .sb-fab-img { animation: bob 4.2s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.sb-fab:hover .sb-fab-img { animation: none; }
.sb-fab .lens { animation: lens 3.2s ease-in-out infinite; }
@keyframes lens { 0%, 100% { transform: scale(1); } 50% { transform: scale(.7); } }

/* onde au toucher */
.rp { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .28); transform: scale(0); opacity: 1; pointer-events: none; animation: rp 620ms var(--ease-out) both; }
@keyframes rp { to { transform: scale(1); opacity: 0; } }

/* titre de l'histoire : chaque mot se lève */
#story .st-title { animation: none !important; }
.st-title .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.st-title .wi { display: inline-block; }
#story[data-swap="in"] .st-title .wi { animation: wordUp 760ms var(--ease-out) both; animation-delay: calc(var(--i) * 70ms); }
#story[data-swap="out"] .st-title .wi { transform: translateY(100%); transition: transform 140ms var(--ease-out); }
@keyframes wordUp { from { transform: translateY(105%); } to { transform: none; } }
#story[data-swap="in"] .st-line { animation-delay: 260ms; }

/* points d'intérêt : entrée en cascade, détail « info » avec un plus qui tourne */
.hs.on .hs-dot { animation: hsIn 560ms var(--ease-out) backwards; animation-delay: var(--d, 0ms); }
@keyframes hsIn { from { transform: scale(.3); opacity: 0; } to { transform: none; opacity: 1; } }
.hs.on .hs-label { transition-delay: 0ms; }
.hs-info .hs-dot::after { content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; background: #fff; clip-path: polygon(38% 0, 62% 0, 62% 38%, 100% 38%, 100% 62%, 62% 62%, 62% 100%, 38% 100%, 38% 62%, 0 62%, 0 38%, 38% 38%); transition: transform 320ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .hs-info:hover .hs-dot::after { transform: rotate(90deg); } }
.hs-info.seen .hs-dot { background: #fff; border-color: rgba(198, 37, 37, .9); }
.hs-info.seen .hs-dot::after { background: var(--red); transform: rotate(45deg); }
.hs-info.seen .hs-dot::before { display: none; }
.hs-swap .hs-dot::after { animation: swapSpin 4s ease-in-out infinite; }
@keyframes swapSpin { 0%, 70% { transform: rotate(45deg); } 100% { transform: rotate(405deg); } }

/* décompte des détails découverts */
.bc-disc { margin-top: 12px; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-soft); }
.bc-disc[hidden] { display: none; }
.bc-disc-n { display: inline-block; min-width: 44px; padding: 3px 10px; border-radius: 999px; background: rgba(41, 52, 61, .85); color: #fff; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.bc-disc.is-done .bc-disc-n { background: var(--red); }
.bc-disc.bump .bc-disc-n { animation: bump 520ms var(--ease-out); }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.28); } 100% { transform: scale(1); } }

/* pièces déjà visitées */
#rooms .pill-room.seen::after { background: rgba(255, 255, 255, .42); transform: scale(.62); }

/* étiquette de pièce quand on change de scène */
.roomtag { position: fixed; z-index: 35; left: 50%; top: 22%; display: none; align-items: baseline; gap: 12px; padding: 12px 22px; border-radius: 999px; background: rgba(41, 52, 61, .92); color: #fff; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); }
.roomtag.on { display: inline-flex; animation: tagIn 2400ms var(--ease-out) both; }
.rt-b { font-size: 14px; color: var(--ink-soft); } .rt-r { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
@keyframes tagIn { 0% { opacity: 0; transform: translate(-50%, 14px); } 14% { opacity: 1; transform: translate(-50%, 0); } 78% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -6px); } }
body.is-story .roomtag, body.is-stills .roomtag { display: none !important; }

/* indice : glisser pour regarder */
.dragHint { position: fixed; z-index: 34; left: 50%; top: 96px; display: none; flex-direction: column; align-items: center; gap: 10px; color: #fff; pointer-events: none; transform: translateX(-50%); }
.dragHint.on { display: flex; animation: fadeHint 6500ms var(--ease-out) both; }
.dh-track { position: relative; width: 150px; height: 44px; border-radius: 999px; background: rgba(41, 52, 61, .86); display: grid; place-items: center; }
.dh-track svg { width: 110px; height: 22px; fill: none; stroke: rgba(255, 255, 255, .55); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transform: scaleX(1.6); }
.dh-dot { position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #fff; animation: drag 1800ms var(--ease-out) infinite; }
.dh-t { padding: 6px 14px; border-radius: 999px; background: rgba(41, 52, 61, .86); font-size: 14px; font-weight: 500; }
@keyframes drag { 0% { transform: translateX(-42px); } 50% { transform: translateX(42px); } 100% { transform: translateX(-42px); } }
@keyframes fadeHint { 0% { opacity: 0; } 8%, 88% { opacity: 1; } 100% { opacity: 0; } }

/* galerie : les images se dévoilent en défilant (le clip est sur l'image, l'observateur regarde la tuile) */
.gl-scroll.reveal .gl-item { animation: none !important; }
.gl-scroll.reveal .gl-item img { clip-path: inset(0 0 100% 0); transform: scale(1.12); transition: clip-path 780ms var(--ease-out), transform 1100ms var(--ease-out); transition-delay: var(--r, 0ms); }
.gl-scroll.reveal .gl-item.vis img { clip-path: inset(0); transform: none; }
@media (hover: hover) and (pointer: fine) { .gl-scroll.reveal .gl-item.vis:hover img { transform: scale(1.035); transition-delay: 0ms; transition-duration: 500ms; } }

@media (max-width: 900px) {
  .top-actions .has-ico .ico { display: none; }
  .top-actions .has-ico { padding-left: 11px; }
  .dragHint { top: 72px; }
  .roomtag { top: 18%; }
  .sb-fab .fab-ico { top: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  .ico *, .rp, .roomtag.on, .dragHint.on, .dh-dot, .sb-fab .sb-fab-img, .sb-fab .lens, .hs.on .hs-dot, .hs-swap .hs-dot::after, #btn-spaces .ico-spaces .pin { animation: none !important; }
  #story[data-swap="in"] .st-title .wi { animation: none !important; }
  .gl-scroll.reveal .gl-item img { clip-path: none; transform: none; transition: none; }
}

#v3-tools-toggle { right: calc(var(--m) + 770px); }
body.v3-free #tools { right: calc(var(--m) + 870px); }
.lbl { display: inline; }
@media (max-width: 900px) { #v3-tools-toggle { right: var(--m); } }
.st-skip.has-ico { position: absolute; overflow: visible; }
.sb-fab.has-ico, .ic.has-ico { overflow: visible; }
