/* The agent's dock, a conversation read top to bottom: its one line, the chips to answer with, the bar with the
   presence beside it, and in the corner the Ontwerpen tile (designbutton.js).

   Its layout is one model, written once here, and every size is one of three named layouts of it:
   - beside (the default): the bar in the middle of the dock, as far in from each side as the Ontwerpen tile is wide,
     which stands on the bar's level at the dock's right end; the line and chips over the bar.
   - stacked (a dock too narrow for that, on a screen tall enough: a phone upright, a narrow window): the bar takes the
     dock's width, the line and chips over it, and under it, a clear gap down, a row of the book's controls: the
     magnifier's buttons, the Ontwerpen tile (its covers and word) and the pile of photos not in the book (controlrow.js).
   - column (a phone held sideways over its book): the dock stands as a narrow column at the screen's right, the book
     beside it; the Ontwerpen tile is its covers alone, level with the bar's right end.
   The covers alone are one look, written once for any dock that narrow (below), which the column is.
   Which one is the dock's own width (a container query on .agent, so a side panel narrowing it counts too) and the
   screen's height; a short screen also makes the parts slimmer (the short sizes, below), whichever layout it is. Each
   layout sets only the few room values below, and the parts read them. */
/* how far the dock's stack sits off the screen's bottom: app.css lays the returned start out above it */
body {
  --dock-lift: calc(var(--safe-bottom, 0px) + 16px);
}
/* the room the agent's words usually take over its bar, by the dock's own width as the ideas' wrapping is (below): the
   book stands above it where that costs it little (framing.js steadyFit, which app.js frameTable hands it from the
   dock's first child, inside its container). Beside on a dock of 1300 px and up: a line of two rows, a reply's ideas
   on one row */
.agent > * {
  --words-room: 112px;
}
/* stacked (the stacked layout's own condition, below): a line of three rows, two ideas one under the other */
@media (min-height: 501px) {
  @container dock (width < 729px) {
    .agent > * {
      --words-room: 190px;
    }
  }
}
/* beside on a dock under 1300 px (a tablet, a small laptop), where two ideas mostly don't fit one row, even running
   on to the Ontwerpen tile (below: two of some 40 letters each take about 810 px, which that row reaches at a dock of
   about 1260): a line of two rows, the ideas wrapped to two */
@container dock (width >= 729px) and (width < 1300px) {
  .agent > * {
    --words-room: 160px;
  }
}
.agent {
  /* our warm orange, leaning to a host's accent when it gives one (bridge.js's theme) */
  --glow: color-mix(in srgb, var(--host-accent, #f2a65a) 70%, #f2a65a);
  --pebble: color-mix(in srgb, var(--glow) 14%, #fff);
  --pebble-ink: #2b2420;
  /* the words' paper (the line's bubble, a question's answers, the paperclip's tip): a fresh white, never the glow's
     peach, which reads as a warning. The glow stays a thin ring, the sign of a question */
  --paper: #fffdf9;
  --paper-edge: rgb(36 34 31 / 0.08);
  /* the room values, which the layouts below set: the bar's height; the presence's size and the gap beside it; the
     Ontwerpen tile's size (as wide as the tray's shelf, tray.js SHELF_PX) and its gap to what stands beside it (the tray's
     tile, the bar and what's said, which keep clear of it);
     the bar's widest; the dock's own margins at the screen's sides; and, stacked, the row's height, its gap under the
     bar */
  --bar: 52px;
  --presence: 56px;
  --face-gap: 10px;
  --design-w: 96px;
  --design-h: 116px;
  --design-gap: 8px;
  --bar-most: 640px;
  --edge-left: 16px;
  --edge-right: max(16px, env(safe-area-inset-right, 0px));
  --row: 44px;
  --row-gap: 18px;
  /* the screen's width, less a side panel standing at the right (app.js sets --table-right, in the screen's px, which
     the chrome's zoom would grow) */
  position: fixed;
  inset: auto calc(var(--table-right, 0px) / var(--ui)) 0 0;
  zoom: var(--ui);
  z-index: 30;
  padding: 0 var(--edge-right) var(--dock-lift) var(--edge-left);
  container: dock / inline-size;
  pointer-events: none;
  font-family: var(--ui-font, system-ui, sans-serif);
  transition: opacity 0.25s;
}
/* under an open sheet (sheets.js coverDock): out of sight as it's out of reach */
[inert] > .agent {
  opacity: 0;
}
.agent > * {
  pointer-events: auto;
}

/* the line, the chips and the bar, one under the other; the face stands beside the bar's left end (.agent-figure), so
   the quiet dock is one bar high over the pages, which run on beneath it to the screen's foot (table.css). Beside: in
   the middle, clear of the Ontwerpen tile by the gap between them and as far in at the left. */
.agent-stack {
  /* the presence's column, which the line and the bar start right of (worked out here, where stacked sets its size) */
  --face-room: calc(var(--presence) + var(--face-gap));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: start;
  gap: 8px;
  position: relative;
  box-sizing: border-box;
  width: min(100% - 2 * (var(--design-w) + var(--design-gap)), var(--bar-most) + var(--face-room));
  padding-left: var(--face-room);
  margin: 0 auto;
  pointer-events: none;
  container-type: inline-size; /* a chip's tag and the bar's buttons go by the stack's width (cqi, below) */
}
.agent-stack > * {
  pointer-events: auto;
}

/* ---- the bar: one line high, growing to a few with what's typed or pasted (dock.js #fit), its buttons on the last.
   Above the Ontwerpen tile, so the paperclip's words show whole. */
.agent-bar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  width: 100%;
  min-height: var(--bar);
  /* the mic's disc as far in from the bar's rounded left end as from its top and bottom, plus room for its listening
     ring (.agent-mic[aria-pressed]), so the ring never touches the bar's edge */
  padding: calc((var(--bar) - 42px) / 2) 6px calc((var(--bar) - 42px) / 2) calc((var(--bar) - 42px) / 2 + 4px);
  border-radius: calc(var(--bar) / 2);
  background: var(--glass, rgb(255 253 249 / 0.85));
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  /* lifted off the pages that run on under it */
  box-shadow:
    0 1px 0 rgb(255 255 255 / 0.7) inset,
    0 10px 34px rgb(36 34 31 / 0.22),
    0 0 0 1px var(--line, rgb(36 34 31 / 0.1));
}
.agent-field {
  flex: 1;
  box-sizing: border-box;
  min-width: 0;
  height: 42px;
  max-height: min(5lh + 18px, 30vh / var(--ui));
  padding: 9px 0;
  border: 0;
  background: none;
  color: var(--text, #24221f);
  font: inherit;
  font-size: 17px;
  line-height: 24px;
  outline: none;
  resize: none;
  /* scrolled, its top line fades out before the bar's rounded edge instead of being cut through */
  mask-image: linear-gradient(transparent, #000 9px);
  /* typed lines wrap, so only height ever scrolls; the invitation alone (a narrow bar keeps it one line, cut by a fade)
     never does, nor shows a scroll bar where a desktop browser draws them */
  overflow: hidden auto;
}
.agent-field:placeholder-shown {
  overflow: hidden;
}
.agent-field::placeholder {
  color: var(--quiet, #77716a);
}
.agent-field.is-live::placeholder {
  color: var(--text, #24221f);
  opacity: 0.8;
}
.agent-mic,
.agent-paperclip,
.agent-voice {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text, #24221f);
  cursor: pointer;
  transition:
    background 0.25s,
    color 0.25s,
    transform 0.2s var(--ease, ease);
}
.agent-mic svg,
.agent-paperclip svg,
.agent-voice svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.agent-mic:active,
.agent-paperclip:active,
.agent-voice:active {
  transform: scale(0.92);
}
/* clear of the field's first letter by its listening ring and a breath more */
.agent-mic {
  margin-right: 8px;
}
.agent-mic.is-off {
  opacity: 0.4;
}
.agent-mic[aria-pressed='true'] {
  background: var(--accent, #24221f);
  color: var(--accent-ink, #fbf8f3);
  animation: agent-mic 1.6s ease-in-out infinite;
}
/* the paperclip for a picture: a quieter button than the mic */
.agent-paperclip {
  width: 38px;
  color: var(--quiet, #77716a);
}
.agent-paperclip svg {
  width: 21px;
  height: 21px;
}
@media (hover: hover) {
  .agent-paperclip:hover {
    color: var(--text, #24221f);
  }
}
/* ---- the paperclip: a few words above it on what it's for, on a pointer's hover or the keyboard's focus,
   and on a touch held or a phone's first tap (handing.js explains), with a button there to pick the picture. Its point
   sits over the paperclip. */
.agent-clip {
  position: relative;
  display: flex;
  flex: none;
}
.agent-tip {
  position: absolute;
  right: -8px;
  bottom: calc(100% + 14px);
  width: max-content;
  /* never past the screen on either side: it ends 8px right of the paperclip and grows leftward, so it has the room
     left of the paperclip (--clip-right, handing.js) less a 12px margin */
  max-width: min(20rem, 100vw / var(--ui) - 40px, var(--clip-right, 100vw) / var(--ui) - 4px);
  display: grid;
  grid-template-columns: 46px 1fr;
  column-gap: 12px;
  align-items: center;
  padding: 11px 14px 12px 10px;
  border-radius: 16px;
  background: var(--paper);
  box-shadow:
    0 0 0 1px var(--paper-edge),
    0 8px 24px rgb(36 34 31 / 0.16);
  color: var(--pebble-ink);
  font-size: 14px;
  line-height: 1.4;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px) scale(0.97);
  transform-origin: calc(100% - 27px) 100%;
  transition:
    opacity 0.2s,
    transform 0.25s var(--ease, ease),
    visibility 0s 0.25s;
  pointer-events: none;
}
.agent-tip::after {
  content: '';
  position: absolute;
  right: 21px;
  bottom: -6px;
  width: 12px;
  height: 12px;
  border-radius: 0 0 3px;
  background: var(--paper);
  box-shadow: 1px 1px 0 rgb(36 34 31 / 0.08);
  transform: rotate(45deg);
}
/* the picture, in the first questions' hand (chromeart.js), beside the title and the words */
.agent-tip-art {
  grid-row: 1 / 3;
  align-self: start;
  rotate: -4deg;
}
.agent-tip-art svg {
  display: block;
  width: 100%;
  height: auto;
}
.agent-tip-title {
  display: block;
  margin-bottom: 2px;
  font-weight: 650;
}
.agent-tip-pick {
  display: none;
  margin-top: 10px;
  min-height: 38px;
  padding: 6px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--pebble-ink);
  color: #fffdf9;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.agent-clip.is-open .agent-tip-pick {
  display: block;
  grid-column: 2;
  justify-self: start;
}
.agent-clip.is-open .agent-tip,
.agent-paperclip:focus-visible + .agent-tip {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    opacity 0.2s,
    transform 0.25s var(--ease, ease);
}
.agent-clip.is-open .agent-tip {
  pointer-events: auto;
}
@media (hover: hover) {
  .agent-paperclip:hover + .agent-tip {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition:
      opacity 0.2s 0.3s,
      transform 0.25s var(--ease, ease) 0.3s;
  }
}
/* a narrow bar, by the stack's width beside the face (a phone, a short narrow window, the column; stacked's bar is
   narrower still by the tile beside it, till it's typed in): its invitation stays one line, a cut one (dock.js #hint)
   fading out where the bar's buttons begin. Container conditions can't read the room values, so the widths are worked
   out from them: under 360 px the field beside the bar's buttons (3 × 42 px, their gaps and padding, about 150 px) has
   under about 210 px. Under 317 px (the bar of a phone 400 px wide: the screen less the edges, 2 × --edge-left, and the
   stacked face's column, --presence 44 + --face-gap 8) the paperclip and the bar's gaps are narrower too, so the field
   keeps room for its hint, and the tip's point still over the paperclip */
@container (width < 360px) {
  /* smaller words in a phone's field, but never under 16 px: iOS Safari zooms the page into a field set smaller */
  .agent-field {
    font-size: 16px;
  }
  .agent-field::placeholder {
    white-space: nowrap;
  }
  .agent-field.is-cut:placeholder-shown {
    mask-image: linear-gradient(to right, #000 70%, transparent);
  }
}
@container (width < 317px) {
  .agent-bar {
    gap: 2px;
  }
  .agent-paperclip {
    width: 30px;
  }
  .agent-tip::after {
    right: 17px;
  }
}

/* one picture carried over the dock: the bar says it takes it */
.agent.is-taking .agent-bar {
  box-shadow:
    0 1px 0 rgb(255 255 255 / 0.7) inset,
    0 6px 24px rgb(36 34 31 / 0.12),
    0 0 0 2px var(--glow);
}
.agent.is-taking .agent-paperclip {
  color: var(--text, #24221f);
  transform: scale(1.12);
}
.agent-voice[aria-pressed='false'] .waves,
.agent-voice[aria-pressed='true'] .cross {
  display: none;
}
.agent-voice[aria-pressed='false'] {
  color: var(--quiet, #77716a);
}

/* the Ontwerpen tile (designbutton.js): a small card of the tray's soft paper, as its shelf beside the book is
   (table.css .has-shelf .tb-tray), with the book's designs lying fanned in it as small covers and its word under them.
   Beside, it stands in the dock's corner as far in from the side as the shelf, so on a wide screen the two stand in one
   column, its foot level with the bar's (stacked puts it in its row, the column makes it its covers alone, short sizes
   as low as the bar) */
.agent-design {
  position: absolute;
  right: max(10px, env(safe-area-inset-right, 0px));
  bottom: var(--dock-lift);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
  width: var(--design-w);
  height: var(--design-h);
  padding: 0 4px 10px;
  border: var(--card-edge);
  border-radius: var(--card-round);
  background: var(--card-paper);
  color: rgb(36 34 31 / 0.7);
  font: 600 13px/17px var(--ui-font, inherit);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition:
    transform 0.3s var(--ease, ease),
    background 0.2s;
}
.agent-design:active {
  transform: scale(0.95);
}
/* while the ways in are up (ways.js: no photos yet, every one refused, or more being added) there's no book in sight to
   design, so the tile steps aside */
body:has(#ways:not([hidden], .leaving)) .agent-design {
  display: none;
}
/* the covers lie in the middle of the room above the word, each a little further to the right and down than the one
   on it and turned its own way (designbutton.js --place, --turn), as the tray's stack lies */
.agent-design-stack {
  --cover: 54px;
  position: relative;
  flex: 1;
  align-self: stretch;
}
.agent-design-cover {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--cover) * var(--cover-w, 1));
  overflow: hidden;
  border-radius: 2px;
  box-shadow:
    0 1px 1px rgb(30 20 10 / 0.14),
    0 6px 14px -6px rgb(30 20 10 / 0.35);
  translate: calc(-50% + (var(--place) - 1) * 6px) calc(-50% + (var(--place) - 1) * 3px);
  rotate: var(--turn);
  transition: rotate 0.35s var(--ease, ease);
}
.agent-design-cover .tb-preview {
  pointer-events: none;
}
.agent-design-name {
  white-space: nowrap;
}
@media (hover: hover) {
  .agent-design:hover {
    background: var(--card-paper-lit);
  }
  /* pointed at, the covers fan out a little further */
  .agent-design:hover .agent-design-cover {
    rotate: calc(var(--turn) * 1.6);
  }
}
/* how many new designs wait: the gold sticker new things wear (arrived.css), on the tile's corner */
.agent-design-new {
  position: absolute;
  top: -6px;
  right: -6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--fresh, #f0b429);
  color: var(--fresh-ink, #3b2a00);
  font: 700 12.5px/1 var(--ui-font, inherit);
  white-space: nowrap;
  box-shadow: 0 0 0 2px var(--surface, #ece8e1);
  animation: design-new 0.5s cubic-bezier(0.34, 1.7, 0.5, 1) both;
}
.agent-design-new[hidden] {
  display: none;
}
@keyframes design-new {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
}
/* while new designs wait, the tile breathes a gold glow twice to say where they are */
.agent-design.has-new {
  animation: design-glow 1.6s ease-in-out 0.4s 2;
}
@keyframes design-glow {
  50% {
    box-shadow:
      var(--card-shadow),
      0 0 0 6px rgb(240 180 41 / 0.45);
  }
}

@keyframes agent-mic {
  50% {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent, #24221f) 18%, transparent);
  }
}

/* ---- the presence and its line: what the agent said stands above its face as a speech bubble on the words' paper,
   its point towards the face (stays until the next action); what it's hearing, faint and plain; a note on how
   something works, quiet. With nothing to say the line takes no room, so the chips sit right on the bar. */
.agent-say {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 100%;
}
.agent-line {
  min-width: 0;
  margin: 0 0 4px;
  padding: 6px 14px;
  /* the corner by the presence's mouth is the bubble's point */
  border-radius: 18px 18px 18px 5px;
  background: var(--paper);
  box-shadow:
    0 0 0 1px var(--paper-edge),
    0 6px 20px rgb(36 34 31 / 0.1);
  /* one size for all the chat's words: the agent's line, its chips and its options */
  font-size: 15px;
  line-height: 1.4;
  color: var(--pebble-ink);
  transform-origin: left bottom;
  transition:
    opacity 0.35s,
    transform 0.35s var(--ease, ease),
    display 0.35s allow-discrete;
}
/* the line and its close button, which a swipe carries off together (shared/tactile/swipeaway.js) */
.agent-bubble {
  position: relative;
  display: flex;
  min-width: 0;
}
/* on the bubble's top right corner, as a note's; a finger's room round the cross it draws */
.agent-close {
  position: absolute;
  top: -9px;
  right: -9px;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--paper);
  box-shadow:
    0 0 0 1px var(--paper-edge),
    0 3px 10px rgb(36 34 31 / 0.16);
  color: var(--quiet, #77716a);
  cursor: pointer;
  animation: agent-close-in 0.3s var(--ease, ease) 0.25s backwards;
}
.agent-close::before {
  content: '';
  position: absolute;
  inset: -9px;
}
.agent-close svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}
.agent-close:hover {
  color: var(--text, #24221f);
}
@keyframes agent-close-in {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
}
.agent-line:not(.is-said, .is-heard, .is-note) {
  display: none;
  opacity: 0;
  transform: translateY(4px) scale(0.97);
}
@starting-style {
  .agent-line {
    opacity: 0;
    transform: translateY(4px) scale(0.97);
  }
}
/* each thing they said while the agent works on its own row under the one before, a hairline between, so a second
   request reads as one more in the queue, never as the first one overwritten (dock.js heard); past the line's room the
   newest stay in view and the oldest fade out at its top */
.agent-line.is-heard {
  display: flex;
  flex-direction: column;
  max-height: calc(6lh + 12px);
  overflow: hidden;
  background: var(--glass, rgb(255 253 249 / 0.85));
  box-shadow: none;
  color: var(--quiet, #77716a);
  font-style: italic;
  white-space: pre-line;
}
.agent-line.is-heard.is-full {
  mask-image: linear-gradient(rgb(0 0 0 / 0.12) 6px, #000 calc(1.2lh + 6px));
}
.agent-heard {
  flex-shrink: 0;
  max-height: 4lh;
  overflow: hidden;
}
.agent-heard + .agent-heard {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid color-mix(in srgb, var(--quiet, #77716a) 22%, transparent);
}
/* at work on what they said: three dots going in its bubble under their words, where the answer will come (the face's
   swirl alone is too quiet a sign) */
.agent.is-working .agent-line.is-heard::after {
  content: '';
  flex-shrink: 0;
  width: 34px;
  height: 10px;
  margin: 8px 0 2px;
  background:
    radial-gradient(circle closest-side, var(--glow) 90%, transparent) 0 50% / 10px 10px no-repeat,
    radial-gradient(circle closest-side, var(--glow) 90%, transparent) 12px 50% / 10px 10px no-repeat,
    radial-gradient(circle closest-side, var(--glow) 90%, transparent) 24px 50% / 10px 10px no-repeat;
  animation: agent-dots 1.1s ease-in-out infinite;
}
@keyframes agent-dots {
  0%,
  100% {
    opacity: 0.35;
    transform: translateX(0);
  }
  50% {
    opacity: 1;
    transform: translateX(3px);
  }
}
/* a long text they pasted: its first lines, fading out */
.agent-heard.is-long {
  mask-image: linear-gradient(#000 calc(100% - 1.2lh), rgb(0 0 0 / 0.12));
}
.agent-line.is-note {
  background: var(--glass, rgb(255 253 249 / 0.85));
  box-shadow: none;
  color: var(--quiet, #77716a);
  font-size: 13px;
}
.agent-picture {
  height: 1.4em;
  max-width: 3.2em;
  margin-right: 0.4em;
  vertical-align: top;
  object-fit: contain;
  border-radius: 3px;
}
.agent-line a {
  color: inherit;
  font-weight: 600;
}

/* ---- the chips: buttons to answer with, under the line where the bubble starts. Tap one and it's said, or done at
   once; its tag says what it changes (the whole book, this spread, a moment by its title). A chip is always one line
   (fotoboek DESIGN.md): chips wrap as whole chips, and a label wider than the row itself ends in an ellipsis, its tag
   kept whole beside it. Rounded as a pill on that one line, as a pill's ends don't hold more lines */
.agent-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}
/* a wide dock's stack stops at the bar's widest, far in from the Ontwerpen tile: the row of ideas may run on past it to
   the right, up to the tile, so two ideas mostly keep their whole words on one row, the room the book leaves the words
   under it (--words-room). Two that don't fit even there wrap as whole chips, as a narrower dock's ideas and a
   question's answers do everywhere: a label never ends in an ellipsis while a row of its own would show it whole.
   The room: the stack's own width, and the half of the dock's left beside the
   stack, less the tile and a gap. The dock's width is taken where the stack sets --dock-w (a registered length, so it's
   the dock's 100cqi there, not the stack's own where the chips use it); where @property isn't known it's the stack's,
   and the row keeps to the stack (max). */
@property --dock-w {
  syntax: '<length>';
  inherits: true;
  initial-value: 0px;
}
.agent-stack {
  --dock-w: 100cqi;
}
@container dock (width >= 1080px) {
  .agent-chips:not(.is-answers) {
    width: max-content;
    max-width: max(100%, 100% + (var(--dock-w) - 100% - var(--face-room)) / 2 - var(--design-w) - var(--design-gap));
  }
}
.agent-chip {
  flex: 0 1 auto;
  display: inline-flex;
  align-items: center;
  gap: 0 9px;
  min-width: 0;
  max-width: 100%;
  min-height: 40px;
  padding: 6px 16px;
  text-align: left;
  line-height: 1.25;
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--text, #24221f) 24%, transparent);
  border-radius: 20px;
  background: #fffdf9;
  box-shadow: 0 3px 10px rgb(36 34 31 / 0.1);
  color: var(--text, #24221f);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition:
    transform 0.2s var(--ease, ease),
    border-color 0.2s,
    box-shadow 0.2s;
  animation: agent-chip-in 0.5s var(--ease, ease) backwards;
}
.agent-chip:hover {
  border-color: color-mix(in srgb, var(--text, #24221f) 45%, transparent);
  box-shadow: 0 5px 14px rgb(36 34 31 / 0.14);
}
.agent-chip:nth-child(2) {
  animation-delay: 0.08s;
}
.agent-chip:nth-child(3) {
  animation-delay: 0.16s;
}
.agent-chip:active {
  transform: scale(0.96);
}
/* the label: shrinks before its tag does, to an ellipsis at the very last */
.agent-chip > :first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* an idea of the agent's own (dock.js chips): a bulb before its words, kept with the first of them */
.agent-chip.is-idea {
  padding-left: 12px;
}
.agent-chip.is-idea > :first-child::before {
  content: '';
  display: inline-block;
  width: 17px;
  height: 17px;
  margin-right: 5px;
  vertical-align: -3px;
  background: #d99a1e;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18h6M10 21h4'/%3E%3Cpath d='M12 3a6 6 0 0 0-3.6 10.8c.7.5 1.1 1.3 1.1 2.2h5c0-.9.4-1.7 1.1-2.2A6 6 0 0 0 12 3Z'/%3E%3C/svg%3E")
    center / contain no-repeat;
}
.agent-chip-reach {
  white-space: nowrap;
  color: var(--quiet, #77716a);
  flex-shrink: 0;
  max-width: min(14em, 34cqi);
  font-size: 13px;
  font-weight: 400;
}
.agent-chip-reach:empty {
  display: none;
}
/* an idea about pages out of sight stands aside until they're back (dock.js retag) */
.agent-chip[hidden] {
  display: none;
}
/* the agent's ideas as its line's last rows (dock.js chips): one bubble for what it said and what it would do next,
   each idea a row of the bubble's own paper under a hairline, its bulb, its words and what a tap changes, as tall as a
   finger needs and with nothing to tap right above or below it but the bubble's own rows */
.agent-ideas {
  display: flex;
  flex-direction: column;
  margin: 6px -14px -6px;
}
.agent-ideas .agent-chip {
  width: 100%;
  min-height: 44px;
  padding: 8px 14px 8px 12px;
  border: 0;
  border-top: 1px solid var(--line, rgb(36 34 31 / 0.1));
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--pebble-ink);
  pointer-events: auto;
}
.agent-ideas .agent-chip:last-child {
  border-radius: 0 0 18px 18px;
}
.agent-ideas .agent-chip:hover {
  background: rgb(36 34 31 / 0.04);
}
.agent-ideas .agent-chip-reach {
  margin-left: auto;
}
/* the narrowest docks (a bar under 277 px: a phone 360 px wide, worked out as for 317 px above): a little less padding,
   so a label of a few words still keeps to one line */
@container (width < 277px) {
  .agent-chip {
    padding-inline: 12px;
  }
}
@keyframes agent-chip-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---- the agent's question: its bubble and its answers share a ring of its warm glow, which the plain chips don't, so
   the answers read as its question's. The bubble's ring spreads once as it asks, and the answers come out of it one by
   one. An answer about a photo carries that photo's number on the book, in the rings' colour (table.css .tb-mark). */
.agent-line.is-asking,
.agent-line.is-said.is-replying {
  box-shadow:
    0 0 0 1.5px var(--glow),
    0 0 0 0 transparent,
    0 6px 20px rgb(36 34 31 / 0.1);
  animation: agent-ask 1s ease-out 0.15s;
}
@keyframes agent-ask {
  from {
    box-shadow:
      0 0 0 1.5px var(--glow),
      0 0 0 0 color-mix(in srgb, var(--glow) 70%, transparent),
      0 6px 20px rgb(36 34 31 / 0.1);
  }
  to {
    box-shadow:
      0 0 0 1.5px var(--glow),
      0 0 0 16px transparent,
      0 6px 20px rgb(36 34 31 / 0.1);
  }
}
.agent-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  min-height: 42px;
  padding: 6px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--paper);
  box-shadow:
    0 0 0 1.5px var(--glow),
    0 4px 14px color-mix(in srgb, var(--glow) 28%, transparent);
  color: var(--pebble-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  transform-origin: 30% 0;
  transition:
    transform 0.2s var(--ease, ease),
    background 0.2s;
  animation: agent-answer-in 0.55s cubic-bezier(0.34, 1.5, 0.64, 1) 0.3s backwards;
}
.agent-option:nth-child(2) {
  animation-delay: 0.42s;
}
.agent-option:nth-child(3) {
  animation-delay: 0.54s;
}
.agent-option:nth-child(n + 4) {
  animation-delay: 0.66s;
}
@media (hover: hover) {
  .agent-option:hover {
    background: color-mix(in srgb, var(--glow) 10%, var(--paper));
  }
}
.agent-option:active {
  transform: scale(0.96);
}
/* an answer that changes the book shows the part it changes small, as its tap leaves it (optionsketch.js: a preview.js
   picture, whose own width is its container's), its words beside it */
.agent-option.has-sketch {
  padding-left: 6px;
  border-radius: 14px;
}
.agent-option .agent-option-sketch.tb-preview {
  flex: none;
  width: 80px;
  overflow: hidden;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgb(36 34 31 / 0.18);
  pointer-events: none;
}
/* a cover is one page: half a spread's width, as high as a spread's picture */
.agent-option .agent-option-sketch.is-cover {
  width: 40px;
}
.agent-option-number {
  display: grid;
  flex: none;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-left: -8px;
  border-radius: 50%;
  background: #e2603a;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
@keyframes agent-answer-in {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.8);
  }
}

/* ---- a reply's chips come out of the bubble one by one. Its ideas (next steps to try) stay plain paper with their
   bulb, so they never read as more of what the agent said; a chip that answers the line itself (the offer to pass a
   wish on) shares the bubble's warm ring (the question's, above), as a question's answers do. */
.agent-chips.is-reply .agent-chip {
  transform-origin: 30% 0;
  animation: agent-answer-in 0.55s cubic-bezier(0.34, 1.5, 0.64, 1) 0.3s backwards;
}
.agent-chips.is-reply .agent-chip:not(.is-idea) {
  border-color: transparent;
  background: var(--paper);
  box-shadow:
    0 0 0 1.5px var(--glow),
    0 4px 14px color-mix(in srgb, var(--glow) 28%, transparent);
  color: var(--pebble-ink);
}
.agent-chips.is-reply .agent-chip:nth-child(2) {
  animation-delay: 0.42s;
}
.agent-chips.is-reply .agent-chip:nth-child(n + 3) {
  animation-delay: 0.54s;
}
@media (hover: hover) {
  .agent-chips.is-reply .agent-chip:not(.is-idea):hover {
    background: color-mix(in srgb, var(--glow) 10%, var(--paper));
  }
}

/* where the line lies over the book (dock.js framed), the room beside its bubble lets a tap through to the book. The
   bubble of what the agent said (never its open question) is the customer's to put away: it wears a close button on
   its corner, and a swipe sideways or down, or a tap on its words, puts it away too (shared/tactile/swipeaway.js).
   Which line is the customer's to put away, dock.js decides (.is-closable). A question's bubble lets a tap through to
   the page as well. */
.agent.is-over .agent-say {
  pointer-events: none;
}
.agent.is-over .agent-figure,
.agent.is-over .agent-line a,
.agent.is-over .agent-bubble:has(> .agent-line.is-closable) {
  pointer-events: auto;
}
.agent.is-over .agent-bubble {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.agent-close {
  display: none;
}
.agent.is-over .agent-line.is-closable + .agent-close {
  display: grid;
}
/* the next tap elsewhere takes the agent's ideas off with its line where they lie over the page, in any window (dock.js
   clear): the book never shrinks to make room for them (framing.js steadyFit) */
.agent.is-hushed .agent-chips:not(.is-answers) {
  display: none;
}

/* ---- the presence: a pebble with a face beside the bar's left end, its line's bubble pointing down towards it */
.agent-figure {
  position: absolute;
  left: 0;
  bottom: calc((var(--bar) - var(--presence)) / 2);
  flex: none;
  width: var(--presence);
  height: var(--presence);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
/* nothing said yet to say again */
.agent-figure:disabled {
  cursor: default;
}
.agent-figure svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 3px 8px rgb(36 34 31 / 0.18));
}
.agent-figure .pebble {
  fill: var(--pebble);
  stroke: var(--pebble-ink);
  stroke-width: 2.6;
  stroke-linejoin: round;
}
.agent-figure .eyes {
  fill: var(--pebble-ink);
  transform-origin: 32px 29px;
  animation: agent-blink 5.5s infinite;
}
.agent-figure .mouth,
.agent-figure .cheek {
  fill: none;
  stroke: var(--pebble-ink);
  stroke-width: 2.2;
  stroke-linecap: round;
}
.agent-figure .cheek {
  stroke: var(--glow);
  opacity: 0.7;
}
.agent-figure .body {
  transform-origin: 32px 54px;
  animation: agent-breathe 4.2s ease-in-out infinite;
}
.agent-figure .ring,
.agent-figure .swirl {
  fill: none;
  stroke: var(--glow);
  stroke-width: 2;
  opacity: 0;
  transform-origin: 32px 32px;
}
.agent-figure .swirl {
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-dasharray: 3 7;
}

/* listening: breathing quicker, ripples going out */
.agent.is-listening .agent-figure .body {
  animation-duration: 1.8s;
}
.agent.is-listening .agent-figure .ring {
  animation: agent-ripple 2.2s ease-out infinite;
}
.agent.is-listening .agent-figure .ring-2 {
  animation-delay: 1.1s;
}
.agent.is-listening .agent-figure .eyes {
  animation: none;
  transform: scale(1.12);
}

/* working: a pencil swirl round it, eyes looking about */
.agent.is-working .agent-figure .swirl {
  opacity: 0.9;
  animation: agent-swirl 1.4s linear infinite;
}
.agent.is-working .agent-figure .eyes {
  animation: agent-look 2.4s ease-in-out infinite;
}
.agent.is-working .agent-figure .body {
  animation: agent-wobble 1.2s ease-in-out infinite;
}

/* speaking: the mouth moves, a warm glow */
.agent.is-speaking .agent-figure .mouth {
  transform-origin: 32px 39px;
  animation: agent-talk 0.32s ease-in-out infinite alternate;
}
.agent.is-speaking .agent-figure .pebble {
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--glow) 60%, transparent));
}
/* a partner's own figure (dock.js figureOf) has no mouth of ours to move: it hops a little while it speaks, in the glow */
.agent-figure .own {
  transform-origin: 32px 57px;
}
.agent.is-speaking .agent-figure .own {
  animation: agent-hop 0.36s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--glow) 60%, transparent));
}
@keyframes agent-hop {
  to {
    transform: translateY(-1.6px) scale(0.98, 1.03);
  }
}

@keyframes agent-breathe {
  50% {
    transform: scale(1.045, 0.97);
  }
}
@keyframes agent-blink {
  0%,
  94%,
  100% {
    transform: scaleY(1);
  }
  97% {
    transform: scaleY(0.1);
  }
}
@keyframes agent-ripple {
  0% {
    opacity: 0.8;
    transform: scale(0.85);
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}
@keyframes agent-swirl {
  to {
    transform: rotate(360deg);
  }
}
@keyframes agent-look {
  0%,
  100% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(-2.5px);
  }
  65% {
    transform: translate(2.5px, -1px);
  }
}
@keyframes agent-wobble {
  50% {
    transform: rotate(-4deg) scale(1.02);
  }
}
@keyframes agent-talk {
  to {
    transform: scaleY(1.9);
  }
}

/* ==== the layouts (the model at the top). Beside is the default, written with the parts above. */

/* beside, on a screen too narrow for the tray's shelf (tray.js SHELF_MIN_W) beside the book: there's no column for the
   tile either, so the dock is as tall as the tile and the book is framed above it */
@media (min-height: 501px) and (max-width: 1099px) {
  body:not(:has(#ways:not([hidden], .leaving))) .agent-stack {
    align-content: end;
    min-height: var(--design-h);
  }
}

/* the row of controls (controlrow.js), in use where the dock stacks (below) */
.agent-row {
  display: none;
}

/* ---- stacked: a dock narrower than a bar beside the Ontwerpen tile needs (a phone upright, a narrow window), on a
   screen tall enough to stand the line and chips above the bar. The book's controls stand in one row under the bar
   (controlrow.js moves them there): the magnifier's buttons, the Ontwerpen tile and the tray's pile, so the bar takes
   the dock's whole width and the book the room above it the tray's corner stack took. The line and the chips over the bar take the dock's width, the
   face's column too. The width is beside's room values summed (a container condition can't read them): a dock under
   729 px leaves the bar beside the tile under 455 px, as 729 = 455 + the face's column (--presence 56 + --face-gap 10)
   + 2 × (--design-w 96 + --design-gap 8). Tall enough: over the short sizes' 500 px. */
@media (min-height: 501px) {
  @container dock (width < 729px) {
    /* (the container's own children: the stack, and the row) */
    .agent > * {
      --presence: 44px;
      --face-gap: 8px;
    }
    .agent-stack {
      width: 100%;
    }
    /* chips beside the face would wrap each to a few lines: they take the dock's whole width instead, the face's
       column too, one under the other, each as wide as the row (a chip is one line); the line over them takes the width beside the face.
       No wrap: a wrapping column's line is as wide as its longest chip's whole label, and stretch would carry every
       chip off the screen with it, where the label should end in its ellipsis */
    .agent-chips:not(:empty) {
      flex-direction: column;
      flex-wrap: nowrap;
      align-items: stretch;
      width: calc(100% + var(--face-room));
      max-width: none;
      margin-left: calc(-1 * var(--face-room));
    }
    .agent-chips:not(:empty) .agent-chip {
      max-width: none;
    }
    /* the line too: its bubble over the face's column as well, its point right over the face beside the bar */
    .agent-say {
      width: calc(100% + var(--face-room));
      max-width: none;
      margin-left: calc(-1 * var(--face-room));
    }
    .agent-chips:not(:empty) .agent-chip-reach {
      margin-left: auto;
    }
    /* the row: the zoom at the left, Ontwerpen in the middle, the pile at the right, each where it is whichever others
       show (the zoom only over a spread, the pile while photos are left), in the bar's glass and as tall as a finger
       needs. The pile's slot shows nothing of its own: the table draws the tray's closed stack in it (table.css
       .has-pile), so a tap there is the tray's */
    .agent-row {
      --control-row: 1;
      display: grid;
      grid-template-columns: 1fr auto 1fr;
      column-gap: 8px;
      align-items: center;
      height: var(--row);
      margin-top: var(--row-gap);
      pointer-events: none;
    }
    .agent-row > :not(.agent-tray-slot) {
      box-sizing: border-box;
      height: var(--row);
      border: 1px solid var(--line, rgb(36 34 31 / 0.1));
      border-radius: 22px;
      background: var(--glass, rgb(255 253 249 / 0.85));
      backdrop-filter: blur(14px) saturate(1.3);
      -webkit-backdrop-filter: blur(14px) saturate(1.3);
      box-shadow: 0 8px 22px -12px rgb(40 30 20 / 0.35);
      pointer-events: auto;
    }
    .agent-row .agent-design {
      grid-column: 2;
      position: relative;
      inset: auto;
      flex-direction: row;
      gap: 6px;
      width: auto;
      padding: 0 16px 0 10px;
      color: var(--text, #24221f);
      font: 600 14px/1 var(--ui-font, inherit);
    }
    .agent-row .agent-design-stack {
      --cover: 21px;
      width: 32px;
    }
    .agent-row .agent-design-name {
      display: inline;
    }
    .agent-row .tb-zoom {
      grid-column: 1;
      justify-self: start;
      position: relative;
      inset: auto;
      padding: 1px;
    }
    .agent-row .tb-zoom[hidden] {
      display: none;
    }
    /* the pile's slot: as wide as its stack (tray.js pileLayout: 50 px with its inset) and its count, which drawer.js
       countSlot writes in it unseen, in the pile's type (table.css .has-pile), digits even so a count's width is its
       length's */
    .agent-row .agent-tray-slot {
      grid-column: 3;
      justify-self: end;
      box-sizing: border-box;
      height: var(--row);
      padding: 0 10px 0 50px;
      font: 600 14px/18px var(--ui-font, system-ui);
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
      visibility: hidden;
    }
    /* while the ways in are up there's no book in sight (the tile steps aside, above; no photos are left over yet) */
    body:has(#ways:not([hidden], .leaving)) .agent-row .tb-zoom {
      display: none;
    }
  }
  /* a phone under about 370 px (a dock under 340): the row's words would crowd it, so Ontwerpen is its covers alone,
     named by its aria-label (the pile keeps its count, which is what it says) */
  @container dock (width < 340px) {
    .agent-row .agent-design-name {
      display: none;
    }
    .agent-row .agent-design {
      padding: 0 4px;
    }
  }
}

/* ---- the tray's tile (controlrow.js trayTile): on an upright screen where the dock stands beside the book (a tablet
   held upright), the closed tray's stack stands on a tile of its own left of Ontwerpen, as large and as low, so the
   book takes the whole height under the top bar. The tile shows nothing of its own: the table draws the stack in it
   (table.css .has-tile), so a tap there is the tray's. While the tray holds photos the bar and what's said keep clear
   of both tiles (the zoom keeps the left) */
.agent-tray-tile {
  display: none;
}
@media (orientation: portrait) and (max-width: 1099px) {
  @container dock (width >= 729px) {
    .agent-tray-tile {
      display: block;
      position: absolute;
      right: calc(max(10px, env(safe-area-inset-right, 0px)) + var(--design-w) + var(--design-gap));
      bottom: var(--dock-lift);
      width: var(--design-w);
      height: var(--design-h);
      pointer-events: none;
    }
    body:has(#table.has-tile.has-tray) .agent-stack {
      width: min(100% - 3 * (var(--design-w) + var(--design-gap)), var(--bar-most) + var(--face-room));
      margin: 0 calc(2 * (var(--design-w) + var(--design-gap))) 0 calc(var(--design-w) + var(--design-gap));
    }
  }
}

/* ---- short sizes (a phone held sideways, a low window): the dock gives the book its height. A slimmer bar nearer the
   screen's edge, the face as small, smaller words; nothing stands above the bar but what's said, so the Ontwerpen tile
   is as low as the bar, level with its right end (never stacked), its covers beside its word */
@media (max-height: 500px) {
  body {
    --dock-lift: calc(var(--safe-bottom, 0px) + 8px);
  }
  .agent {
    --bar: 44px;
    --presence: 44px;
    --face-gap: 8px;
    --design-w: 124px;
    --design-h: var(--bar);
    --bar-most: 600px;
    --edge-left: max(16px, env(safe-area-inset-left, 0px));
  }
  .agent-stack {
    gap: 0;
  }
  .agent-line {
    margin-bottom: 6px;
    padding: 5px 13px;
    font-size: 15px;
    line-height: 1.35;
  }
  .agent-chips {
    gap: 6px;
  }
  .agent-chips:not(:empty) {
    margin-bottom: 6px;
  }
  .agent-chip,
  .agent-option {
    min-height: 34px;
    padding: 4px 13px;
    font-size: 15px;
  }
  .agent-option.has-sketch {
    padding-left: 4px;
  }
  .agent-option .agent-option-sketch.tb-preview {
    width: 56px;
  }
  .agent-option .agent-option-sketch.is-cover {
    width: 28px;
  }
  .agent-design {
    right: var(--edge-right);
    flex-direction: row;
    gap: 4px;
    padding: 0 14px 0 2px;
    border-radius: calc(var(--bar) / 2);
  }
  .agent-design-stack {
    --cover: 28px;
    flex: none;
    width: 40px;
  }
}

/* ---- the covers alone: a dock too narrow for a tile with its word beside the bar (the column, a low narrow window;
   stacked's row gives it its word back) has the tile as its covers alone, as wide and high as the bar, level with its right end. After the short
   sizes, whose bar-high tile it narrows (its row and gap kept: the word is away) */
@container dock (width < 729px) {
  .agent > * {
    --design-w: var(--bar);
    --design-h: var(--bar);
  }
  .agent-design {
    right: var(--edge-right);
    justify-content: center;
    padding: 0;
    border-radius: calc(var(--bar) / 2);
  }
  .agent-design-stack {
    --cover: 28px;
    flex: none;
    width: 40px;
  }
  .agent-design-name {
    display: none;
  }
}

/* ---- column: a phone held sideways with its book made. Under the dock the book would keep a strip a third of the
   screen high, so the dock stands as a column at the right, the line and chips over its bar as ever, and the book takes
   the height beside it (app.js frameTable reads --dock-side as room at the right; the ways in, back over a book that has
   no photos, lie beside it too: app.css). The Ontwerpen tile is its covers alone (the narrow dock's, above), so the bar
   keeps the column's width. The start keeps the dock below it. */
@media (max-height: 500px) and (min-aspect-ratio: 3/2) and (max-width: 1099px) {
  body.booked {
    --dock-side: 1;
    --dock-column: min(42vw, 360px);
  }
  body.booked .agent {
    --edge-left: 4px;
    --edge-right: max(12px, env(safe-area-inset-right, 0px));
    inset: auto 0 0 auto;
    width: var(--dock-column);
  }
  /* the column stays below the top bar (app.js sets --top-bottom): a line longer than the room left scrolls from its
     start, the chips and the bar keep their place */
  body.booked .agent-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: calc(100% - var(--design-w) - var(--design-gap));
    max-height: calc(100dvh - var(--top-bottom, 52px) - var(--dock-lift) - 8px);
    margin: 0;
  }
  body.booked .agent-stack > * {
    flex-shrink: 0;
  }
  /* a line longer than the room scrolls inside its own bubble: a scroll box clips what's painted outside it, so the
     bubble scrolls rather than a box around it, and keeps its soft shadow and asking ring whole */
  body.booked .agent-say {
    flex-shrink: 1;
    min-height: 0;
    align-items: stretch;
  }
  body.booked .agent-bubble {
    min-height: 0;
  }
  body.booked .agent-line:not(.is-heard) {
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  /* (its words scroll up and down: a swipe puts it away sideways only) */
  body.booked .agent.is-over .agent-bubble {
    touch-action: pan-y;
  }
}

@media (prefers-reduced-motion: reduce) {
  .agent-figure *,
  .agent-mic,
  .agent-chip,
  .agent-line,
  .agent-line::after,
  .agent-close,
  .agent-option,
  .agent-design,
  .agent-design * {
    animation: none !important;
  }
  .agent.is-working .agent-figure .swirl {
    opacity: 0.9;
  }
}
