/* Tags and a note on the files in a delivery: Details on a saved tile, the
   bar of what the producer has chosen to change together, and the tag field
   and the Download button of the Details sheet. Loaded by index.html after
   delivery.css, so it can rely on .up-cell, .up-tile and the bars from
   uploads.css and upload-tiles.css, the sheet from components.css and the
   .tag, .chip and .btn from app.css. The scripts are delivery-file-tiles.js,
   delivery-select.js, delivery-tag-field.js and delivery-meta-sheet.js.

   A saved tile, Details in its corner (the button is the whole 44 px
   square, the plate is what is drawn). A frozen delivery's tile has no
   Details, and Download takes the same corner, square and plate:

     +----------------------+        +----------------------+
     |                      |        |                      |
     |                  [#3]|        |                   [v]|
     +----------------------+        +----------------------+
       Details                         Download (frozen)

   The tag field:

     Tags                                          3 of 20 tags
     +-----------------------------------------------------------+
     | [Ceremony x] [Altar x] [Family x]  type a tag...          |
     +-----------------------------------------------------------+
     You can add 17 more tags.
     Already used in this delivery   [Reception] [Dancing]

   Colours are tokens. The accent appears once, as the field's focus (the
   same edge and ring as every text field). */

/* --- the corner of a saved tile: Details, or Download ------------------ */

.up-corner {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  width: var(--control-l);
  height: var(--control-l);
  padding: var(--space-1);
  border: 0;
  background: none;
  color: var(--on-photo);
  cursor: pointer;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.up-corner-plate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-width: 24px;
  height: 24px;
  padding: 0 var(--space-1h);
  border-radius: var(--radius-s);
  background: var(--veil);
  box-shadow: 0 0 0 1px var(--photo-edge);
  font: 500 var(--text-xs)/16px var(--font-sans);
  transition: background-color var(--dur-fast) var(--ease-out);
}
.up-corner svg { width: var(--icon-s); height: var(--icon-s); }
.up-corner:hover .up-corner-plate { background: var(--photo-ink); }
/* The plate is what is seen, so it carries the focus ring: a ring round the
   whole 44 px square would float in the picture. */
.up-corner:focus-visible { outline: none; }
.up-corner:focus-visible .up-corner-plate { outline: 2px solid var(--on-photo); outline-offset: 1px; }

/* Details with nothing to show yet: faint until the pointer is near. Touch
   has no hover, so there it is always drawn, and so is any file that has
   tags or a note. Download is always drawn. */
@media (hover: hover) {
  .up-details.is-empty { opacity: 0; }
  .up-cell:hover .up-details.is-empty,
  .up-details.is-empty:focus-visible { opacity: 1; }
}

/* --- choosing saved files: the hint, the bar ------------------------------ */

/* Select pressed: Done takes the place of Select, and a line of its own holds
   the ways to choose and what to do. */
.up-select-row { display: flex; flex-basis: 100%; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-4); }
.up-none { margin: var(--space-3) 0 0; color: var(--ink2); }

.up-select-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); }

/* --- the tag field ------------------------------------------------------- */

.tag-field-head { display: flex; align-items: baseline; gap: var(--space-3); margin-bottom: var(--space-1h); }
.tag-field-head .lbl { margin: 0 auto 0 0; }
.is-problem { color: var(--red); }

.tagbox {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1h);
  min-height: var(--control);
  padding: var(--space-1) var(--space-2h);
  border: 1px solid var(--field-line);
  border-radius: var(--radius-control);
  background: var(--surface);
  cursor: text;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.tagbox:hover { border-color: var(--ink2); }
.tagbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }

/* The labels and the input are one flow: the tokens give their children to
   the box, so the typing carries on after the last label and wraps with them. */
.tag-tokens { display: contents; }
.tag-token { display: inline-flex; align-items: center; gap: var(--space-1); height: 26px; padding: 0 var(--space-0) 0 var(--space-2); }
.tag-word { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: isolate; }
.tag-x {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-s);
  background: none;
  color: inherit;
  cursor: pointer;
}
.tag-x:hover { background: color-mix(in srgb, currentColor 14%, transparent); }
.tag-x svg { width: 12px; height: 12px; stroke-width: 2.4; }

.tagbox-input {
  flex: 1 1 8rem;
  min-width: 0;
  height: 28px;
  padding: 0;
  border: 0;
  outline: 0;
  background: none;
  box-shadow: none;
  color: var(--ink);
  font: 400 var(--input-font)/20px var(--font-sans);
}

.tag-status { min-height: 18px; margin: var(--space-1h) 0 0; }
.tag-suggestions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-3); }
.tag-suggestions .chips { display: contents; }
.tag-suggestions .chip { max-width: 100%; }

/* A finger: the labels and their x are as tall as a touch target. */
@media (pointer: coarse) {
  .tag-token { height: var(--control-l); }
  .tag-x { width: var(--control-l); height: var(--control-l); }
  .tagbox-input { height: var(--control-l); }
}

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

@media (max-width: 820px) {
  .up-select-bar .up-summary-in { grid-template-columns: minmax(0, 1fr); gap: var(--space-3); padding: var(--space-3) var(--space-4); }
  .up-select-actions { justify-content: stretch; }
  .up-select-actions .btn { flex: 1 1 auto; padding-inline: var(--space-2); }
}

/* --- Download in a file's Details sheet --------------------------------- */

/* The button that saves the file, above its tags. A finger gets 44 px on
   any touch screen, whatever its width, and so does a phone's width with any
   pointer. */
.sheet-download { margin: 0 0 var(--space-4); }
@media (pointer: coarse), (max-width: 820px) {
  .sheet-download .btn { min-height: var(--control-l); }
}
