/* ===== Three.js Earth System Styles v4.0 ===== */

/* Three.js Container */
.three-earth-container {
  position: fixed;
  inset: 0;
  z-index: -5;
  pointer-events: auto;
  overflow: hidden;
  contain: strict;
  isolation: isolate;
  cursor: grab;
  transition: opacity 0.8s ease;
}

.three-earth-container.is-dragging {
  cursor: grabbing;
}

.three-earth-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  transform: translateZ(0); /* Hardware acceleration */
  will-change: transform;
}

/* Loading & Error States */
.three-earth-loading,
.three-earth-error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 300px;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  font-family: var(--font-inter);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 24px;
  border-radius: 12px;
  background: rgba(10, 20, 40, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  opacity: 1;
  transition: opacity 0.5s ease;
}

.three-earth-loading.hidden,
.three-earth-error.hidden {
  opacity: 0;
  pointer-events: none;
}

/* NEW: Loading progress bar */
.loading-progress-container {
  width: 100%;
  height: 8px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin: 16px 0;
}

.loading-progress-bar {
  width: 0%;
  height: 100%;
  background-color: #87ceeb;
  border-radius: 4px;
  transition: width 0.3s ease-out;
}

.loading-progress-text {
  font-size: 14px;
  font-weight: 500;
}

.three-earth-error {
  background: rgba(60, 20, 20, 0.9);
}

/* Section-based Opacity Transitions */
.three-earth-container[data-section="hero"] {
  opacity: 1;
}

.three-earth-container[data-section="features"] {
  opacity: 0.95;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .three-earth-container {
    transition: none;
  }
}

/* Performance Overlay */
.three-earth-performance-overlay {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.75);
  color: rgba(255, 255, 255, 0.85);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: "Courier New", monospace;
  font-size: 11px;
  line-height: 1.5;
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.three-earth-container:hover .three-earth-performance-overlay {
  opacity: 1;
}
