/* Invite welcome overlay (public/invite.js). Nothing here applies unless
   invite.js has put html.invite-open on the page, which only happens for a
   /?invite=<code> link, so the home page is untouched for everyone else.

   The veil is the brand ground, the same #e6e8ec the welcome video is
   rendered on. It opens on a still first screen (the orange phone above
   one wide button); the tap on that button starts the video, which the
   still screen then fades to. */
html.invite-open, html.invite-open body { overflow: hidden; }
html.invite-open { scroll-behavior: auto; }

.invite-veil {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: var(--ground, #e6e8ec);
  opacity: 1;
  transition: opacity 600ms ease;
}
.invite-veil.is-leaving { opacity: 0; pointer-events: none; }

.invite-veil video {
  display: block;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  /* cover, not contain: browsers render the file's grey a few levels lighter
     than the CSS ground (partial colour tagging), so letterbox bands showed
     as faint seams. The run keeps its content inside a central safe zone,
     so the small crop on a 19.5:9 phone or a 16:10 desktop loses nothing. */
  object-fit: cover;
  background: var(--ground, #e6e8ec);
}

/* The first screen: over the (still unplayed) video, on the same ground.
   Hidden until the lookup answers, so a bad code never shows it. */
.invite-intro {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  box-sizing: border-box;
  /* Content sits a little above centre and clear of Skip. */
  padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(88px, calc(env(safe-area-inset-bottom) + 72px)) max(16px, env(safe-area-inset-left));
  background: var(--ground, #e6e8ec);
  opacity: 1;
  transition: opacity 250ms ease;
}
.invite-veil:not(.is-ready) .invite-intro { visibility: hidden; }
.invite-intro.is-gone { opacity: 0; pointer-events: none; }

.invite-phone {
  display: block;
  /* About 60% of the screen, but never so tall that the button is pushed
     off a short phone; object-fit keeps it uncropped and undistorted. */
  height: min(60vh, calc(100vh - 240px));
  height: min(60dvh, calc(100dvh - 240px));
  width: auto;
  max-width: 100%;
  object-fit: contain;
  flex: none;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
}

/* The site's primary button (.cta on the home page and /start/): blue
   fill, white label, 15px radius, 56px tall; as wide as the column. */
.invite-veil .invite-meet {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 400px;
  min-height: 56px;
  padding: 15px 22px;
  border: 0;
  border-radius: 15px;
  background: var(--blue, #0067dc);
  color: #fff;
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
  box-shadow: 0 5px 14px #0067dc12;
  cursor: pointer;
  flex: none;
}
.invite-veil .invite-meet:hover { background: #005bc5; }
.invite-veil .invite-meet:focus-visible { outline: 3px solid var(--blue, #0067dc); outline-offset: 4px; }
.invite-veil .invite-meet.is-pending { opacity: .7; cursor: progress; }

.invite-skip {
  position: absolute;
  z-index: 2;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  min-width: 44px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: var(--muted, #535965);
  font-family: var(--sans);
  font-size: 14px;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .invite-veil, .invite-intro { transition: none; }
}
