/* Toggle crystal liquid — compacto, solo iconos (sin texto superpuesto) */
.theme-crystal {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.theme-crystal:focus-visible .theme-crystal__track {
  outline: 2px solid rgba(20, 184, 166, 0.75);
  outline-offset: 3px;
}

.theme-crystal__track {
  position: relative;
  display: block;
  width: 56px;
  height: 32px;
  border-radius: 999px;
  box-sizing: border-box;
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.22) 0%,
    rgba(110, 120, 135, 0.42) 55%,
    rgba(75, 82, 92, 0.5) 100%
  );
  border: none;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.42),
    0 0 0 2px rgba(20, 184, 166, 0.48),
    inset 0 1px 3px rgba(255, 255, 255, 0.18),
    inset 0 -2px 5px rgba(0, 0, 0, 0.16),
    0 4px 16px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

/* Etiquetas solo para lectores de pantalla */
.theme-crystal__labels {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.theme-crystal__orb {
  position: absolute;
  top: 50%;
  right: 2px;
  left: auto;
  width: 28px;
  height: 28px;
  margin-top: -14px;
  border-radius: 50%;
  background:
    radial-gradient(140% 130% at 30% 12%, rgba(255, 255, 255, 0.98) 0%, rgba(255, 255, 255, 0.35) 38%, transparent 65%),
    linear-gradient(150deg, #f0f4f8 0%, #b8c4d4 50%, #8e9aad 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.7),
    0 2px 8px rgba(0, 0, 0, 0.25),
    inset 0 2px 4px rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition:
    right 0.35s cubic-bezier(0.34, 1.2, 0.64, 1),
    left 0.35s cubic-bezier(0.34, 1.2, 0.64, 1),
    transform 0.2s ease;
}

.theme-crystal.is-light .theme-crystal__orb {
  right: auto;
  left: 2px;
}

.theme-crystal:hover .theme-crystal__orb {
  transform: scale(1.05);
}

.theme-crystal:active .theme-crystal__orb {
  transform: scale(0.96);
}

.theme-crystal__icon {
  position: absolute;
  width: 14px;
  height: 14px;
  color: rgba(30, 41, 59, 0.9);
  transition: opacity 0.2s ease, transform 0.22s ease;
}

.theme-crystal__icon--sun {
  opacity: 0;
  transform: scale(0.75);
}

.theme-crystal__icon--moon {
  opacity: 1;
  transform: scale(1);
}

.theme-crystal.is-light .theme-crystal__icon--sun {
  opacity: 1;
  transform: scale(1);
}

.theme-crystal.is-light .theme-crystal__icon--moon {
  opacity: 0;
  transform: scale(0.75);
}

.theme-crystal__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.theme-dark .theme-crystal__track {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.18) 0%,
    rgba(90, 110, 140, 0.4) 55%,
    rgba(50, 62, 80, 0.48) 100%
  );
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.4),
    0 0 0 2px rgba(79, 208, 197, 0.5),
    inset 0 1px 3px rgba(255, 255, 255, 0.14),
    0 4px 14px rgba(0, 0, 0, 0.22);
}

@media (max-width: 768px) {
  .theme-crystal__track {
    width: 52px;
    height: 30px;
  }

  .theme-crystal__orb {
    width: 26px;
    height: 26px;
    margin-top: -13px;
  }
}
