:root {
  --gbam-motion-fast: 140ms;
  --gbam-motion-enter: 260ms;
  --gbam-motion-ease: cubic-bezier(.2, .7, .2, 1);
}

@keyframes gbam-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes gbam-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes gbam-spin { to { transform: rotate(360deg); } }

.assistant-log[aria-busy="true"]::after {
  content: "";
  width: 16px;
  height: 16px;
  flex: none;
  align-self: flex-start;
  border: 2px solid var(--gbam-blue);
  border-right-color: transparent;
  border-radius: 50%;
}

@media (prefers-reduced-motion: no-preference) {
  .masthead, body > main > header {
    animation: gbam-fade 200ms ease-out backwards;
  }
  .intro, .destination, .home-shortcuts, .android-download,
  .travel-assistant, .operator-directory, .page > footer,
  body > main > [data-locale]:not([hidden]), body > main > section {
    animation: gbam-enter var(--gbam-motion-enter) var(--gbam-motion-ease) backwards;
  }
  .destination:nth-child(2) { animation-delay: 45ms; }
  .home-shortcuts { animation-delay: 65ms; }
  .android-download { animation-delay: 85ms; }
  .travel-assistant { animation-delay: 105ms; }
  .operator-directory, .page > footer { animation-delay: 125ms; }
  .assistant-message, .assistant-place-choices button,
  details[open] > :not(summary) {
    animation: gbam-enter 180ms var(--gbam-motion-ease) backwards;
  }
  .assistant-log[aria-busy="true"]::after { animation: gbam-spin 800ms linear infinite; }
  :is(.page, body > main) :is(a, button, summary) {
    transition: transform var(--gbam-motion-fast) var(--gbam-motion-ease),
      background-color var(--gbam-motion-fast) ease,
      border-color var(--gbam-motion-fast) ease,
      color var(--gbam-motion-fast) ease,
      box-shadow var(--gbam-motion-fast) ease,
      opacity var(--gbam-motion-fast) ease;
  }
  :is(.page, body > main) :is(input, select, textarea) {
    transition: border-color var(--gbam-motion-fast) ease,
      box-shadow var(--gbam-motion-fast) ease,
      background-color var(--gbam-motion-fast) ease;
  }
  .destination .card-arrow, .bus-keypad-shortcut [aria-hidden],
  .android-download-button span {
    display: inline-block;
    transition: transform 180ms var(--gbam-motion-ease);
  }
  .destination:focus-visible .card-arrow { transform: translate(3px, -3px); }
  .destination:active, .page button:enabled:active,
  .page :is(.android-download-button, .bus-keypad-shortcut, .sources-button):active {
    transform: scale(.985);
  }
  @media (hover: hover) and (pointer: fine) {
    .destination:hover { transform: translateY(-3px); box-shadow: 0 8px 20px #172b4310; }
    .destination:hover .card-arrow { transform: translate(3px, -3px); }
    .bus-keypad-shortcut:hover [aria-hidden] { transform: translateX(3px); }
    .android-download-button:hover span { transform: translateY(3px); }
    .android-download-button:hover { transform: translateY(-1px); }
    .page :is(.operator-link, .sources-button):hover { transform: translateY(-2px); }
    .page button:enabled:hover { filter: brightness(.97); }
  }
  /* Keep long legal documents readable without compositing the whole page. */
  body > main > [data-locale]:not([hidden]) { animation: none; }
  body > main > [data-locale]:not([hidden]) > :is(h1, p:first-of-type) {
    animation: gbam-enter 180ms var(--gbam-motion-ease) backwards;
  }
  @media (max-width: 767px), (pointer: coarse) {
    :root { --gbam-motion-enter: 200ms; }
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
