/* Webster International shared motion and interaction polish.
   Deliberately presentation-only: no content, state or navigation changes. */
:root {
  --wi-motion-quick: 160ms;
  --wi-motion-normal: 240ms;
  --wi-motion-ease: cubic-bezier(.22, 1, .36, 1);
  --wi-motion-shadow: 0 12px 30px rgb(8 23 46 / 12%);
}

/* Consistent feedback without overriding individual page colour systems. */
:is(.button, .linkbtn, .pillbtn, .ax-actions a, .ax-jump a, .case-nav a, .nav-contact) {
  transition:
    transform var(--wi-motion-quick) var(--wi-motion-ease),
    box-shadow var(--wi-motion-normal) ease,
    background-color var(--wi-motion-quick) ease,
    color var(--wi-motion-quick) ease,
    border-color var(--wi-motion-quick) ease;
}
:is(.work-card, .service-teaser, .milestone-card, main .card, .ax-card, .progressPanel, .panel, .stat) {
  transition:
    transform var(--wi-motion-normal) var(--wi-motion-ease),
    box-shadow var(--wi-motion-normal) ease,
    border-color var(--wi-motion-quick) ease,
    background-color var(--wi-motion-quick) ease;
}
:is(#navlinks a, .navlinks a, .top .links a, .item) {
  transition:
    color var(--wi-motion-quick) ease,
    background-color var(--wi-motion-quick) ease,
    border-color var(--wi-motion-quick) ease,
    box-shadow var(--wi-motion-quick) ease;
}
:is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  transition: border-color var(--wi-motion-quick) ease, box-shadow var(--wi-motion-quick) ease, background-color var(--wi-motion-quick) ease;
}
:is(input:not([type="checkbox"]):not([type="radio"]), select, textarea):focus-visible {
  box-shadow: 0 0 0 3px rgb(22 86 217 / 12%);
}

/* Generic native controls and ordinary text links get smooth states, too. */
:where(button, [role="button"]) {
  transition:
    background-color var(--wi-motion-quick) ease,
    border-color var(--wi-motion-quick) ease,
    color var(--wi-motion-quick) ease,
    box-shadow var(--wi-motion-quick) ease,
    filter var(--wi-motion-quick) ease,
    transform var(--wi-motion-quick) var(--wi-motion-ease);
}
:where(main a:not([class])) {
  transition: color var(--wi-motion-quick) ease, text-decoration-color var(--wi-motion-quick) ease;
}
@media (hover: hover) and (pointer: fine) {
  button:not(:disabled):not(.item):not(.menu):hover {
    filter: brightness(1.045);
  }
  button:not(:disabled):not(.item):not(.menu):active {
    transform: scale(.985);
  }
}

/* A moving underline for the shared site navigation, except on the active page. */
#navlinks a:not(.nav-contact):not([aria-current]) {
  position: relative;
}
#navlinks a:not(.nav-contact):not([aria-current])::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 3px;
  left: 0;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--wi-motion-normal) var(--wi-motion-ease);
}
#navlinks a:not(.nav-contact):not([aria-current]):is(:hover, :focus-visible)::after {
  transform: scaleX(1);
}

/* Subtle tactile polish for pointer devices. Keep focus outlines intact. */
@media (hover: hover) and (pointer: fine) {
  :is(.button, .linkbtn, .pillbtn, .ax-actions a, .ax-jump a, .case-nav a, .nav-contact):not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: var(--wi-motion-shadow);
  }
  :is(.button, .linkbtn, .pillbtn, .ax-actions a, .ax-jump a, .case-nav a, .nav-contact):not(:disabled):active {
    transform: translateY(0) scale(.985);
    box-shadow: none;
  }
  :is(.work-card, .service-teaser, .milestone-card, main .card, .ax-card, .progressPanel, .panel, .stat):hover {
    transform: translateY(-3px);
    box-shadow: var(--wi-motion-shadow);
  }
  .navigation .brand img {
    transition: transform var(--wi-motion-normal) var(--wi-motion-ease);
  }
  .navigation .brand:hover img {
    transform: scale(1.025);
  }
}

/* Gentle disclosure feedback; the details element remains semantic and keyboard-usable. */
@keyframes wi-details-in {
  from { opacity: .55; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}
details[open] > :not(summary) {
  animation: wi-details-in var(--wi-motion-normal) var(--wi-motion-ease) both;
}

/* Progressive enhancement for same-origin full-page navigation. */
@view-transition {
  navigation: auto;
}
::view-transition-old(root), ::view-transition-new(root) {
  animation-duration: 180ms;
}

/* Reduced-motion preferences apply to CSS and JS (the JS checks matchMedia). */
@media (prefers-reduced-motion: reduce) {
  html:focus-within { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  ::view-transition-old(root), ::view-transition-new(root) {
    animation-duration: .01ms !important;
  }
}
