/* atmos.css: WS6 Atmosphere (blackout, torch, work lights, freefall snow). */

/* ---------- A1: lights out ---------- */
/* One luminance decrease: ink sinks to true black over .6 s. The rows, the bulb, the HUD and the ruler are
   faded by atmos.js with WAAPI, so their own transitions (owned by WS2/WS4) are never overwritten. */
body[data-lights="off"] {
  --ink: #000;
  transition: background-color .6s linear, color .6s linear;
}
body[data-lights="restore"] { transition: background-color .8s ease, color .8s ease; }
body[data-lights="off"] .grain { opacity: 0; transition: opacity .6s linear; }
body[data-lights="restore"] .grain { transition: opacity .8s ease; }

/* the prompt that hands the light to the viewer */
.adjust {
  position: fixed; left: 50%; top: 50%;
  z-index: 47;
  width: max-content; max-width: calc(100vw - 32px);
  margin: 0;
  transform: translate(-50%, -50%);
  color: var(--paper);
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .6s ease;
}
.adjust.on { opacity: .82; }
.adjust:empty { display: none; }

/* ---------- A2: the torch ---------- */
canvas.dark {
  position: fixed; left: 0; top: 0;
  z-index: 30;
  width: 100%; height: calc(100vh + 160px);
  pointer-events: none;
  opacity: 0; visibility: hidden;
  transition: opacity .6s linear, visibility 0s .6s;
}
canvas.dark.on { opacity: 1; visibility: visible; }

/* work lights, in the HUD (IV only, while the lights are off) */
.hud-controls .slot-lights:has(> .hud-lights[hidden]) { display: none; }
.hud-controls .slot-lights { position: relative; }
.hud-controls .hud-lights[hidden],
.hud-controls .hud-work[hidden] { display: none; }
/* the badge hangs under the button, out of flow, so nothing in the HUD moves when it appears */
.hud-work {
  position: absolute; right: 0; top: calc(100% + 9px);
  padding: 2px 5px 1px;
  background: var(--paper); color: #000;
  white-space: nowrap;
  pointer-events: none;
}

/* ---------- A2: freefall snow ---------- */
canvas.snow {
  position: fixed; left: 0; top: 0;
  z-index: 31;
  width: 100%; height: calc(100vh + 160px);
  pointer-events: none;
  visibility: hidden;
}
canvas.snow.on { visibility: visible; }

/* ---------- reduced motion: one 400 ms dim, no prompt, no torch, no snow ---------- */
@media (prefers-reduced-motion: reduce) {
  body[data-lights] { transition: background-color .4s linear, color .4s linear !important; }
  body[data-lights] .grain { transition: opacity .4s linear !important; }
  canvas.dark, canvas.snow, .adjust { display: none !important; }
}
