/* feature-forms.css — Studio's Feature name, Feature orientation, Archive feature, New
   feature and New project forms, which feature-forms.js builds.

   Every colour, type size and control size is a role `styles.css` declares on `:root`
   and again under `[data-theme="dark"]`, so there is no dark block here. The one
   literal is the dialog's backdrop, because a custom property does not reach
   `::backdrop` in every browser this page supports. Spacing follows Studio's scale
   (4, 8, 12, 16, 24), and the forms take Studio's standard width, 480 points.

   Nothing here is written from script. The shell's CSP (`style-src 'self'`) refuses
   style attributes, so state arrives as a class, `hidden` or `disabled`, and these
   rules draw it. KIND and LAYOUT in New feature are groups.js's picker, which
   groups.css draws. */

/* `styles.css` already hides `[hidden]`; repeated for the elements below that set a
   display of their own, so this file does not lean on another's rule. */
.ff-dialog [hidden] { display: none !important; }

/* ---------------------------------------------------------------- the card */

/* A native modal `<dialog>` in the top layer: a card on the panel surface with a
   hairline and Studio's 12-point radius, cross-faded in over a 40% black scrim, with
   no blur and no shadow. The header and footer stay put; the body scrolls. */
.ff-dialog {
  width: min(480px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
.ff-dialog[open] { display: flex; animation: ff-dialog-in .3s ease-in-out; }
.ff-dialog::backdrop { background: rgba(0, 0, 0, .4); }
@keyframes ff-dialog-in { from { opacity: 0; } }
.ff-frame { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; }

.ff-head { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 24px 24px 0; }
.ff-title { flex: 1 1 auto; min-width: 0; margin: 0; font: var(--type-h1); overflow-wrap: anywhere; }
.ff-close { width: var(--icon-button); height: var(--icon-button); flex: 0 0 var(--icon-button); display: grid; place-items: center; padding: 0; color: var(--ink); background: transparent; border: 0; border-radius: var(--radius-icon); font-size: 17px; line-height: 1; cursor: pointer; }
.ff-close:hover:not(:disabled) { background: var(--hover); }
.ff-close:disabled { color: var(--muted); cursor: progress; }

/* Studio's small loading indicator, beside the close button while the form works.
   Neutral, as Studio's is: orange is kept for a chat turn at work. The card keeps its
   size, so submitting never makes it shrink and grow. */
.ff-spinner { width: 12px; height: 12px; flex: 0 0 12px; display: inline-block; border: 1.5px solid var(--line-strong); border-top-color: var(--loading); border-radius: 50%; animation: ff-spin .8s linear infinite; }
@keyframes ff-spin { to { transform: rotate(360deg); } }

/* The fields, 16 points apart: the explanation, the field, the line beneath it. */
.ff-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 16px; padding: 16px 24px; }
.ff-lead { margin: 0; color: var(--ink-soft); font: var(--type-body); overflow-wrap: anywhere; }

/* ------------------------------------------------------------- the fields */

/* `StudioLabeledFieldView`: the title in eyebrow type over the field. The title is
   drawn as it is written and never transformed, because Archive feature's carries the
   feature's own name, which has to be typed exactly: "TYPE PokemonList TO CONFIRM". */
.ff-field { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ff-eyebrow { margin: 0; color: var(--muted); font: var(--type-eyebrow); letter-spacing: var(--eyebrow-tracking); overflow-wrap: anywhere; }
.ff-input { width: 100%; height: var(--control-height); padding: 0 12px; color: var(--ink); background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius-button); font: var(--type-body); }
.ff-input:focus { border-color: var(--selected-line-strong); }
.ff-input::placeholder { color: var(--muted); }
.ff-input:disabled { color: var(--muted); background: var(--chip); cursor: progress; }

/* "Saved as …" in the muted caption, or the name's problem in its place, in the
   danger ink. */
.ff-note { margin: 0; color: var(--muted); font: var(--type-caption); overflow-wrap: anywhere; }
.ff-note.problem { color: var(--bad-ink); }

/* `StudioChoiceRowView`, 8 points apart: unchosen, the muted surface with no edge;
   chosen, Studio's raised neutral fill, a neutral edge and primary ink, with the mark
   filled and ticked so the state is not carried by the edge alone. The note on a chosen
   row takes `--ink-soft`, because `--muted` falls under 4.5:1 there (TechPlan.md § The
   design system is Studio's). */
.ff-choices { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ff-choice { width: 100%; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px; color: var(--ink); text-align: left; background: var(--panel-muted); border: 1px solid transparent; border-radius: var(--radius-button); cursor: pointer; }
.ff-choice:hover:not(:disabled) { background-image: linear-gradient(var(--hover), var(--hover)); }
.ff-choice.selected { background: var(--selected-fill); border-color: var(--selected-line-strong); }
.ff-choice:disabled { cursor: progress; opacity: .48; }
.ff-choice-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ff-choice-title { color: var(--ink); font: var(--type-label); overflow-wrap: anywhere; }
.ff-choice.selected .ff-choice-title { color: var(--selected-ink); }
.ff-choice-note { color: var(--muted); font: var(--type-caption); overflow-wrap: anywhere; }
.ff-choice.selected .ff-choice-note { color: var(--ink-soft); }
.ff-choice-mark { width: 16px; height: 16px; flex: 0 0 16px; display: grid; place-items: center; box-sizing: border-box; border: 1.5px solid var(--muted); border-radius: 50%; }
.ff-choice.selected .ff-choice-mark { background: var(--selected-ink); border-color: var(--selected-ink); }
.ff-choice.selected .ff-choice-mark::after { content: "✓"; color: var(--selected-fill); font: var(--type-caption-strong); line-height: 1; }

/* ------------------------------------------------------------- the footer */

/* A failure sits directly above the actions it is about and scrolls within Studio's
   180 points (`formMessageMaximumHeight`), so the actions never leave. */
.ff-foot { flex: 0 0 auto; display: flex; flex-direction: column; gap: 12px; padding: 0 24px 24px; }
.ff-messages { max-height: 180px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
/* `StudioFormErrorView`: the danger family's muted fill under its own ink. */
.ff-error { margin: 0; padding: 12px; color: var(--bad-ink); background: var(--bad-bg); border-radius: var(--radius-button); font: var(--type-small); overflow-wrap: anywhere; }

/* Studio's dialog buttons: equal shares of the row, 28 points, body type — the
   dismissal in the Cancel role and the answer in the primary orange. Archive feature's
   answer is Studio's Secondary button in the danger family: its ink on its muted fill
   inside its line. A Create action and Archive feature carry a mark before the title. */
.ff-actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.ff-button { height: var(--control-height); min-width: 0; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; overflow: hidden; border: 1px solid transparent; border-radius: var(--radius-button); font: var(--type-body); white-space: nowrap; cursor: pointer; transition: background-color .16s ease, border-color .16s ease, color .16s ease; }
.ff-button-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ff-glyph { width: 12px; height: 12px; flex: 0 0 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ff-button.cancel { color: var(--ink); background-color: var(--panel-muted); border-color: var(--line); }
.ff-button.cancel:hover:not(:disabled) { background-image: linear-gradient(var(--hover), var(--hover)); }
.ff-button.cancel:active:not(:disabled) { background-image: linear-gradient(var(--pressed), var(--pressed)); }
.ff-button.primary { color: var(--on-primary); background: var(--primary); }
.ff-button.primary:hover:not(:disabled) { background: var(--primary-hover); }
.ff-button.primary:active:not(:disabled) { background: var(--primary-pressed); }
.ff-button.danger { color: var(--bad-ink); background-color: var(--bad-bg); border-color: var(--bad-line); }
.ff-button.danger:hover:not(:disabled) { background-image: linear-gradient(var(--hover), var(--hover)); }
.ff-button.danger:active:not(:disabled) { background-image: linear-gradient(var(--pressed), var(--pressed)); }
/* After every role, so a disabled answer is muted ink on the chip whatever its role. */
.ff-button:disabled { color: var(--muted); background: var(--chip); background-image: none; border-color: transparent; cursor: not-allowed; }

@media (prefers-reduced-motion: reduce) {
  .ff-dialog[open] { animation: none; }
  .ff-spinner { animation: none; border-top-color: var(--loading); }
}

@media (max-width: 560px) {
  .ff-head { padding: 20px 16px 0; }
  .ff-body { padding: 12px 16px; }
  .ff-foot { padding: 0 16px 20px; }
}
