/* CTA is a normal page section: portrait video on the left, the existing pitch on the right. */
.cta {
  padding: var(--space-128) var(--page-gutter);
  /* FAQ shares this section canvas; the root page canvas uses a different swatch. */
  background: var(--color-how-it-works-canvas);
}

.cta__layout {
  display: grid;
  grid-template-columns: 500px minmax(0, 640px);
  justify-content: center;
  align-items: center;
  gap: var(--space-72);
  width: min(100%, var(--section-track));
  margin-inline: auto;
}

.cta__media {
  container-type: size;
  width: 500px;
  height: 700px;
  margin: 0;
}

.cta__video {
  /* Neck focus in cta-video.js's 1080×1920 SOURCE. Update the ratio and focal
     point with that asset; clamped offsets keep the cover crop inside its edges. */
  --cta-video-focal-x: .36;
  --cta-video-focal-y: .44;
  --cta-video-cover-width: max(100cqw, calc(100cqh * 9 / 16));
  --cta-video-cover-height: max(100cqh, calc(100cqw * 16 / 9));
  display: block;
  width: 100%;
  height: 100%;
  border-radius: var(--space-24);
  background: var(--color-lp-section);
  object-fit: cover;
  object-position:
    clamp(calc(100cqw - var(--cta-video-cover-width)), calc(50cqw - var(--cta-video-cover-width) * var(--cta-video-focal-x)), 0px)
    clamp(calc(100cqh - var(--cta-video-cover-height)), calc(50cqh - var(--cta-video-cover-height) * var(--cta-video-focal-y)), 0px);
}

.cta__copy {
  min-width: 0;
  max-width: 640px;
}

.cta__title {
  margin: 0;
  color: var(--color-lp-headline);
  font: var(--type-h1-font);
  letter-spacing: var(--type-h1-letter-spacing);
}

.cta__title em { font-weight: inherit; }

.cta__body {
  max-width: 520px;
  margin: var(--space-24) 0 0;
  color: var(--color-lp-subhead);
  font: var(--type-body-1-font);
}

.cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-16);
  margin-top: var(--space-40);
}

.cta .button--primary {
  border: 0;
  background: var(--color-hero-cta);
  cursor: pointer;
}

.cta .button--primary:hover {
  background: color-mix(in srgb, var(--color-hero-cta), var(--color-black) 12%);
}

.cta .button:focus-visible,
.cta .nav-download:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
}

.cta__notes {
  justify-content: flex-start;
  margin-top: var(--space-24);
}

.cta__notes li {
  gap: var(--space-8);
  color: var(--color-lp-nav);
}

dialog.auth {
  inset: 0;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: var(--space-24);
  /* Only the viewport shell may scroll on short screens; the card and its two
     panels have no scroll containers. */
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 0;
  background: transparent;
  color: var(--color-lp-headline);
}

dialog.auth[open] { display: flex; }
html:has(dialog.auth[open]) { overflow: hidden; }

dialog.auth::backdrop {
  background: color-mix(in srgb, var(--color-black) 48%, transparent);
}

.auth__layout {
  position: relative;
  flex: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: min(640px, 100%);
  min-height: 0;
  margin: auto;
  border-radius: var(--space-24);
  background: var(--color-white);
  transform: translateZ(0);
  /* No clip-path here: it flattens the 3D space that the entrance layers share. The stage clips its own video. */
  transform-style: preserve-3d;
}

.auth__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-width: 0;
  padding: var(--space-48);
  overflow: visible;
}

.auth__intro,
.auth__card,
.auth__reassure {
  flex-shrink: 0;
  width: min(100%, 440px);
  margin-inline: auto;
}

.auth__title {
  margin: 0;
  font: var(--type-h2-font);
  letter-spacing: var(--type-h2-letter-spacing);
}

.auth__reassure {
  margin-block: var(--space-16) 0;
  color: var(--color-lp-subhead);
  font: var(--type-body-1-font);
}

.auth__reassure { white-space: pre-line; }

.auth__close:focus-visible,
.auth__provider:focus-visible,
.auth__text-button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
}

.auth__card {
  display: grid;
  gap: var(--space-16);
  margin-top: var(--space-32);
  padding: var(--space-24);
  border-radius: var(--space-24);
  background: var(--color-white);
  box-shadow: 0 var(--space-24) 56px rgb(17 17 17 / 8%), 0 1px 2px rgb(17 17 17 / 6%);
}

.auth__providers {
  display: grid;
  gap: var(--space-8);
}

.auth__provider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  min-height: var(--space-48);
  padding: 0 var(--space-16);
  border: 1px solid rgb(17 17 17 / 10%);
  border-radius: 999px;
  background: var(--color-white);
  color: var(--color-lp-headline);
  font: var(--type-body-2-font);
  font-weight: 600;
  cursor: pointer;
}

.auth__provider:hover { background: var(--color-quiet-grey); }

.auth__provider img {
  width: var(--space-16);
  height: var(--space-16);
}

.auth__field {
  display: grid;
  gap: var(--space-8);
  color: var(--color-lp-label);
  font: var(--type-body-2-font);
  font-weight: 600;
}

.auth__field input {
  width: 100%;
  min-height: var(--space-48);
  padding: 0 var(--space-16);
  border: 1px solid rgb(17 17 17 / 12%);
  border-radius: 12px;
  background: var(--color-white);
  color: var(--color-lp-headline);
  font: var(--type-body-1-font);
  font-weight: 400;
}

.auth__field input:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.auth__field input[aria-invalid="true"] {
  border-color: var(--color-error);
  outline-color: var(--color-error);
}

.auth__error {
  color: var(--color-error);
  font: var(--type-body-2-font);
}

.auth__error[hidden] { display: none; }

.auth__text-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-lp-button);
  font: var(--type-body-2-font);
  font-weight: 600;
  cursor: pointer;
}

.auth__status {
  min-height: var(--line-height-24);
  margin: 0;
  color: var(--color-lp-headline);
  font: var(--type-body-2-font);
}

.auth__status:empty { display: none; }

.auth__close {
  position: absolute;
  z-index: 2;
  top: var(--space-16);
  right: var(--space-16);
  display: grid;
  place-items: center;
  width: var(--space-40);
  height: var(--space-40);
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--color-white);
  box-shadow: 0 8px 24px rgb(17 17 17 / 12%);
  cursor: pointer;
}

.auth__stage {
  display: none;
  position: relative;
  min-width: 0;
  margin: var(--space-24);
  overflow: clip;
  border-radius: var(--space-24);
  /* The local transform lets this crop catch preserve-3d paint from the calendar. */
  transform: translateZ(0);
  clip-path: inset(0 round var(--space-24));
}

.auth__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth__veil {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--color-black) 50%, transparent);
}

/* Popup entrance, shared by every popup: a <dialog class="popup">. Its markup gives the layers roles:
   .popup-layout is the box that tilts (the dialog's only child); its direct children are panels and the surface
   (video or image stage, depth 0). Inside a panel, .popup-text and .popup-actions are the lifted layers.
   The dialog's perspective projects the tilt. Lifts show only during the tilt and settle to 0 with it, so the resting
   popup stays flat. The depth needs the preserve-3d chain dialog > layout > panel > layer, and no clip-path or opacity
   on the layout or panel, or it flattens. Timing and depth are tokens on dialog.popup. */
dialog.popup {
  --popup-fade: 600ms;
  --popup-enter: 1200ms;
  --popup-easing: cubic-bezier(0.7, 0, 0.21, 1);
  --popup-tilt: -80deg;
  --popup-scale-from: 0.7;
  --popup-lift-text: 36px;
  --popup-lift-actions: 96px;
  perspective: 1400px;
}

@keyframes popup-fade { from { opacity: 0; } }
@keyframes popup-tilt { from { transform: rotateX(var(--popup-tilt)) scale(var(--popup-scale-from)); } to { transform: rotateX(0) scale(1); } }
@keyframes popup-lift-text { from { transform: translateZ(var(--popup-lift-text)); } to { transform: translateZ(0); } }
@keyframes popup-lift-actions { from { transform: translateZ(var(--popup-lift-actions)); } to { transform: translateZ(0); } }

dialog.popup[open] { animation: popup-fade var(--popup-fade) var(--popup-easing) both; }
dialog.popup[open] .popup-layout { transform-style: preserve-3d; animation: popup-tilt var(--popup-enter) var(--popup-easing) both; }
dialog.popup[open] .popup-layout > * { transform-style: preserve-3d; }
dialog.popup[open] .popup-text { animation: popup-lift-text var(--popup-enter) var(--popup-easing) both; }
dialog.popup[open] .popup-actions { animation: popup-lift-actions var(--popup-enter) var(--popup-easing) both; }

@media (prefers-reduced-motion: reduce) {
  dialog.popup[open] .popup-layout,
  dialog.popup[open] .popup-text,
  dialog.popup[open] .popup-actions { animation: none; }
}

/* The 30-day trial popup owns this breakpoint independently of the CTA video layout. */
@media (min-width: 1024px) {
  .auth__layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
    width: min(1120px, 100%);
    min-height: min(760px, calc(100dvh - var(--space-48)));
  }

  .auth__panel { align-items: stretch; text-align: left; }
  .auth__stage { display: block; }
}

@media (max-height: 850px) {
  .auth__panel { padding: var(--space-32); }
  .auth__card { margin-top: var(--space-16); padding: var(--space-16); }
  /* The provider buttons always stay one under the other; short screens only make them lower. */
  .auth__provider { min-height: var(--space-40); }
  .auth__reassure { margin-top: var(--space-8); }
}

@media (1024px <= width < 1366px) {
  .cta__layout {
    grid-template-columns: 350px minmax(0, 1fr);
    gap: var(--space-32);
    width: min(100%, calc(350px + var(--space-32) + 640px));
  }

  .cta__media { width: 350px; height: 500px; }
}

@media (width < 1024px) {
  .cta { padding-block: var(--space-80); }

  .cta__layout {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: var(--space-32);
    text-align: center;
  }

  .cta__copy { justify-self: center; }
  .cta__body { margin-inline: auto; }

  .cta__media {
    width: 100%;
    height: 400px;
  }

  .cta__actions,
  .cta__notes { justify-content: center; }

  .cta__notes { column-gap: var(--space-16); }
}

@media (width < 768px) {
  .cta__media { height: 250px; }
}

@media (max-width: 743px) {
  .cta__title { line-height: var(--line-height-48); }

  dialog.auth {
    padding: var(--space-8);
  }

  .auth__panel { padding: var(--space-64) var(--space-24) var(--space-24); }
}

@media (max-width: 640px) {
  .cta .cta__notes {
    flex-direction: row;
    flex-wrap: nowrap;
    width: 100%;
    max-width: none;
    margin-inline: 0;
    column-gap: var(--space-8);
  }

  .cta .cta__notes li {
    gap: var(--space-4);
    white-space: nowrap;
  }
}

/* Login: "Enter via email" turns into an email field with a round arrow button beside it. */
.auth__email-link {
  justify-self: center;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth__email {
  display: grid;
  gap: var(--space-8);
}

.auth__email[hidden] { display: none; }

.auth__field { text-align: left; }

.auth__input-row {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.auth__input-row input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

.auth__continue {
  flex: none;
  display: grid;
  place-items: center;
  width: var(--space-48);
  height: var(--space-48);
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--color-accent);
  color: var(--color-white);
  cursor: pointer;
}

.auth__continue:hover { background: var(--color-lp-button); }

.auth__continue svg {
  width: var(--space-24);
  height: var(--space-24);
}

.auth__continue:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
}

/* Login: the one-time code step reuses the input row; its actions sit under the field. */
.auth__code {
  display: grid;
  gap: var(--space-16);
}

.auth__code[hidden] { display: none; }

.auth__code-text {
  margin: 0;
  color: var(--color-lp-subhead);
  font: var(--type-body-1-font);
  text-align: left;
}

.auth__code-text span {
  color: var(--color-lp-headline);
  font-weight: 600;
}

.auth__code-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-8) var(--space-16);
}

.auth__code-actions .auth__text-button {
  text-decoration: underline;
  text-underline-offset: 3px;
}
