/* The client's page for a delivery made as Files: the release notes on
   top, the checksum note, and each file as a row of a list
   (js/recipient-files-row.js). Loaded after recipient-list.css, whose list
   frame it reuses (.rc-list), and after files.css (the checksum line and
   the program line).

   A row. The whole row is the download (.rc-link's reach), and the check,
   Copy and Download sit above that reach:

     [ ] [icon] setup-2.4.1.msi                        48.2 MB  [Download]
                64-bit installer
                SHA-256 9f2c…e1a0 [Copy]
                This is a program. Run it only if you trust the sender, ...

   On a phone the row stacks: name, size, the details, then Download across
   the foot. The colours are app.css's tokens. */

/* --- above the list ----------------------------------------------------- */

.rc-notes {
  margin: 0 0 var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--line);
}
.rc-notes .eyebrow { margin-bottom: var(--space-2); }
.rc-files-note { margin: 0 0 var(--space-3); }
.rc-taken-note { margin: 0 0 var(--space-3); }

/* --- a row -------------------------------------------------------------- */

.rc-grid.rc-list .rc-cell.rc-file {
  grid-template-columns: auto 40px minmax(0, 1fr) auto auto;
  grid-template-areas:
    "check icon name size download"
    ".     .    details details details";
  align-items: center;
  column-gap: var(--space-3);
  row-gap: var(--space-1);
  padding: var(--space-3);
  contain-intrinsic-block-size: auto 96px;
}

.rc-file .rc-check { position: relative; z-index: 1; grid-area: check; padding: 11px; }
/* The checks of a list of files are always there (upload-tiles.css hides a
   tile's until the pointer is near, which a list read for what to take
   cannot afford); the selector outweighs that rule's. */
.rc-grid.rc-list.wgrid.up-grid .rc-file.up-cell .up-check { opacity: 1; }
.rc-file:not(.is-selected) .up-check { border-color: var(--field-line); background: var(--surface); }

.rc-file-icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-control);
  background: var(--sunken);
  color: var(--mute);
}
.rc-file-icon svg { width: var(--icon-l); height: var(--icon-l); }

.rc-grid.rc-list .rc-file .rc-file-name { grid-area: name; min-width: 0; width: auto; }
.rc-file .up-name { display: block; font-weight: 500; white-space: normal; overflow-wrap: anywhere; }
.rc-file-size { grid-area: size; text-align: right; }

/* The row is one big button: the name's link reaches over the whole row.
   Everything else that can be pressed or read stays above it: a hash you
   cannot hover or select cannot be compared by hand, and a click on the
   program warning must not start a download. Notes and the warning are
   only as wide as their words, so the rest of their line still takes the
   file. */
.rc-file .rc-file-name::after { content: ""; position: absolute; inset: 0; }
.rc-file .rc-file-name:focus-visible::after { outline: 2px solid var(--focus); outline-offset: -2px; }
.rc-file .file-sum .btn,
.rc-file .file-sum code,
.rc-file .rc-file-note,
.rc-file .file-trust,
.rc-file .rc-file-download { position: relative; z-index: 1; }
.rc-file .file-sum code { user-select: all; }
.rc-file .rc-file-note,
.rc-file .file-trust { width: fit-content; max-width: 100%; }

.rc-file-details { grid-area: details; min-width: 0; }
.rc-file-note { margin: 0 0 var(--space-1); font-size: var(--text-m); line-height: 18px; color: var(--ink2); overflow-wrap: anywhere; }
.rc-file-download { grid-area: download; }

/* --- the bar, with two ways to download --------------------------------- */

.rc-bar:has([data-a=rc-download-one-by-one]) { max-width: 880px; }

@media (max-width: 820px) {
  .rc-bar [data-a=rc-download-zip] { flex: 1 1 100%; order: 2; }
}

/* --- phone -------------------------------------------------------------- */

@media (max-width: 520px) {
  .rc-grid.rc-list .rc-cell.rc-file {
    grid-template-columns: auto 40px minmax(0, 1fr);
    grid-template-areas:
      "check icon name"
      ".     .    size"
      ".     .    details"
      "download download download";
    align-items: start;
  }
  .rc-file-size { text-align: left; }
  .rc-file-download { justify-self: stretch; justify-content: center; margin-top: var(--space-2); }
}

/* --- a file the sender took back (js/recipient-taken-row.js) ------------- */

/* A line, not a row: no check, no download, no tab stop. Retracted is struck
   through and reads as set aside; pruned and removed are plain lines. In a
   wall of pictures it spans the whole width. */
.rc-taken {
  display: grid;
  /* the first column is where a file's check sits, so the icons line up */
  grid-template-columns: var(--control-l) 40px minmax(0, 1fr) auto;
  grid-template-areas:
    ".    icon name size"
    ".    .    details details";
  align-items: center;
  column-gap: var(--space-3);
  row-gap: var(--space-1);
  padding: var(--space-3);
  grid-column: 1 / -1;
  color: var(--ink2);
}
.rc-taken .rc-file-icon { grid-area: icon; }
.rc-taken-name { grid-area: name; min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.rc-taken.is-retracted .rc-taken-name { text-decoration: line-through; color: var(--mute); }
.rc-taken-size { grid-area: size; text-align: right; }
.rc-taken-details { grid-area: details; min-width: 0; }
.rc-taken-why { margin: 0; font-size: var(--text-m); line-height: 18px; overflow-wrap: anywhere; }
/* The server accepts a reason of several lines, so its line breaks are
   kept. */
.rc-taken-why [data-part=rc-reason] { white-space: pre-line; }

.rc-list .rc-taken,
.rc-list .rc-day { border-top: 1px solid var(--line2); }
.rc-list > :first-child { border-top: 0; }
.rc-list .rc-taken + .rc-cell { border-top: 1px solid var(--line2); }

/* --- a maintained delivery, by day (js/recipient-dated-list.js) ---------- */

.rc-day {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: var(--space-3);
  padding: var(--space-3) var(--space-3) var(--space-2);
  background: var(--sunken);
}
.rc-day-date { font: 500 var(--text-label)/16px var(--font-sans); letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
.rc-day-note { min-width: 0; color: var(--ink2); overflow-wrap: anywhere; }

.rc-new { margin-top: var(--space-1); }
.rc-list .up-cap .rc-new { grid-area: 2 / 3 / 3 / -1; justify-self: start; }

@media (max-width: 520px) {
  .rc-taken {
    grid-template-columns: var(--control-l) 40px minmax(0, 1fr);
    grid-template-areas:
      ".    icon name"
      ".    .    size"
      ".    .    details";
  }
  .rc-taken-size { text-align: left; }
}
