/* Botão de tema (Issue #311), copiado do botão de tema do designi.com.br em tamanho menor: redondo, sem fundo e sem borda,
   cinza; no hover cresce, ganha fundo suave e a cor cheia. Sol e lua giram: o do tema atual fica em 0°/escala 1 e o outro
   some em ±90°/escala 0. Só transform e opacity. Markup em app/views/tema_botao.php. */
.tb {
  --tb-muted: var(--muted, var(--gp-muted, var(--g-muted, #6B6B73)));
  --tb-texto: var(--text, var(--gp-text, var(--g-text, #141414)));
  --tb-fundo: var(--surface2, var(--gp-surface2, var(--g-surface2, rgba(127, 127, 127, .14))));
  position: relative; box-sizing: border-box; width: 32px; height: 32px; flex: none; padding: 0; margin: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 9999px; background: transparent; color: var(--tb-muted); cursor: pointer;
  transition: transform .3s cubic-bezier(.4, 0, .2, 1), background-color .3s cubic-bezier(.4, 0, .2, 1), color .3s cubic-bezier(.4, 0, .2, 1);
}
/* Área de toque de 44px (Issue #311, auditoria P2) mesmo com o botão de 32px: a camada invisível aumenta só o alvo do clique. */
.tb::after { content: ""; position: absolute; inset: -6px; border-radius: 9999px; }
.tb:hover { transform: scale(1.1); background: var(--tb-fundo); color: var(--tb-texto); }
.tb:active { transform: scale(.95); }
.tb:focus-visible { outline: 2px solid var(--tb-texto); outline-offset: 2px; }
.tb-sol, .tb-lua {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  transition: transform .5s cubic-bezier(.4, 0, .2, 1), opacity .5s cubic-bezier(.4, 0, .2, 1);
}
.tb-sol svg, .tb-lua svg { display: block; }
/* Claro: sol à vista, lua escondida. */
.tb-sol { transform: rotate(0) scale(1); opacity: 1; }
.tb-lua { transform: rotate(90deg) scale(0); opacity: 0; }
/* Escuro: lua à vista, sol sai girando para o outro lado. */
:root[data-theme="dark"] .tb-sol { transform: rotate(-90deg) scale(0); opacity: 0; }
:root[data-theme="dark"] .tb-lua { transform: rotate(0) scale(1); opacity: 1; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tb-sol { transform: rotate(-90deg) scale(0); opacity: 0; }
  :root:not([data-theme="light"]) .tb-lua { transform: rotate(0) scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .tb, .tb-sol, .tb-lua { transition: none; }
  .tb:hover, .tb:active { transform: none; }
}
