/*
 * Fonds peints des salles (armurerie, ateliers, salle de garde) : tools/skins/fonds_salles.py, skins/base/salles/ ; la forge reprend
 * celle du forgeron. Le fond se voit en haut de la scène (.ws-scene[data-fond], posé par shared/salle-fond.js), les
 * panneaux se posent devant ; une couche (.ws-lueurs) porte les lueurs animées, sous le contenu.
 * .ws-mur : l'espace de mur nu entre l'en-tête et les panneaux, pour que le haut du décor se voie.
 *   Hauteur = 30 % de la largeur, moins --mur-off (ce qu'occupe déjà l'en-tête de la page).
 * Couleurs du décor hors thèmes (docs/THEMES.md § 3). Pas de style en ligne (CSP) : positions par le CSSOM.
 */
:root:root:root:root .ws-scene[data-fond] {
  background: url("/skins/base/salles/armes.png") 50% 0 / 100% auto no-repeat, linear-gradient(180deg, #1d1915, var(--ws-bois));
  image-rendering: pixelated; overflow: clip;   /* clip : ne crée pas de défilement, le glisser (position fixe) reste libre */
  &[data-fond="forge"] { background-image: url("/skins/base/forge/fond.png"), linear-gradient(180deg, #1d1915, var(--ws-bois)); }
  &[data-fond="gravure"] { background-image: url("/skins/base/salles/gravure.png"), linear-gradient(180deg, #1d1915, var(--ws-bois)); }
  &[data-fond="joaillerie"] { background-image: url("/skins/base/salles/joaillerie.png"), linear-gradient(180deg, #1d1915, var(--ws-bois)); }
  &[data-fond="metiers"] { background-image: url("/skins/base/salles/metiers.png"), linear-gradient(180deg, #1d1915, var(--ws-bois)); }
  &[data-fond="garde"] { background-image: url("/skins/base/salles/garde.png"), linear-gradient(180deg, #1d1915, var(--ws-bois)); }

  > :not(.ws-lueurs, .av-fantome-glisse) { position: relative; z-index: 1; }
  .ws-mur { aspect-ratio: 16 / 4.8; margin-top: calc(-1 * var(--mur-off, 200px)); pointer-events: none; z-index: 0; }

  .ws-lueurs { position: absolute; z-index: 0; top: 0; left: 0; right: 0; aspect-ratio: 16 / 9; overflow: hidden; pointer-events: none; }
  /* le bas du fond se fond dans le bois de la scène */
  .ws-lueurs::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 32%; background: linear-gradient(180deg, transparent, #1d1915); }
  .ws-lueur { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; mix-blend-mode: screen; }
  .ws-feu { width: 26%; aspect-ratio: 1; background: radial-gradient(closest-side, rgba(255, 140, 50, .34), transparent); animation: ws-feu 2.4s steps(7) infinite alternate; }
  .ws-foyer { width: 46%; aspect-ratio: 1.3; background: radial-gradient(closest-side, rgba(255, 120, 40, .30), transparent); animation: ws-feu 1.8s steps(6) infinite alternate; }
  .ws-rune { width: 36%; aspect-ratio: 1.6; border-radius: 40%; background: radial-gradient(closest-side, rgba(80, 180, 255, .26), transparent); animation: ws-souffle 4.5s ease-in-out infinite; }
  .ws-lune { width: 24%; aspect-ratio: .8; background: radial-gradient(closest-side, rgba(150, 180, 240, .16), transparent); animation: ws-souffle 7s ease-in-out infinite; }
  .ws-eclat { position: absolute; width: 6px; height: 6px; transform: translate(-50%, -50%) rotate(45deg); background: #fff; opacity: 0;
    box-shadow: 0 0 6px 2px rgba(255, 255, 255, .7); animation: ws-eclat 3.6s ease-in-out infinite; }
  .ws-braise { position: absolute; width: 4px; height: 4px; background: #fcd678; opacity: 0; animation: ws-monte 3.2s linear infinite; }
}
@keyframes ws-feu { 0% { opacity: .55; } 30% { opacity: .95; } 55% { opacity: .7; } 80% { opacity: 1; } 100% { opacity: .8; } }
@keyframes ws-souffle { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@keyframes ws-eclat { 0%, 70%, 100% { opacity: 0; transform: translate(-50%, -50%) rotate(45deg) scale(.4); } 80% { opacity: .95; transform: translate(-50%, -50%) rotate(45deg) scale(1); } }
@keyframes ws-monte { 0% { transform: translate(0, 0); opacity: 0; } 10% { opacity: 1; } 100% { transform: translate(-10px, -90px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  :root:root:root:root .ws-scene[data-fond] :is(.ws-lueur, .ws-eclat, .ws-braise) { animation: none; }
  :root:root:root:root .ws-scene[data-fond] :is(.ws-eclat, .ws-braise) { display: none; }
}
/* Petit écran : le fond garde 360 px de haut (recadré au milieu), une bande de mur nu le montre sous l'en-tête. */
@media (max-width: 760px) {
  :root:root:root:root .ws-scene[data-fond] {
    background-size: auto 360px, auto; background-position: 50% 120px, 0 0;   /* l'en-tête couvre le haut : on y descend le décor */
    .ws-mur { aspect-ratio: auto; height: 130px; margin-top: 0; }
    .ws-lueurs { top: 120px; left: 50%; right: auto; width: 640px; margin-left: -320px; }
  }
}
/* Ce qu'occupe déjà l'en-tête de chaque page (enseigne, rangée des mercenaires ou onglets) : le mur nu complète. */
:root:root:root:root body[data-page="inventaire"] .ws-scene { --mur-off: 290px; }
:root:root:root:root body[data-page="ateliers"] .ws-scene { --mur-off: 250px; }
