.workspace--list {
  position: fixed;
  right: var(--rem-24);
  bottom: var(--rem-24);
  /* Above every page element, below every modal backdrop. The lowest of those
     is the document review's, at 899. */
  z-index: 800;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--rem-8);
  width: 19.75rem; /* 316px */
}

/* Only shown while the list is expanded. buttons.css sets the shared shadow
   from a nested rule whose parent list includes a[role="button"].buttons--button,
   so beating it needs this much selector. */
.workspace--list .buttons--button[data-type="outlined"][data-style="neutral"].workspace--collapse {
  display: none;
  box-shadow: var(--shadow-neutral-lg);
}

.workspace--cards {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.workspace--card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--rem-8);
  width: 100%;
  padding: var(--rem-12) var(--rem-12) var(--rem-12) var(--rem-16);
  background: var(--surface-primary);
  border: 1.5px solid var(--border-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-neutral-lg);
  cursor: pointer;
}

/* A margin rather than a gap, so folding can animate it. */
.workspace--card + .workspace--card {
  margin-top: 2px;
}

/* Each card stays under the one before it, including while they slide past each other. */
.workspace--card-top {
  z-index: 4;
}

.workspace--card:nth-child(2) {
  z-index: 3;
}

.workspace--card:nth-child(3) {
  z-index: 2;
}

.workspace--card:nth-child(4) {
  z-index: 1;
}

/* The "<N> IN PROGRESS" row: only the top card renders it, and only while collapsed. */
.workspace--summary {
  display: flex;
  align-items: center;
  /* buttons.css centres every bare button; this row reads from the left. */
  justify-content: flex-start;
  gap: 2px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* A universal `* { color: … }` rule in application.css sets colour on every
   element directly, so these cannot be inherited from the button. */
.workspace--count {
  font-size: var(--rem-10);
  /* Without this the row is taller than its text. */
  line-height: 1;
  color: var(--text-action-neutral-secondary);
  font-variation-settings: "wght" var(--text-medium);
}

.workspace--card-body {
  display: flex;
  align-items: center;
  gap: var(--rem-8);
  width: 100%;
}

.workspace--card-text {
  display: flex;
  flex-direction: column;
  gap: var(--rem-4);
  flex: 1;
  min-width: 0;
}

.workspace--card-title {
  font-size: var(--rem-13);
  line-height: 1.2;
  color: var(--text-heading);
  font-variation-settings: "wght" var(--text-medium);
}

.workspace--card-subtitle {
  overflow: hidden;
  font-size: var(--rem-12);
  line-height: 1.2;
  color: var(--text-subheading);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Collapsed: the newest card sits on top and the cards behind it fan out
   below, each lower, narrower and fainter, clipped to a sliver.
   Height minus the pull-up is what peeks out: 24 - 16 = 8px each. */
.workspace--list[data-expanded="false"] .workspace--card:not(.workspace--card-top) {
  height: var(--rem-24);
  /* A column flex item will not shrink below its content without this. */
  min-height: 0;
  flex: none;
  /* width: 100% would shift these sideways instead of narrowing them. */
  width: auto;
  margin-top: calc(-1 * var(--rem-16));
  overflow: hidden;
}

.workspace--list[data-expanded="false"] .workspace--card:not(.workspace--card-top) > * {
  visibility: hidden;
}

.workspace--list[data-expanded="false"] .workspace--card:nth-child(2) {
  margin-inline: var(--rem-6);
  opacity: 0.75;
}

.workspace--list[data-expanded="false"] .workspace--card:nth-child(3) {
  margin-inline: var(--rem-12);
  opacity: 0.5;
}

.workspace--list[data-expanded="false"] .workspace--card:nth-child(4) {
  margin-inline: var(--rem-18);
  opacity: 0.25;
}

/* A fifth card and beyond only appears once the list is expanded. It shrinks
   to nothing rather than display: none, so it can grow back in. */
.workspace--list[data-expanded="false"] .workspace--card:nth-child(n+5) {
  height: 0;
  margin: 0;
  padding-block: 0;
  border-block-width: 0;
  opacity: 0;
  visibility: hidden;
}

.workspace--list[data-expanded="true"] .workspace--summary {
  display: none;
}

.workspace--list[data-expanded="true"] .buttons--button[data-type="outlined"][data-style="neutral"].workspace--collapse {
  display: flex;
}

/* While folding or unfolding, cards show what they hold and clip it to their animated size. */
.workspace--list[data-animating] .workspace--card {
  overflow: hidden;
}

.workspace--list[data-animating] .workspace--card:not(.workspace--card-top) > * {
  visibility: visible;
}
