/* Track Mishnah UI 2.17.21
 * Rebalanced dashboard card heights and restored normal page-wheel scrolling
 * over the left dashboard stack.
 * Presentation-only: no database/schema, assignment, reminder, permission,
 * export, or messaging-data behavior changes.
 */

@media (min-width: 1220px) {
  /* Keep the dashboard matched to My Learning, but let wheel/touch gestures
   * over the left stack continue to the page instead of being trapped by the
   * old overscroll containment rule. */
  body.app-theme-jewel .dashboard-primary-workspace > .project-overview {
    height: var(--tm-dashboard-workspace-height) !important;
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    overscroll-behavior: auto !important;
    overscroll-behavior-y: auto !important;
    scrollbar-gutter: auto !important;
    touch-action: pan-y;
  }

  /* The top Overview card and bottom Project Progress card get the visual
   * weight; Continue Learning and My Progress stay intentionally shorter. */
  body.app-theme-jewel .dashboard-primary-workspace .project-overview-heading {
    flex: 0 0 175px;
    min-height: 175px;
    align-content: center;
  }

  body.app-theme-jewel .dashboard-primary-workspace .dashboard-command-grid {
    min-height: 0;
    flex: 1 1 auto !important;
    grid-template-rows:
      minmax(0, .8fr)
      minmax(0, .8fr)
      minmax(0, 1.4fr) !important;
  }

  body.app-theme-jewel .dashboard-primary-workspace .continue-learning-card,
  body.app-theme-jewel .dashboard-primary-workspace .personal-dashboard-summary,
  body.app-theme-jewel .dashboard-primary-workspace .project-progress-card {
    min-height: 0 !important;
  }

  body.app-theme-jewel .dashboard-primary-workspace .continue-learning-card,
  body.app-theme-jewel .dashboard-primary-workspace .personal-dashboard-summary {
    padding-block: 6px;
  }

  body.app-theme-jewel .dashboard-primary-workspace .project-progress-card {
    padding-block: 10px;
  }
}

@media (min-width: 1220px) and (max-height: 760px) {
  /* On shorter desktop windows, keep the same visual hierarchy while avoiding
   * impossible minimums that would make the stack exceed its workspace. */
  body.app-theme-jewel .dashboard-primary-workspace .project-overview-heading {
    flex-basis: 150px;
    min-height: 150px;
  }

  body.app-theme-jewel .dashboard-primary-workspace .dashboard-command-grid {
    grid-template-rows:
      minmax(0, .82fr)
      minmax(0, .82fr)
      minmax(0, 1.36fr) !important;
  }
}
