/* FROM — the waitlist pop-up. Every "Join waitlist" button opens it. Words on the left; on the right a form that
   starts with the same three illustrations as home section 1, so people pick what they came for. */

.waitlist {
  width: min(1120px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: clamp(28px, 4vw, 56px);
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--paper-warm);
  color: var(--ink);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.waitlist::backdrop {
  background: rgba(7, 13, 23, 0.55);
  backdrop-filter: blur(6px);
}

.waitlist[open] {
  animation: waitlist-in 0.45s var(--ease-out);
}

.waitlist[open]::backdrop {
  animation: waitlist-fade 0.3s ease-out;
}

@keyframes waitlist-in {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
}

@keyframes waitlist-fade {
  from {
    opacity: 0;
  }
}

/* Stops the page behind from scrolling while the pop-up is open. */
html:has(.waitlist[open]) {
  overflow: hidden;
}

/* In the top corner, in the pop-up's own padding, so it never covers the form. */
.waitlist__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: inset 0 0 0 1.5px var(--line);
  transition: background-color 0.2s, color 0.2s;
}

.waitlist__close:hover {
  background: var(--ink);
  color: #fff;
}

.waitlist__grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  align-items: start;
  gap: clamp(32px, 5vw, 72px);
}

.waitlist__words {
  position: sticky;
  top: 0;
  padding-top: 8px;
}

.waitlist__title {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(34px, 4.2vw, 60px);
  line-height: 1.02;
  font-weight: 760;
  letter-spacing: -0.05em;
  text-wrap: balance;
}

.waitlist__lede {
  max-width: 40ch;
  margin-top: 22px;
  font-size: clamp(17px, 1.3vw, 19px);
  line-height: 1.55;
  color: var(--ink-2);
}

.waitlist__promise {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
}

.waitlist__promise .icon {
  color: var(--orange);
}

/* ---------- The form ---------- */

.join {
  padding: clamp(24px, 3vw, 40px);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow:
    0 0 0 1px rgba(7, 13, 23, 0.05),
    0 30px 60px -36px rgba(7, 13, 23, 0.25);
}

.join__group {
  margin: 0;
  padding: 0;
  border: 0;
}

.join__legend {
  margin-bottom: 14px;
  padding: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

/* Three picks, each one a small crop of its section-1 illustration. */
.join__roles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.role {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  background: var(--paper-warm);
  box-shadow: inset 0 0 0 1.5px var(--line);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.2s, background-color 0.2s;
}

.role input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.role__art {
  width: 100%;
  height: auto;
  aspect-ratio: 480 / 330;
  object-fit: cover;
  object-position: center 30%;
}

.role__name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px 14px;
  font-size: 15px;
  line-height: 1.25;
  font-weight: 650;
}

.role__tick {
  display: grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--line);
  background: var(--paper);
  color: #fff;
}

.role__tick .icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.4;
  opacity: 0;
}

.role:hover {
  box-shadow: inset 0 0 0 1.5px var(--ink-3);
}

.role:has(input:checked) {
  background: var(--orange-wash);
  box-shadow: inset 0 0 0 2px var(--orange);
}

.role:has(input:checked) .role__tick {
  background: var(--orange);
  box-shadow: none;
}

.role:has(input:checked) .role__tick .icon {
  opacity: 1;
}

.role:has(input:focus-visible) {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
}

/* ---------- Fields ---------- */

.join__fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 14px;
  margin-top: 28px;
}

.field {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.field--wide {
  grid-column: 1 / -1;
}

.field[hidden] {
  display: none;
}

.field__label {
  font-size: 15px;
  font-weight: 650;
}

.field__label small {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-3);
}

.field__box {
  display: flex;
  align-items: center;
  height: 56px;
  border-radius: 16px;
  background: var(--paper);
  box-shadow: inset 0 0 0 1.5px var(--line);
  transition: box-shadow 0.2s;
}

.field__box:focus-within {
  box-shadow: inset 0 0 0 2px var(--ink);
}

.field__prefix {
  padding-left: 16px;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-2);
}

.field__box input {
  flex: 1;
  width: 0;
  min-width: 0;
  height: 100%;
  padding: 0 16px;
  border: 0;
  border-radius: inherit;
  background: none;
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  outline: none;
}

.field__prefix + input {
  padding-left: 8px;
}

.field__box input::placeholder {
  color: #98a2b3;
}

.field__error {
  display: none;
  font-size: 14px;
  font-weight: 600;
  color: #c4320a;
}

.field.is-invalid .field__box {
  box-shadow: inset 0 0 0 2px #e0521d;
}

.field.is-invalid .field__error {
  display: block;
}

.join__submit {
  width: 100%;
  height: 58px;
  margin-top: 28px;
  font-size: 17px;
}

.join__submit[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.join__status {
  margin-top: 16px;
  font-size: 15px;
  font-weight: 600;
  color: #c4320a;
}

.join__status[hidden] {
  display: none;
}

.join__fine {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  color: var(--ink-3);
}

/* ---------- After joining ---------- */

.join__done {
  display: grid;
  justify-items: start;
  gap: 14px;
  padding: clamp(8px, 2vw, 24px) 0;
}

.join__done[hidden],
.join__form[hidden] {
  display: none;
}

.join__done-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
}

.join__done-mark .icon {
  width: 30px;
  height: 30px;
  stroke-width: 2.4;
}

.join__done-title {
  margin: 8px 0 0;
  font-size: clamp(28px, 2.6vw, 38px);
  line-height: 1.1;
  font-weight: 740;
  letter-spacing: -0.035em;
}

.join__done-text {
  max-width: 42ch;
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink-2);
}

.join__again {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ---------- Tablet and phone ---------- */

@media (max-width: 1000px) {
  .waitlist__grid {
    grid-template-columns: 1fr;
  }

  .waitlist__words {
    position: static;
  }

  .waitlist__title {
    max-width: 16ch;
  }
}

@media (max-width: 560px) {
  .waitlist {
    width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    padding: 20px 16px 32px;
    border-radius: 0;
  }

  .waitlist__close {
    top: 12px;
    right: 12px;
  }

  .join {
    padding: 20px;
  }

  .join__roles {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* One row per pick: small picture on the left, name on the right. */
  .role {
    flex-direction: row;
    align-items: center;
  }

  .role__art {
    width: 96px;
    aspect-ratio: 1;
    object-position: center 35%;
  }

  .role__name {
    flex: 1;
    padding: 0 16px;
    font-size: 16px;
  }

  .join__fields {
    grid-template-columns: 1fr;
  }
}

/* The bot trap: off-screen, out of the tab order, never seen by people. */
.join__trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.join__fine a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}
