/* Shared raised-button interaction. Existing colors, markup and positioning stay intact. */
:where(button,[role="button"],summary,input[type="submit"],input[type="button"],input[type="reset"],input[type="image"],a[href]:not(.brand):not(.bpi_thumb),a.cm-secondary,.gallery-photo[tabindex="0"]) {
  --press-rest: 4px;
  --press-hover: 6px;
  --press-active: 2px;
  --press-edge: rgba(12,35,56,.38);
  --press-shadow: rgba(0,0,0,.2);
  --press-inset: inset 0 0 0 transparent;
}
html body :is(button,[role="button"],summary,input[type="submit"],input[type="button"],input[type="reset"],input[type="image"],a[href]:not(.brand):not(.bpi_thumb),a.cm-secondary,.gallery-photo[tabindex="0"]):not(.social-button):not(:disabled):not([aria-disabled="true"]) {
  --press-depth: var(--press-rest);
  translate: 0 calc(-1 * var(--press-depth));
  box-shadow: 0 var(--press-depth) 0 var(--press-edge), 0 calc(var(--press-depth) + 2px) 4px var(--press-shadow), var(--press-inset);
  transition: translate 600ms cubic-bezier(.3,.7,.4,1), box-shadow 600ms cubic-bezier(.3,.7,.4,1), background-color 200ms ease, color 200ms ease;
  -webkit-tap-highlight-color: transparent;
}

html body :is(button,[role="button"],summary,input[type="submit"],input[type="button"],input[type="reset"],input[type="image"],a[href]:not(.brand):not(.bpi_thumb),a.cm-secondary,.gallery-photo[tabindex="0"]):not(.social-button):not(:disabled):not([aria-disabled="true"]):is(:hover,:focus-visible) {
  --press-depth: var(--press-hover);
  transition: translate 250ms cubic-bezier(.3,.7,.4,1.5), box-shadow 250ms cubic-bezier(.3,.7,.4,1.5), background-color 200ms ease, color 200ms ease;
}

html body :is(button,[role="button"],summary,input[type="submit"],input[type="button"],input[type="reset"],input[type="image"],a[href]:not(.brand):not(.bpi_thumb),a.cm-secondary,.gallery-photo[tabindex="0"]):not(.social-button):not(:disabled):not([aria-disabled="true"]):active {
  --press-depth: var(--press-active);
  transition: translate 34ms, box-shadow 34ms, background-color 200ms ease, color 200ms ease;
}

/* Shade the edge using each button's existing palette. */
html body :is(a,button,input).button.green { --press-edge: #116340; }
html body :is(a,button,input).button.blue { --press-edge: #174579; }
html body :is(a,button,input).button.yellow,
html body a.header-cta { --press-edge: #b79327; }
html body :is(a,button,input).button.light { --press-edge: #b9c6ce; }
html body .jp-news-carousel :is(.jn-all,.jn-arrow,.jn-share) { --press-edge: #7c151b; }

/* Small, densely packed controls need less travel than the main calls to action. */
html body :is(.menu-toggle,.jp-language-switcher button,.cal-day,.cal-agenda-item,.cm-group button,.carousel-dots button,.cm-empty button,.leaflet-control-zoom a) {
  --press-rest: 1px;
  --press-hover: 3px;
  --press-active: 0px;
}

/* Text actions must be transformable without changing their colors or typography. */
html body :is(a.card-link,a.cm-directory-link,.cm-popup a,.cm-map-note a,.bpi_details h3 a,a.cal-event-link,.leaflet-control-attribution a) {
  display: inline-block;
}
html body .nav a { display: block; }
/* Retain the navigation underline and avoid boxed shadows on plain text or map pins. */
html body :is(.nav a,.footer a:not(.social-button):not(.brand),.bpi_details h3 a,.cm-map-note a,.leaflet-control-attribution a,.leaflet-popup-close-button,.leaflet-marker-icon,.gallery-photo[tabindex="0"]) {
  --press-rest: 0px;
  --press-hover: 2px;
  --press-active: 0px;
  --press-edge: transparent;
  --press-shadow: transparent;
}
html body .nav a:is(:hover,.active) { --press-inset: inset 0 -3px var(--yellow); }
html body :is(a.card-link,a.cm-directory-link,.cm-popup a,a.cal-event-link) {
  --press-rest: 1px;
  --press-hover: 3px;
  --press-active: 0px;
}

/* Keep keyboard navigation visible, and never animate unavailable controls. */
html body :is(button,[role="button"],summary,input[type="submit"],input[type="button"],input[type="reset"],input[type="image"],a[href]:not(.brand):not(.bpi_thumb),a.cm-secondary,.gallery-photo[tabindex="0"]):not(.social-button):focus-visible {
  outline: 3px solid #2365b5;
  outline-offset: 5px;
}
html body :is(button,input[type="submit"],input[type="button"],input[type="reset"]):disabled,
html body [aria-disabled="true"] {
  translate: none;
}

@media (prefers-reduced-motion: reduce) {
  html body :is(button,[role="button"],summary,input[type="submit"],input[type="button"],input[type="reset"],input[type="image"],a[href]:not(.brand):not(.bpi_thumb),a.cm-secondary,.gallery-photo[tabindex="0"]):not(.social-button) {
    transition: none !important;
    translate: none !important;
  }
}
