/* Cloud Cream Island as the homepage hero backdrop (see macaron-town/island.js). */

.island {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  /* The sky the scene opens on, so there is no flash before the poster decodes. */
  background: #cfe3f5;
}

.island__stage {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.island__stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
  /* Opaque backdrop until the first frame paints (transparent WebGL reads as black behind the nav). */
  background: #cfe3f5;
}

.island__stage canvas:active {
  cursor: grabbing;
}

/* Held until the town has finished assembling, then crossfaded out from under it. */
.island__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 2;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

.island.is-live .island__poster {
  opacity: 0;
}

/* Shown over the still until the town is ready to fly in. */
.island__loader {
  position: absolute;
  left: 50%;
  top: 42%;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 22px 16px;
  pointer-events: none;
  border-radius: 22px;
  background: rgba(255, 252, 248, 0.92);
  box-shadow:
    0 10px 30px rgba(86, 62, 112, 0.16),
    0 0 0 1px rgba(255, 255, 255, 0.8);
  transform: translate(-50%, -50%);
  transition: opacity 0.45s ease;
}

.island.is-live .island__loader,
.island.is-poster .island__loader {
  opacity: 0;
}

.island__loader-macaron {
  width: 58px;
  height: auto;
  animation: island-loader-bob 1.3s ease-in-out infinite;
}

.island__loader-track {
  width: 132px;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 0 1px rgba(43, 33, 64, 0.08);
}

.island__loader-bar {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #3eae16;
  transform: scaleX(0);
  transform-origin: left center;
}

.island__loader-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(43, 33, 64, 0.82);
  text-shadow:
    0 0 0.4em #fff,
    0 1px 0 #fff;
}

@keyframes island-loader-bob {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

/* The town is tall and the hero is wide: on a phone the poster crops to the island itself. */
@media (max-width: 720px) {
  .island__poster {
    object-position: 50% 42%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .island__poster,
  .island__loader {
    transition: none;
  }

  .island__loader-macaron {
    animation: none;
  }
}
