/* =============================================
   Oakland Habla — Clay Figurine Visualization
   Base reset & layout
   ============================================= */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #1a0a00;
  overflow: hidden;
  font-family: 'Nunito', system-ui, sans-serif;
}

/* Three.js canvas fills the viewport */
#canvas {
  position: fixed;
  top: 0;
  left: 0;
  display: block;
}

/* =============================================
   CSS2D label styles (injected via Three.js)
   ============================================= */

.data-label {
  background: rgba(26, 10, 0, 0.82);
  border: 2px solid #c0541a;
  border-radius: 8px;
  padding: 6px 12px;
  color: #fff;
  text-align: center;
  pointer-events: none;
  /* CSS2DRenderer positions the element; we shift left by half width */
  transform: translateX(-50%);
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
  min-width: 110px;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}

.data-label .lang-name {
  font-family: 'Pacifico', cursive;
  font-size: 13px;
  color: #ffcc88;
  display: block;
  margin-bottom: 3px;
}

.data-label .pop-number {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  display: block;
}

.data-label .pop-percent {
  font-size: 11px;
  color: #bbaaaa;
  display: block;
}

.data-label .pop-detail {
  display: none;
  font-size: 10px;
  color: #ffcc88;
  margin-top: 5px;
  border-top: 1px solid rgba(192, 84, 26, 0.5);
  padding-top: 4px;
}

/* Hovered state — triggered via raycaster in JS */
.data-label.hovered {
  background: rgba(50, 18, 0, 0.95);
  border-color: #ffd700;
  transform: translateX(-50%) scale(1.1);
}

.data-label.hovered .pop-detail {
  display: block;
}

/* Chinese language variant */
.data-label.chinese {
  border-color: #2e8b57;
}

.data-label.chinese.hovered {
  border-color: #e6b800;
}

.data-label.chinese .lang-name {
  color: #a8e6c0;
}

/* =============================================
   UI Overlay panels
   ============================================= */

/* Title card — top centre */
.title-card {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  background: rgba(26, 10, 0, 0.85);
  border: 2px solid #c0541a;
  border-radius: 14px;
  padding: 10px 28px;
  backdrop-filter: blur(6px);
  pointer-events: none;
  z-index: 100;
}

.title-card h1 {
  font-family: 'Pacifico', cursive;
  font-size: 30px;
  color: #e8884a;
  line-height: 1;
}

.title-card p {
  font-size: 12px;
  color: #ffcc88;
  margin-top: 3px;
  letter-spacing: 0.03em;
}

/* Legend — bottom left */
.legend {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: rgba(26, 10, 0, 0.85);
  border: 1px solid #c0541a;
  border-radius: 10px;
  padding: 12px 18px;
  pointer-events: none;
  backdrop-filter: blur(6px);
  z-index: 100;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: #fff;
  font-size: 13px;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
}

.legend-source {
  font-size: 10px;
  color: #887766;
  margin-top: 8px;
  line-height: 1.5;
}

/* "More languages" notice — bottom right */
.tip-more-languages {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(26, 10, 0, 0.85);
  border: 1px dashed #c0541a;
  border-radius: 10px;
  padding: 10px 18px;
  color: #ffcc88;
  font-size: 12px;
  pointer-events: none;
  backdrop-filter: blur(6px);
  z-index: 100;
}

/* Interaction hint — top right */
.instructions {
  position: fixed;
  top: 20px;
  right: 20px;
  color: rgba(255, 204, 136, 0.55);
  font-size: 11px;
  pointer-events: none;
  z-index: 100;
  letter-spacing: 0.02em;
}

/* =============================================
   Floating SudoRoom Logo Card
   ============================================= */

.floating-card {
  position: fixed;
  width: 80px;
  height: 80px;
  background: rgba(26, 10, 0, 0.92);
  border: 2px solid #e8884a;
  border-radius: 16px;
  padding: 8px;
  z-index: 150;
  cursor: pointer;
  text-decoration: none;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  transition: border-color 0.3s ease, transform 0.2s ease;
  animation: float-around 20s ease-in-out infinite;
  animation-delay: 0s;
}

.floating-card:hover {
  border-color: #ffd700;
  transform: scale(1.1);
}

.floating-card-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

@keyframes float-around {
  0% {
    top: 15%;
    left: 5%;
  }
  10% {
    top: 25%;
    left: 15%;
  }
  20% {
    top: 45%;
    left: 8%;
  }
  30% {
    top: 60%;
    left: 20%;
  }
  40% {
    top: 70%;
    left: 10%;
  }
  50% {
    top: 65%;
    left: 75%;
  }
  60% {
    top: 40%;
    left: 80%;
  }
  70% {
    top: 20%;
    left: 70%;
  }
  80% {
    top: 10%;
    left: 50%;
  }
  90% {
    top: 15%;
    left: 25%;
  }
  100% {
    top: 15%;
    left: 5%;
  }
}

/* Tutorial pill — bottom centre */
.tutorial-pill {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(192, 84, 26, 0.92);
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 20px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(6px);
  z-index: 200;
  white-space: nowrap;
  letter-spacing: 0.02em;
  transition: background 0.2s, transform 0.2s;
  animation: pill-pulse 3s ease-in-out infinite;
}

.tutorial-pill:hover {
  background: rgba(224, 100, 40, 1);
  transform: translateX(-50%) translateY(-2px);
}

@keyframes pill-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192, 84, 26, 0.5); }
  50%       { box-shadow: 0 0 0 8px rgba(192, 84, 26, 0); }
}

/* VR pill — bottom centre, above the tutorial pill */
.vr-pill {
  position: fixed;
  bottom: 64px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 60, 110, 0.92);
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 20px;
  border-radius: 20px;
  border: 1px solid rgba(100, 160, 255, 0.35);
  backdrop-filter: blur(6px);
  z-index: 200;
  white-space: nowrap;
  letter-spacing: 0.02em;
  transition: background 0.2s, transform 0.2s;
}

.vr-pill:hover {
  background: rgba(40, 80, 160, 1);
  transform: translateX(-50%) translateY(-2px);
}
