/* InvitationStep (built here, from the invitation page's prototype): one question on a screen. A desktop has the logo and
   the progress on top, the question and its action centred, the way back at the bottom left; a phone has the way back
   and the progress on top, and the action as a bar fixed to the bottom of the screen. Its fields are bigger than the
   back office's, through the field hooks, so a thumb hits them. Tokens only. */
.invitation-step {
  --wi-segmented-progress-width: calc(var(--space-12) * 4);
  --wi-segmented-progress-height: 0.375rem;
  /* Rounder than the back office's controls, as the prototype draws them: pills, with room inside. */
  --wi-btn-radius: var(--radius-full);
  --wi-field-radius: var(--radius-full);
  --wi-field-padding-block: var(--space-3);
  box-sizing: border-box;
  min-height: 100svh;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "lead . progress"
    "stage stage stage"
    "foot . .";
  column-gap: var(--space-6);
  padding: var(--space-6) var(--space-12);
  background: linear-gradient(180deg, var(--background-sunken), var(--blue-gray-50));
  font-family: var(--font-family-sans);
}

/* With the language picker, the header row has a column more at its right end. */
.invitation-step--language-picker {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas:
    "lead . progress language"
    "stage stage stage stage"
    "foot . . .";
}
.invitation-step__language {
  grid-area: language;
  align-self: center;
}

.invitation-step__logo {
  grid-area: lead;
  display: block;
  height: var(--size-button-sm);
  width: auto;
}

.invitation-step__back {
  grid-area: foot;
  align-self: end;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) 0;
  font-size: var(--font-size-sm);
  line-height: var(--font-line-height-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
}
.invitation-step__back:hover {
  color: var(--text-primary);
}
.invitation-step__back:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.invitation-step__back svg {
  width: var(--size-icon-sm);
  height: var(--size-icon-sm);
}

.invitation-step__progress {
  grid-area: progress;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.invitation-step__step {
  font-size: var(--font-size-sm);
  line-height: var(--font-line-height-sm);
  color: var(--text-secondary);
}

.invitation-step__stage {
  grid-area: stage;
  display: grid;
  align-content: center;
  justify-items: center;
  padding-block: var(--space-4);
  min-width: 0;
}

.invitation-step__question {
  width: 100%;
  max-width: 37.5rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.invitation-step--wide .invitation-step__question {
  max-width: 65rem;
}

.invitation-step__title {
  margin: 0;
  font-size: var(--font-size-4xl);
  line-height: 1.1;
  font-weight: var(--font-weight-semibold);
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-wrap: balance;
}
.invitation-step__lead {
  margin: 0;
  max-width: 46ch;
  font-size: var(--font-size-lg);
  line-height: var(--font-line-height-lg);
  color: var(--text-secondary);
}

/* The fields of a question are big: the hooks the field components read. */
.invitation-step__content {
  --wi-field-height-md: 3.75rem;
  --wi-field-font-size: var(--font-size-xl);
  --wi-field-line-height: var(--font-line-height-xl);
  --wi-field-padding-inline: var(--space-5);
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}
.invitation-step__content .wi-field__label {
  font-size: var(--font-size-sm);
}

.invitation-step__form {
  display: grid;
  gap: var(--space-4);
}

.invitation-step__action {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
}
.invitation-step__hint {
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
}
.invitation-step__hint kbd {
  font: inherit;
  font-size: var(--font-size-xs);
  padding: 0 var(--space-2);
  background: var(--background-surface);
  border: var(--border-1) solid var(--border-strong);
  border-bottom-width: var(--border-2);
  border-radius: var(--radius-sm);
}

@media (max-width: 767.98px) {
  .invitation-step {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "lead progress"
      "stage stage";
    padding: var(--space-3) 0 0;
    --wi-segmented-progress-width: calc(var(--space-12) * 2);
  }
  .invitation-step--language-picker {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "lead progress language"
      "stage stage stage";
    column-gap: var(--space-2);
  }
  .invitation-step__back {
    margin-inline-start: var(--space-4);
  }
  .invitation-step__progress {
    margin-inline-end: var(--space-4);
  }
  .invitation-step--language-picker .invitation-step__progress {
    margin-inline-end: 0;
  }
  .invitation-step__language {
    margin-inline-end: var(--space-4);
  }
  /* The logo is the desktop's: a phone's top holds the way back and the progress, and the welcome starts with its photo. */
  .invitation-step__logo {
    display: none;
  }
  .invitation-step__back {
    grid-area: lead;
    align-self: center;
  }
  .invitation-step__step {
    display: none;
  }

  .invitation-step__stage {
    display: flex;
    flex-direction: column;
    align-content: start;
    padding: var(--space-6) var(--space-5) 0;
  }
  .invitation-step__question {
    flex: 1 1 auto;
    gap: var(--space-4);
  }
  .invitation-step__title {
    font-size: var(--font-size-3xl);
  }
  .invitation-step__lead {
    font-size: var(--font-size-base);
    line-height: var(--font-line-height-base);
  }
  .invitation-step__content {
    --wi-field-height-md: var(--size-button-lg);
    --wi-field-font-size: var(--font-size-lg);
    --wi-field-line-height: var(--font-line-height-lg);
    flex: 1 1 auto;
    align-content: start;
  }

  /* The action: a bar at the bottom of the screen, full width, whatever the question's height. */
  .invitation-step__action {
    position: sticky;
    bottom: 0;
    margin: auto calc(-1 * var(--space-5)) 0;
    padding: var(--space-3) var(--space-5) max(var(--space-4), env(safe-area-inset-bottom));
    background: var(--background-surface);
    border-top: var(--border-1) solid var(--border-default);
  }
  .invitation-step__button {
    width: 100%;
  }
  .invitation-step__hint {
    display: none;
  }
}
