/* Complete-control feedback. Load after route styles.
   Native box-shadow follows the actual rounded border on every side: no masked
   conic sectors, rotating ellipse, or nested icon disc. Palette roles stay live. */
:root {
  --button-glow-rim: linear-gradient(var(--accent), var(--accent));
  --button-glow-shadow:
    0 0 0 1px var(--accent),
    0 0 4px color-mix(in srgb, var(--accent) 38%, transparent),
    0 0 12px color-mix(in srgb, var(--accent-warm) 24%, transparent);
}

/* Retire only known decorative rim pseudos. Chevron, hamburger, tooltip,
   slider-thumb, drag-marker and ordinary inline icon pseudos are untouched. */
body :is(
  .btn, .nav-toggle, .nav-link, .v7-glow-button, .v7-popup-link,
  .pond-trigger, .pond-buttons button, .pond-group > summary,
  [id="koi-catalog"] > summary, .coast-socials a, .site-release__summary,
  .tz-form .tz-chip, .chi-events-button
)::before {
  content: none !important;
  opacity: 0 !important;
  animation: none !important;
  filter: none !important;
}

/* Each named action owns its complete outline. Open/selected is not an
   interaction state: keep selection fills and borders, but hide idle halos.
   Important is confined to shadow ownership because legacy per-ID rules and
   route-specific primary/selected shadows otherwise beat the shared contract. */
body :is(
  .btn, .nav-toggle, .nav-link, .v7-glow-button, .v7-popup-link,
  .pond-trigger, .pond-buttons button, .pond-group > summary,
  [id="koi-catalog"] > summary, .coast-socials a, .site-release__summary,
  .tz-form .tz-chip, .chi-events-button,
  .vox-icon-button, .vox-compact-button, .vox-tool-action, .vox-tools-trigger,
  .combiner-icon-button, .combiner-small-button, .combiner-tool-action, .combiner-tools-trigger,
  .tools-shortcut-open, .tools-shortcut-move, .tools-shortcut-remove,
  .tools-shortcuts-more, .tools-filter, .tools-running-item, .tools-search-clear,
  .tool-favorite-button, .tools-back-to-top, .tools-launcher-tile,
  .tt-presets button
) {
  --control-interaction-glow: none;
  box-shadow: var(--control-interaction-glow) !important;
}

/* Visible keyboard focus works in every input mode. Hover-only decoration
   is restricted to real hover-capable pointers, so taps do not leave halos. */
body :is(
  .btn, .nav-toggle, .nav-link, .v7-glow-button, .v7-popup-link,
  .pond-trigger, .pond-buttons button, .pond-group > summary,
  [id="koi-catalog"] > summary, .coast-socials a, .site-release__summary,
  .tz-form .tz-chip, .chi-events-button,
  .vox-icon-button, .vox-compact-button, .vox-tool-action, .vox-tools-trigger,
  .combiner-icon-button, .combiner-small-button, .combiner-tool-action, .combiner-tools-trigger,
  .tools-shortcut-open, .tools-shortcut-move, .tools-shortcut-remove,
  .tools-shortcuts-more, .tools-filter, .tools-running-item, .tools-search-clear,
  .tool-favorite-button, .tools-back-to-top, .tt-presets button
):not(:disabled):not([aria-disabled="true"]):focus-visible,
/* The launcher's two native actions share one already surfaced tile. Paint its
   outside, not a halo clipped inside the Open/Pin partition. Keyboard only
   follows a real focus-visible descendant, never generic focus-within. */
body .tools-launcher-tile:has(:focus-visible) {
  --control-interaction-glow: var(--button-glow-shadow);
}

@media (hover: hover) and (pointer: fine) {
  body :is(
    .btn, .nav-toggle, .nav-link, .v7-glow-button, .v7-popup-link,
    .pond-trigger, .pond-buttons button, .pond-group > summary,
    [id="koi-catalog"] > summary, .coast-socials a, .site-release__summary,
    .tz-form .tz-chip, .chi-events-button,
    .vox-icon-button, .vox-compact-button, .vox-tool-action, .vox-tools-trigger,
    .combiner-icon-button, .combiner-small-button, .combiner-tool-action, .combiner-tools-trigger,
    .tools-shortcut-open, .tools-shortcut-move, .tools-shortcut-remove,
    .tools-shortcuts-more, .tools-filter, .tools-running-item, .tools-search-clear,
    .tool-favorite-button, .tools-back-to-top, .tt-presets button
  ):not(:disabled):not([aria-disabled="true"]):hover,
  /* The launcher's two native actions share one already surfaced tile. Paint its
     outside, not a halo clipped inside the Open/Pin partition. Keyboard only
     follows a real focus-visible descendant, never generic focus-within. */
  body .tools-launcher-tile:hover {
    --control-interaction-glow: var(--button-glow-shadow);
  }
}

/* Shortcut icons remain ordinary content, not a second glowing button. */
body .tools-shortcut-circle {
  box-shadow: none !important;
}

/* Theme Rail is deliberately outside the decorative action family. Preserve
   its native thumb/track pseudos and its ordinary keyboard-focus outline. */
body .theme-toggle__button {
  box-shadow: none !important;
  filter: none !important;
}

/* The feedback is static in every mode. Remove remaining control transition
   interpolation under reduced motion without changing application behavior. */
@media (prefers-reduced-motion: reduce) {
  body :is(
    .btn, .nav-toggle, .nav-link, .v7-glow-button, .v7-popup-link,
    .pond-trigger, .pond-buttons button, .pond-group > summary,
    [id="koi-catalog"] > summary, .coast-socials a, .site-release__summary,
    .tz-form .tz-chip, .chi-events-button,
    .vox-icon-button, .vox-compact-button, .vox-tool-action, .vox-tools-trigger,
    .combiner-icon-button, .combiner-small-button, .combiner-tool-action, .combiner-tools-trigger,
    .tools-shortcut-open, .tools-shortcut-move, .tools-shortcut-remove,
    .tools-shortcuts-more, .tools-filter, .tools-running-item, .tools-search-clear,
    .tool-favorite-button, .tools-back-to-top, .tools-launcher-tile,
    .tt-presets button
  ) { transition: none !important; }
}
