/* attach.css — files in the Assistant chat (copilot.js, 2026-09-28): the
   paperclip in the composer, the chips of files waiting for Send, the drop
   target, and the files under a message in the log. Its own file so the
   chat's attachments can be read (or taken out) in one place; loaded after
   rail.css. Tokens only (tokens.css) — no colour of its own.

   Two homes, one set of rules: the dock (narrow, at the right edge of every
   page) and the Assistant page draw the same composer and the same log, so
   the only difference below is that the dock's thumbnails are smaller. */

/* ---- the paperclip: an icon button at the start of the composer's row ---- */
.cp-acts .cp-attach { margin-right: auto; display: inline-flex; align-items: center; justify-content: center; padding: 6px 10px; }
.cp-att-i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---- the chips: files waiting for Send, above the box ---- */
.cp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-chips[hidden] { display: none; }            /* a class's display would otherwise beat the hidden attribute */
.cp-chip, .cp-att-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 240px; min-width: 0;
  padding: 3px 4px 3px 6px; border: 1px solid var(--ash); border-radius: var(--r-input); background: var(--carbon);
  color: var(--mist); font: var(--w-body) var(--fs-small)/var(--lh-small) var(--sans); letter-spacing: var(--ls-small); }
.cp-chip img { width: 28px; height: 28px; flex: none; object-fit: cover; border-radius: var(--r-input); display: block; background: var(--graphite); }
.cp-chip-k { flex: none; font: var(--w-head) 11px/1 var(--mono); color: var(--fog); padding: 3px 4px; border-radius: var(--r-input); background: var(--graphite); }
.cp-chip-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-chip-x { flex: none; width: 22px; height: 22px; min-height: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--r-pill); background: transparent; color: var(--fog); font: var(--w-head) 15px/1 var(--sans); cursor: pointer; }
.cp-chip-x:hover { color: var(--snow); background: var(--inset); }
.cp-chip-x:focus-visible { outline: 1px solid var(--violet-light); outline-offset: 1px; }

/* ---- a drop in progress: the whole composer is the target ---- */
.cp-composer.cp-drop { outline: 1px dashed var(--violet-light); outline-offset: 4px; border-radius: var(--r-card); background: var(--violet-wash); }

/* ---- the files under one of her messages in the log ---- */
.cp-att-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cp-msg p + .cp-att-list, .cp-msg ul + .cp-att-list { margin-top: 4px; }
.cp-att-img { display: block; line-height: 0; border-radius: var(--r-input); border: 1px solid var(--ash); overflow: hidden; background: var(--graphite); }
.cp-att-img:hover { border-color: var(--violet-light); }
.cp-att-img img { display: block; width: auto; height: auto; max-width: 180px; max-height: 132px; min-width: 48px; min-height: 48px; object-fit: cover; }
a.cp-att-chip { text-decoration: none; }
a.cp-att-chip:hover { border-color: var(--violet-light); color: var(--snow); text-decoration: none; }
.cp-att-chip.gone { color: var(--fog); border-style: dashed; }

/* ---- the dock is narrow: smaller thumbnails, chips that fit its column ---- */
.cp-dock .cp-att-img img { max-width: 120px; max-height: 90px; }
.cp-dock .cp-chip, .cp-dock .cp-att-chip { max-width: 100%; }

/* ---- a phone: fingers, not a mouse ---- */
@media (max-width: 760px) {
  .cp-acts .cp-attach { min-height: 40px; min-width: 44px; }
  .cp-chip-x { width: 32px; height: 32px; }
  .cp-att-img img { max-width: 140px; max-height: 110px; }
}

/* ---- the lightbox (lightbox.js, 2026-10-15): a photo opened in place, with the next one and the
   one before. Over everything (the rail, the dock); the photo fits the window; the buttons sit
   at the edges so the picture is never covered. On a phone the arrows move to the bottom. ---- */
.lb { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .88); }
.lb[hidden] { display: none; }
/* heights against the SMALL viewport (dvh) where the browser has it: on a phone 100vh is the viewport
   with the toolbars hidden, and a tall photo sized to it loses its ends under them (observatory.css
   does the same for the chat) */
.lb-fig { margin: 0; max-width: calc(100vw - 128px); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lb-img { display: block; max-width: calc(100vw - 128px); max-height: calc(100vh - 76px); max-height: calc(100dvh - 76px); width: auto; height: auto; object-fit: contain; border-radius: var(--r-card); background: var(--graphite); }
.lb-img.lb-failed { min-width: 160px; min-height: 120px; }
.lb-cap { display: flex; gap: 12px; align-items: baseline; max-width: 100%; color: var(--mist); font: var(--w-body) var(--fs-small)/var(--lh-small) var(--sans); letter-spacing: var(--ls-small); }
.lb-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-n { flex: none; color: var(--fog); font-family: var(--mono); }
.lb-x, .lb-prev, .lb-next { position: fixed; width: 44px; height: 44px; border: 0; border-radius: var(--r-pill); cursor: pointer;
  background: rgba(255, 255, 255, .1); color: var(--snow); font: var(--w-head) 28px/1 var(--sans); display: inline-flex; align-items: center; justify-content: center; }
.lb-x:hover, .lb-prev:hover, .lb-next:hover { background: rgba(255, 255, 255, .22); }
.lb-x:focus-visible, .lb-prev:focus-visible, .lb-next:focus-visible { outline: 1px solid var(--violet-light); outline-offset: 2px; }
.lb-x { top: calc(14px + var(--safe-t)); right: 14px; }      /* clear of an iPhone's clock (tokens.css --safe-t) */
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
.lb-prev[hidden], .lb-next[hidden] { display: none; }
body.lb-open { overflow: hidden; }
/* a small thumbnail at the start of a file row (the client's File tab); a thumbnail that could not
   be drawn becomes a box of the same size with a few words in it, never a sentence that pushes the
   row's own name out of view (the row is one line, overflow hidden) */
.att-mini { display: inline-flex; vertical-align: middle; margin-right: 8px; }
.att-mini .att-ph { display: inline-flex; }
.att-mini .att-img { width: 56px; height: 56px; }
.att-mini .att-gone { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; box-sizing: border-box;
  padding: 2px; overflow: hidden; white-space: normal; text-align: center; font-size: 10px; line-height: 1.2; color: var(--fog);
  border: 1px dashed var(--ash); border-radius: var(--r-card); }
/* a voice message in a thread (CONTRACT-V2 §25) */
.att-voice { display: block; width: 240px; max-width: 100%; height: 36px; }
@media (max-width: 760px) {
  .lb-fig, .lb-img { max-width: 100vw; }
  .lb-img { max-height: calc(100vh - 110px); max-height: calc(100dvh - 110px); border-radius: 0; }
  .lb-prev, .lb-next { top: auto; bottom: calc(16px + var(--safe-b)); transform: none; }
  .lb-prev { left: 16px; }
  .lb-next { right: 16px; }
}
