/* Pagewise shared public-surface motion. Deliberately quiet: motion confirms
   intent and hierarchy, never competes with reading. */
:root {
  --pw-site-ease: cubic-bezier(.22, 1.08, .36, 1);
  --pw-site-shadow: 0 16px 38px -30px rgba(57, 43, 92, .34);
  --pw-site-shadow-raised: 0 24px 50px -32px rgba(83, 64, 145, .42);
}

html { scroll-behavior: smooth; }
::selection { background: rgba(120, 101, 255, .19); color: inherit; }

@media (hover: hover) and (pointer: fine) {
  :is(.pathway, .choice, .card, .login-card, .panel, .bi-control-surface,
      .result-area, .nordic-bookcase, .catalogue-route, .book-list-item,
      .share-card, .demo-card, .legal-card, .article-card) {
    transition: transform .32s var(--pw-site-ease), box-shadow .32s var(--pw-site-ease),
      border-color .24s ease, background-color .24s ease, filter .24s ease;
  }
  :is(.pathway, .choice, .book-list-item, .demo-card):hover {
    transform: translateY(-2px);
    box-shadow: var(--pw-site-shadow-raised);
  }
  :is(.panel, .bi-control-surface, .result-area, .nordic-bookcase, .catalogue-route,
      .share-card, .login-card, .legal-card, .article-card):hover {
    box-shadow: var(--pw-site-shadow);
  }
  :is(button, a, [role="button"]):not([disabled]) {
    transition: transform .2s var(--pw-site-ease), box-shadow .24s var(--pw-site-ease),
      border-color .2s ease, background-color .2s ease, color .2s ease, opacity .2s ease;
  }
  :is(button, [role="button"]):not([disabled]):active { transform: translateY(0) scale(.985); }
  :is(.choice, .pathway, .book-list-item):hover :is(.arrow, .mode-arrow) { transform: translateX(3px); }
}

:is(a, button, input, textarea, select, [role="button"]):focus-visible {
  outline: 3px solid rgba(107, 95, 255, .28);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Phone ergonomics are a baseline rather than a visual variant.  These
   public controls appear on the catalogue, entry, and sign-in routes; keep
   them comfortably tappable without changing the desktop composition. */
@media (max-width: 760px) {
  :is(.back, .booklist-toggle, .mode-tab, .choice, .button, .chip-filter,
      .catalogue-search-suggestions button, .result-filter button,
      .catalogue-chip, .book-list-item, .pathway) {
    touch-action: manipulation;
  }
  :is(.back, .booklist-toggle, .choice, .button, .chip-filter,
      .catalogue-search-suggestions button, .catalogue-chip) {
    min-height: 44px;
  }
  input, textarea, select { font-size: max(16px, 1rem); }
}
