/* ============================================================================
   THEME TOGGLE COMPONENT

   Sun/Moon toggle button for switching between light and dark themes.

   Purpose: Provide accessible theme switching with clear visual feedback.

   Required HTML Structure:

   <button class="theme-toggle" id="theme-toggle" aria-label="Switch to light mode">
     <i class="fas fa-moon theme-toggle__icon theme-toggle__icon--dark"></i>
     <i class="fas fa-sun theme-toggle__icon theme-toggle__icon--light"></i>
   </button>

   Behavior:
   - Dark mode (default): Moon icon visible
   - Light mode: Sun icon visible
   - Icons animate on theme change

   Accessibility:
   - aria-label updates to reflect current action
   - Keyboard accessible (Enter/Space to toggle)
   - Focus ring visible on keyboard navigation
   - Icons are decorative (aria-hidden on icons)

   Notes:
   - Position in header nav, right side next to CTA button
   - Uses Font Awesome icons (fa-sun, fa-moon)
   - Smooth transition between icon states
   ============================================================================ */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  vertical-align: middle;
}

.theme-toggle:hover {
  background: var(--bg-header-border);
  border-color: var(--sky-blue);
}

.theme-toggle:focus {
  outline: 2px solid var(--sky-blue);
  outline-offset: 2px;
}

/* Icon container */
.theme-toggle__icon {
  position: absolute;
  font-size: 18px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Dark mode icon (moon) - visible by default */
.theme-toggle__icon--dark {
  color: var(--sky-blue);
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Light mode icon (sun) - hidden by default */
.theme-toggle__icon--light {
  color: var(--sky-blue);
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

/* Light theme: swap icon visibility */
[data-theme="light"] .theme-toggle__icon--dark {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

[data-theme="light"] .theme-toggle__icon--light {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Mobile styles - toggle is inside nav li */
@media (max-width: 992px) {
  #nav li:has(.theme-toggle) {
    display: flex;
    justify-content: center;
    padding: 1rem 0;
    border-bottom: none;
  }

  .theme-toggle {
    margin: 0;
  }
}

/* Small mobile - slightly smaller button */
@media (max-width: 520px) {
  .theme-toggle {
    width: 36px;
    height: 36px;
  }

  .theme-toggle__icon {
    font-size: 16px;
  }
}
