/*
 * Animated homepage background for the palm scenes (the mountains keep their rules in main.css).
 * site-theme.js sets data-site-theme on <html> before the first paint, so only the chosen scene's
 * image is requested.
 *
 * Each tile is 1848x770 with a blended seam so it loops without a visible join. It is shown at 0.8x
 * the width of the original mountain strip at every breakpoint, which keeps the strip height and the
 * pan speed (width / 48s equals the mountain's width / 60s) the same.
 */
:root {
  --home-tile: 1800px;
}

html[data-site-theme="bayshore"] #bg,
html[data-site-theme="sunset"] #bg {
  animation: home-palms 48s linear infinite;
  background-size: var(--home-tile) auto;
  width: calc(100% + var(--home-tile));
}

html[data-site-theme="bayshore"] #bg {
  background-color: #348cb2;
  background-image: url("images/bg-tampa.jpg");
  background-image: image-set(url("images/bg-tampa.avif") type("image/avif"),
    url("images/bg-tampa.jpg") type("image/jpeg"));
}

html[data-site-theme="sunset"] #bg {
  background-color: #2a2350;
  background-image: url("images/bg-tampa-sunset.jpg");
  background-image: image-set(url("images/bg-tampa-sunset.avif") type("image/avif"),
    url("images/bg-tampa-sunset.jpg") type("image/jpeg"));
}

/* One tile of travel per cycle; the repeating background makes the loop seamless. */
@keyframes home-palms {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(calc(-1 * var(--home-tile)), 0, 0);
  }
}

@media screen and (max-width: 1680px) {
  :root {
    --home-tile: 1200px;
  }
}

@media screen and (max-width: 1280px) {
  :root {
    --home-tile: 600px;
  }
}

@media screen and (max-width: 736px) {
  :root {
    --home-tile: 240px;
  }
}

@media screen and (max-width: 480px) {
  :root {
    --home-tile: 330px;
  }
}
