:root {
  --arcana-motion-ease: cubic-bezier(.22, .72, .26, 1);
  --arcana-motion-fast: 160ms;
  --arcana-motion-medium: 260ms;
}

.brand {
  position: relative;
  isolation: isolate;
}

.brand::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: -11px auto -11px -10px;
  width: 72px;
  border-radius: 50%;
  background: radial-gradient(ellipse, #ffca7c4d, transparent 70%);
  opacity: 0;
  pointer-events: none;
}

.page-top {
  position: relative;
  isolation: isolate;
}

.page-top::before,
.page-top::after {
  content: '';
  position: absolute;
  z-index: -1;
  pointer-events: none;
}

.page-top::before {
  inset: -14px 0 -7px;
  background: radial-gradient(ellipse at 18% 60%, #52243144, transparent 70%);
}

.page-top::after {
  inset: auto 0 -8px;
  height: 1px;
  background: linear-gradient(90deg, #d59d65b3, #97536373 25%, #57323c40 70%, transparent);
  transform-origin: left;
}

.library-controls:focus-within {
  border-color: #b77571;
  box-shadow: 0 0 0 3px #aa57591c;
}

.library-controls .search-field:focus-within > svg {
  color: #ffe3ad;
}

@media (prefers-reduced-motion: no-preference) {
  .motion-brand-enter .brand-mark {
    animation: arcana-mark-deal 660ms var(--arcana-motion-ease);
  }

  .motion-brand-enter .brand-name {
    animation: arcana-wordmark-in 460ms 45ms var(--arcana-motion-ease) backwards;
  }

  .brand::before {
    transition: opacity var(--arcana-motion-medium) var(--arcana-motion-ease);
  }

  .brand.motion-brand-enter::before {
    animation: arcana-mark-glow 780ms ease-out;
  }

  .brand-mark {
    transition: transform var(--arcana-motion-medium) var(--arcana-motion-ease);
  }

  .brand:is(:hover, :focus-visible) .brand-mark {
    transform: translateY(-2px) rotate(-7deg) scale(1.05);
  }

  .brand:is(:hover, :focus-visible)::before {
    opacity: 1;
  }

  .motion-heading-enter h1 {
    animation: arcana-heading-rise 440ms var(--arcana-motion-ease);
  }

  .motion-heading-enter :is(p, .header-actions, .discovery-header-actions) {
    animation: arcana-heading-rise 380ms 45ms var(--arcana-motion-ease) backwards;
  }

  .motion-heading-enter::before {
    animation: arcana-wash-in 610ms var(--arcana-motion-ease);
  }

  .motion-heading-enter::after {
    animation: arcana-rule-in 610ms var(--arcana-motion-ease);
  }

  .sidebar .nav-button {
    transition: background-color var(--arcana-motion-fast), border-color var(--arcana-motion-fast),
      color var(--arcana-motion-fast), scale var(--arcana-motion-fast) var(--arcana-motion-ease);
  }

  .sidebar .nav-button > :is(svg:first-child, .nav-title, .nav-count) {
    transition: translate var(--arcana-motion-fast) var(--arcana-motion-ease),
      rotate var(--arcana-motion-fast) var(--arcana-motion-ease), color var(--arcana-motion-fast);
  }

  .sidebar .nav-button:active {
    scale: .985;
  }

  .sidebar .nav-button:is(:hover, :focus-visible) > svg:first-child {
    rotate: -7deg;
    translate: 2px 0;
  }

  .sidebar .nav-button:is(:hover, :focus-visible) > .nav-title {
    translate: 3px 0;
  }

  .sidebar .nav-button:is(:hover, :focus-visible) > .nav-count {
    translate: -2px 0;
  }

  #app:has(.motion-heading-enter) .sidebar .nav-button.active::before {
    animation: arcana-active-rail 340ms var(--arcana-motion-ease);
  }

  #app:has(.motion-heading-enter) .sidebar .nav-button.active > .nav-count {
    animation: arcana-count-in 300ms var(--arcana-motion-ease);
  }

  :is(.button, .icon-button, .text-link, .discovery-tabs > button) {
    transition: background-color var(--arcana-motion-fast), border-color var(--arcana-motion-fast),
      color var(--arcana-motion-fast), box-shadow var(--arcana-motion-fast),
      scale var(--arcana-motion-fast) var(--arcana-motion-ease);
  }

  :is(.button, .icon-button, .text-link, .discovery-tabs > button):active:not(:disabled):not([aria-disabled="true"]) {
    scale: .96;
  }

  .button.primary:is(:hover, :focus-visible):not(:disabled) {
    box-shadow: inset 0 1px #fff9dbd9, 0 3px 18px #ffb45438;
  }

  .button.primary > svg,
  .browse-button > svg,
  .mobile-drawer-close > svg {
    transition: rotate var(--arcana-motion-medium) var(--arcana-motion-ease);
  }

  .button.primary:is(:hover, :focus-visible) > svg {
    rotate: 8deg;
  }

  .browse-button:is(:hover, :focus-visible) > svg,
  .mobile-drawer-close:is(:hover, :focus-visible) > svg {
    rotate: -8deg;
  }

  .library-controls,
  :is(input:not([type="checkbox"]), select, textarea) {
    transition: border-color var(--arcana-motion-fast), box-shadow var(--arcana-motion-medium);
  }

  .library-controls .filter-toggle > svg,
  .library-controls .search-field > svg {
    transition: color var(--arcana-motion-fast), scale var(--arcana-motion-medium) var(--arcana-motion-ease);
  }

  .library-controls .filter-toggle[aria-expanded="true"] > svg,
  .library-controls .search-field:focus-within > svg {
    scale: 1.12;
  }
}

@media (max-width: 900px) and (prefers-reduced-motion: no-preference) {
  .sidebar.motion-drawer-enter {
    animation: arcana-drawer-slide var(--arcana-motion-medium) var(--arcana-motion-ease);
  }

  .sidebar.motion-drawer-exit {
    animation: arcana-drawer-slide 230ms ease-in reverse;
  }

  .menu-backdrop.motion-drawer-exit {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: #000b;
    backdrop-filter: blur(3px);
    pointer-events: none;
  }

  .menu-backdrop.motion-drawer-enter {
    animation: arcana-drawer-shade var(--arcana-motion-medium) ease-out;
  }

  .menu-backdrop.motion-drawer-exit {
    animation: arcana-drawer-shade 230ms ease-out reverse both;
  }

  .motion-drawer-enter > :is(.sidebar-brand, .sidebar-group, .sidebar-utility, .sidebar-bottom) {
    animation: arcana-drawer-content 260ms 40ms var(--arcana-motion-ease) backwards;
  }

  .motion-drawer-enter > .sidebar-brand + .sidebar-group {
    animation-delay: 75ms;
  }

  .motion-drawer-enter > .sidebar-categories {
    animation-delay: 105ms;
  }
}

@keyframes arcana-mark-deal {
  from { opacity: .55; transform: translate(-6px, 5px) rotate(-21deg) scale(.87); }
  70% { opacity: 1; transform: translate(0, -2px) rotate(5deg) scale(1.05); }
  to { transform: none; }
}

@keyframes arcana-wordmark-in {
  from { opacity: .58; translate: -7px 0; }
  to { opacity: 1; translate: 0; }
}

@keyframes arcana-mark-glow {
  from, to { opacity: 0; }
  45% { opacity: 1; }
}

@keyframes arcana-heading-rise {
  from { opacity: .62; translate: 0 9px; }
  to { opacity: 1; translate: 0; }
}

@keyframes arcana-wash-in {
  from { opacity: 0; }
  48% { opacity: 1; }
}

@keyframes arcana-rule-in {
  from { opacity: .1; transform: scaleX(.04); }
  to { opacity: 1; transform: scaleX(1); }
}

@keyframes arcana-active-rail {
  from { opacity: .34; scale: 1 .28; }
  to { opacity: 1; scale: 1 1; }
}

@keyframes arcana-count-in {
  from { scale: .86; }
  58% { scale: 1.09; }
  to { scale: 1; }
}

@keyframes arcana-drawer-slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes arcana-drawer-shade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes arcana-drawer-content {
  from { opacity: .7; translate: -10px 0; }
  to { opacity: 1; translate: 0; }
}
