/* studio workspace */

.studio-top { padding: 40px 0 28px; background: var(--paper); }

.stepper { position: sticky; top: 78px; z-index: 40; background: var(--paper); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stepper-in { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
.step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-right: 1px solid var(--line);
  font-size: .88rem;
  font-weight: 500;
  color: var(--ink-3);
  cursor: pointer;
  text-align: left;
}
.step:last-child { border-right: 0; }
.step i {
  font-style: normal;
  font-family: var(--mono);
  font-size: .7rem;
  width: 22px; height: 22px;
  flex: none;
  border-radius: 6px;
  background: var(--ground-2);
  display: grid;
  place-items: center;
}
.step[aria-current="step"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.step-label { min-width: 0; }
/* completed, current, locked: the rail reports the run rather than decorating it */
.step-note {
  margin-left: auto;
  font-family: var(--mono);
  font-size: .6rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.step[data-state="done"] { color: var(--ink-2); }
.step[data-state="done"] i { background: var(--ok); color: #fff; }
.step[data-state="done"] .step-note { color: var(--ok); }
.step[data-state="locked"] { color: var(--ink-3); }
.step[data-state="locked"] i { background: var(--ground); color: var(--ink-3); }
.step[aria-current="step"] i { background: var(--tint); color: var(--accent-deep); }
.step:hover { background: var(--ground); }
.step { transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.step[aria-current="step"] i { background: var(--tint); color: var(--accent-deep); }
@media (max-width: 820px) {
  .stepper { position: static; }
  .stepper-in { grid-template-columns: 1fr 1fr; }
  .step { border-bottom: 1px solid var(--line); }
  /* the label stays: a rail of four bare numbers says nothing. Only the state
     word is dropped, because the chip already carries the state in colour. */
  .step .step-note { display: none; }
  .step { font-size: .82rem; padding: 13px 14px; }
}

.studio { padding: 26px 0 80px; background: var(--ground); }
.studio-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
@media (max-width: 1000px) { .studio-grid { grid-template-columns: 1fr; } }

.step-panel { background: var(--paper); scroll-margin-top: 150px; }
.step-panel .panel-head h2 { font-size: 1.32rem; margin-top: 4px; }
.step-panel .panel-head { align-items: flex-start; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }

.form-msg { margin-top: 12px; font-size: .84rem; color: var(--ink-2); min-height: 1.2em; }
.form-msg[data-kind="bad"] { color: var(--bad); }
.form-msg[data-kind="ok"] { color: var(--ok); }

.engine-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  background: var(--ground);
  margin-bottom: 18px;
  font-size: .88rem;
}
.engine-row span:first-child { display: inline-flex; align-items: center; gap: 8px; }

.ref-preview { margin: 0 0 16px; }
.ref-preview img { width: 120px; height: 120px; object-fit: cover; border-radius: var(--r-s); border: 1px solid var(--line); }
.ref-preview figcaption { margin-top: 6px; }

.subject-result { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.subject-art { margin: 0; }
/* height: auto so the width/height attributes on the tag act as the ratio the
   box is reserved at instead of a 1024 px presentational hint */
.subject-art img { width: 100%; height: auto; max-width: 320px; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-m); border: 1px solid var(--line); }
.subject-art figcaption { margin-top: 8px; }
.subject-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.candidates { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 20px; }
@media (max-width: 560px) { .candidates { grid-template-columns: 1fr; } }

.cand { border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; background: var(--paper); }
.cand.locked { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cand.failed { border-color: #f0c0c0; }
.cand-art { aspect-ratio: 1; background: var(--ground-2); position: relative; }
.cand-art img { width: 100%; height: 100%; object-fit: cover; }
.cand-skeleton { position: absolute; inset: 0; display: grid; place-content: center; background: linear-gradient(100deg, var(--ground-2) 30%, #f7faf8 50%, var(--ground-2) 70%); background-size: 240% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
/* the count of seconds a candidate has been waiting, so no slot looks stuck */
.cand-elapsed { color: var(--ink-2); letter-spacing: .04em; }
@media (prefers-reduced-motion: reduce) { .cand-skeleton { animation: none; } }
.cand-failed { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; gap: 8px; padding: 16px; color: var(--bad); }
.cand-failed span { word-break: break-word; }
.cand-body { padding: 12px; display: grid; gap: 10px; }
.cand-meta { word-break: break-all; }
.cand-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.batch-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }

.trait-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.cat { border: 1px solid var(--line); border-radius: var(--r-s); padding: 14px; margin-bottom: 12px; background: var(--ground); }
.cat-head { display: flex; gap: 10px; margin-bottom: 10px; }
.cat-head input { flex: 1; }
/* four trait lines plus the padding, so a four value category is not clipped */
.cat textarea { min-height: 108px; font-family: var(--mono); font-size: .8rem; }
.excl { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 8px; align-items: center; margin-bottom: 10px; }
.excl span { color: var(--ink-3); }
@media (max-width: 560px) { .excl { grid-template-columns: 1fr; } }

.rarity { margin-top: 24px; }
.rarity .matrix { min-width: 340px; }
@media (max-width: 440px) {
  /* the table stays a table at 390: the cells tighten, the numbers keep their
     own column and the wrapper scrolls only if a trait name is very long */
  .rarity .matrix { min-width: 0; font-size: .78rem; }
  .rarity .matrix th, .rarity .matrix td { padding: 8px 6px; }
}

.gate { margin-top: 24px; border: 1px solid var(--line); border-radius: var(--r-s); padding: 16px; }
.gate-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.gate-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.gate-list:empty::after { content: "Build the metadata to run the gate."; color: var(--ink-3); font-size: .84rem; }
.gate-list li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: start; }
.gate-list li span[aria-hidden] { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; }
.gate-list li.pass span[aria-hidden] { background: #edf9f2; color: var(--ok); }
.gate-list li.fail span[aria-hidden] { background: #fdf1f1; color: var(--bad); }
.gate-list b { display: block; font-size: .88rem; }
.gate-list .small { display: block; }

.preview { margin-top: 18px; }
.preview summary { cursor: pointer; font-size: .86rem; font-weight: 600; margin-bottom: 10px; }

.publish-flow { display: grid; gap: 10px; margin-top: 20px; }
.publish-step { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-s); }
.publish-step .pk { width: 24px; height: 24px; border-radius: 50%; background: var(--ground-2); display: grid; place-items: center; font-family: var(--mono); font-size: .7rem; }
.publish-step b { display: block; font-size: .88rem; }
.publish-step [data-kind="ok"] { color: var(--ok); }
.publish-step [data-kind="bad"] { color: var(--bad); }
.publish-step [data-kind="work"] { color: var(--accent-deep); }


/* ---------- v2 studio polish ---------- */

/* A disabled primary is not a pale call to action: it is a locked control, and
   it says what unlocks it in its own label. */
.btn-primary:disabled, .btn-primary[aria-disabled="true"] {
  background: var(--ground-2);
  color: var(--ink-3);
  border-color: var(--line);
  opacity: 1;
}

/* One line saying what to do, where the thing that is missing would be. */
.studio-empty {
  margin-top: 18px;
  padding: 18px 20px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-s);
  font-size: .85rem;
  color: var(--ink-2);
  background: var(--ground);
}

/* On a phone a step panel is taller than the screen, so its action stays at the
   bottom of the panel instead of scrolling off the top of it. */
@media (max-width: 1000px) {
  .studio-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin-left: -20px;
    margin-right: -20px;
    padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
  }
  .cta-row.studio-actions { margin-top: 18px; }
}
