/* ═══════════════════════════════════════════════════════════════════════════
   HOVER CONSISTENCY
   Canonical hover visuals and hover-capability fallbacks across mouse,
   touchpad, and hover-capable pen input.
   ═══════════════════════════════════════════════════════════════════════════ */

:root,
[data-theme="light"] {
  --interactive-hover-bg: var(--fill-hover);
  --interactive-hover-fg: var(--text);
  --interactive-hover-border: var(--border-strong);
  --header-fill-hover: var(--fill-hover);
}

[data-theme="dark"] {
  --interactive-hover-bg: var(--fill-hover);
  --interactive-hover-fg: var(--text);
  --interactive-hover-border: var(--border-strong);
  --header-fill-hover: var(--fill-hover);
}

.topbar-brand:hover,
.topbar-brand.is-hovered,
.topbar-title-control:hover,
.topbar-title-control.is-hovered,
.topbar-wordcount:hover,
.topbar-wordcount.is-hovered {
  background: var(--header-fill-hover);
  color: var(--text-sec);
  opacity: 1;
}

.tb-style-select:hover,
.tb-style-select.is-hovered {
  background: var(--interactive-hover-bg);
  border-color: var(--border);
}

.dropdown-item:hover:not(.is-active),
.dropdown-item.is-hovered:not(.is-active) {
  background: var(--interactive-hover-bg);
  color: var(--interactive-hover-fg);
}

.dropdown-item.is-destructive:hover,
.dropdown-item.is-destructive.is-hovered {
  background: rgba(138, 48, 48, .08);
}

.btn--primary:hover,
.btn--primary.is-hovered {
  filter: brightness(1.08);
  transform: translateY(var(--motion-hover-lift));
}

.btn--secondary:hover,
.btn--secondary.is-hovered {
  background: var(--interactive-hover-bg);
  color: var(--interactive-hover-fg);
}

.btn--ghost:hover,
.btn--ghost.is-hovered {
  background: var(--interactive-hover-bg);
  color: var(--interactive-hover-fg);
}

.btn--danger:hover,
.btn--danger.is-hovered {
  background: var(--danger-fill-strong);
}

.ui-close:hover,
.ui-close.is-hovered,
.ui-action-btn:hover:not(.ui-action-btn--primary),
.ui-action-btn.is-hovered:not(.ui-action-btn--primary),
.ui-choice-btn:hover:not(.is-active),
.ui-choice-btn.is-hovered:not(.is-active),
.ui-chip:hover:not(.is-active),
.ui-chip.is-hovered:not(.is-active),
.ui-option-btn:hover:not(.is-active),
.ui-option-btn.is-hovered:not(.is-active),
.sp-choice-group .ui-choice-btn:hover:not(.is-active),
.sp-choice-group .ui-choice-btn.is-hovered:not(.is-active),
.sp-subnav-btn:hover:not(.is-active),
.sp-subnav-btn.is-hovered:not(.is-active),
.sp-action-btn:hover:not(.sp-action-btn--primary),
.sp-action-btn.is-hovered:not(.sp-action-btn--primary),
.sp-list-row:hover:not(.is-active),
.sp-list-row.is-hovered:not(.is-active),
.hcp-remove:hover,
.hcp-remove.is-hovered,
.citation-list-item:hover,
.citation-list-item.is-hovered,
button.microsoft-cloud-list-row:hover,
button.microsoft-cloud-list-row.is-hovered,
.outline-action-btn:hover:not(:disabled),
.outline-action-btn.is-hovered:not(:disabled),
.find-opt-check:hover:not(:has(input:checked)),
.find-opt-check.is-hovered:not(:has(input:checked)),
.note-edit-btn:hover,
.note-edit-btn.is-hovered,
.sidebar-drag-handle:hover,
.sidebar-drag-handle.is-hovered {
  background: var(--interactive-hover-bg);
  color: var(--interactive-hover-fg);
}

.ProseMirror a[href].is-hovered,
.citation-ref.is-hovered {
  background: color-mix(in srgb, rgba(var(--accent-rgb), .12) 78%, transparent);
  text-decoration-thickness: 2px;
}

.sp-entity-btn:hover,
.sp-entity-btn.is-hovered {
  background: color-mix(in srgb, var(--sp-card-bg) 86%, var(--interactive-hover-bg));
  border-color: color-mix(in srgb, var(--sp-card-border) 72%, var(--interactive-hover-border));
}

.ui-action-btn--primary:hover,
.ui-action-btn--primary.is-hovered {
  background: rgba(var(--accent-rgb), .18);
  color: var(--accent);
}

.sp-action-btn--primary:hover,
.sp-action-btn--primary.is-hovered,
.find-nav-btn--primary:hover,
.find-nav-btn--primary.is-hovered {
  background: var(--accent-hover);
  color: var(--text-on-accent);
}

.files-manage-action--primary:hover,
.files-manage-action--primary.is-hovered {
  background: var(--accent-hover);
  border-color: transparent;
  color: var(--text-on-accent);
}

.files-manage-action--danger:hover,
.files-manage-action--danger.is-hovered {
  background: var(--danger-fill-strong);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.find-opt-check:has(input:checked):hover,
.find-opt-check:has(input:checked).is-hovered {
  background: var(--accent);
  border-color: transparent;
  color: var(--text-on-accent);
}

@media (any-hover: none) {
  .topbar-brand:hover:not(.is-hovered),
  .topbar-title-control:hover:not(.is-hovered),
  .tb-style-select:hover:not(.is-hovered) {
    background: transparent;
  }

  .dropdown-item:hover:not(.is-hovered):not(.is-active),
  .ui-close:hover:not(.is-hovered),
  .ui-option-btn:hover:not(.is-hovered):not(.is-active),
  .sp-subnav-btn:hover:not(.is-hovered):not(.is-active),
  .sp-list-row:hover:not(.is-hovered):not(.is-active),
  .citation-list-item:hover:not(.is-hovered) {
    background: transparent;
  }

  .topbar-wordcount:hover:not(.is-hovered) {
    background: transparent;
    color: var(--text-muted);
  }

  .tb-style-select:hover:not(.is-hovered) {
    border-color: transparent;
    color: var(--text-sec);
  }

  .dropdown-item:hover:not(.is-hovered):not(.is-active) {
    color: var(--text-sec);
  }

  .ui-close:hover:not(.is-hovered) {
    color: var(--text-muted);
  }

  .ui-option-btn:hover:not(.is-hovered):not(.is-active) {
    color: var(--text-sec);
  }

  .sp-subnav-btn:hover:not(.is-hovered):not(.is-active) {
    color: var(--text-muted);
  }

  .sp-list-row:hover:not(.is-hovered):not(.is-active),
  .citation-list-item:hover:not(.is-hovered) {
    color: inherit;
  }

  .dropdown-item.is-destructive:hover:not(.is-hovered) {
    background: transparent;
  }

  .btn--primary:hover:not(.is-hovered) {
    filter: none;
    transform: none;
  }

  .btn--secondary:hover:not(.is-hovered) {
    background: var(--fill-subtle);
    color: var(--text-sec);
  }

  .btn--ghost:hover:not(.is-hovered) {
    background: transparent;
    color: var(--text-sec);
  }

  .btn--danger:hover:not(.is-hovered) {
    background: var(--danger-fill);
  }

  .ui-action-btn:hover:not(.is-hovered):not(.ui-action-btn--primary),
  .ui-chip:hover:not(.is-hovered):not(.is-active),
  .find-opt-check:hover:not(.is-hovered):not(:has(input:checked)),
  .note-edit-btn:hover:not(.is-hovered),
  .sidebar-drag-handle:hover:not(.is-hovered) {
    background: var(--fill-muted);
    color: var(--text-sec);
  }

  .ProseMirror a[href]:hover:not(.is-hovered),
  .citation-ref:hover:not(.is-hovered) {
    background: transparent;
    text-decoration-thickness: 1.5px;
  }

  .ui-action-btn--primary:hover:not(.is-hovered) {
    background: rgba(var(--accent-rgb), .1);
    color: var(--accent);
  }

  .ui-choice-group:not(.ui-choice-group--wrap) .ui-choice-btn:hover:not(.is-hovered):not(.is-active),
  .sp-choice-group .ui-choice-btn:hover:not(.is-hovered):not(.is-active) {
    background: transparent;
    color: var(--text-muted);
  }

  .ui-choice-group--wrap .ui-choice-btn:hover:not(.is-hovered):not(.is-active) {
    background: var(--fill-muted);
    color: var(--text-muted);
  }

  .sp-action-btn:hover:not(.is-hovered):not(.sp-action-btn--primary) {
    background: var(--fill-muted);
    color: var(--text-sec);
  }

  .hcp-remove:hover:not(.is-hovered) {
    background: transparent;
    color: var(--text-sec);
  }

  .sp-action-btn--primary:hover:not(.is-hovered),
  .find-nav-btn--primary:hover:not(.is-hovered),
  .files-manage-action--primary:hover:not(.is-hovered),
  .find-opt-check:has(input:checked):hover:not(.is-hovered) {
    background: var(--accent);
    color: var(--text-on-accent);
  }

  .files-manage-action--danger:hover:not(.is-hovered) {
    background: var(--danger-fill);
    color: var(--danger-text);
  }

  button.microsoft-cloud-list-row:hover:not(.is-hovered),
  .outline-action-btn:hover:not(.is-hovered):not(:disabled) {
    background: var(--bg-card);
  }

  button.microsoft-cloud-list-row:hover:not(.is-hovered) {
    border-color: var(--border);
  }

  .outline-action-btn:hover:not(.is-hovered):not(:disabled) {
    border-color: var(--border-subtle);
    color: var(--text-muted);
  }

  .sp-entity-btn:hover:not(.is-hovered) {
    background: var(--sp-card-bg);
    border-color: var(--sp-card-border);
  }

  .hcp-swatch:hover:not(.is-hovered) {
    transform: none;
    box-shadow: none;
  }

  [data-tip]::after {
    display: none !important;
  }
}
