@import url("/auth/tokens.css");

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/auth/inter-latin-wght-normal.woff2") format("woff2-variations");
}

@font-face {
  font-family: "Inter Fallback";
  src: local("Arial");
  size-adjust: 107%;
  ascent-override: 90%;
  descent-override: 22%;
  line-gap-override: 0%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  accent-color: var(--color-blue-500);
}

@supports (color: light-dark(#000, #fff)) {
  :root {
    color-scheme: light dark;
  }

  @media (prefers-color-scheme: dark) {
    .auth-logo,
    .auth-icon-mono {
      filter: invert(1);
    }

    .auth-button-primary {
      box-shadow: var(--shadow-sm);
    }
  }
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--color-background-slate);
  color: var(--color-text-primary);
  font-family: "Inter Variable", "Inter Fallback", sans-serif;
}

button,
input {
  font: inherit;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-3xl);
}

.auth-select-wrap {
  position: relative;
  width: 100%;
}

.auth-select-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: var(--spacing-md);
  width: 0.5rem;
  height: 0.5rem;
  border-right: 0.09375rem solid var(--color-text-tertiary);
  border-bottom: 0.09375rem solid var(--color-text-tertiary);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.auth-select {
  appearance: none;
  padding-right: 2.5rem;
  cursor: pointer;
}

.auth-stack {
  width: 100%;
  max-width: 27.125rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.auth-logo {
  width: 2.5rem;
  height: 2.5rem;
}

.auth-card {
  width: 100%;
  padding: var(--spacing-md);
  border: 0.03125rem solid var(--color-stroke-default);
  border-radius: 1.5rem;
  background: var(--color-background-canvas);
  box-shadow: 0 2rem 4rem -1rem rgba(38, 56, 91, 0.22), var(--shadow-modal);
  backdrop-filter: blur(0.5rem);
}

.auth-card-inner {
  position: relative;
  min-height: 32.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-5xl);
  padding: 3rem;
  border: 0.03125rem solid var(--color-stroke-default);
  border-radius: 1rem;
  background: var(--color-background-lvl-n0);
}

.auth-title {
  margin: 0;
  font-size: var(--text-lg);
  line-height: var(--text-lg--line-height);
  font-weight: var(--font-weight-bold);
}

.auth-actions,
.auth-provider-stack,
.auth-form,
.auth-field {
  width: 100%;
}

.auth-provider-stack,
.auth-heading-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-provider-stack {
  width: 100%;
  gap: var(--spacing-xl);
}

.auth-heading-copy {
  gap: var(--spacing-md);
  text-align: center;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-xl);
}

.auth-actions-single {
  grid-template-columns: 1fr;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-5xl);
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.auth-label {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: var(--text-sm--line-height);
}

.auth-helper {
  padding: var(--spacing-2xs) var(--spacing-xs) 0;
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
}

.auth-submit {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
}

.auth-error {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-md);
  margin: 0;
  padding: var(--spacing-md);
  border: 0.03125rem solid var(--color-stroke-error);
  border-radius: var(--radius-xl);
  background: var(--color-red-50);
  color: var(--color-text-error);
  font-size: var(--text-sm);
  line-height: var(--text-sm--line-height);
}

.auth-error::before {
  content: "";
  width: 0.875rem;
  height: 0.875rem;
  margin-top: 0.0625rem;
  flex: none;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='9' r='7.25'/%3E%3Cpath d='M9 12.5V8.75'/%3E%3Cpath d='M9 6.25h.01' stroke-width='2'/%3E%3C/svg%3E") center / contain no-repeat;
}

.auth-success {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

.auth-input {
  width: 100%;
  height: var(--size-element-md);
  padding: 0 var(--spacing-md);
  border: 0.03125rem solid var(--color-stroke-interactive);
  border-radius: var(--radius-md);
  outline: none;
  background: var(--color-background-canvas);
  box-shadow: var(--shadow-md);
  color: var(--color-text-primary);
  font-size: var(--text-base-n1);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.auth-input::placeholder {
  color: var(--color-text-disabled);
}

.auth-input:hover:not(:focus, [readonly]) {
  border-color: var(--color-stroke-interactive-hover);
}

.auth-input[readonly] {
  color: var(--color-text-secondary);
  cursor: default;
}

.auth-input:user-invalid:not(:focus) {
  border-color: var(--color-stroke-error);
}

.auth-input:focus {
  border-color: var(--color-stroke-accent);
  box-shadow: 0 0 0 0.125rem color-mix(in srgb, var(--color-stroke-accent) 16%, transparent);
}

.auth-button {
  min-height: var(--size-element-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  border: 0.03125rem solid var(--color-stroke-interactive-hover);
  border-radius: var(--radius-lg);
  padding: 0 var(--spacing-xl);
  background: var(--color-background-lvl-1);
  color: var(--color-text-primary);
  font-size: var(--text-base-n1);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  box-shadow: var(--shadow-sm),
    inset 0 -0.0625rem 0.125rem var(--color-background-lvl-n0),
    inset 0 0.125rem 0.25rem var(--color-background-lvl-1);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, transform 120ms ease;
}

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

.auth-button:active {
  transform: scale(0.99);
}

.auth-button[aria-busy="true"] {
  cursor: progress;
}

.auth-button[aria-busy="true"] > span {
  display: none;
}

.auth-button[aria-busy="true"]::before {
  content: "";
  width: 0.75rem;
  height: 0.75rem;
  border: 0.09375rem solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: auth-spin 700ms linear infinite;
}

.auth-button[aria-busy="true"]::after {
  content: attr(data-pending-label);
}

@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

.auth-button:focus-visible,
.auth-link:focus-visible,
.auth-text-button:focus-visible,
.auth-terms input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 0.125rem color-mix(in srgb, var(--color-stroke-accent) 30%, transparent);
}

.auth-button-primary {
  border: 0;
  background: var(--color-grey-950);
  color: var(--color-background-lvl-1);
  box-shadow: var(--shadow-primary-btn);
}

.auth-button-primary:hover {
  background: var(--color-grey-800);
}

.auth-button-icon {
  width: var(--spacing-2xl);
  height: var(--spacing-2xl);
  flex: none;
}

.auth-divider {
  width: 100%;
  height: 0.0625rem;
  background: var(--color-stroke-interactive);
}

.auth-copy {
  margin: 0;
  color: var(--color-text-tertiary);
  font-size: var(--text-base-n1);
  text-align: center;
}

.auth-link {
  color: var(--color-text-primary);
  font-weight: var(--font-weight-bold);
  text-decoration: underline;
}

.auth-link-plain {
  font-weight: inherit;
}

.auth-password-field {
  position: relative;
}

.auth-password-rules {
  display: none;
}

.auth-password-field:focus-within .auth-password-rules {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin: 0;
  padding: var(--spacing-xl);
  border-radius: var(--radius-lg);
  list-style: none;
  background: var(--color-grey-950);
  color: var(--color-grey-50);
  font-size: var(--text-base-n1);
  white-space: nowrap;
  box-shadow: var(--shadow-modal);
  transform: translateX(-50%);
  animation: auth-pop 120ms ease-out;
}

.auth-password-rules::after {
  content: "";
  position: absolute;
  bottom: -0.3125rem;
  left: 50%;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 0.15625rem;
  background: var(--color-grey-950);
  transform: translateX(-50%) rotate(45deg);
}

.auth-password-rules li {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  opacity: 0.7;
  transition: opacity 120ms ease;
}

.auth-password-rules li::before {
  content: "";
  width: 0.75rem;
  height: 0.75rem;
  flex: none;
  border: 0.09375rem solid currentColor;
  border-radius: 50%;
  opacity: 0.6;
}

.auth-password-rules li[data-met],
.auth-password-field:has(.auth-input:valid) .auth-password-rules li {
  opacity: 1;
}

.auth-password-rules li[data-met]::before,
.auth-password-field:has(.auth-input:valid) .auth-password-rules li::before {
  border: 0;
  background: var(--color-green-400);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 6.5l2.25 2.25L9.5 3.5'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 1;
}

@keyframes auth-pop {
  from {
    opacity: 0;
    transform: translate(-50%, 0.25rem);
  }
}

.auth-verify-form {
  gap: 2.25rem;
}

.auth-verify-actions {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
}

.auth-otp {
  --otp-slot: 2rem;
  --otp-gap: var(--spacing-xs);
  position: relative;
  align-self: center;
}

.auth-otp-slots {
  display: flex;
  gap: var(--otp-gap);
}

.auth-otp-slot {
  width: var(--otp-slot);
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0.03125rem solid var(--color-stroke-interactive);
  border-radius: var(--radius-md);
  background: var(--color-background-canvas);
  box-shadow: var(--shadow-md);
  color: var(--color-text-disabled);
  font-size: var(--text-base-n1);
  transition: border-color 120ms ease;
}

.auth-otp:has(.auth-otp-input:placeholder-shown) .auth-otp-slot::before {
  content: "x";
}

.auth-otp:has(.auth-otp-input:focus) .auth-otp-slot {
  border-color: var(--color-stroke-accent);
}

.auth-otp .auth-otp-input {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 1;
  width: calc(100% + var(--otp-slot));
  height: 100%;
  padding: 0 0 0 calc(var(--otp-slot) / 2 - 0.5ch);
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--color-text-primary);
  font-variant-numeric: tabular-nums;
  letter-spacing: calc(var(--otp-slot) + var(--otp-gap) - 1ch);
  clip-path: inset(0 var(--otp-slot) 0 0);
}

.auth-otp .auth-otp-input:focus {
  box-shadow: none;
}

.auth-text-button.auth-resend {
  padding: 0;
  color: inherit;
  font-size: inherit;
}

.auth-text-button.auth-resend:enabled {
  color: var(--color-text-primary);
  font-weight: var(--font-weight-bold);
  text-decoration: underline;
  cursor: pointer;
}

.auth-reset {
  color: var(--color-text-secondary);
  text-align: left;
}

.auth-terms {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  color: var(--color-text-secondary);
  font-size: var(--text-base-n1);
  cursor: pointer;
}

.auth-terms input {
  appearance: none;
  width: 1rem;
  height: 1rem;
  flex: none;
  display: grid;
  place-content: center;
  margin: 0;
  border: 0.0625rem solid var(--color-stroke-interactive);
  border-radius: var(--radius-2xs);
  background: var(--color-background-lvl-1);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.auth-terms input:hover {
  border-color: var(--color-stroke-interactive-hover);
}

.auth-terms input:checked {
  border-color: var(--color-stroke-accent);
  background: var(--color-blue-500);
}

.auth-terms input:checked::after {
  content: "";
  width: 0.75rem;
  height: 0.75rem;
  background: white;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 6.5l2.25 2.25L9.5 3.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.auth-terms input:user-invalid {
  border-color: var(--color-stroke-error);
}

.auth-copy-secondary {
  color: var(--color-text-secondary);
  line-height: 1rem;
}

.auth-text-button {
  border: 0;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: var(--text-base-n1);
}

@media (prefers-reduced-motion: reduce) {
  .auth-password-field:focus-within .auth-password-rules {
    animation: none;
  }

  .auth-button:active {
    transform: none;
  }
}

@media (max-width: 32rem) {
  .auth-card-inner {
    padding: 2rem var(--spacing-5xl);
  }

  .auth-actions {
    grid-template-columns: 1fr;
  }
}
