/* ============================================================
   PAPYROS — Paper Club join form
   ============================================================ */

.body--join {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.masthead--join {
  position: sticky;
  top: 0;
  z-index: 40;
  flex-shrink: 0;
}

.masthead--join .masthead__inner {
  min-height: 2.75rem;
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.masthead__join-tag {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rubric);
  white-space: nowrap;
}

.join-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.join {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  min-height: 0;
  padding: 0 var(--gutter);
}

.join__progress {
  height: 3px;
  background: var(--rule-soft);
  border-radius: 2px;
  margin: 1rem 0 1.25rem;
  flex-shrink: 0;
  overflow: hidden;
}

.join__progress-bar {
  height: 100%;
  width: 0%;
  background: var(--rubric);
  border-radius: 2px;
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.join__stage {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 0.5rem;
}

.join__form {
  width: 100%;
}

.join__step {
  display: none;
  flex-direction: column;
  width: 100%;
  padding: 0.25rem 0 1rem;
  animation: none;
}

.join__step.is-active {
  display: flex;
}

.join__step.is-exiting {
  display: flex;
  animation: joinExit 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.join__step.is-entering {
  display: flex;
  animation: joinEnter 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes joinEnter {
  from { opacity: 0; transform: translateX(1.25rem); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes joinExit {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(-1.25rem); }
}

.join__label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rubric);
  margin: 0 0 0.75rem;
}

.join__question {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.25rem, 4.5vw, 1.85rem);
  line-height: 1.3;
  color: var(--ink);
  margin: 0 0 1.25rem;
  letter-spacing: -0.01em;
  max-width: 26em;
}

.join__optional {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  font-weight: 400;
}

.join__input,
.join__textarea {
  width: 100%;
  max-width: 100%;
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.75rem 0.85rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.join__textarea {
  min-height: 7rem;
  resize: vertical;
  max-height: 32vh;
}

.join__input:focus,
.join__textarea:focus {
  border-color: var(--rubric);
  box-shadow: 0 0 0 3px rgba(154, 123, 47, 0.12);
}

.join__input::placeholder,
.join__textarea::placeholder {
  color: var(--ink-faint);
}

.join__hint {
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--ink-faint);
  margin: 0.85rem 0 0;
}

.join__hint kbd {
  display: inline-block;
  padding: 0.1em 0.35em;
  border: 1px solid var(--rule);
  border-radius: 2px;
  font-size: 0.6rem;
}

.join__footer {
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 30;
  margin: 0 calc(-1 * var(--gutter));
  padding: 0.75rem var(--gutter) calc(0.75rem + env(safe-area-inset-bottom, 0px));
  background: rgba(246, 243, 236, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--rule);
}

.join__footer-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 40rem;
  margin: 0 auto;
}

.join__btn {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--paper-raised);
  background: var(--ink);
  border: none;
  border-radius: 3px;
  padding: 0.85rem 1.25rem;
  min-height: 48px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.join__btn:hover { background: var(--rubric-d); }
.join__btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.join__btn--ghost {
  color: var(--ink-muted);
  background: transparent;
  padding-left: 0.25rem;
  padding-right: 0.75rem;
  min-width: 4.5rem;
}

.join__btn--ghost:hover {
  color: var(--ink);
  background: transparent;
}

.join__next {
  flex: 1;
  text-align: center;
}

.join__counter {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--ink-faint);
  white-space: nowrap;
  flex-shrink: 0;
}

.join__done,
.join__error {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 2rem var(--gutter);
}

.join__done[hidden],
.join__error[hidden],
.join__footer[hidden] {
  display: none !important;
}

.join__done-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  color: var(--ink);
  margin: 0 0 1rem;
}

.join__done-body {
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin: 0 0 2rem;
  max-width: 32ch;
  margin-left: auto;
  margin-right: auto;
}

.join__done-back { margin: 0; }

.join__field-error {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: #9b4d4d;
  margin-top: 0.5rem;
}

/* ---------- Mobile ---------- */
@media (max-width: 540px) {
  :root { --gutter: 1rem; }

  .masthead--join .wordmark {
    font-size: 0.88rem;
  }

  .join__progress {
    margin-top: 0.75rem;
    margin-bottom: 1rem;
  }

  .join__question {
    font-size: clamp(1.15rem, 5.5vw, 1.4rem);
    line-height: 1.35;
    margin-bottom: 1rem;
    max-width: none;
  }

  .join__input,
  .join__textarea {
    font-size: 16px;
    padding: 0.85rem;
  }

  .join__textarea {
    min-height: 6.5rem;
    max-height: 28vh;
  }

  .join__hint {
    display: none;
  }

  .join__footer-inner {
    gap: 0.5rem;
  }

  .join__btn--ghost {
    min-width: auto;
    padding-right: 0.5rem;
  }
}

@media (max-width: 380px) {
  .join__counter {
    display: none;
  }

  .join__next {
    flex: 1;
  }
}

@media (hover: none) and (pointer: coarse) {
  .join__hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .join__step.is-exiting,
  .join__step.is-entering,
  .join__progress-bar {
    animation: none;
    transition: none;
  }
}

@media (min-width: 541px) {
  .join {
    padding-top: clamp(1rem, 4vh, 2.5rem);
    padding-bottom: 1rem;
  }

  .join__footer {
    position: static;
    margin: 1.5rem 0 0;
    padding: 1.25rem 0 0;
    background: transparent;
    backdrop-filter: none;
    border-top: 1px solid var(--rule);
  }

  .join__footer-inner {
    padding: 0;
  }

  .join__next {
    flex: 0 0 auto;
    min-width: 9rem;
  }
}
