<!-- Preloader HTML - Add this right after the opening <body> tag in theme.liquid -->
<div id="preloader">
  <div class="spinner">
    <div class="bounce1"></div>
    <div class="bounce2"></div>
    <div class="bounce3"></div>
  </div>
</div>

<!-- Preloader CSS - Add this in the <head> section of theme.liquid -->
<style>
  #preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-in-out;
  }
  
  .spinner {
    width: 70px;
    text-align: center;
  }
  
  .spinner > div {
    width: 18px;
    height: 18px;
    background-color: #333;
    border-radius: 100%;
    display: inline-block;
    animation: sk-bouncedelay 1.4s infinite ease-in-out both;
    margin: 0 3px;
  }
  
  .spinner .bounce1 {
    animation-delay: -0.32s;
  }
  
  .spinner .bounce2 {
    animation-delay: -0.16s;
  }
  
  @keyframes sk-bouncedelay {
    0%, 80%, 100% { 
      transform: scale(0);
    } 40% { 
      transform: scale(1.0);
    }
  }
  
  .preloader-hidden {
    opacity: 0;
    pointer-events: none;
  }
</style>

<!-- Preloader JavaScript - Add this before the closing </body> tag -->
<script>
  document.addEventListener("DOMContentLoaded", function() {
    // Wait for everything to load
    window.addEventListener("load", function() {
      // When page is fully loaded, add class to fade out preloader
      const preloader = document.getElementById("preloader");
      preloader.classList.add("preloader-hidden");
      
      // After animation is complete, remove the preloader completely
      setTimeout(function() {
        preloader.style.display = "none";
      }, 500);
    });
  });
</script>