/* Panels, the form, and its fields. */

/* in its rail (docs/UI-STEP-1-ROUND-3.md): the rail keeps its side padding, the page sets only top and bottom */
.page {
  padding-block: 32px 96px;
  display: grid;
  gap: 24px;
}

.lead {
  font-size: var(--t-lead);
  margin: 0;
}

.panel {
  border: 1px solid var(--hairline);
  box-shadow: var(--ring);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: clamp(16px, 3vw, 28px);
  display: grid;
  gap: 12px;
  min-width: 0;
}

.panel--quiet {
  background: transparent;
}

.panel__title {
  font-size: var(--t-subhead);
  font-weight: 400;
  margin: 0;
}

.split {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}

.status {
  margin: 0;
  color: var(--ink-muted);
}

.status strong {
  color: var(--ink);
  font-weight: 400;
}

.form {
  display: grid;
  gap: 32px;
}

.form__section {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 20px;
  min-width: 0;
}

.form__title {
  font-size: var(--t-subhead);
  padding: 0 0 8px;
  border-bottom: 1px solid var(--hairline);
  width: 100%;
}

.form__help,
.field__help {
  margin: 0;
  color: var(--ink-muted);
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field__label {
  font-size: var(--t-label);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="url"],
.field textarea,
.panel input[type="text"],
.panel input[type="url"],
.panel textarea {
  width: 100%;
  background: var(--ground);
  border: 1px solid var(--hairline);
  box-shadow: var(--ring);
  border-radius: 12px;
  padding: 12px 14px;
  line-height: 1.4;
  min-width: 0;
}

.field textarea {
  resize: vertical;
}

.field [aria-invalid="true"] {
  border-color: var(--alert);
}

.field__count {
  justify-self: end;
  color: var(--ink-subtle);
}

.field__error {
  margin: 0;
  color: var(--alert);
  min-height: 0;
}

.field__error:empty {
  display: none;
}

.mono {
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}

.choices {
  display: grid;
  gap: 8px;
}

/* a tap anywhere on the label sets the box: the label is the 44px target */
.choice,
.check {
  display: flex;
  gap: 12px;
  align-items: baseline;
  min-height: 44px;
  padding-block: 10px;
  cursor: pointer;
}

.choice {
  flex-wrap: wrap;
}

.choice__desc {
  color: var(--ink-muted);
  flex-basis: 100%;
  padding-left: 28px;
}

.check input,
.choice input {
  accent-color: var(--green);
  flex: none;
  width: 16px;
  height: 16px;
  transform: translateY(2px);
}

.form__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.form__status {
  margin: 0;
  color: var(--ink-muted);
}

.members {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.members__row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.invite__row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.invite {
  font-size: var(--t-lead);
  letter-spacing: 0;
}

.btn--small {
  padding: 6px 12px;
  min-height: 44px;
}

.updates {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

.updates__meta {
  margin: 0 0 4px;
  color: var(--ink-subtle);
}

.updates__body {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.updates__empty {
  color: var(--ink-muted);
}

.share {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.members__lead {
  color: var(--ink-muted);
}

/* the project logo field: the plate as the fleet card shows it, then upload and remove */
.logo__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.logo__plate {
  width: 96px;
  height: 96px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--hairline);
  box-shadow: var(--ring);
  background: var(--elevated);
  color: var(--ink-muted);
  font-size: 48px;
  text-transform: lowercase;
}

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

/* the announcements panel on /build/admin: the emblem picker (a 44px square per emblem, the chosen one framed),
   then the list with edit and delete */
.emblem-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  border: 0;
}

.emblem-picks legend {
  padding: 0;
  margin-bottom: 6px;
}

.emblem-pick {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--hairline);
  box-shadow: var(--ring);
  border-radius: 10px;
  color: var(--ink-muted);
  cursor: pointer;
}

.emblem-pick input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.emblem-pick:has(input:checked) {
  color: var(--ink);
  border-color: var(--plate-rule);
  background: rgb(var(--warm-ink) / 0.08);
}

.emblem-pick:has(input:focus-visible) {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.notice-admin {
  margin: 0;
  padding: 0;
  list-style: none;
}

.notice-admin__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
}

.notice-admin__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: anywhere;
}

.notice-admin__actions {
  display: flex;
  gap: 6px;
}

/* a category's emblem on /build/admin: the emblem as it will show, then the select */
.emblem-choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.emblem-shown {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--ground);
  box-shadow: 0 0 0.5px 1px var(--edge-light);
}

/* /build/admin's comments: the latest everywhere, a hidden one dimmed */
.cmods {
  list-style: none;
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
}

.cmod {
  display: grid;
  gap: 6px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--hairline);
  justify-items: start;
}

.cmod--hidden .cmod__body {
  opacity: 0.55;
}

.cmod__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 0;
  overflow-wrap: anywhere;
}

.cmod__meta a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.cmod__body {
  margin: 0;
}

/* the submission form as steps (docs/UI-STEP-3.md, sections 3 and 4) ------------------------------------------- */

.steps {
  display: grid;
  gap: 24px;
}

@media (min-width: 1024px) {
  .steps {
    grid-template-columns: clamp(220px, 22vw, 290px) minmax(0, 1fr);
    align-items: start;
    gap: 40px;
  }
}

.steps__main {
  min-width: 0;
}

/* desktop: the step list, sticky on the left */
.steps__list {
  display: none;
}

@media (min-width: 1024px) {
  .steps__list {
    display: block;
    position: sticky;
    top: 124px;
  }
}

.steplist {
  list-style: none;
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
}

.steplist__item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--ink-muted);
  text-decoration: none;
  transition:
    background-color 160ms,
    color 160ms;
}

.steplist__item:hover {
  background: rgb(var(--warm-ink) / 0.05);
  color: var(--ink);
}

.steplist__item[aria-current="step"] {
  border-color: var(--edge-light);
  background: var(--surface);
  box-shadow: var(--ring);
  color: var(--ink);
}

.steplist__mark {
  display: grid;
}

.steplist__text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.steplist__name {
  overflow-wrap: anywhere;
}

.steplist__state {
  font-size: 12px;
  color: var(--ink-muted);
}

.steplist__item[data-state="complete"] .steplist__state {
  color: var(--green-muted);
}

.steplist__item[data-state="not_started"] .steplist__state {
  color: var(--ink-subtle);
}

/* phones: a compact stepper, "step 2 of 6" with previous and next */
.stepper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 10px 12px 10px 16px;
  border: 1px solid var(--edge-light);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--ring);
}

@media (min-width: 1024px) {
  .stepper {
    display: none;
  }
}

.stepper__count {
  font-size: 14px;
  color: var(--ink-muted);
}

.stepper__buttons {
  display: flex;
  gap: 8px;
}

/* the current step in a section card under its flat-disc heading */
.step {
  padding: 24px;
  border: 1px solid var(--edge-light);
  border-radius: 14px;
  background: rgb(var(--warm-ink) / 0.025);
  box-shadow: var(--ring);
}

@media (max-width: 479px) {
  .step {
    padding: 18px 16px;
  }
}

.step__fields {
  display: grid;
  gap: 20px;
}

/* the fields in the engraved line style: a recess cut into the card, a dark line along its top inside, the light
   edge below it, like the frame's rules */
.step .field input[type="text"],
.step .field input[type="email"],
.step .field input[type="url"],
.step .field textarea,
.me__panel textarea {
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  background: var(--ground);
  box-shadow:
    inset 0 1px 2px rgb(0 0 0 / 0.45),
    0 1px 0 var(--line-light);
}

.step .field input:focus-visible,
.step .field textarea:focus-visible,
.me__panel textarea:focus-visible {
  border-color: rgb(var(--warm-ink) / 0.4);
}

/* category: small cards with their emblem, their name and their description */
.choices--cards {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
  gap: 10px;
}

.choice--card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  align-content: start;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--edge-light);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--ring);
  transition:
    background-color 160ms,
    transform 160ms;
}

.choice--card:hover {
  background: var(--elevated);
}

.choice--card .choice__radio {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  transform: none;
}

.choice--card:has(.choice__radio:checked) {
  border-color: rgb(var(--warm-ink) / 0.3);
  background: var(--elevated);
  transform: translateY(-1px);
  box-shadow:
    var(--ring),
    inset 0 1px 0 rgb(var(--warm-ink) / 0.12),
    0 6px 14px rgb(0 0 0 / 0.38);
}

.choice--card:has(.choice__radio:focus-visible) {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.choice__mark {
  display: grid;
  padding-top: 2px;
  color: rgb(var(--warm-ink) / 0.8);
}

/* every card the same: the emblem and the name on one row, the description 4px under the name and in line with it.
   In a grid of cards each card takes two of the grid's rows (a band for the names, a band for the descriptions), so
   a name on two lines makes its whole band taller instead of pushing its own description down: the names sit at the
   foot of the band, and every description in a row starts on the same line */
.choices--cards > .choice--card {
  grid-row: span 2;
  grid-template-rows: subgrid;
  row-gap: 4px;
}

.choice__head {
  display: flex;
  align-items: flex-start;
  align-self: end;
  gap: 10px;
}

.choice__head .choice__mark {
  flex: none;
  width: 24px;
}

.choice--card .choice__desc {
  align-self: start;
  padding-left: 34px;
  font-size: 13px;
}

/* checkboxes: a framed square with an ink tick */
input.tick,
.tickmark {
  appearance: none;
  -webkit-appearance: none;
  display: inline-grid;
  place-content: center;
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1px solid rgb(var(--warm-ink) / 0.55);
  border-radius: 3px;
  background: var(--ground);
  box-shadow: inset 0 1px 1px rgb(0 0 0 / 0.5);
  cursor: pointer;
  transform: translateY(3px);
}

input.tick::after,
.tickmark::after {
  content: "";
  width: 5px;
  height: 10px;
  border: solid var(--ink);
  border-width: 0 2px 2px 0;
  rotate: 45deg;
  translate: 0 -1px;
  opacity: 0;
}

input.tick:checked::after,
.tickmark[aria-checked="true"]::after {
  opacity: 1;
}

input.tick:disabled {
  cursor: default;
  opacity: 0.7;
}

input.tick:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* the foot of a step: the status line, then save changes and next step */
.step__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px 12px;
  margin-top: 20px;
}

.step__status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: 0 auto 0 0;
  font-size: 13px;
  color: var(--ink-muted);
}

.step__status[data-state="failed"],
.step__conflict {
  color: var(--alert);
}

.step__retry {
  appearance: none;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}

.step__notices {
  display: grid;
  gap: 12px;
}

.step__notices:not(:empty) {
  margin-bottom: 16px;
}

/* unsaved edits from earlier, offered back */
.step__restore {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--edge-light);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--ring);
}

.step__restore p {
  margin: 0;
}

.step__restore-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* the review (docs/UI-STEP-3-FIXES.md, section 2): what's left, a card per step, then the terms and submit apart */
.review {
  display: grid;
  gap: 16px;
}

.rcard {
  padding: 20px;
  border: 1px solid var(--edge-light);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--ring);
}

@media (max-width: 479px) {
  .rcard {
    padding: 16px 14px;
  }
}

/* readiness: "ready to submit" with the laurel, or what's left, each with "fix →" to its field */
.ready__title {
  margin: 0;
  font-size: var(--t-subhead);
  font-weight: 400;
}

.ready--yes,
.confirm {
  display: grid;
  justify-items: start;
  gap: 12px;
}

.ready--yes .ready__title,
.confirm .ready__title {
  color: var(--green);
}

.ready__mark {
  display: grid;
  color: var(--green);
}

.ready__list {
  list-style: none;
  display: grid;
  gap: 4px;
  margin: 12px 0 0;
  padding: 0;
}

.ready__row {
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 16px;
  min-height: 44px;
  border-top: 1px solid var(--line-dark);
  box-shadow: inset 0 1px 0 var(--line-light);
}

@media (max-width: 599px) {
  .ready__row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .ready__step {
    grid-column: 1 / -1;
    padding-top: 8px;
  }
}

.ready__step {
  font-size: 13px;
  color: var(--ink-muted);
}

.ready__field {
  overflow-wrap: anywhere;
}

.ready__fix {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  white-space: nowrap;
}

.confirm__when {
  margin: 0;
  color: var(--ink-muted);
}

/* a step's card: its emblem, name and chip, its edit, then label | answer */
.review__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.review__mark {
  display: grid;
  color: rgb(var(--warm-ink) / 0.8);
}

.review__name {
  margin: 0;
  font-size: var(--t-label);
  font-weight: 400;
}

.chip.chip--complete {
  color: var(--green-muted);
}

.chip.chip--missing {
  color: var(--alert);
}

.review__edit {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-left: auto;
  color: var(--ink);
}

.review__list {
  display: grid;
  gap: 14px;
  margin: 16px 0 0;
}

.review__row {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: 4px 20px;
}

@media (max-width: 599px) {
  .review__row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.review__row dt {
  color: var(--ink-muted);
  font-size: 13px;
}

.review__row dd {
  display: grid;
  justify-items: start;
  gap: 4px;
  margin: 0;
  min-width: 0;
}

/* a long answer: its first 3 lines, then "show more" */
.answer {
  display: grid;
  justify-items: start;
  min-width: 0;
}

.answer__text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.answer__text--open {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  overflow: visible;
}

.answer__more {
  appearance: none;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}

.answer--missing,
.answer__error {
  color: var(--alert);
  font-size: 14px;
}

/* the last card, apart from the summary: the terms and submit */
.rcard--submit {
  margin-top: 28px;
  display: grid;
  gap: 16px;
}

.review__submit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.review__blocked {
  margin: 0;
  font-size: 13px;
  color: var(--ink-muted);
}

.review__blocked[hidden] {
  display: none;
}

.tickmark {
  cursor: default;
  transform: none;
}

/* a picked category card carries its place: 1 is the main category (docs/UI-STEP-3-FIXES.md, section 1) */
.choice__order {
  position: absolute;
  top: 8px;
  right: 8px;
  display: none;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ground);
  box-shadow: 0 0 0.5px 1px var(--edge-light);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.choice--card[data-order]:not([data-order=""]) .choice__order {
  display: grid;
}

.choice--card[data-order="1"] .choice__order {
  background: var(--green);
  color: rgb(26 24 21);
}

.choice--card:has(.choice__radio:disabled:not(:checked)) {
  opacity: 0.55;
}

.choice--card .choice__name {
  padding-right: 26px;
}

/* ---- one spacing system for every form (docs/UI-STEP-3-FIXES.md, section 3) ------------------------------------
   inside a field: the label, 8px, its help, 12px, the field itself, 8px, its counter (and its error). Between fields
   32px; a section's heading to its first field 24px; a field's buttons 16px below it. bin/widths measures these from
   screenshots and flags anything closer. */
.field {
  display: block;
}

.field > * {
  margin-block: 0;
}

.field > * + .field__help {
  margin-top: 8px;
}

.field
  > *
  + :is(
    input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
    textarea,
    select,
    .choices,
    .logo__row,
    .invite__row
  ) {
  margin-top: 12px;
}

.field > * + .field__count {
  display: block;
  margin-top: 8px;
  text-align: right;
}

.field > * + :is(.field__error, .form__status) {
  margin-top: 8px;
}

.field > * + :is(.form__actions, .cbox__actions, .btn, button) {
  margin-top: 16px;
}

/* field to field */
.step__fields,
.form__section,
.form {
  gap: 32px;
}

/* a section's heading to its first field */
.step > .sh {
  margin-bottom: 24px;
}

/* the field's buttons, below it, wherever the field sits in plain flow */
.field + :is(.form__actions, .cbox__actions, .btn, button) {
  margin-top: 16px;
}

/* panels stack with a 12px gap: the title takes 24px to the first field, fields 32px apart, buttons 16px below */
.panel > .panel__title {
  margin-bottom: 12px;
}

.panel > .field + .field {
  margin-top: 20px;
}

.panel
  > .field
  + :is(.form__actions, .cbox__actions, .btn, button, .invite__row) {
  margin-top: 4px;
}

/* the comment box: its field, then its counter and button 16px below */
.cbox > .cbox__actions {
  margin-top: 8px;
}
