.invite-door {
  width: min(100%, 34rem);
  margin-top: 0.25rem;
  text-align: left;
  color: var(--ink);
}

.invite-door summary {
  width: fit-content;
  margin: 0;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--ember);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  text-underline-offset: 0.2em;
}

.invite-door summary:focus-visible,
.invite-field input:focus-visible,
.invite-field textarea:focus-visible,
.invite-option input:focus-visible,
.invite-check input:focus-visible,
.invite-nav button:focus-visible,
.invite-privacy a:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 3px;
}

.invite-step:focus,
.invite-done:focus,
.invite-status:focus {
  outline: none;
}

.invite-panel {
  padding: 1rem 0.2rem 0;
}

.invite-intro {
  margin: 0 0 1.25rem;
  font-size: 1rem;
}

#invite-form {
  display: grid;
  gap: 1.2rem;
  text-align: left;
}

#invite-form[hidden] {
  display: none;
}

.invite-status {
  min-height: 0;
  margin: 0;
  font-size: 0.95rem;
}

.invite-status:not(:empty) {
  padding: 0.65rem 0.75rem;
  border-left: 3px solid var(--ember);
  background: var(--paper);
}

/* One question per step. Without JavaScript every step shows, one after another. */
.invite-step {
  display: grid;
  gap: 0.6rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.invite-step[hidden] {
  display: none;
}

.invite-step legend {
  margin: 0 0 0.6rem;
  padding: 0;
  font-family: var(--display);
  font-size: clamp(1.7rem, 3.2vw, 2.2rem);
  line-height: 1;
}

.invite-optional {
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--ember);
}

.invite-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.9rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--ink);
  background: var(--paper);
  font-size: 1rem;
  cursor: pointer;
}

.invite-option:has(input:checked) {
  border-color: var(--ember);
  box-shadow: inset 3px 0 0 var(--ember);
}

.invite-option input,
.invite-check input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  flex: none;
  accent-color: var(--ember);
}

.invite-field {
  display: grid;
  gap: 0.35rem;
}

.invite-field label {
  font-size: 0.9rem;
  font-weight: 600;
}

.invite-field label.invite-hint {
  font-weight: 400;
}

.invite-field input,
.invite-field textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

.invite-field textarea {
  min-height: 7rem;
  resize: vertical;
}

.invite-field [aria-invalid="true"],
.invite-option:has([aria-invalid="true"]) {
  border-width: 2px;
  border-color: var(--ember);
}

#invite-code {
  max-width: 12rem;
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 1.2rem;
  letter-spacing: 0.3em;
}

.invite-error {
  color: var(--ember);
  font-size: 0.85rem;
  text-align: left;
}

.invite-error[hidden],
.invite-field[hidden] {
  display: none;
}

.invite-check {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.invite-check input {
  margin-top: 0.15rem;
}

.invite-account-intro {
  margin: 0;
  font-size: 1rem;
}

.invite-nav {
  display: flex;
  gap: 0.75rem;
}

.invite-nav button {
  min-height: 2.8rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.invite-nav button[hidden] {
  display: none;
}

#invite-submit {
  border-color: var(--ember);
}

#invite-submit:disabled {
  cursor: wait;
  opacity: 0.65;
}

.invite-privacy,
.invite-nojs {
  margin: 0;
  font-size: 0.8rem;
  text-align: left;
}

.invite-privacy a {
  color: var(--ink);
  text-decoration-color: var(--ember);
  text-underline-offset: 0.2em;
}

.invite-done {
  padding: 0.4rem 0 0;
}

.invite-done[hidden] {
  display: none;
}

.invite-done .kicker {
  margin-bottom: 1rem;
}

.invite-done-lead {
  font-size: clamp(18px, 1.6vw, 24px);
}

.invite-trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (max-width: 520px) {
  .invite-door {
    width: 100%;
  }

  .invite-panel {
    padding-right: 0;
    padding-left: 0;
  }
}

/* The stage (Ari, 2026-10-06): with JavaScript the funnel opens full screen, one step at a time, the page
   sinks behind it, and an ASCII field ripples under it. stage.mjs builds it; without JavaScript none of
   this applies and the steps stay in the door above. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

html.is-staged {
  overflow: hidden;
}

main {
  transition: transform 720ms cubic-bezier(0.2, 0.7, 0.1, 1), opacity 720ms ease, filter 720ms ease;
}

html.is-staged main {
  transform: scale(0.93);
  opacity: 0.32;
  filter: blur(5px) saturate(0.4);
}

.stage {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  color: var(--ink);
  opacity: 0;
  transition: opacity 460ms ease;
}

.stage.is-in {
  opacity: 1;
}

.stage::backdrop {
  background: transparent;
}

.stage-field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.stage-frame {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100%;
  padding: clamp(16px, 3vw, 36px) var(--pad);
}

.stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.stage-mark {
  margin: 0;
  font-family: var(--display);
  font-size: 1.7rem;
  line-height: 1;
}

.stage-progress {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  margin: 0;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
}

.stage-meter b {
  font-weight: 400;
  color: var(--ember);
}

.stage-close {
  min-height: 2.6rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.85rem;
  cursor: pointer;
}

.stage-close:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 3px;
}

.stage-body {
  align-self: center;
  width: min(100%, 42rem);
  margin: 0 auto;
  padding: clamp(28px, 7vh, 80px) 0;
  transform: translateY(26px);
  transition: transform 720ms cubic-bezier(0.2, 0.7, 0.1, 1);
}

.stage.is-in .stage-body {
  transform: none;
}

.stage .invite-intro {
  max-width: 34rem;
  margin-bottom: 2rem;
  font-size: 1.05rem;
}

.stage .invite-intro[hidden] {
  display: none;
}

.stage #invite-form {
  gap: 1.6rem;
}

.stage .invite-step {
  gap: 0.8rem;
  transition: opacity 220ms ease, transform 220ms ease;
}

.stage .invite-step legend {
  margin-bottom: 1.4rem;
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  line-height: 0.95;
}

.stage .invite-option {
  min-height: 3.6rem;
  padding: 0.8rem 1.1rem;
  font-size: 1.15rem;
  transition: border-color 160ms ease, transform 200ms cubic-bezier(0.2, 0.7, 0.1, 1);
}

.stage .invite-option:hover {
  border-color: var(--ember);
  transform: translateX(6px);
}

.stage .invite-option:has(input:checked) {
  transform: translateX(6px);
}

.stage .invite-nav button {
  min-height: 3.2rem;
  padding: 0.65rem 1.4rem;
  font-size: 1.05rem;
}

.stage .invite-done .kicker {
  margin-bottom: 1.2rem;
}

.stage .invite-done-lead {
  margin: 0 0 1.4rem;
  font-family: var(--display);
  font-size: clamp(2.4rem, 6.5vw, 4.2rem);
  line-height: 0.98;
}

/* The old step lifts away; the new one's parts rise in one after another. */
.stage #invite-form,
.stage .invite-done {
  transition: opacity 220ms ease, transform 220ms ease;
}

.stage .stage-leave {
  opacity: 0;
  transform: translateY(-16px);
}

.stage .stage-rise {
  opacity: 0;
  transform: translateY(18px);
}

.stage .invite-step > *,
.stage .invite-done > * {
  transition: opacity 460ms ease calc(var(--i, 0) * 55ms), transform 560ms cubic-bezier(0.2, 0.7, 0.1, 1) calc(var(--i, 0) * 55ms);
}

@media (max-width: 600px) {
  .stage-progress .stage-meter {
    display: none;
  }

  .stage-mark {
    font-size: 1.4rem;
  }

  .stage-body {
    align-self: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  main,
  .stage,
  .stage-body,
  .stage .invite-step,
  .stage .invite-option,
  .stage .invite-step > *,
  .stage .invite-done > * {
    transition: none;
  }

  .stage .invite-option:hover,
  .stage .invite-option:has(input:checked) {
    transform: none;
  }
}
