/* Homepage 3D skills — pairs with static/js/skills-sphere.js */

.skills-sphere-section {
  position: relative;
  padding: clamp(2.5rem, 6vw, 4.5rem) 1.25rem;
  padding-bottom: clamp(3rem, 8vw, 5rem);
  margin: 0 auto;
  max-width: 1200px;
  overflow: visible;
  /* Old .skills-section used --bg-alt; keep sphere flush with page */
  background: transparent !important;
}

.skills-sphere-layout {
  position: relative;
  z-index: 1;
}

.skills-sphere-card {
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  overflow: visible;
}

.skills-sphere-header {
  text-align: center;
  padding: clamp(2rem, 4vw, 3rem) clamp(1.25rem, 3vw, 2rem) 1.25rem;
}

.skills-sphere-title {
  margin: 0 0 0.65rem;
  font-size: clamp(1.5rem, 3.5vw, 1.875rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.skills-sphere-subtitle {
  margin: 0 auto;
  max-width: 36rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.skills-sphere-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1.75rem;
}

.skills-sphere-filter-btn {
  cursor: pointer;
  padding: 0.45rem 1.1rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  background: var(--bg-glass);
  transition:
    border-color 0.25s ease,
    color 0.25s ease,
    background 0.25s ease,
    box-shadow 0.25s ease;
}

.skills-sphere-filter-btn:hover {
  border-color: rgba(var(--accent-color-rgb), 0.45);
  color: var(--accent-color);
}

.skills-sphere-filter-btn--active {
  border-color: var(--accent-color);
  color: var(--accent-color);
  background: rgba(var(--accent-color-rgb), 0.1);
  box-shadow: none;
}

.skills-sphere-filter-btn:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

.skills-sphere-canvas-host {
  position: relative;
  width: 100%;
  height: min(520px, 68vh);
  min-height: 300px;
  margin-top: 0.5rem;
  border-radius: 0;
  cursor: grab;
  touch-action: none;
  overflow: visible;
}

.skills-sphere-canvas-host:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 4px;
}

.skills-sphere-canvas-host:active {
  cursor: grabbing;
}

.skills-sphere-canvas-host canvas {
  display: block;
}

/* CSS2D layer — Three.js sets overflow:hidden by default, which clips edge labels */
.skills-sphere-canvas-host > div:last-child {
  position: absolute !important;
  inset: 0;
  pointer-events: none;
  overflow: visible !important;
}

.skills-sphere-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-family: "Share Tech Mono", ui-monospace, monospace;
  font-size: 0.85rem;
  color: var(--accent-color);
  pointer-events: none;
  animation: skills-sphere-pulse 1.4s ease-in-out infinite;
}

.skills-sphere-loading--hide {
  display: none;
}

@keyframes skills-sphere-pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

/* Floating skill labels (attached by JS) */
.skill-sphere-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.65rem;
  border-radius: 0.375rem;
  border: 1px solid var(--border-color);
  background: var(--bg-glass);
  backdrop-filter: blur(8px);
  color: var(--text-secondary);
  font-family: "Share Tech Mono", ui-monospace, monospace;
  font-size: clamp(0.68rem, 1.5vw, 0.78rem);
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  pointer-events: auto;
  box-shadow: none;
  transition:
    opacity 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.15),
    filter 0.35s ease,
    transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.15),
    border-color 0.25s ease,
    color 0.25s ease,
    background 0.25s ease;
  transform-origin: center center;
  user-select: none;
}

.skill-sphere-label:hover {
  z-index: 10;
  border-color: rgba(var(--accent-color-rgb), 0.4);
  color: var(--text-primary);
  background: rgba(var(--accent-color-rgb), 0.08);
}

.skill-sphere-label--inactive {
  opacity: 0.14 !important;
  filter: blur(1.5px);
  transform: scale(0.88) !important;
  pointer-events: none;
}

/* Light tile behind brand icons — dark/simpleicons marks read on dark glass chips */
.skill-sphere-icon {
  display: block;
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
  object-fit: contain;
  padding: 0.2rem;
  box-sizing: content-box;
  border-radius: 0.3rem;
  background: linear-gradient(180deg, #ffffff 0%, #eef2f6 100%);
  border: 1px solid rgba(15, 23, 42, 0.14);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 2px rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .skill-sphere-icon {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-color: rgba(15, 23, 42, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    0 1px 2px rgba(0, 0, 0, 0.04);
}

@media (max-width: 640px) {
  .skills-sphere-canvas-host {
    height: min(420px, 65vh);
    min-height: 280px;
  }

  .skills-sphere-filter-btn {
    font-size: 0.72rem;
    padding: 0.4rem 0.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skills-sphere-loading {
    animation: none;
    opacity: 0.85;
  }
}
