/* join page styles */

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

.join-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

body.join-page {
  background-color: var(--slate-50);
  min-height: 100svh;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* top progress bar */
.join-progress-wrap {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: 7px;
  border-top: 3px solid #ffffff;
  background-color: #dcdfe2;
}

.join-progress-fill {
  height: 100%;
  width: 0%;
  background-color: var(--slate-950);
  transition: width 380ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* dither canvas background */
.dither-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% 105%, rgba(148, 163, 184, 0.16), transparent 72%),
    var(--slate-50);
}

.dither-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.dither-bg.dither-fallback {
  background-image:
    radial-gradient(rgba(15, 23, 42, 0.14) 0.75px, transparent 1px),
    radial-gradient(ellipse 80% 65% at 50% 95%, rgba(148, 163, 184, 0.18), transparent 75%);
  background-size: 6px 6px, 100% 100%;
}

/* bottom-anchored glyph matrix background */
.glyph-matrix-bg {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 40vh;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.55) 45%, transparent 100%);
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.55) 45%, transparent 100%);
}

.glyph-matrix-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* form stage */
.join-stage {
  position: relative;
  z-index: 2;
  min-height: 100svh;
  min-height: var(--vvh, 100dvh);
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: clamp(2rem, 5vh, 3.5rem) clamp(1.25rem, 5vw, 2.5rem) 5.5rem;
}

.join-form {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
}

.join-step {
  width: 100%;
}

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

/* step transitions */
.join-step.is-entering-forward {
  animation: joinStepInForward 340ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.join-step.is-entering-backward {
  animation: joinStepInBackward 340ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes joinStepInForward {
  from {
    opacity: 0;
    transform: translateY(20px);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes joinStepInBackward {
  from {
    opacity: 0;
    transform: translateY(-20px);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .join-step.is-entering-forward,
  .join-step.is-entering-backward {
    animation: none;
  }
  .join-progress-fill {
    transition: none;
  }
}

/* welcome screen */
.join-welcome-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.join-welcome-logo {
  display: inline-flex;
  margin-bottom: 1.75rem;
}

.join-welcome-logo img {
  height: 52px;
  width: auto;
}

.join-welcome-title {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 4.8vw, 2.85rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--slate-950);
  margin-bottom: 1rem;
}

.join-welcome-desc {
  font-size: clamp(0.95rem, 1.7vw, 1.05rem);
  color: var(--slate-600);
  line-height: 1.65;
  max-width: 560px;
  margin-bottom: 2rem;
}

.join-welcome-actions {
  margin-bottom: 1.1rem;
}

.join-welcome-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--slate-500);
}

.join-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.join-meta-item .icon {
  width: 0.9rem;
  height: 0.9rem;
}

/* question header */
.join-fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.join-question-header,
.join-legend {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  width: 100%;
  margin-bottom: 1.5rem;
}

.join-q-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.45rem;
  height: 1.45rem;
  margin-top: 0.28rem;
  background-color: var(--slate-950);
  color: var(--color-white);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 4px;
}

.join-q-heading {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.join-q-title {
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.35;
  color: var(--slate-950);
}

.join-required {
  color: var(--slate-950);
  font-weight: 700;
  margin-inline-start: 0.15rem;
}

.join-q-desc {
  font-size: 0.88rem;
  color: var(--slate-600);
  line-height: 1.5;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.join-selected-count {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  background-color: var(--slate-950);
  color: var(--color-white);
}

.join-selected-count[hidden] {
  display: none;
}

.join-body {
  margin-inline-start: 2.15rem;
}

/* text inputs and textarea */
.join-input-wrap {
  margin-bottom: 1.35rem;
}

.join-line-input,
.join-line-textarea {
  width: 100%;
  font-family: var(--font-mono);
  font-size: max(1rem, clamp(1.15rem, 2.2vw, 1.45rem));
  line-height: 1.45;
  color: var(--slate-950);
  background-color: transparent;
  border: none;
  border-bottom: 1.5px solid rgba(15, 23, 42, 0.32);
  border-radius: 0;
  padding: 0.5rem 0;
  min-height: 48px;
  scroll-margin-bottom: 120px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.join-line-input::placeholder,
.join-line-textarea::placeholder {
  color: rgba(15, 23, 42, 0.36);
}

.join-line-input:focus,
.join-line-textarea:focus {
  border-bottom-color: var(--slate-950);
  box-shadow: 0 1px 0 0 var(--slate-950);
}

.join-line-input[aria-invalid="true"],
.join-line-textarea[aria-invalid="true"] {
  border-bottom-color: rgba(15, 23, 42, 0.45);
}

.join-line-textarea {
  resize: none;
  min-height: 48px;
  height: 48px;
  overflow-y: hidden;
  overflow-wrap: break-word;
}

/* role choice list */
.join-choices-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 490px;
  max-height: min(56vh, 470px);
  overflow-y: auto;
  padding: 5px 8px 6px 5px;
  margin-inline-start: -5px;
  margin-bottom: 1.25rem;
  overscroll-behavior: contain;
}

.join-choice-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 46px;
  padding: 0.5rem 0.75rem;
  background-color: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid rgba(15, 23, 42, 0.16);
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.join-choice-card:hover {
  background-color: rgba(255, 255, 255, 0.96);
  border-color: rgba(15, 23, 42, 0.38);
}

.join-choice-card:has(input[type="checkbox"]:focus-visible),
.join-choice-card:has(input[type="radio"]:focus-visible) {
  outline: 2px solid var(--slate-950);
  outline-offset: 2px;
}

.join-choice-card:has(input[type="checkbox"]:checked),
.join-choice-card:has(input[type="radio"]:checked),
.join-choice-card.is-selected {
  background-color: #ffffff;
  border-color: var(--slate-950);
  box-shadow: 0 0 0 1px var(--slate-950);
}

.join-keycap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 4px;
  border: 1px solid rgba(15, 23, 42, 0.25);
  background-color: rgba(255, 255, 255, 0.65);
  color: var(--slate-700);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.join-choice-card:has(input[type="checkbox"]:checked) .join-keycap,
.join-choice-card:has(input[type="radio"]:checked) .join-keycap,
.join-choice-card.is-selected .join-keycap {
  background-color: var(--slate-950);
  border-color: var(--slate-950);
  color: var(--color-white);
}

.join-choice-label {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--slate-800);
  line-height: 1.3;
}

.join-choice-card:has(input[type="checkbox"]:checked) .join-choice-label,
.join-choice-card:has(input[type="radio"]:checked) .join-choice-label,
.join-choice-card.is-selected .join-choice-label {
  color: var(--slate-950);
  font-weight: 600;
}

.join-choice-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--slate-950);
  opacity: 0;
  transform: scale(0.7);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.join-choice-check .icon {
  width: 0.95rem;
  height: 0.95rem;
  stroke-width: 2.5;
}

.join-choice-card:has(input[type="checkbox"]:checked) .join-choice-check,
.join-choice-card:has(input[type="radio"]:checked) .join-choice-check,
.join-choice-card.is-selected .join-choice-check {
  opacity: 1;
  transform: scale(1);
}

/* inline other input */
.join-choice-other {
  cursor: pointer;
}

.join-other-placeholder-label {
  cursor: pointer;
}

.join-other-placeholder-label[hidden] {
  display: none;
}

.join-other-inline-editor {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.join-other-inline-editor[hidden] {
  display: none;
}

.join-other-inline-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: max(1rem, 0.9rem);
  color: var(--slate-950);
  outline: none;
  padding: 0.2rem 0;
}

.join-other-inline-input::placeholder {
  color: rgba(15, 23, 42, 0.42);
}

.join-other-confirm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 4px;
  background-color: transparent;
  color: var(--slate-950);
  transition: background-color var(--transition-fast);
}

.join-other-confirm-btn:hover {
  background-color: var(--slate-100);
}

.join-other-confirm-btn .icon {
  width: 0.95rem;
  height: 0.95rem;
  stroke-width: 2.5;
}

/* action slot and inline errors */
.join-action-slot {
  min-height: 44px;
  display: flex;
  align-items: center;
}

.join-error-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.8rem;
  background-color: #f9e6e8;
  color: #9f2d34;
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 500;
  animation: joinErrorPop 180ms ease both;
}

.join-error-pill[hidden] {
  display: none;
}

.join-error-pill .icon {
  width: 0.95rem;
  height: 0.95rem;
  color: #b4232c;
}

@keyframes joinErrorPop {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* buttons */
.join-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 40px;
  padding: 0.45rem 1.05rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 5px;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), transform 120ms ease;
  user-select: none;
}

.join-btn[hidden] {
  display: none;
}

.join-btn-lg {
  min-height: 44px;
  padding: 0.55rem 1.4rem;
  font-size: 0.92rem;
}

.join-btn-primary {
  background-color: var(--slate-950);
  color: var(--color-white);
  border-color: var(--slate-950);
}

.join-btn-primary:hover:not(:disabled) {
  background-color: var(--slate-800);
  border-color: var(--slate-800);
  color: var(--color-white);
}

.join-btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.join-btn-primary:disabled {
  opacity: 0.65;
  cursor: wait;
}

.join-btn-outline {
  background-color: #ffffff;
  color: var(--slate-800);
  border-color: var(--slate-300);
}

.join-btn-outline:hover {
  background-color: var(--slate-100);
  border-color: var(--slate-400);
  color: var(--slate-950);
}

/* bottom-right steppers */
.join-footer-nav {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 40;
}

.join-footer-nav[hidden] {
  display: none;
}

.join-stepper-group {
  display: inline-flex;
  border-radius: 5px;
  overflow: hidden;
  background-color: var(--slate-950);
  box-shadow: 0 4px 14px -4px rgba(15, 23, 42, 0.28);
}

.join-stepper-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 34px;
  color: var(--color-white);
  background-color: var(--slate-950);
  transition: background-color var(--transition-fast), opacity var(--transition-fast);
}

.join-stepper-btn + .join-stepper-btn {
  border-inline-start: 1px solid rgba(255, 255, 255, 0.22);
}

.join-stepper-btn:hover:not(:disabled) {
  background-color: var(--slate-800);
}

.join-stepper-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.join-stepper-btn .icon {
  width: 1rem;
  height: 1rem;
  stroke-width: 2.25;
}

/* confirmation screen */
.join-success-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.join-success-icon {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: var(--radius-full);
  background-color: var(--slate-950);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.join-success-icon .icon {
  width: 1.5rem;
  height: 1.5rem;
  stroke-width: 2.5;
}

.join-success-title {
  font-family: var(--font-mono);
  font-size: clamp(1.6rem, 3.8vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--slate-950);
  margin-bottom: 0.85rem;
}

.join-success-desc {
  font-size: 0.95rem;
  color: var(--slate-600);
  line-height: 1.65;
  max-width: 480px;
  margin-bottom: 2rem;
}

.join-success-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.join-success-social {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
}

.join-success-social-label {
  font-size: 0.8rem;
  color: var(--slate-500);
}

/* mobile layout */
@media (max-width: 640px) {
  .join-stage {
    padding-bottom: 5.5rem;
  }

  .join-body {
    margin-inline-start: 0;
  }

  .join-action-slot {
    justify-content: flex-end;
  }

  .join-choices-list {
    max-width: 100%;
    max-height: min(46vh, 380px);
  }

  .join-footer-nav {
    right: 1rem;
    bottom: 1rem;
    transition: opacity var(--transition-fast);
  }

  body.is-keyboard-open .join-footer-nav {
    opacity: 0;
    pointer-events: none;
  }
}

@media (pointer: coarse) {
  .join-line-input,
  .join-choice-card {
    min-height: 50px;
  }
}
