/* ==========================================================================
   theme-switcher.css — Floating accent-color picker
   ========================================================================== */

/* --- Smooth accent transition (applied temporarily during color change) --- */
.accent-transitioning,
.accent-transitioning *,
.accent-transitioning *::before,
.accent-transitioning *::after {
  transition:
    color 0.55s ease,
    background-color 0.55s ease,
    border-color 0.55s ease,
    box-shadow 0.55s ease,
    fill 0.55s ease,
    stroke 0.55s ease !important;
}

/* --- Floating Button --- */
.theme-switcher {
  position: fixed;
  bottom: 80px;
  right: 24px;
  z-index: 500;
}

.theme-switcher-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--bg);
  color: var(--accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow:
    0 0 0 0 transparent,
    0 4px 16px rgba(0, 0, 0, 0.4);
  transition:
    border-color 0.3s ease,
    color 0.3s ease,
    box-shadow 0.3s ease,
    transform 0.3s ease,
    background 0.3s ease;
}

.theme-switcher-btn:hover {
  transform: scale(1.08);
  box-shadow:
    0 0 16px var(--accent-soft),
    0 4px 16px rgba(0, 0, 0, 0.4);
}

.theme-switcher-btn svg {
  width: 22px;
  height: 22px;
  transition: transform 0.4s ease;
}

.theme-switcher.open .theme-switcher-btn svg {
  transform: rotate(90deg);
}

/* --- Popover Menu --- */
.theme-switcher-popover {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  background: rgba(23, 23, 26, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl, 20px);
  padding: 14px 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px) scale(0.95);
  transform-origin: bottom right;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease,
    transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] .theme-switcher-popover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

.theme-switcher.open .theme-switcher-popover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.theme-switcher-popover-title {
  font-family: var(--font-mono, monospace);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text-faint, #6b6b70);
  text-transform: uppercase;
  margin: 0 0 2px;
  padding: 0 2px;
  white-space: nowrap;
}

.theme-switcher-colors {
  display: flex;
  gap: 10px;
}

.theme-color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  padding: 0;
  outline: none;
}

.theme-color-swatch:hover {
  transform: scale(1.15);
}

.theme-color-swatch.active {
  border-color: var(--text, #f2f1ec);
  box-shadow: 0 0 0 2px var(--bg, #0b0b0d), 0 0 0 4px var(--text, #f2f1ec);
}

.theme-color-swatch::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: inherit;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.theme-color-swatch.active::after {
  content: "\2713";
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  background: transparent;
}

/* --- Mobile adjustments --- */
@media (max-width: 768px) {
  .theme-switcher {
    bottom: 80px;
    right: 16px;
  }

  .theme-switcher-btn {
    width: 44px;
    height: 44px;
  }

  .theme-switcher-btn svg {
    width: 20px;
    height: 20px;
  }

  .theme-switcher-popover {
    padding: 12px 14px;
    right: 0;
  }

  .theme-color-swatch {
    width: 32px;
    height: 32px;
  }
}

@media (max-width: 480px) {
  .theme-switcher {
    bottom: 70px;
    right: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .accent-transitioning,
  .accent-transitioning *,
  .accent-transitioning *::before,
  .accent-transitioning *::after {
    transition: none !important;
  }

  .theme-switcher-btn svg,
  .theme-switcher-popover,
  .theme-color-swatch {
    transition: none;
  }
}
