.orderly-loading {
  display: inline-flex;
  align-items: center;
  gap: .55em;
}

.orderly-loading::before, button[data-working]::before {
  content: "";
  display: inline-block;
  flex: none;
  width: var(--loader-width, 1.45em);
  aspect-ratio: 815 / 615;
  vertical-align: -.18em;
  background: currentColor;
  mask: url('/brand/orderly-mini-black.svg') center / contain no-repeat;
}

button[data-working]:not(:has(> .icon))::before { margin-inline-end: .32em; }
button[data-working] > .icon { display: none; }

/* Two-part ticket buttons keep their label and stub in place: the mark sits inside the label. */
button[data-working]:is(.action-ticket, .flow-next, .shop-bar-button, .ticket-fab)::before { content: none; }
button[data-working] > :is(.action-ticket-label, .flow-next-label)::before,
button[data-working].shop-bar-button > span:first-child > b::before {
  content: "";
  display: inline-block;
  flex: none;
  width: 1.3em;
  aspect-ratio: 815 / 615;
  margin-inline-end: .45em;
  vertical-align: -.12em;
  background: currentColor;
  mask: url('/brand/orderly-mini-black.svg') center / contain no-repeat;
}
/* The label stays centred: the mark sits beside the words, never above them. */
button[data-working] > :is(.action-ticket-label, .flow-next-label) { display: flex; align-items: center; justify-content: center; }
/* Busy controls ignore a second tap until the first one finishes. */
[data-working] { cursor: progress; pointer-events: none; }

.orderly-page-loading {
  --loader-width: 2.6rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: clamp(132px, 22vh, 220px);
  color: var(--muted);
  font-weight: 650;
  text-align: center;
}

.orderly-navigation-loading {
  position: fixed;
  z-index: 35;
  inset-block-end: max(16px, env(safe-area-inset-bottom));
  inset-inline: 0;
  width: max-content;
  max-width: calc(100% - 28px);
  margin-inline: auto;
  padding: .65rem .9rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--sheet);
  color: var(--accent-dark);
  box-shadow: 0 3px 12px #1b242019;
  font-size: .875rem;
  font-weight: 700;
  pointer-events: none;
}

.orderly-loading[hidden] { display: none; }

@media (scripting: none) {
  .orderly-js-loading { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  ::view-transition-group(root) { animation-duration: 220ms; }

  main:not([aria-busy="true"]), [data-page-enter] {
    animation: orderly-page-rise 560ms cubic-bezier(.2, .72, .22, 1);
  }

  .orderly-loading::before, button[data-working]::before,
  button[data-working] > :is(.action-ticket-label, .flow-next-label)::before,
  button[data-working].shop-bar-button > span:first-child > b::before {
    background-image: linear-gradient(112deg, transparent 39%, currentColor 50%, transparent 61%);
    background-color: color-mix(in srgb, currentColor 52%, transparent);
    background-size: 310% 100%;
    background-position: 100% 0;
    animation: orderly-ink-sweep 1.45s cubic-bezier(.35, .05, .45, 1) infinite;
  }

  @keyframes orderly-page-rise {
    from { opacity: .55; translate: 0 17px; }
  }

  @keyframes orderly-ink-sweep {
    0% { background-position: 100% 0; translate: -1px 0; }
    72%, 100% { background-position: 0 0; translate: 1px 0; }
    92%, 100% { translate: -1px 0; }
  }
}

/* Dialogs lift in and settle out instead of popping. The My tickets drawer
   keeps its own slide. */
@media (prefers-reduced-motion: no-preference) {
  dialog:not(.ticket-drawer) {
    opacity: 0;
    transform: translateY(14px) scale(.985);
    transition: opacity 220ms ease, transform 320ms cubic-bezier(.2, .8, .2, 1), overlay 320ms allow-discrete, display 320ms allow-discrete;
  }
  dialog:not(.ticket-drawer)[open] { opacity: 1; transform: none; }
  @starting-style {
    dialog:not(.ticket-drawer)[open] { opacity: 0; transform: translateY(14px) scale(.985); }
  }
  dialog:not(.ticket-drawer)::backdrop {
    background-color: transparent;
    transition: background-color 280ms ease, overlay 320ms allow-discrete, display 320ms allow-discrete;
  }
  dialog:not(.ticket-drawer)[open]::backdrop { background-color: #1b242066; }
  @starting-style {
    dialog:not(.ticket-drawer)[open]::backdrop { background-color: transparent; }
  }

  /* A light press on everything tappable. */
  :is(.button, .icon-action, .hub-tile, .settings-row, .flow-choice):active:not(:disabled) { transform: translateY(1px); }
  :is(.button, .icon-action, .hub-tile, .settings-row) { transition: transform 120ms ease, background-color 160ms ease, border-color 160ms ease, color 160ms ease; }
}
