/* ============================================================================
   Capture studio.
   ============================================================================ */

.studio {
  position: absolute;
  inset: 0;
  z-index: var(--z-sheet);
  display: grid;

  /* `minmax(0, 1fr)`, not the default `auto`.
     An auto row sizes to its CONTENT, so with a long form the row grew to
     1072px inside a 780px box — the sheet overflowed, its body never became a
     scroll container, and the footer was pushed 200px below the window. The
     0 minimum is the part that matters: it lets the row be smaller than the
     content it holds, which is what forces the body to scroll instead. */
  grid-template-rows: minmax(0, 1fr);
  place-items: stretch;
}

.studio[hidden] { display: none; }

.st-sheet {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--c-ground);
  display: grid;
  grid-template-rows: auto 1fr auto;   /* header · scrolls · buttons */
  transform: translateY(100%);
  transition: transform var(--dur-slow) var(--ease-out);
}

.studio.is-open .st-sheet { transform: translateY(0); }

.st-top {
  height: var(--header-h);
  padding: 0 var(--s-3);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  border-bottom: var(--border-faint);
}

.st-x {
  width: 34px; height: 34px; min-height: 0; min-width: 0;
  display: grid; place-items: center;
  border-radius: var(--r-pill);
  color: var(--c-text-muted);
}

.st-step {
  font-size: var(--t-caption-2);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--c-text-faint);
}

.st-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.st-body::-webkit-scrollbar { display: none; }

/* --- blocks --- */

.st-block { display: flex; flex-direction: column; gap: var(--s-2); }
.st-center { align-items: center; text-align: center; padding: var(--s-10) 0; }

.st-title {
  font-size: var(--t-title-2);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-heading);
}

.st-copy { font-size: var(--t-subhead); color: var(--c-text-muted); line-height: var(--lh-body); }
.st-copy strong { color: var(--c-gold); font-weight: var(--fw-semibold); }

.st-points { display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-1); }

.st-points li {
  font-size: var(--t-footnote);
  color: var(--c-text-muted);
  padding-left: var(--s-4);
  position: relative;
}

.st-points li::before {
  content: "";
  position: absolute;
  left: 0; top: 8px;
  width: 5px; height: 5px;
  border-radius: var(--r-pill);
  background: var(--c-gold);
}

/* --- stage --- */

.st-stage {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--c-raised);
  display: grid;
  place-items: center;
}

.st-preview {
  width: 100%;
  max-height: 46dvh;
  object-fit: cover;
  display: block;
}

.st-canvas { max-width: 100%; max-height: 46dvh; height: auto; display: block; }

.st-timer {
  position: absolute;
  top: var(--s-3); right: var(--s-3);
  font-size: var(--t-caption);
  font-variant-numeric: tabular-nums;
  color: var(--c-text);
  background: var(--c-scrim);
  padding: 4px var(--s-2);
  border-radius: var(--r-pill);
}

.st-progress {
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.15);
}

.st-progress i { display: block; height: 100%; width: 0; background: var(--c-danger); }

/* --- record button --- */

.st-record {
  width: 68px; height: 68px;
  margin: 0 auto;
  border-radius: var(--r-pill);
  border: 3px solid var(--c-text);
  display: grid;
  place-items: center;
  background: transparent;
}

.st-record span {
  width: 52px; height: 52px;
  border-radius: var(--r-pill);
  background: var(--c-danger);
  transition: border-radius var(--dur-fast) var(--ease-out),
              width var(--dur-fast) var(--ease-out),
              height var(--dur-fast) var(--ease-out);
}

.st-record.is-live span { width: 26px; height: 26px; border-radius: 6px; }

.st-hint { text-align: center; font-size: var(--t-footnote); color: var(--c-text-faint); }

/* --- fields --- */

.st-field { display: flex; flex-direction: column; gap: var(--s-2); }

.st-label {
  font-size: var(--t-caption-2);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--c-text-muted);
}

.st-help { font-size: var(--t-caption); color: var(--c-text-faint); }

.st-input {
  height: var(--tap-min);
  padding: 0 var(--s-3);
  border-radius: var(--r-md);
  background: var(--c-raised);
  border: var(--border-hairline);
  color: var(--c-text);
  font-size: var(--t-callout);
}

.st-input:focus { border-color: var(--c-line-strong); }

.st-range {
  -webkit-appearance: none;
  appearance: none;
  height: 28px;
  background: none;
}

.st-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--c-line);
}

.st-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  margin-top: -9px;
  border-radius: var(--r-pill);
  background: var(--c-gold);
}

/* --- chips --- */

.st-chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }

/* ---------------------------------------------------- category typeahead -- */

.st-cat { position: relative; }

/* Overlaid, not in flow. A suggestion list that pushed the rest of the form
   down would move the Publish button under the seller's thumb mid-tap. */
.st-cat-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 5;
  max-height: 232px;
  overflow-y: auto;
  border: var(--border-hairline);
  border-radius: var(--r-md);
  background: var(--c-surface);
}

.st-cat-list[hidden] { display: none; }

.st-cat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  width: 100%;
  min-height: var(--tap-min);
  padding: 0 var(--s-3);
  border: none;
  border-bottom: var(--border-faint);
  background: transparent;
  color: var(--c-text);
  font-size: var(--t-subhead);
  text-align: left;
}

.st-cat-item:last-child { border-bottom: none; }
.st-cat-item:active { background: var(--c-raised); }

/* How many live listings already sit in that category — the number is the
   argument for picking it rather than inventing a synonym. */
.st-cat-item em {
  font-style: normal;
  font-size: var(--t-caption);
  color: var(--c-text-faint);
  font-variant-numeric: tabular-nums;
}

.st-cat-item.is-new { color: var(--c-gold); }

.st-chip {
  height: 34px;
  min-height: 0;
  padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  border: var(--border-hairline);
  color: var(--c-text-muted);
  font-size: var(--t-footnote);
  font-weight: var(--fw-semibold);
}

.st-chip.is-on {
  background: var(--c-gold);
  border-color: var(--c-gold);
  color: var(--c-text-on-gold);
}

/* --- card size picker --- */

.st-sizes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-2);
  align-items: end;
}

.st-size {
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-1);
  padding: var(--s-2) 0;
  border-radius: var(--r-md);
  border: var(--border-hairline);
  background: transparent;
}

.st-size.is-on { border-color: var(--c-gold); background: var(--c-gold-wash); }
.st-size.is-poor { opacity: 0.4; }

/* Real proportions with the real frame inside, so the choice is shown rather
   than described. */
.st-size-frame {
  width: 74%;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--c-raised);
  display: block;
}

.st-size-frame canvas { width: 100%; height: 100%; object-fit: cover; display: block; }

.st-size-name { font-size: var(--t-caption-2); color: var(--c-text-muted); }

.st-size-cost {
  font-size: var(--t-caption);
  font-weight: var(--fw-bold);
  color: var(--c-gold);
  font-variant-numeric: tabular-nums;
}

.st-size-tip {
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--c-success);
}

/* --- buttons --- */

/* Outside the scroll area entirely. A primary action that needs scrolling to
   find is a broken screen, and on the details step there is always more content
   below the buttons. */
.st-foot {
  flex-shrink: 0;
  padding: var(--s-3) var(--s-4) var(--s-4);
  border-top: var(--border-faint);
  background: var(--c-ground);
}

.st-row { display: flex; gap: var(--s-2); }

.st-primary {
  flex: 1 1 auto;
  height: var(--tap-min);
  border-radius: var(--r-md);
  background: var(--c-gold);
  color: var(--c-text-on-gold);
  font-size: var(--t-callout);
  font-weight: var(--fw-bold);
}

.st-ghost {
  flex: 0 0 auto;
  height: var(--tap-min);
  padding: 0 var(--s-4);
  border-radius: var(--r-md);
  border: var(--border-hairline);
  color: var(--c-text-muted);
  font-size: var(--t-callout);
  font-weight: var(--fw-semibold);
}

.st-primary:active, .st-ghost:active { opacity: 0.75; }

.st-error {
  font-size: var(--t-footnote);
  color: var(--c-danger);
  text-align: center;
}

.st-spinner {
  width: 30px; height: 30px;
  border: 3px solid var(--c-line);
  border-top-color: var(--c-gold);
  border-radius: var(--r-pill);
  animation: st-spin 0.9s linear infinite;
  margin-bottom: var(--s-3);
}

@keyframes st-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .st-spinner { animation-duration: 3s; }
  .st-sheet { transition: none; }
}

/* --- framing guide over the viewfinder ------------------------------------
   Shows exactly what the chosen card will keep, so the seller composes for it
   while filming instead of discovering the crop afterwards. */

.st-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: 92%;
  max-width: 92%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: var(--r-md);
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

/* --- cover frame picker --------------------------------------------------- */

.st-frames {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-2);
}

.st-frames-wait {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-8) 0;
  font-size: var(--t-footnote);
  color: var(--c-text-faint);
}

.st-frame {
  min-height: 0;
  min-width: 0;
  padding: 0;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 2px solid transparent;
  background: var(--c-raised);
}

.st-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }

.st-frame.is-on { border-color: var(--c-gold); }
.st-frame:active { opacity: 0.8; }

/* --- spec table ----------------------------------------------------------
   Editable rows, because the model guesses and the seller knows. */

.st-specs { display: flex; flex-direction: column; gap: var(--s-2); }

.st-spec {
  display: grid;
  grid-template-columns: 38% 1fr auto;
  gap: var(--s-2);
  align-items: center;
}

.st-spec-k, .st-spec-v {
  height: 40px;
  min-width: 0;
  padding: 0 var(--s-3);
  border-radius: var(--r-md);
  background: var(--c-raised);
  border: var(--border-hairline);
  color: var(--c-text);
  font-size: var(--t-footnote);
}

.st-spec-k { color: var(--c-text-muted); }
.st-spec-v { font-weight: var(--fw-semibold); }
.st-spec-k:focus, .st-spec-v:focus { border-color: var(--c-line-strong); }

.st-spec-x {
  width: 32px; height: 32px;
  min-height: 0; min-width: 0;
  display: grid; place-items: center;
  border-radius: var(--r-pill);
  color: var(--c-text-faint);
  font-size: 19px;
  line-height: 1;
}

.st-addrow {
  align-self: start;
  height: 36px;
  min-height: 0;
  padding: 0 var(--s-3);
  border-radius: var(--r-pill);
  border: 1px dashed var(--c-line-strong);
  color: var(--c-text-muted);
  font-size: var(--t-footnote);
  font-weight: var(--fw-semibold);
}

/* Offered only once the wait is long enough to notice, so it never reads as
   the expected path. */
.st-skip {
  width: 100%;
  min-height: 0;
  padding: var(--s-3) 0 0;
  background: none;
  color: var(--c-text-faint);
  font-size: var(--t-footnote);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --- status notice + inline rebuild -------------------------------------- */

.st-notice {
  padding: var(--s-3);
  border-radius: var(--r-md);
  border: var(--border-hairline);
  background: var(--c-raised);
  color: var(--c-text-muted);
  font-size: var(--t-footnote);
  line-height: var(--lh-body);
}

.st-notice.is-bad {
  color: var(--c-danger);
  border-color: rgba(242, 99, 92, 0.4);
  background: var(--c-danger-wash);
}

/* The description and the builder button sit together, so retrying is one tap
   from the words being retried. */
.st-retry { display: flex; gap: var(--s-2); align-items: stretch; }
.st-retry .st-input { flex: 1 1 auto; min-width: 0; }

.st-retry-go {
  flex: 0 0 auto;
  height: var(--tap-min);
  padding: 0 var(--s-3);
  border-radius: var(--r-md);
  border: var(--border-gold);
  background: var(--c-gold-wash);
  color: var(--c-gold);
  font-size: var(--t-footnote);
  font-weight: var(--fw-bold);
  white-space: nowrap;
}

.st-retry-go:disabled { opacity: 0.55; }
.st-retry-go:active { opacity: 0.7; }

/* --- publish progress ----------------------------------------------------- */

.st-ring {
  --pct: 0;
  width: 78px;
  height: 78px;
  border-radius: var(--r-pill);
  display: grid;
  place-items: center;
  margin-bottom: var(--s-4);
  background: conic-gradient(var(--c-gold) calc(var(--pct) * 1%), var(--c-line) 0);
  transition: background var(--dur-fast) linear;
  position: relative;
}

.st-ring::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: var(--r-pill);
  background: var(--c-ground);
}

.st-ring-num {
  position: relative;
  z-index: 1;
  font-family: var(--font-num);
  font-size: var(--t-callout);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  color: var(--c-gold);
}

.st-tick {
  width: 62px;
  height: 62px;
  border-radius: var(--r-pill);
  display: grid;
  place-items: center;
  margin-bottom: var(--s-4);
  color: var(--c-success);
  border: 2px solid var(--c-success);
}

.st-hint.is-bad { color: var(--c-danger); }

/* --- demand entry point ---------------------------------------------------
   Sits between the pitch and the primary action on the studio's first screen,
   because deciding WHAT to sell comes before deciding to record. Deliberately
   not gold: the primary action here is still "Choose card size", and gold on
   both would leave neither reading as primary. */

.st-demand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  min-height: var(--tap-min);
  margin-bottom: var(--s-3);
  padding: var(--s-3) var(--s-4);

  border-radius: var(--r-lg);
  border: var(--border-gold);
  background: var(--c-gold-wash);
  color: var(--c-text);
  text-align: left;
}

.st-demand:active { opacity: 0.75; }

.st-demand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.st-demand-label {
  font-size: var(--t-subhead);
  font-weight: var(--fw-bold);
}

.st-demand-sub {
  font-size: var(--t-caption-2);
  color: var(--c-text-muted);
}

.st-demand svg {
  width: 16px;
  height: 16px;
  margin-left: auto;
  color: var(--c-gold);
  flex: none;
}
