/* Keyboard focus follows the current board theme without changing saved content. */
body {
  --hn-focus-ring: #176997;
}

body.hn-dark {
  --hn-focus-ring: #a7dcff;
}

body :is(button, a[href], input, textarea, select, summary, [role="menuitem"], [role="option"], [contenteditable="true"], [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 2px solid var(--hn-focus-ring) !important;
  outline-offset: 2px !important;
}

/* Keep keyboard focus inside the unified Search list's scrolling boundary. */
body .hn-boards-dialog :is(.hn-board-open,.hn-content-open,.hn-board-disclosure):focus-visible {
  outline-offset: -2px !important;
  background: var(--theme-hover, #e8f0f1) !important;
}

/* Card actions remain visible while reached by keyboard. */
body :is(.heading-card, .image-card) > .drag-handle:focus-within,
body .frame-controls:focus-within {
  opacity: 1 !important;
}

@media (prefers-reduced-motion: reduce) {
  /* Preserve live collaborator cursor updates and canvas positioning. */
  body :is(.sidebar, .canvas-hint, .card, .board-card, .project-start-card,
    .popover, .canvas-context-menu, .toast, .hn-mobile-sheet,
    .selection-tools, .text-format-toolbar, .frame-controls,
    .favorite-board-row, .save-dot) {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  body :is(button, a[href], input, textarea, select, summary, [role="menuitem"], [role="option"], [contenteditable="true"], [tabindex]:not([tabindex="-1"])):focus-visible {
    outline-color: Highlight !important;
  }
}
