/* Round theme control + clinic-style reveal from the toggle. */
.theme-toggle {
  width: 42px;
  height: 42px;
  min-height: 0;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--link);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover,
.theme-toggle:focus-visible {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--link);
  outline: none;
}
.theme-toggle svg,
.theme-toggle .ico {
  width: 18px;
  height: 18px;
  display: block;
}
.theme-toggle .theme-label,
.theme-toggle .switch-track {
  display: none;
}

/* Theme change spreads from the toggle; every surface flips together. */
html.theme-reveal::view-transition-group(root) {
  animation: none;
}
html.theme-reveal::view-transition-old(root) {
  animation: none;
  z-index: 1;
}
html.theme-reveal::view-transition-new(root) {
  z-index: 2;
  animation: theme-reveal 0.72s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
html.theme-reveal *,
html.theme-reveal *::before,
html.theme-reveal *::after {
  transition: none !important;
  animation: none !important;
}
html.theme-anim *:not(.nf-drawer):not(.nf-popover-backdrop):not(.modal-backdrop):not(.modal) {
  transition-property: background-color, color, border-color, box-shadow, fill, stroke, outline-color !important;
  transition-duration: 0.42s !important;
  transition-timing-function: ease !important;
  transition-delay: 0s !important;
}
html.theme-anim .nf-drawer,
html.theme-anim .nf-popover-backdrop,
html.theme-anim .modal-backdrop,
html.theme-anim .modal {
  transition-duration: 0.21s !important;
  transition-timing-function: ease !important;
  transition-delay: 0s !important;
}
html.theme-anim .nf-drawer {
  transition-property: transform, visibility, background-color, color, border-color, box-shadow !important;
}
html.theme-anim .nf-popover-backdrop {
  transition-property: opacity, background-color !important;
}
html.theme-anim .modal-backdrop,
html.theme-anim .modal {
  transition-property: background-color, color, border-color, box-shadow, opacity !important;
}
@media (prefers-reduced-motion: reduce) {
  html.theme-reveal::view-transition-old(root),
  html.theme-reveal::view-transition-new(root),
  html.theme-anim * {
    animation: none !important;
    transition: none !important;
  }
}
