/* The gateway, provider handoff and native form share the same two-column scene. */
[data-id-stage='id'][data-id-stage='id'] {
  --stage-gutter: clamp(1rem, 3vh, 2rem);
  display: block;
  align-content: start;
  box-sizing: border-box;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  padding: var(--stage-gutter) clamp(1rem, 4vw, 3rem);
  color: #18243d;
  background: #f8f8f2;
}

[data-id-stage='id'] [data-stage-frame] {
  display: grid;
  width: min(100%, 65rem);
  max-width: none;
  margin: 0 auto;
  grid-template-columns: minmax(0, 1fr) minmax(31.75rem, 1.15fr);
  align-items: center;
  gap: clamp(2.5rem, 6vw, 5.5rem);
}

[data-id-stage='id'] [data-stage-brand] {
  display: grid;
  min-width: 0;
  /* The signature stays centered in the viewport even when a tall form needs to scroll. */
  min-height: calc(100svh - 2 * var(--stage-gutter));
  align-self: start;
  align-content: center;
  margin: 0;
  justify-items: center;
  gap: 0.5rem;
  text-align: center;
}

[data-id-stage='id'] [data-stage-brand] > a {
  display: grid;
  width: min(100%, clamp(13.75rem, 24vw, 19rem));
  min-height: 44px;
  align-items: center;
  border-radius: 0.5rem;
}

[data-id-stage='id'] [data-stage-brand] > a img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1510 / 330;
}

[data-id-stage='id'] [data-stage-brand] p {
  margin: 0;
  color: #566072;
  font-size: clamp(1.0625rem, 2vw, 1.25rem);
  line-height: 1.35;
}

[data-id-stage='id'] [data-stage-art] {
  display: block;
  width: min(100%, 22.5rem);
  height: auto;
  margin-top: 0.625rem;
  aspect-ratio: 440 / 306;
  background: radial-gradient(ellipse at 53% 50%, #eae3f6 0 44%, transparent 44.5%);
}

[data-id-stage='id'] [data-stage-panel] {
  box-sizing: border-box;
  min-width: 0;
  width: min(100%, 31.75rem);
  margin: 0;
  justify-self: start;
}

[data-id-stage='id'] [data-stage-loading] {
  display: grid;
  align-content: start;
  min-height: var(--stage-card-height, auto);
  gap: 1.25rem;
  padding: clamp(1.25rem, 4vw, 2.25rem);
  border: 1px solid #d6d8d5;
  border-radius: 1.375rem;
  background: white;
}

[data-stage-loading] [data-loading-field] {
  height: 2.875rem;
  border: 1px solid #e5e0ec;
  border-radius: 0.625rem;
  background: #f7f5fa;
}

/* Give the placeholder and its incoming native card the same minimum size. Errors can grow the card. */
[data-stage-loading='/login'],
[data-stage-panel]:has(#login-password) {
  --stage-card-height: 36.5rem;
}

[data-stage-loading='/register'],
[data-stage-panel]:has(#register-display-name) {
  --stage-card-height: 42.5rem;
}

[data-stage-loading='/forgot'],
[data-stage-loading='/forgot-password'],
[data-stage-panel]:has(#forgot-email) {
  --stage-card-height: 25rem;
}

@media (width > 56rem) {
  [data-stage-loading='/reset'],
  [data-stage-loading='/reset-password'],
  [data-stage-panel]:has(#reset-password) {
    --stage-card-height: 32rem;
  }

  [data-id-stage='id'] [data-stage-panel] .mantine-Card-root {
    min-height: var(--stage-card-height, auto);
  }
}

[data-stage-loading] [data-loading-field]:first-of-type {
  width: 52%;
  height: 1.5rem;
  border: 0;
  background: #eee8f6;
}

[data-stage-loading] [role='status'] {
  margin: 0;
  color: #566072;
  font:
    500 0.9375rem/1.5 Onest,
    system-ui,
    sans-serif;
}

@media (max-width: 56rem) {
  [data-stage-loading='/login'] {
    --stage-card-height: 33rem;
  }

  [data-stage-loading='/register'] {
    --stage-card-height: 41rem;
  }

  [data-stage-loading='/forgot'],
  [data-stage-loading='/forgot-password'] {
    --stage-card-height: 23.5rem;
  }

  [data-id-stage='id'][data-id-stage='id'] {
    padding-block: clamp(1.25rem, calc((100svh - 44rem) / 2), 4rem) 2rem;
  }

  [data-id-stage='id'] [data-stage-frame] {
    width: min(100%, 31.75rem);
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(1.25rem, 3vh, 1.75rem);
  }

  [data-id-stage='id'] [data-stage-brand] {
    min-height: 0;
  }

  [data-id-stage='id'] [data-stage-brand] > a {
    width: min(100%, clamp(12.5rem, 30vw, 16.125rem));
  }

  [data-id-stage='id'] [data-stage-art] {
    display: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  [data-id-stage='id'] [data-stage-panel]:not([data-stage-loading]) {
    animation: id-panel-arrive 170ms ease-out;
  }

  @keyframes id-panel-arrive {
    from {
      opacity: 0.78;
    }
  }
}
