/* =========================================================================
   templates/atomic/showcase/css/forms.css — the Forms page

   STRUCTURE ONLY. Linked by forms.html alone. Must pass
   `node tools/atomic-lint.mjs --kind=structure-paint`: it decides where
   things sit and how much room they get, never colour, border, radius or type.
   Paint comes from components.css (core + floor) against the previewed style.

   Shape of the page: an intro (title, lead, three-step tracker), then three
   sections. From 900px each section is a narrow heading column beside a field
   column, so the long form scans as three labelled blocks instead of one
   endless list; below that the heading sits above its fields.
   ========================================================================= */

.forms-page { gap: var(--space-7); }

.cm-intro {
  display: grid;
  gap: var(--space-4);
  max-inline-size: 44rem;
}
.cm-lead { max-inline-size: 40rem; }
/* a plain jump list: three links to the sections below, not a wizard */
.cm-jump {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
}
.cm-jump a { display: inline-flex; align-items: center; min-height: 44px; }

/* error summary: one line per failing field, above the first section */
.cm-summary { display: grid; gap: var(--space-2); max-inline-size: 40rem; }
.cm-summary[hidden] { display: none; }
.cm-summary ul { display: grid; gap: 0; list-style: none; padding: 0; margin: 0; }
.cm-summary a { display: inline-flex; align-items: center; min-height: 2rem; }

.cm-form {
  display: grid;
  gap: var(--space-7);
  min-width: 0;
}

.cm-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  min-width: 0;
}
.cm-section-head {
  display: grid;
  gap: var(--space-2);
  align-content: start;
}
.cm-fields { min-width: 0; }

@media (min-width: 900px) {
  .cm-section {
    grid-template-columns: minmax(12rem, 1fr) minmax(0, 2.6fr);
    gap: var(--space-6);
  }
  .cm-section-head {
    position: sticky;
    inset-block-start: calc(var(--space-8) + var(--space-4));
  }
}

/* fieldset groups sit in the .field grid; the legend is the group's label */
.cm-group { gap: var(--space-2); }
.cm-legend { display: block; }
.cm-choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
}
.cm-choices-stack { flex-direction: column; flex-wrap: nowrap; gap: var(--space-1); }
.cm-choice {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
}
.cm-choice > input { flex: none; }

/* native controls the floor has no class for */
.cm-colour { inline-size: 100%; min-block-size: var(--control-h); }
.slider { min-width: 0; }

/* the submit row and the outcome beneath it */
.cm-submit {
  display: grid;
  gap: var(--space-3);
}
/* Send first, the secondary route next, the destructive Clear parked at the far
   end. Stacked on a phone, in the same order, full width. */
.cm-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}
.cm-clear { margin-inline-start: auto; display: inline-flex; align-items: center; }
.cm-clear-confirm { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.cm-clear-confirm[hidden], .cm-clear [hidden] { display: none; }
@media (max-width: 639px) {
  .cm-foot { flex-direction: column; align-items: stretch; }
  .cm-foot .btn { width: 100%; }
  .cm-clear { margin-inline-start: 0; display: grid; }
}
.cm-done {
  display: grid;
  gap: var(--space-2);
  justify-items: start;
  max-inline-size: 40rem;
}
.cm-done[hidden] { display: none; }
@media (min-width: 900px) {
  .cm-submit {
    grid-template-columns: minmax(12rem, 1fr) minmax(0, 2.6fr);
    column-gap: var(--space-6);
  }
  .cm-submit > * { grid-column: 2; }
}
