/*
 * .seq-node-form — one node of the workflow editor (docs/design-system/component-inventory.md).
 *
 * One turbo-frame per node in the real app: the step chosen from the registry, its input
 * slots bound to upstream output slots, its parameters via .seq-params--form, and validation
 * errors naming node and slot. Builds on the gem's .form-field and .form-input; the showcase
 * renders it as a <form> with a <fieldset>.
 *
 * Markup:
 *   <form class="seq-node-form">
 *     <div class="seq-node-form__head"><code class="seq-node-form__node">n2</code> <span class="seq-node-form__depth">depth 1</span> <button class="seq-node-form__remove ...">remove node</button></div>
 *     <div class="seq-node-form__step form-field"><label>step</label><select class="form-input form-input--sm">...</select></div>
 *     <ol class="seq-node-form__slots">
 *       <li class="seq-node-form__slot"><code class="seq-node-form__slot-name">reads_fastq</code><span class="seq-node-form__slot-type">fastq</span><select class="form-input form-input--sm">...</select></li>
 *     </ol>
 *     <table class="seq-params seq-params--form">...</table>
 *     <ul class="seq-node-form__errors"><li class="seq-node-form__error">...</li></ul>
 *   </form>
 */

.seq-node-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-16);
  padding: var(--spacing-16);
  border: var(--stroke-weight-1) solid var(--border-default);
  border-radius: var(--corner-radius-xs);
  background: var(--background-surface-1);
}
.seq-node-form.is-invalid {
  border-color: var(--invalid);             /* a form error is not a failed check: not a lamp role */
}

.seq-node-form__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--spacing-8) var(--spacing-12);
}
.seq-node-form__node {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-14);
  font-weight: var(--font-weight-400);
  color: var(--text-primary);
}
.seq-node-form__remove {
  margin-inline-start: auto;
}

/* Shared label treatment for the step field and the slot list heading. */
.seq-node-form__step > label {
  display: block;
  margin: 0 0 var(--spacing-4);
  font-family: var(--font-family-body);
  font-size: var(--font-size-14);
  font-weight: var(--font-weight-400);
  color: var(--text-secondary);
}
.seq-node-form .form-input {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-14);
  font-weight: var(--font-weight-400);
}
/* Focus: the page ring and the box-shadow reset are 03-generic/_base.css's .form-input rules. */
.seq-node-form__step {
  max-width: var(--width-320);
}

/* Input slots: slot name, its artifact_type, the upstream node.slot it is bound to. */
.seq-node-form__slots {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.seq-node-form__slot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto minmax(0, 1.5fr);
  align-items: center;
  column-gap: var(--spacing-12);
  padding-block: var(--spacing-8);
  border-block-start: var(--stroke-weight-1) solid var(--border-subtle);
}
.seq-node-form__slot:last-child {
  border-block-end: var(--stroke-weight-1) solid var(--border-subtle);
}
.seq-node-form__slot-name {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-14);
  font-weight: var(--font-weight-400);
  color: var(--text-primary);
}
.seq-node-form__slot-type {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-12);
  font-weight: var(--font-weight-400);
  color: var(--text-secondary);
}
.seq-node-form__slot-type::before {
  content: "artifact_type ";
}
.seq-node-form__arrow {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-14);
  font-weight: var(--font-weight-400);
  color: var(--text-secondary);
}
.seq-node-form__slot.is-unbound .form-input {
  border-style: dashed;
  border-color: var(--invalid);             /* a form error is not a failed check: not a lamp role */
}

/* Validation errors naming node and slot: blocked ink and a text prefix, never color alone. */
.seq-node-form__errors {
  list-style: none;
  margin: 0;
  padding: var(--spacing-12) var(--spacing-16);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-4);
  border: var(--stroke-weight-1) solid var(--invalid);
  border-radius: var(--corner-radius-xs);
}
.seq-node-form__error {
  font-family: var(--font-family-body);
  font-size: var(--font-size-14);
  font-weight: var(--font-weight-400);
  color: var(--invalid-ink);
  line-height: 1.4;
}
.seq-node-form__error::before {
  content: "error: ";
  font-family: var(--font-family-mono);
  font-size: var(--font-size-12);
  font-weight: var(--font-weight-400);
}
.seq-node-form__error code {
  font-size: var(--font-size-12);
  color: var(--text-primary);
}

@media (max-width: 767px) {
  .seq-node-form__slot {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: var(--spacing-4);
  }
  .seq-node-form__arrow { display: none; }
  .seq-node-form__slot .form-input { grid-column: 1 / -1; }
}
