/** How long the door tutorial text stays fully lit before it starts to fade. */
export const TUTORIAL_MS = 26_000;
/** Length of the fade once the hold expires. */
export const TUTORIAL_FADE_MS = 800;

/**
 * Tutorial text alpha at `elapsedMs` into the night. Pure update()-driven math,
 * deliberately NOT a tween: the old `if (alpha > 0) tweens.add(...)` guard
 * spawned a fresh 800ms tween every frame (each new tween re-captured the
 * current alpha and kept it above zero, so the guard never closed — ~1,100 live
 * tweens by night's end), and tweens stall under the preview pane's stepped
 * clock anyway.
 */
export function tutorialAlpha(elapsedMs: number): number {
  if (elapsedMs <= TUTORIAL_MS) return 1;
  return Math.max(0, 1 - (elapsedMs - TUTORIAL_MS) / TUTORIAL_FADE_MS);
}
