/* OnlyShows 0.11.7: joined database base, softer fades, and stable profile transitions. */

@media (max-width: 719px) {
  body.mobile-database-tab .library:not([hidden]) {
    bottom: calc(178px + env(safe-area-inset-bottom));
  }

  .mobile-workspace-heading {
    margin-bottom: 4px !important;
  }

  body:not(.mobile-profile-tab) .show-grid {
    --library-fade-size: 80px;
    -webkit-mask-image: linear-gradient(
      to bottom,
      transparent 0,
      rgb(0 0 0 / 8%) 10px,
      rgb(0 0 0 / 28%) 26px,
      rgb(0 0 0 / 58%) 46px,
      rgb(0 0 0 / 82%) 64px,
      #000 var(--library-fade-size),
      #000 calc(100% - var(--library-fade-size)),
      rgb(0 0 0 / 82%) calc(100% - 64px),
      rgb(0 0 0 / 58%) calc(100% - 46px),
      rgb(0 0 0 / 28%) calc(100% - 26px),
      rgb(0 0 0 / 8%) calc(100% - 10px),
      transparent 100%
    );
    mask-image: linear-gradient(
      to bottom,
      transparent 0,
      rgb(0 0 0 / 8%) 10px,
      rgb(0 0 0 / 28%) 26px,
      rgb(0 0 0 / 58%) 46px,
      rgb(0 0 0 / 82%) 64px,
      #000 var(--library-fade-size),
      #000 calc(100% - var(--library-fade-size)),
      rgb(0 0 0 / 82%) calc(100% - 64px),
      rgb(0 0 0 / 58%) calc(100% - 46px),
      rgb(0 0 0 / 28%) calc(100% - 26px),
      rgb(0 0 0 / 8%) calc(100% - 10px),
      transparent 100%
    );
  }

  body:not(.mobile-profile-tab) .library.library-at-top:not(.library-at-bottom) .show-grid {
    -webkit-mask-image: linear-gradient(
      to bottom,
      #000 0,
      #000 calc(100% - var(--library-fade-size)),
      rgb(0 0 0 / 82%) calc(100% - 64px),
      rgb(0 0 0 / 58%) calc(100% - 46px),
      rgb(0 0 0 / 28%) calc(100% - 26px),
      rgb(0 0 0 / 8%) calc(100% - 10px),
      transparent 100%
    );
    mask-image: linear-gradient(
      to bottom,
      #000 0,
      #000 calc(100% - var(--library-fade-size)),
      rgb(0 0 0 / 82%) calc(100% - 64px),
      rgb(0 0 0 / 58%) calc(100% - 46px),
      rgb(0 0 0 / 28%) calc(100% - 26px),
      rgb(0 0 0 / 8%) calc(100% - 10px),
      transparent 100%
    );
  }

  body:not(.mobile-profile-tab) .library.library-at-bottom:not(.library-at-top) .show-grid {
    -webkit-mask-image: linear-gradient(
      to bottom,
      transparent 0,
      rgb(0 0 0 / 8%) 10px,
      rgb(0 0 0 / 28%) 26px,
      rgb(0 0 0 / 58%) 46px,
      rgb(0 0 0 / 82%) 64px,
      #000 var(--library-fade-size),
      #000 100%
    );
    mask-image: linear-gradient(
      to bottom,
      transparent 0,
      rgb(0 0 0 / 8%) 10px,
      rgb(0 0 0 / 28%) 26px,
      rgb(0 0 0 / 58%) 46px,
      rgb(0 0 0 / 82%) 64px,
      #000 var(--library-fade-size),
      #000 100%
    );
  }

  body.mobile-database-tab #mobileWorkspaceDock {
    bottom: calc(68px + env(safe-area-inset-bottom)) !important;
  }

  body.mobile-database-tab .mobile-database-actions {
    border-bottom: 0 !important;
    border-radius: 26px 26px 0 0 !important;
    background: var(--surface-container-high) !important;
    box-shadow: 0 -6px 18px rgb(0 0 0 / 10%) !important;
  }

  html body.mobile-database-tab .mobile-bottom-nav {
    border-top-color: transparent !important;
    border-radius: 0 0 30px 30px !important;
    background: var(--surface-container-high) !important;
    box-shadow: 0 10px 26px rgb(0 0 0 / 18%) !important;
  }

  .show-grid.mobile-grid-odd:not(.mobile-list-view) > .show-card:first-of-type {
    grid-column: 2;
  }

  body.mobile-profile-tab .profile-dialog.mobile-tab-page[open] .insights-head,
  body.mobile-profile-tab .profile-dialog.mobile-tab-page[open] .insights-scroll {
    animation: profile-content-fade 220ms ease both !important;
  }

  .profile-dialog.mobile-tab-page .insights-scroll {
    padding-bottom: 80px !important;
    -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 76px), transparent 100%);
    mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 76px), transparent 100%);
  }

  .search-dialog .remote-result .add-result {
    display: inline-flex;
    min-width: 72px;
    height: 40px;
    padding: 0 15px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    line-height: 1;
    text-align: center;
    transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease;
  }

  .search-dialog .remote-result .add-result:active:not(:disabled) {
    transform: scale(.96);
  }
}

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

@media (prefers-reduced-motion: reduce) {
  body.mobile-profile-tab .profile-dialog.mobile-tab-page[open] .insights-head,
  body.mobile-profile-tab .profile-dialog.mobile-tab-page[open] .insights-scroll {
    animation: none !important;
  }
}
