/*
 * Region map loading placeholder (#4822), loaded after map.css by cruises_from/region.php. The
 * container keeps its 700px from the first paint, filled with the map's water color and a slow
 * shimmer, and fades to the map once its tiles load. map.css's phone rule (display: none !important
 * at 720px and narrower) still hides the map on phones.
 */
#map_container.map-container-reserved {
  display: block;
}

.map-water-destination {
  --map-water: #60aefa;
}

.map-water-departure {
  --map-water: #2f71b1;
}

.map-container-reserved #region_map {
  background-color: var(--map-water);
}

.map-loading {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: var(--map-water);
  pointer-events: none;
  transition: opacity 0.2s ease-out, visibility 0s linear 0.2s;
}

.map-loading::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgb(255 255 255 / 16%) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: map-loading-shimmer 1.8s ease-in-out infinite;
}

.map-loading-label {
  position: relative;
  padding: 8px 16px;
  border-radius: 999px;
  background-color: rgb(3 51 98 / 55%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;

  /* Shown only if loading takes longer than 300ms, so a fast load doesn't flash it. */
  opacity: 0;
  animation: map-loading-label-in 0.2s ease-out 0.3s forwards;
}

.map-loaded .map-loading {
  opacity: 0;
  visibility: hidden;
}

.map-failed .map-loading::before,
.map-failed .map-loading-label {
  display: none;
}

.map-loading-error {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 12px 20px;
  border-radius: 8px;
  background-color: rgb(3 51 98 / 85%);
  color: #fff;
  font-size: 15px;
  text-align: center;
  transform: translate(-50%, -50%);
}

.map-loading-error a {
  color: #fff;
  text-decoration: underline;
}

.map-loading-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@keyframes map-loading-shimmer {
  to {
    transform: translateX(100%);
  }
}

@keyframes map-loading-label-in {
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .map-loading,
  .map-loading::before {
    animation: none;
    transition: none;
  }

  .map-loading::before {
    display: none;
  }

  /* The label still waits 300ms, then appears at once instead of fading in. */
  .map-loading-label {
    animation-duration: 0s;
  }
}
