// Splash — single linear sequence: in → breathe → zoom-out → done. No loops.
// Plays when the website is opened/loaded fresh, but not when navigating between
// pages within the same session (sessionStorage clears when all tabs are closed).

const Splash = () => {
  const [show, setShow] = React.useState(() => {
    return sessionStorage.getItem("aa-splash-played") !== "1";
  });

  React.useEffect(() => {
    if (!show) return;
    const t = setTimeout(() => {
      sessionStorage.setItem("aa-splash-played", "1");
      setShow(false);
    }, 3600);
    return () => clearTimeout(t);
  }, [show]);

  if (!show) return null;

  return (
    <div className="splash" aria-hidden="true">
      <img src="assets/logo-mark.png" alt="" className="splash-logo"/>
    </div>
  );
};

window.Splash = Splash;
