/* ==========================================================================
   JOIN FLOW
   A sheet of paper over the whole screen. At the top a way to close it, the
   step count and a line that fills. The visitor's pass stands above the
   form on a phone and beside it from 900px, and fills in as they type. Each
   step is one fieldset; only the current one shows (JoinFlow.js), and the
   next arrives from the side it lies on. On a phone the step's buttons stay
   under the thumb.
   ========================================================================== */

.join-flow {
  min-height: 100svh;
  background-color: var(--paper);
}

/* BAR */

.join-flow__bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-top: calc(env(safe-area-inset-top) + 0.625rem);
  padding-left: 0.75rem;
  padding-right: 1.25rem;
  padding-bottom: 0.625rem;
  background-color: color-mix(in srgb, var(--paper) 92%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/* Tablet Landscape Up - Min 900px */
@media (min-width: 900px) {
  .join-flow__bar {
    justify-content: flex-end;
    padding-top: 1.25rem;
    padding-left: 2rem;
    padding-right: 3rem;
    background-color: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

.join-flow__close {
  margin-right: auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 999px;
  background-color: color-mix(in srgb, var(--ink) 7%, transparent);
  color: var(--ink);
  transition: transform var(--duration-sm) var(--ease-out);
}

.join-flow__close:active {
  transform: scale(0.9);
}

.join-flow__count {
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 650;
  color: var(--slate);
}

.join-flow__track {
  flex: 1;
  max-width: 520px;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background-color: color-mix(in srgb, var(--ink) 9%, transparent);
}

.join-flow__track span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background-color: var(--ink);
  transform: scaleX(var(--join-progress, 0.3333));
  transform-origin: 0 50%;
  transition: transform var(--duration-lg) var(--ease-out);
}

.no-js .join-flow__count,
.no-js .join-flow__track {
  display: none;
}

/* LAYOUT */

.join-flow__wrapper {
  display: grid;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
  padding-bottom: 2rem;
}

/* Tablet Landscape Up - Min 900px */
@media (min-width: 900px) {
  .join-flow__wrapper {
    grid-template-columns: minmax(0, 1fr) minmax(0, 520px);
    align-items: start;
    column-gap: 5rem;
    padding-left: 3rem;
    padding-right: 3rem;
    padding-bottom: 5rem;
  }
}

/* Desktop Up - Min 1200px */
@media (min-width: 1200px) {
  .join-flow__wrapper {
    column-gap: 8rem;
  }
}

/* PASS */

.join-flow__pass {
  justify-self: center;
  width: min(150px, 40%);
  margin-top: 0.75rem;
}

/* Tablet Landscape Up - Min 900px */
@media (min-width: 900px) {
  .join-flow__pass {
    position: sticky;
    top: 14svh;
    width: min(340px, 100%);
    margin-top: 8svh;
  }
}

/* FORM */

.join-flow__form {
  margin-top: 1.75rem;
}

/* Tablet Landscape Up - Min 900px */
@media (min-width: 900px) {
  .join-flow__form {
    margin-top: 4rem;
  }
}

/* Named only while a step is changing, so that leaving the sheet takes the
   form with it. */
.is-stepping .join-flow__form {
  view-transition-name: join-step;
}

.join-flow__step {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.is-scripted .join-flow__step {
  display: none;
}

.is-scripted .join-flow__step.is-current {
  display: block;
}

.no-js .join-flow__step + .join-flow__step {
  margin-top: 3rem;
}

.join-flow__step > legend {
  display: block;
  float: left;
  width: 100%;
  padding: 0;
}

.join-flow__step > legend + * {
  clear: both;
}

.join-flow__title {
  display: block;
  font-family: var(--header-font-family);
  font-size: 40px;
  font-weight: 790;
  line-height: 1;
  letter-spacing: -0.045em;
}

/* Tablet Landscape Up - Min 900px */
@media (min-width: 900px) {
  .join-flow__title {
    font-size: 64px;
  }
}

.join-flow__lede {
  padding-top: 0.75rem;
  font-size: 17px;
  color: var(--slate);
}

/* TIERS */

.join-flow__tiers {
  display: grid;
  gap: 0.625rem;
  margin-top: 1.5rem;
}

.join-flow-tier {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 0.75rem;
  row-gap: 0.25rem;
  padding-top: 1.125rem;
  padding-right: 1.25rem;
  padding-bottom: 1.125rem;
  padding-left: 1.25rem;
  border-radius: 22px;
  background-color: var(--white);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ink) 9%, transparent);
  cursor: pointer;
  transition: box-shadow var(--duration-sm) ease, transform var(--duration-sm) var(--ease-out);
}

.join-flow-tier:active {
  transform: scale(0.985);
}

.join-flow-tier:has(input:checked) {
  box-shadow: inset 0 0 0 2.5px var(--ink);
}

.join-flow-tier:has(input:focus-visible) {
  outline: 3px solid var(--focus-color);
  outline-offset: 3px;
}

.join-flow-tier input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.join-flow-tier__swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--white);
  background-image: radial-gradient(circle at 30% 25%, var(--primary-color-lighter), transparent 60%), radial-gradient(circle at 75% 80%, var(--secondary-color-lighter), transparent 60%);
  box-shadow: inset 0 0 0 3px var(--white), 0 0 0 1.5px color-mix(in srgb, var(--ink) 16%, transparent);
  transition: box-shadow var(--duration-sm) ease;
}

.join-flow-tier[data-tier="grow"] .join-flow-tier__swatch {
  background-color: var(--platinum);
  background-image: linear-gradient(135deg, var(--platinum-lighter), var(--platinum-darkened) 55%, var(--platinum-lighter));
}

.join-flow-tier[data-tier="lead"] .join-flow-tier__swatch {
  background-color: var(--onyx);
  background-image: radial-gradient(circle at 50% 50%, var(--champagne) 0 22%, transparent 24%);
}

.join-flow-tier:has(input:checked) .join-flow-tier__swatch {
  box-shadow: inset 0 0 0 0 var(--white), 0 0 0 1.5px var(--ink);
}

.join-flow-tier__name {
  font-size: 20px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.join-flow-tier__price {
  font-size: 14px;
  font-weight: 560;
  color: var(--slate);
  white-space: nowrap;
}

.join-flow-tier__price .price {
  font-size: 20px;
  color: var(--ink);
}

.join-flow-tier__price .price span {
  margin-top: 0.06em;
  font-size: 0.72em;
}

.join-flow-tier__line {
  grid-column: 2 / -1;
  font-size: 15px;
  line-height: 1.35;
  color: var(--slate);
}

.join-flow__compare {
  margin-top: 0.75rem;
  color: var(--primary-color);
}

/* FIELDS */

.join-flow__fields {
  display: grid;
  gap: 1.125rem;
  margin-top: 1.5rem;
}

.join-flow-field label,
.join-flow-choice legend {
  display: block;
  margin-bottom: 0.4375rem;
  padding: 0;
  font-size: 15px;
  font-weight: 650;
}

.join-flow-field input {
  width: 100%;
  height: 56px;
  padding-left: 1.125rem;
  padding-right: 1.125rem;
  border: 0;
  border-radius: 16px;
  background-color: var(--white);
  color: var(--ink);
  font-size: 17px;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ink) 12%, transparent);
  transition: box-shadow var(--duration-sm) ease;
}

.join-flow-field input::placeholder {
  color: color-mix(in srgb, var(--ink) 34%, transparent);
}

.join-flow-field input:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--ink), 0 0 0 4px color-mix(in srgb, var(--primary-color) 22%, transparent);
}

.join-flow-field input[aria-invalid="true"] {
  box-shadow: inset 0 0 0 2px var(--tertiary-color);
}

.join-flow-choice {
  margin: 0;
  padding: 0;
  border: 0;
}

.join-flow-choice div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.join-flow-choice label {
  position: relative;
  cursor: pointer;
}

.join-flow-choice input {
  position: absolute;
  opacity: 0;
}

.join-flow-choice span {
  display: grid;
  place-items: center;
  height: 52px;
  border-radius: 999px;
  background-color: var(--white);
  font-size: 16px;
  font-weight: 620;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ink) 12%, transparent);
  transition: background-color var(--duration-sm) ease, color var(--duration-sm) ease;
}

.join-flow-choice input:checked + span {
  background-color: var(--ink);
  color: var(--white);
  box-shadow: none;
}

.join-flow-choice input:focus-visible + span {
  outline: 3px solid var(--focus-color);
  outline-offset: 3px;
}

/* SUMMARY */

.join-flow__summary {
  margin-top: 1.5rem;
  margin-bottom: 0;
  padding-top: 0.25rem;
  padding-right: 1.25rem;
  padding-bottom: 0.25rem;
  padding-left: 1.25rem;
  border-radius: 22px;
  background-color: var(--white);
}

.join-flow__summary div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.8125rem;
  padding-bottom: 0.8125rem;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
  font-size: 15px;
}

.join-flow__summary div:last-child {
  border-bottom: 0;
}

.join-flow__summary dt {
  color: var(--slate);
}

.join-flow__summary dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 650;
  text-align: right;
}

/* AGREEMENT */

.join-flow__agree {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.join-flow-check {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 0.75rem;
  font-size: 15px;
  line-height: 1.45;
  cursor: pointer;
}

.join-flow-check input {
  width: 26px;
  height: 26px;
  margin: 0;
  accent-color: var(--ink);
}

.join-flow-check a {
  font-weight: 650;
}

.join-flow__note {
  margin-top: 1.25rem;
  padding-top: 1rem;
  padding-right: 1.125rem;
  padding-bottom: 1rem;
  padding-left: 1.125rem;
  border-radius: 18px;
  background-color: var(--paper-darkened);
  font-size: 15px;
  line-height: 1.45;
}

/* ERRORS */

.join-flow__error {
  margin-top: 0.5rem;
  font-size: 14px;
  font-weight: 600;
  color: var(--tertiary-color);
}

/* ACTIONS */

.join-flow__actions {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 0.625rem;
  margin-top: 1.5rem;
  margin-left: -1.25rem;
  margin-right: -1.25rem;
  padding-top: 1.25rem;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
  padding-bottom: calc(env(safe-area-inset-bottom) + 1rem);
  background-image: linear-gradient(to bottom, transparent, var(--paper) 1.25rem);
}

/* Tablet Landscape Up - Min 900px */
@media (min-width: 900px) {
  .join-flow__actions {
    position: static;
    margin-top: 2rem;
    margin-left: 0;
    margin-right: 0;
    padding: 0;
    background-image: none;
  }
}

.no-js .join-flow__actions:not(:last-child),
.no-js [data-join-next],
.no-js .join-flow__back {
  display: none;
}

.join-flow__back {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border: 0;
  border-radius: 999px;
  background-color: color-mix(in srgb, var(--ink) 7%, transparent);
  color: var(--ink);
  transition: transform var(--duration-sm) var(--ease-out);
}

.join-flow__back:active {
  transform: scale(0.92);
}

/* STEP TRANSITIONS */

/* The next step arrives from the right and the last one leaves to the left;
   going back reverses it. Only while a step is changing (JoinFlow.js). */
html:active-view-transition-type(join-forward)::view-transition-old(join-step) {
  animation: join-flow-out-left 320ms var(--ease-in) both;
}

html:active-view-transition-type(join-forward)::view-transition-new(join-step) {
  animation: join-flow-in-right 520ms var(--ease-out) 80ms both;
}

html:active-view-transition-type(join-back)::view-transition-old(join-step) {
  animation: join-flow-out-right 320ms var(--ease-in) both;
}

html:active-view-transition-type(join-back)::view-transition-new(join-step) {
  animation: join-flow-in-left 520ms var(--ease-out) 80ms both;
}

@keyframes join-flow-out-left {
  to {
    opacity: 0;
    translate: -48px 0;
  }
}

@keyframes join-flow-in-right {
  from {
    opacity: 0;
    translate: 64px 0;
  }
}

@keyframes join-flow-out-right {
  to {
    opacity: 0;
    translate: 48px 0;
  }
}

@keyframes join-flow-in-left {
  from {
    opacity: 0;
    translate: -64px 0;
  }
}
