/* =============================================================================
   THEME SWITCHER — Dark / Light mode toggle pill
   Hidden on mobile, visible on desktop (≥1024px).
   ============================================================================= */

/* Hide on mobile */
.theme-toggle {
  display: none;
}

/* Show on desktop */
@media (min-width: 1024px) {
  .theme-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 4px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    gap: 0;
    flex-shrink: 0;
  }
}

/* ---------------------------------------------------------------------------
   SLIDING INDICATOR — moves behind active button
--------------------------------------------------------------------------- */

.theme-toggle__indicator {
  position: absolute;
  top: 4px;
  left: 4px;
  bottom: 4px;
  width: calc(50% - 4px);
  background: var(--color-surface);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  transition: transform 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  z-index: 0;
}

/* Slide to dark (right) side */
.theme-toggle.is-dark .theme-toggle__indicator {
  transform: translateX(100%);
}

/* ---------------------------------------------------------------------------
   BUTTONS
--------------------------------------------------------------------------- */

.theme-toggle__btn {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  width: 36px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
  padding: 0;
}

.theme-toggle__btn:hover {
  color: var(--color-text);
}

.theme-toggle__btn[aria-pressed="true"] {
  color: var(--color-brand-text);
}

.theme-toggle__btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  transition: transform 400ms cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity var(--transition-fast);
}

.theme-toggle__btn[aria-pressed="true"].theme-toggle__btn--light svg {
  transform: rotate(20deg);
}

.theme-toggle__btn[aria-pressed="true"].theme-toggle__btn--dark svg {
  transform: rotate(-15deg);
}

.theme-toggle__btn:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-full);
}

/* ---------------------------------------------------------------------------
   LABEL VARIANT — text beside icon on desktop only
--------------------------------------------------------------------------- */

.theme-toggle--labels .theme-toggle__btn {
  width: auto;
  padding: 0 var(--space-3);
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
}

.theme-toggle--labels .theme-toggle__indicator {
  width: calc(50% - 4px);
}

.theme-toggle__btn-label {
  display: none;
}

@media (min-width: 1024px) {
  .theme-toggle--labels .theme-toggle__btn-label {
    display: inline;
  }
}

/* ---------------------------------------------------------------------------
   DARK MODE SELF-STYLING
--------------------------------------------------------------------------- */

html[data-theme="dark"] .theme-toggle {
  background: var(--color-bg-secondary);
  border-color: var(--color-border);
}

html[data-theme="dark"] .theme-toggle__indicator {
  background: var(--color-surface-raised);
  border-color: var(--color-border-strong);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  .theme-toggle {
    background: var(--color-bg-secondary);
    border-color: var(--color-border);
  }

  .theme-toggle__indicator {
    background: var(--color-surface-raised);
    border-color: var(--color-border-strong);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  }
}

/* ---------------------------------------------------------------------------
   GLOW EFFECTS
--------------------------------------------------------------------------- */

.theme-toggle.is-dark .theme-toggle__btn--dark {
  color: var(--color-primary-300);
}

.theme-toggle:not(.is-dark) .theme-toggle__btn--light {
  color: var(--color-amber-500);
}
