/* ============================================================================
   HIRE A WORKER (chat-first UI step 5, 2026-10-12) — hire-view.js, coworkers.js
   ----------------------------------------------------------------------------
   The owner's Factory canvas in this app's palette and type: a title and one
   line, a box to describe the worker you need, the ready-made roles as cards
   with what each is given and what a job may spend, and beside them the skills
   and connections a worker can be given.

   Loaded after customize.css so it wins at equal specificity. Every colour is
   a token or a mix of tokens, so the dark theme follows with no second block.

   Motion is the motion pack's "lists arrive": cards come in with 4px of
   travel on the snap curve, staggered 18ms for the first six, the rest
   together. No spring — a card carries a cost line, and money never bounces.
   Reduced motion makes it an 80ms fade (the block at the end).
   ============================================================================ */

.cz-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* The Coworkers header and tabs stand down while the Hire page is up: it has
   its own title, its own way back and its own "Write one yourself". */
#coworkers-view.cw-hiring > .mv-head,
#coworkers-view.cw-hiring > .cw-tabs { display: none; }
/* The view's own top padding stays: it is the topbar's clearance (style.css,
   "80px is the topbar plus the gap a page title needs"), and a first draft
   that cut it to 40px put the title under the topbar. */

.hire { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 300px); gap: 32px; align-items: start; }
.hire-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
@container coworkers (max-width: 980px) {
  .hire { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- the head ---------- */
/* The heading takes the ring when the page opens and is not a control, so
   it shows none — the dialogs' headings' rule (`.dlg-head h2:focus`). */
.hire-title:focus { outline: none; }
.hire-head { display: flex; flex-direction: column; gap: 6px; }
.hire-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hire-title { margin: 0; font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; color: var(--text); }
.hire-lede { margin: 0; max-width: 600px; font-size: 15px; line-height: 1.5; color: var(--dim); }
.hire-acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- describe ---------- */
.hire-describe {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 14px 12px 16px; border: 1px solid var(--line); border-radius: var(--card-r);
  background: var(--card); box-shadow: var(--elev-1);
  transition: border-color var(--dur-quick) var(--ease-snap), box-shadow var(--dur-quick) var(--ease-snap);
}
.hire-describe:focus-within { border-color: color-mix(in srgb, var(--focus-ring) 55%, var(--line)); }
.hire-describe textarea {
  width: 100%; resize: vertical; min-height: 44px; border: 0; background: none; padding: 2px 0;
  font: inherit; font-size: 15px; line-height: 1.5; color: var(--text);
}
.hire-describe textarea:focus { outline: none; }
.hire-describe textarea::placeholder { color: var(--dim-2); }
.hire-describe-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hire-describe-say { font-size: 12.5px; line-height: 1.45; color: var(--dim); max-width: 560px; }
.hire-describe [data-hire-draft], #cw-pane .hire-foot [data-add-preset] {
  flex: none; background: var(--btn-ink); color: var(--on-btn-ink); border: 0;
  border-radius: 9px; min-height: 34px; padding: 7px 14px; font-weight: 500;
}
.hire-describe [data-hire-draft]:hover, #cw-pane .hire-foot [data-add-preset]:hover:not(:disabled) {
  background: color-mix(in srgb, var(--btn-ink) 86%, var(--paper)); color: var(--on-btn-ink); border: 0;
}

/* ---------- roles ---------- */
/* 18px over the heading, so "Ready-made roles" reads as the cards' title and
   not as the describe box's foot — it sat 7px under that box (desktop QA,
   2026-10-14). */
.hire-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 18px; }
.hire-sec-head h3 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.005em; color: var(--text); }
.hire-sec-note { font-size: 13px; color: var(--dim); }
.hire .cw-section { display: flex; flex-direction: column; gap: 10px; }
.hire .cw-gallery-head p { margin: 0; }
.hire .cw-presets { grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 14px; }

.hire .cw-preset { padding: 16px; gap: 10px; border-radius: var(--card-r); box-shadow: var(--elev-1); }
/* On the team: the canvas's quiet green wash, so what you already have reads
   apart from what you could hire, without a badge. */
.hire .cw-preset.on-team { background: color-mix(in srgb, var(--sage-wash) 55%, var(--card)); border-color: color-mix(in srgb, var(--fill-sage) 22%, var(--line)); }
.hire .cw-preset .cw-top { display: flex; align-items: center; gap: 10px; }
.hire .cw-preset .cc-avatar { width: 32px; height: 32px; border-radius: 9px; font-size: 14px; }
.hire-who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.hire-who b { font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.25; }
.hire-state { font: 500 12px/1.4 var(--f-body); letter-spacing: normal; color: var(--dim); }
.hire .cw-preset .role { font-size: 13.5px; line-height: 1.5; color: var(--text); flex: 0 0 auto; }
.hire-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.hire-chip {
  display: inline-flex; align-items: center; gap: 5px; min-height: 26px; padding: 2px 8px 2px 4px;
  border-radius: 7px; background: var(--card-2); border: 1px solid var(--line); font-size: 12.5px; color: var(--text);
}
.hire-chip .conn-ic { width: 20px; height: 20px; border-radius: 5px; background: none; box-shadow: none; }
.hire-chip.skill { padding-left: 8px; background: color-mix(in srgb, var(--stone-tint) 70%, var(--card)); }
.hire-foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding-top: 4px; }
.hire-cost { font-family: var(--f-body); font-size: 12px; font-weight: 500; line-height: 1.45; letter-spacing: normal; color: var(--dim); font-variant-numeric: tabular-nums; min-width: 0; }
.hire-foot .cw-actions { margin-left: auto; display: flex; gap: 6px; }
.hire-foot [data-preset-settings] { background: var(--card); color: var(--text); border: 1px solid var(--line-2); border-radius: 9px; min-height: 34px; padding: 7px 12px; font-weight: 500; }
.hire-foot [data-preset-settings]:hover { background: var(--card-2); }
.hire .cw-consent { font-size: 13px; line-height: 1.5; color: var(--text); }
.hire .cw-consent p { margin: 0 0 6px; }

/* ---------- the side column ---------- */
.hire-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; }
.hire-card { border: 1px solid var(--line); border-radius: var(--card-r); background: var(--card); padding: 14px 16px 6px; box-shadow: var(--elev-1); }
.hire-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hire-card-top h3 { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.hire-card-sub { margin: 6px 0 8px; font-size: 12.5px; line-height: 1.45; color: var(--dim); }
.hire-list { list-style: none; margin: 0; padding: 0; }
.hire-row { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 2px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--text); }
.hire-row .conn-ic { width: 22px; height: 22px; border-radius: 6px; }
.hire-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hire-row-meta { flex: none; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--f-body); font-size: 12px; font-weight: 500; letter-spacing: normal; color: var(--dim); }
.hire-row.is-off .hire-row-name { color: var(--dim); }
.hire-row.is-off .conn-ic { opacity: .55; }

/* ---------- on a phone ---------- */
@media (max-width: 720px) {
  .hire-title { font-size: 26px; }
  .hire-describe-foot { flex-direction: column; align-items: stretch; }
  .hire-describe [data-hire-draft] { min-height: 44px; }
  .hire .cw-presets { grid-template-columns: minmax(0, 1fr); }
  .hire-side { position: static; }
  .hire-foot [data-add-preset], .hire-foot [data-preset-settings] { min-height: 44px; }
}

/* ---------- motion: lists arrive ---------- */
@keyframes hire-arrive { from { opacity: 0; transform: translateY(4px); } }
@keyframes hire-fade { from { opacity: 0; } }
/* `.hire-enter` is on the page the first time it is drawn, never on the
   Coworkers view's 15-second redraw (coworkers.js `hirePage`). */
.hire-enter .hire-top, .hire-enter .cw-preset, .hire-enter .hire-card { animation: hire-arrive var(--dur-base) var(--ease-snap) both; }
.hire-enter .cw-preset:nth-child(2) { animation-delay: 18ms; }
.hire-enter .cw-preset:nth-child(3) { animation-delay: 36ms; }
.hire-enter .cw-preset:nth-child(4) { animation-delay: 54ms; }
.hire-enter .cw-preset:nth-child(5) { animation-delay: 72ms; }
.hire-enter .cw-preset:nth-child(n+6) { animation-delay: 90ms; }
.hire-enter .hire-card + .hire-card { animation-delay: 40ms; }
@media (prefers-reduced-motion: reduce) {
  .hire-enter .hire-top, .hire-enter .cw-preset, .hire-enter .hire-card { animation: hire-fade 80ms linear both; animation-delay: 0s; }
  .hire-describe { transition: none; }
}
