/**
 * Component — Theme Switch
 * Zero layout shift toggle. Icon selected via [data-theme] attribute,
 * set synchronously by the inline critical script in header.php.
 * @package Recipes_Lola
 * @version 1.0.0
 */

.rl-theme-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: var(--rl-space-10);
  block-size: var(--rl-space-10);
  border-radius: var(--rl-radius-md);
  color: var(--rl-color-foreground);
  flex-shrink: 0;
  transition: background-color var(--rl-transition-fast);
}

.rl-theme-switch:hover { background-color: var(--rl-color-surface-raised); }

.rl-theme-switch:focus-visible {
  outline: var(--rl-focus-outline-width) solid var(--rl-focus-outline-color);
  outline-offset: var(--rl-focus-outline-offset);
}

.rl-theme-switch__icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  inline-size: var(--rl-icon-size-md);
  block-size: var(--rl-icon-size-md);
  margin: auto;
  opacity: 0;
  transition: opacity var(--rl-transition-fast);
}

.rl-theme-switch__icon--sun { opacity: 1; }
.rl-theme-switch__icon--moon { opacity: 0; }

:root[data-theme="dark"] .rl-theme-switch__icon--sun { opacity: 0; }
:root[data-theme="dark"] .rl-theme-switch__icon--moon { opacity: 1; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .rl-theme-switch__icon--sun { opacity: 0; }
  :root:not([data-theme="light"]) .rl-theme-switch__icon--moon { opacity: 1; }
}
