/* One compact theme control, clear of mobile safe areas and normal page content. */
@layer components {
  .floating-theme {
    position: fixed;
    right: max(var(--space-4), env(safe-area-inset-right));
    bottom: max(var(--space-4), env(safe-area-inset-bottom));
    z-index: var(--z-header);
    background: var(--color-surface);
    border-radius: var(--radius-control);
    box-shadow: var(--shadow-1);
    &[data-inline] { position: static; width: fit-content; }
    [data-theme-icon] { display: flex; }
    [data-theme-icon="dark"] { display: none; }
  }
  :root[data-theme="dark"] .floating-theme {
    [data-theme-icon="light"] { display: none; }
    [data-theme-icon="dark"] { display: flex; }
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .floating-theme {
      [data-theme-icon="light"] { display: none; }
      [data-theme-icon="dark"] { display: flex; }
    }
  }
}
