/* "You are the harness" widget (site/harness-step.js). Everything is scoped with the hs- prefix
   and uses only the design tokens from style.css. Cards reuse .card, .card-head, .card.model and
   .card.result from style.css. */

.hs {
  position: relative;
  container-type: inline-size;
  --hs-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}
.hs [hidden] { display: none !important; }

.hs-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1rem, 3cqi, 2rem);
  align-items: start;
}
/* Stacked when the widget itself is narrow (a phone, or a narrow column on desktop). The
   conversation stays on top, so the drag goes straight up into the slot. */
@container (max-width: 40rem) {
  .hs-grid { grid-template-columns: minmax(0, 1fr); }
  .hs-run { width: 100%; }
}

.hs .hs-title {
  font: 500 0.75rem/1.3 var(--mono);
  letter-spacing: 0.03em;
  color: var(--ink-2);
  margin: 0 0 0.6rem;
}

/* The cards from style.css rise in on insertion; this widget runs its own motion instead. */
.hs .card { animation: none; }

/* ---------- conversation ---------- */
.hs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.7rem;
}

.hs-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 5.5rem;
  padding: 1rem;
  border: 2px dashed var(--rule);
  border-radius: 10px;
  font: 500 0.8rem/1.4 var(--mono);
  color: var(--ink-2);
  text-align: center;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.hs[data-state="ran"] .hs-slot,
.hs[data-state="moving"] .hs-slot {
  border-color: color-mix(in srgb, var(--result) 70%, var(--rule));
  background: color-mix(in srgb, var(--result) 7%, transparent);
  color: var(--ink);
}
.hs-slot.hs-over {
  border-style: solid;
  border-color: var(--result);
  background: color-mix(in srgb, var(--result) 16%, transparent);
}

.hs-result:focus { outline: none; }
.hs-result:focus-visible { outline: 2px solid var(--focus, var(--ink)); outline-offset: 3px; }

/* ---------- your computer ---------- */
.hs-pc {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 0.9rem;
}

.hs-note {
  margin: 0 0 0.9rem;
  font: 400 0.95rem/1.5 var(--body);
  color: var(--ink-2);
  max-width: 34rem;
}

.hs-summary {
  margin: 0 0 0.75rem;
  font: 400 0.78rem/1.5 var(--mono);
  color: var(--ink-2);
}
.hs-summary-label { display: block; font-weight: 500; margin-bottom: 0.15rem; }
.hs .hs-summary-text {
  display: block;
  font: 500 0.8rem/1.5 var(--mono);
  color: var(--ink);
  background: none;
  padding: 0;
  overflow-wrap: anywhere;
}

.hs-out {
  position: relative;
  transform-origin: 0 0;
  transition: box-shadow 150ms ease;
}
.hs-out.hs-lifted {
  z-index: 10;
  box-shadow:
    0 0 0 1px var(--result),
    0 24px 48px -24px color-mix(in srgb, var(--ink) 65%, transparent);
}

.hs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.7rem 0.8rem 0.8rem;
  border-top: 1px dashed var(--rule);
}
.hs-actions > * { flex: 1 1 12rem; }

.hs-pasted {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 5.5rem;
  margin: 0;
  padding: 1rem;
  border: 2px dashed var(--rule);
  border-radius: 10px;
  font: 500 0.8rem/1.4 var(--mono);
  color: var(--ink-2);
  text-align: center;
}

/* ---------- buttons and the drag handle ---------- */
.hs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  min-width: 2.75rem;
  margin: 0;
  padding: 0.55rem 1rem;
  font: 600 0.85rem/1.25 var(--mono);
  text-align: center;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--result);
  border-radius: 8px;
  cursor: pointer;
  transition: transform 160ms var(--hs-ease-out), background-color 150ms ease, border-color 150ms ease;
}
.hs-btn:active { transform: scale(0.97); }
.hs-btn:focus-visible { outline: 2px solid var(--focus, var(--ink)); outline-offset: 3px; }

.hs-btn-primary {
  color: var(--on-fill, var(--card));
  background: var(--result);
  border-color: var(--result);
}

@media (hover: hover) and (pointer: fine) {
  .hs-btn:hover { background: color-mix(in srgb, var(--result) 12%, var(--card)); }
  .hs-btn-primary:hover { background: color-mix(in srgb, var(--result) 86%, var(--ink)); }
}

.hs-handle {
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.hs-grip { flex: none; fill: var(--result); }

.hs-is-dragging,
.hs-is-dragging * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
.hs-is-dragging .hs-handle { background: color-mix(in srgb, var(--result) 12%, var(--card)); }
.hs-out.hs-on-slot { box-shadow: 0 0 0 2px var(--result), 0 24px 48px -24px color-mix(in srgb, var(--ink) 65%, transparent); }
.hs-on-slot .hs-handle { color: var(--on-fill, var(--card)); background: var(--result); }
.hs-on-slot .hs-grip { fill: currentColor; }

/* ---------- screen-reader-only live region ---------- */
.hs-live {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .hs *, .hs *::before, .hs *::after { transition: none !important; animation: none !important; }
}
