/* Trash: the list of deleted memories, restoring, and deleting for good.
   Rows, the marked summary and the hold button are shared: see components.css. */

.trash {
  display: grid;
  grid-template-columns: minmax(0, 1fr) calc(var(--rail-wide) + var(--float));
  gap: var(--s4);
  height: 100%;
  padding: var(--s5) var(--gutter);
}
.trash-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  align-self: start;
  max-height: 100%;
}
.trash-side {
  display: grid;
  align-content: start;
  gap: var(--s4);
}
.trash-row {
  grid-template-columns: 40px minmax(0, 1fr) auto auto;
  min-height: 74px;
}
.trash-row .row-text {
  -webkit-line-clamp: 1;
}
.trash-when {
  color: var(--ink-3);
}
.trash-row .btn {
  margin-right: var(--s1);
}
/* A long trash (more than a hundred rows on the page) costs nothing off screen: its rows are only
   laid out and painted when they are near it. */
.trash-rows.is-long .trash-row {
  content-visibility: auto;
  contain-intrinsic-size: auto 74px;
}
.trash-row .row-main:hover .row-title {
  color: var(--cyan);
}
.trash-row .row-meta {
  overflow: hidden;
}
.trash-row .row-meta .src-fit {
  flex: none;
  max-width: 16ch;
}
/* "deleted 9 d ago" is a column on wide screens and joins the meta line where there are no columns. */
.trash-when-meta {
  display: none;
}
.trash-readouts {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
}
.trash-stale {
  color: var(--gold);
}
.trash-more {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  min-height: 56px;
  padding: var(--s2) 0 0;
}
.trash-more-text {
  font: 400 var(--t-mini) / 1 var(--f-mono);
  color: var(--ink-3);
}
/* While something is being restored or deleted, the marks stand as they are. */
.trash.is-busy .tick {
  opacity: 0.45;
  pointer-events: none;
}
.row.is-doomed {
  background: rgba(255, 92, 80, 0.07);
  box-shadow: inset var(--bold) 0 0 var(--red);
}
.row.is-doomed .row-title {
  text-decoration: line-through;
  text-decoration-color: var(--red-line);
}
.trash-purge.is-armed {
  --edge: var(--red-line);
  --edge-cut: var(--red);
}
.trash-purge.is-armed .plane-label::before {
  background: var(--red);
}
.trash-purge .marked-grid {
  grid-template-columns: repeat(2, auto);
  justify-content: start;
  gap: var(--s6);
}
.purge-text {
  margin: 0 0 var(--s4);
  font-size: var(--t-small);
  color: var(--ink-2);
}
.purge-more {
  display: flex;
  gap: var(--s1);
  margin: var(--s2) 0 0 calc(var(--s3) * -1);
}
.purge-more:empty {
  display: none;
}

/* ---------------------------------------------------------------- restoring */
.trash-progress {
  display: grid;
  gap: var(--s2);
  justify-items: start;
  margin-top: var(--s3);
}
.trash-progress .meter {
  width: 100%;
}
.trash-progress-text {
  font-size: var(--t-small);
  color: var(--ink-2);
}
/* The ones that could not be restored, each with the server's reason. Gold: they are still in the trash. */
.trash-failed {
  display: grid;
  gap: var(--s2);
  justify-items: start;
  margin-top: var(--s4);
  padding-left: var(--s3);
  border-left: var(--bold) solid var(--gold);
}
.trash-failed-title {
  font: 500 var(--t-ui) / 1.3 var(--f-display);
  letter-spacing: 0.02em;
  color: var(--gold);
}
.trash-failed-list {
  display: grid;
  gap: var(--s2);
  width: 100%;
  max-height: 208px;
  overflow: auto;
}
.trash-failed-list li {
  display: grid;
  min-width: 0;
}
.trash-failed-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}
.trash-failed-why {
  font-size: var(--t-small);
  color: var(--ink-2);
}
.trash-failed .btn {
  margin-left: calc(var(--s3) * -1);
}
.trash-bar {
  display: none;
}

/* ---------------------------------------------------------------- reading one */
.trash-preview-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s1) var(--s3);
  font: 400 var(--t-mini) / 1.4 var(--f-mono);
  color: var(--ink-3);
}
.trash-preview-meta .src {
  font-size: var(--t-mini);
  max-width: 24ch;
}
.trash-preview-text {
  max-width: 62ch;
  font: 400 var(--t-read) / 1.68 var(--f-read);
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.trash-preview-text:focus-visible {
  outline-offset: -2px;
}
.trash-empty-dialog .holdbtn {
  margin-top: var(--s2);
}

/* ---------------------------------------------------------------- medium */
@media (max-width: 1240px) and (min-width: 761px) {
  .trash {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}

/* ---------------------------------------------------------------- phone */
@media (max-width: 760px) {
  .trash {
    display: flex;
    flex-direction: column;
    height: auto;
    padding: var(--s4) var(--gutter) var(--s5);
  }
  .trash-list {
    max-height: none;
  }
  .trash-row {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    align-items: center;
  }
  .trash-row .tick {
    margin-top: 0;
  }
  .trash-row .btn {
    width: 40px;
    padding: 0;
    margin-right: 0;
  }
  .trash-row .btn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .trash-when {
    display: none;
  }
  /* A phone's row has room for who saved it and when it was deleted; the rest is in the memory itself. */
  .trash-saved,
  .trash-chars {
    display: none;
  }
  .trash-row .row-meta .src-fit {
    max-width: 10ch;
  }
  /* What is marked stays within reach while the list is scrolled: the planes that act on it are below it. */
  /* (A toast rises clear of that bar, so it never covers "Restore" or "Delete".) */
  html[data-view="trash"] {
    --toast-lift: 64px;
  }
  .trash-bar:not([hidden]) {
    position: sticky;
    bottom: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: var(--s1);
    min-height: 60px;
    margin: 0 calc(var(--gutter) * -1);
    padding: 0 var(--gutter);
    background: var(--near);
    border-top: var(--bold) solid var(--red);
  }
  .trash-bar-count {
    font: 500 var(--t-ui) / 1 var(--f-display);
    letter-spacing: 0.02em;
    color: var(--red);
    white-space: nowrap;
  }
  .trash-bar-n {
    font: 400 var(--t-head) / 1 var(--f-mono);
  }
  .trash-bar-gap {
    flex: 1;
  }
}
@media (max-width: 1040px) {
  .trash-when-meta {
    display: inline;
  }
  /* Beside the planes on a tablet the list is as narrow as a phone's: the same short meta line,
     so nothing is cut off in the middle of a word. */
  .trash-saved,
  .trash-chars {
    display: none;
  }
}
