/* =====================================================
   Musée des idées (en plus de style.css)
   1. La page   2. Le décor   3. Les tableaux
   4. Aide et boutons   5. Grande vue d'un tableau
   6. Les secrets
   ===================================================== */

/* ---------- 1. La page : le couloir remplit l'écran ---------- */
body.musee {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.couloir {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  touch-action: none;          /* les doigts font avancer au lieu de zoomer */
  user-select: none;
  border-top: 4px solid var(--brun);
}

.couloir h1 {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: min-content;
  text-align: center;
  font: 400 clamp(1rem, 2.4vw, 1.8rem)/1.05 var(--police-titre);
  pointer-events: none;
  z-index: 1;
}

.couloir h1 button {
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: default;           /* rien n'indique que c'est un secret */
  pointer-events: auto;
}


/* ---------- 2. Le décor (dessiné par musee.js) ---------- */
#decor {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#decor .plafond { fill: #fdf6e9; }
#decor .mur     { fill: #ead9bd; }
#decor .sol     { fill: #b98d63; }
#decor .dalle   { fill: #a87c54; }
#decor .lampe   { fill: var(--jaune); opacity: .55; }
#decor .fond    { fill: var(--creme); stroke: var(--brun); stroke-width: 3; }
#decor .joint   { stroke: #3e342855; stroke-width: 2; }
#decor .plinthe { stroke: #3e342866; stroke-width: 3; }
#decor .arete   { stroke: var(--brun); stroke-width: 4; }


/* ---------- 3. Les tableaux ---------- */
/* La boîte qui contient les tableaux donne la perspective.
   Elle laisse passer les clics ; seuls les tableaux les reçoivent. */
#accroches {
  position: absolute;
  inset: 0;
  perspective-origin: 50% 50%;
  pointer-events: none;
}

#accroches > * {
  pointer-events: auto;
}

.tableau {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: var(--l);
  background: none;
  border: 0;
  color: var(--brun);
  cursor: pointer;
  will-change: transform;
}

.toile {
  position: relative;
  display: block;
  width: 100%;
  height: var(--h);
  padding: 8px;
  background: var(--blanc);
  border: 14px solid var(--cadre);
  box-shadow: 0 10px 0 var(--ombre);
}

.toile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cartel {
  max-width: 100%;
  padding: 2px 18px;
  background: var(--brun);
  color: var(--creme);
  border-radius: 8px;
  font: calc(var(--h) * .11)/1.35 var(--police-titre);
}

.tableau:hover .toile,
.tableau:focus-visible .toile {
  border-color: var(--brun);
}

/* Idées abandonnées : accrochées de travers et un peu passées */
.abandonne .toile { rotate: -4deg; }
.abandonne img    { filter: grayscale(.85); opacity: .85; }

/* Presque abandonnées : à peine de travers, avec un tampon en bas */
.presque .toile { rotate: 2deg; }
.presque img    { filter: grayscale(.4); }

.tampon {
  position: absolute;
  left: 50%;
  top: 84%;
  translate: -50% -50%;
  rotate: -7deg;
  padding: 0 14px;
  background: var(--blanc);
  color: #a52f1c;
  border: 5px solid #a52f1c;
  border-radius: 10px;
  font: calc(var(--h) * .1)/1.4 var(--police-titre);
  white-space: nowrap;
}


.presque .tampon {
  rotate: -4deg;
  color: #8a5200;
  border-color: #8a5200;
  font-size: calc(var(--h) * .085);
}


/* ---------- 4. Aide et boutons ---------- */
.aide {
  position: absolute;
  left: 50%;
  top: 12px;
  translate: -50% 0;
  width: max-content;
  max-width: 92%;
  padding: .3rem 1rem;
  text-align: center;
  background: var(--brun);
  color: var(--creme);
  border-radius: 20px;
  font-size: 1.1rem;
  pointer-events: none;
  z-index: 200000;
  transition: opacity .6s;
}

.parti .aide { opacity: 0; }

.marche {
  position: absolute;
  left: 50%;
  bottom: 12px;
  translate: -50% 0;
  display: flex;
  gap: .6rem;
  z-index: 200000;
}

.marche button {
  padding: .3rem 1.1rem;
  background: var(--blanc);
  color: var(--brun);
  border: 3px solid var(--brun);
  border-radius: 99px;
  font: 1.15rem var(--police-texte);
  white-space: nowrap;
  cursor: pointer;
}

.marche button:active { translate: 0 3px; }


/* ---------- 5. Grande vue d'un tableau (même fenêtre que la page Moi) ---------- */
#vue-bandeau {
  padding-block: 1.25rem;
  background: var(--cadre);
}

#vue-bandeau h2 {
  width: fit-content;
  margin-inline: auto;
  padding: 0 1rem;
  background: var(--brun);
  color: var(--creme);
  border-radius: 10px;
}

#vue-image {
  display: block;
  width: 100%;
  max-height: 30vh;
  object-fit: contain;
}


/* ---------- 6. Les secrets ---------- */
#compteur {
  position: absolute;
  right: 12px;
  bottom: 64px;
  padding: .15rem .9rem;
  background: var(--jaune);
  color: var(--brun);
  border: 3px solid var(--brun);
  border-radius: 99px;
  font: 1.1rem var(--police-texte);
  cursor: pointer;
  z-index: 200000;
}

/* Tableau doré, avec un reflet qui passe */
.dore .toile {
  border-color: #d99a12;
  outline: 6px solid #ffd966;
  box-shadow: 0 0 45px 14px #ffd966;
}

.dore .toile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, #fff0 40%, #fffc 50%, #fff0 60%) 150% 0 / 250% 100%;
  animation: reflet 2.4s linear infinite;
}

@keyframes reflet {
  to { background-position-x: -50%; }
}

/* La porte de la réserve */
.issue {
  gap: 0;
  width: calc(var(--l) * .62);
  padding: 0;
}

.battant {
  position: relative;
  display: block;
  width: 100%;
  height: calc(var(--h) * 1.55);
  background: #6d4a2c;
  border: 10px solid var(--brun);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  box-shadow: inset 0 0 0 10px #5a3c22;
}

.plaque {
  position: absolute;
  left: 50%;
  top: 18%;
  translate: -50% 0;
  padding: 0 12px;
  background: var(--jaune);
  color: var(--brun);
  border: 3px solid var(--brun);
  border-radius: 6px;
  font: calc(var(--h) * .09)/1.4 var(--police-titre);
  white-space: nowrap;
}

.poignee {
  position: absolute;
  right: 16%;
  top: 55%;
  width: 11%;
  aspect-ratio: 1;
  background: var(--jaune);
  border: 4px solid var(--brun);
  border-radius: 50%;
}

.issue.secoue .battant { animation: secouer .35s; }

@keyframes secouer {
  25% { translate: -9px 0; }
  75% { translate: 9px 0; }
}

/* Mode lampe torche : tout est noir sauf un rond */
.couloir.noir::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--x) var(--y), #0000 0 90px, #0e0a06f5 210px);
  pointer-events: none;
  z-index: 150000;
}

@media (max-width: 600px) {
  #compteur { bottom: 68px; font-size: 1rem; }
}

/* Les petits messages passent au-dessus des boutons et du noir */
body.musee #toast {
  bottom: 7.5rem;
  z-index: 300000;
}
