/* Embedding Space Explorer — blog interactive component */

.ee-container {
  background: var(--color-surface, #f8f9fa);
  border: 1px solid var(--color-border, #dee2e6);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 2rem 0;
  position: relative;
}

.ee-title {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
}

.ee-subtitle {
  margin: 0 0 1rem;
  color: var(--color-muted, #6c757d);
  font-size: 0.9rem;
}

.ee-controls {
  display: flex;
  align-items: flex-end;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.ee-control-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
  color: var(--color-text-secondary, #495057);
}

.ee-slider-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ee-slider {
  width: 160px;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--color-border, #dee2e6);
  border-radius: 3px;
  outline: none;
}

.ee-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-primary, #0d6efd);
  cursor: pointer;
}

.ee-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-primary, #0d6efd);
  cursor: pointer;
  border: none;
}

.ee-slider-value {
  min-width: 2rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-text, #212529);
}

.ee-btn {
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--color-border, #dee2e6);
  border-radius: 4px;
  background: transparent;
  color: var(--color-text-secondary, #495057);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ee-btn:hover {
  border-color: var(--color-primary, #0d6efd);
}

.ee-btn-active {
  background: var(--color-primary, #0d6efd);
  color: #fff;
  border-color: var(--color-primary, #0d6efd);
}

/* Legend */
.ee-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.ee-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  border-radius: 3px;
  cursor: pointer;
  transition: opacity 0.15s;
  user-select: none;
  color: var(--color-text, #212529);
}

.ee-legend-item:hover {
  background: var(--color-border, #dee2e6);
}

.ee-legend-hidden {
  opacity: 0.35;
  text-decoration: line-through;
}

.ee-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* Canvas */
.ee-canvas {
  width: 100%;
  height: 400px;
  border: 1px solid var(--color-border, #dee2e6);
  border-radius: 4px;
  background: #0a0d12;
  cursor: grab;
  touch-action: none;
}

.ee-canvas:active {
  cursor: grabbing;
}

/* Tooltip */
.ee-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.85);
  color: #e8edf3;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8rem;
  line-height: 1.4;
  pointer-events: none;
  z-index: 10;
  max-width: 280px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ee-tooltip-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ee-tooltip-path {
  color: #9ba3ad;
  font-size: 0.75rem;
}

.ee-tooltip-topic {
  color: #7bc4d8;
  font-size: 0.75rem;
  margin-top: 0.15rem;
}

/* Stats */
.ee-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  border-top: 1px solid var(--color-border, #dee2e6);
  padding-top: 1rem;
  margin-top: 0.75rem;
}

.ee-stat {
  text-align: center;
}

.ee-stat-number {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--color-text, #212529);
  line-height: 1.2;
}

.ee-stat-label {
  font-size: 0.8rem;
  color: var(--color-muted, #6c757d);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .ee-container {
    background: var(--color-surface, #1e1e1e);
    border-color: var(--color-border, #333);
  }
  .ee-canvas {
    border-color: var(--color-border, #333);
  }
}

/* Mobile */
@media (max-width: 600px) {
  .ee-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .ee-canvas {
    height: 300px;
  }
  .ee-stats {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

/* Alpine cloak */
[x-cloak] { display: none !important; }
