/* Standalone controls only: card hit areas and concept demos keep their own motion. */
body :is(button, a.primary-button, a.secondary-save, .resource-card-actions a, .resource-detail-actions a, .resource-detail-links a):not(.demo-open, .term-body, .resource-body, .demo *, .brand) {
  --button-floor: 0 1px 0 #20211f12;
  --button-hover-shadow: 0 2px 5px #20211f12;
  --button-pressed-shadow: 0 0 0 #20211f00, inset 0 1px 2px #20211f1c;
  box-shadow: var(--button-floor);
  transform: none;
  transition: transform 160ms cubic-bezier(.2,.7,.3,1), box-shadow 160ms ease,
    filter 160ms ease, background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

body :is(.request-primary, .primary-button, .surprise-button, .secondary-save):not(.demo *) {
  --button-floor: 0 3px 0 #20211f26, 0 4px 6px #20211f0a;
  --button-hover-shadow: 0 4px 0 #20211f24, 0 6px 9px #20211f12;
  --button-pressed-shadow: 0 1px 0 #20211f26, inset 0 2px 3px #20211f24;
}

/* Preserve selected colors and borders; selection is independent of physical press. */
body :is(.resource-view-tabs button, .view-toggle button):is([aria-selected="true"], [aria-pressed="true"], .active, .selected) {
  --button-floor: 0 1px 4px #20211f12;
}

body :is(button, a.primary-button, a.secondary-save, .resource-card-actions a, .resource-detail-actions a, .resource-detail-links a):not(.demo-open, .term-body, .resource-body, .demo *, .brand):focus-visible {
  outline: 2px solid #20211f;
  outline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  body :is(button, a.primary-button, a.secondary-save, .resource-card-actions a, .resource-detail-actions a, .resource-detail-links a):not(.demo-open, .term-body, .resource-body, .demo *, .brand, :disabled, [aria-disabled="true"]):hover {
    box-shadow: var(--button-hover-shadow);
    filter: brightness(1.025);
  }
  body :is(button, a.primary-button, a.secondary-save, .resource-card-actions a, .resource-detail-actions a, .resource-detail-links a):not(.demo-open, .term-body, .resource-body, .demo *, .brand, :disabled, [aria-disabled="true"]):hover {
    transform: translateY(-1px);
  }
}

/* :active also covers touch and native button Space presses. */
body :is(button, a.primary-button, a.secondary-save, .resource-card-actions a, .resource-detail-actions a, .resource-detail-links a):not(.demo-open, .term-body, .resource-body, .demo *, .brand, :disabled, [aria-disabled="true"]):is(:active, .is-control-pressed) {
  box-shadow: var(--button-pressed-shadow);
  filter: brightness(.97);
  transition-duration: 25ms;
}
body :is(button, a.primary-button, a.secondary-save, .resource-card-actions a, .resource-detail-actions a, .resource-detail-links a):not(.demo-open, .term-body, .resource-body, .demo *, .brand, :disabled, [aria-disabled="true"]):is(:active, .is-control-pressed) {
  transform: translateY(3px) scale(.97);
}

body :is(button, a.primary-button, a.secondary-save, .resource-card-actions a, .resource-detail-actions a, .resource-detail-links a):not(.demo-open, .term-body, .resource-body, .demo *, .brand):is(:disabled, [aria-disabled="true"]) {
  transform: none;
  box-shadow: var(--button-floor);
  filter: none;
  cursor: default;
  transition: none;
}
body .preview-toggle:disabled:hover { background: #fff; }

@media (hover: none), (pointer: coarse) {
  body :is(button, a.primary-button, a.secondary-save, .resource-card-actions a, .resource-detail-actions a, .resource-detail-links a):not(.demo-open, .term-body, .resource-body, .demo *, .brand):hover:not(:active, .is-control-pressed) {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  body :is(button, a.primary-button, a.secondary-save, .resource-card-actions a, .resource-detail-actions a, .resource-detail-links a):not(.demo-open, .term-body, .resource-body, .demo *, .brand):is(:hover, :active, .is-control-pressed) {
    transform: none;
  }
}
