/*
 * Goaliva calm UX layer.
 *
 * Deliberately additive: preserve the existing open-canvas composition,
 * typography, colors, journey layouts, and route behavior. This layer adds
 * response to interaction without turning the product into a game.
 */
:root {
  --ux-ease: cubic-bezier(.2, .8, .2, 1);
  --ux-focus: #985892;
  --ux-surface-hover: #fffdfa;
  --ux-shadow-soft: 0 8px 24px rgba(50, 16, 47, .07);
}

html {
  scroll-behavior: smooth;
}

.button,
wa-button.button::part(button) {
  transition:
    background-color .18s var(--ux-ease),
    border-color .18s var(--ux-ease),
    color .18s var(--ux-ease),
    box-shadow .18s var(--ux-ease),
    transform .18s var(--ux-ease);
}

.button:hover:not(:disabled),
wa-button.button:hover::part(button) {
  transform: translateY(-1px);
  box-shadow: var(--ux-shadow-soft);
}

.button:active:not(:disabled),
wa-button.button:active::part(button) {
  transform: none;
  box-shadow: none;
}

.card,
wa-card.card,
.create-source,
.source-choices label,
.mode,
.option,
.goal-actions summary {
  transition:
    background-color .18s var(--ux-ease),
    border-color .18s var(--ux-ease),
    box-shadow .18s var(--ux-ease);
}

.card:hover,
wa-card.card:hover,
.create-source:hover,
.goal-actions summary:hover {
  border-color: #dfd0cb;
}

.program-card:hover,
wa-card.program-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--ux-shadow-soft);
}

.option:hover {
  background: var(--ux-surface-hover);
  border-color: #d9c6bf;
}

input:hover,
textarea:hover,
select:hover {
  border-color: #c9aebf;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
wa-button:focus-visible {
  outline: 3px solid var(--ux-focus);
  outline-offset: 3px;
}

.progress-track span {
  transition: width .4s var(--ux-ease);
}

.ux-action-pending {
  cursor: wait !important;
  opacity: .72;
}

.ux-action-pending::after {
  content: '';
  display: inline-block;
  width: .72em;
  height: .72em;
  margin-inline-start: .5em;
  border: 2px solid currentColor;
  border-inline-end-color: transparent;
  border-radius: 50%;
  vertical-align: -.08em;
  animation: ux-spin .8s linear infinite;
}

wa-button.ux-action-pending::part(button) {
  cursor: wait;
  opacity: .72;
}

.ux-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

#ux-connection-status {
  position: fixed;
  inset: 12px 12px auto;
  z-index: 120;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  max-width: min(560px, calc(100% - 24px));
  margin-inline: auto;
  padding: 9px 13px;
  border: 1px solid #e2b9b0;
  border-radius: 12px;
  background: #fff6f1;
  color: var(--ink);
  box-shadow: var(--ux-shadow-soft);
  font-size: 13px;
  text-align: center;
}

#ux-connection-status[hidden] {
  display: none;
}

#ux-connection-status button {
  border: 0;
  border-radius: 8px;
  padding: 3px 7px;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
}

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

@media (max-width: 760px) {
  #ux-connection-status {
    inset-inline: 12px;
    border-radius: 10px;
  }

  .button,
  wa-button.button::part(button) {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }

  .button,
  .button:hover,
  .button:active,
  wa-button.button::part(button),
  wa-button.button:hover::part(button),
  wa-button.button:active::part(button),
  .program-card:hover,
  wa-card.program-card:hover {
    transform: none !important;
  }
}
