/* Keryx email sign-up/sign-in dialog (auth-dialog.html, auth.js). */
html:has(.auth-dialog[open]) {
  overflow: hidden;
}
.auth-dialog {
  width: min(100% - clamp(24px, 4vw, 32px), 440px);
  max-height: calc(100dvh - max(24px, env(safe-area-inset-top)) - max(24px, env(safe-area-inset-bottom)));
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.28);
  overflow: auto;
  overscroll-behavior: contain;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms cubic-bezier(.2,.6,.2,1), transform 180ms cubic-bezier(.2,.6,.2,1),
    display 180ms allow-discrete, overlay 180ms allow-discrete;
}
.auth-dialog[open] {
  opacity: 1;
  transform: translateY(0);
}
.auth-dialog::backdrop {
  background: transparent;
  transition: background-color 180ms cubic-bezier(.2,.6,.2,1), display 180ms allow-discrete, overlay 180ms allow-discrete;
}
.auth-dialog[open]::backdrop {
  background: rgb(23 51 41 / 0.6);
}
/* Native dialog owns focus, Escape and the top layer. Supporting browsers
   keep its exit visible; others close immediately without delaying an action. */
@starting-style {
  .auth-dialog[open] { opacity: 0; transform: translateY(8px); }
  .auth-dialog[open]::backdrop { background: transparent; }
}
.auth-dialog [hidden] {
  display: none !important;
}
.auth-panel {
  position: relative;
  display: grid;
  gap: 16px;
  padding: clamp(24px, 4vw, 32px) clamp(20px, 4vw, 28px) max(24px, env(safe-area-inset-bottom));
}
.auth-panel h2 {
  margin: 0;
  padding-right: 40px;
  font-size: 30px;
}
.auth-lede,
.auth-hint,
.auth-links,
.auth-status,
.auth-error {
  margin: 0;
}
.auth-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.auth-close:hover {
  background: rgb(23 51 41 / 0.08);
}
.auth-google {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: 20px 1fr 20px;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 12px;
  border: 1px solid #747775;
  border-radius: 4px;
  background: #fff;
  color: #1f1f1f;
  font-family: "Google Sans", Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  text-align: center;
  text-decoration: none;
}
.auth-google img {
  display: block;
  width: 20px;
  height: auto;
}
.auth-google:hover {
  background: #f8fafd;
  box-shadow: 0 1px 2px rgb(60 64 67 / 0.15);
}
.auth-google:active {
  background: #eef3fc;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 0;
  font-size: 14px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid rgb(23 51 41 / 0.25);
}
.auth-form {
  display: grid;
  gap: 14px;
}
.auth-field {
  display: grid;
  gap: 6px;
}
.auth-field label {
  font-weight: 700;
  font-size: 15px;
}
.auth-field input {
  min-height: 48px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgb(23 51 41 / 0.45);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  font-size: 16px; /* 16px keeps iOS from zooming on focus. */
}
.auth-field input[aria-invalid="true"] {
  border-color: #b23f22;
  box-shadow: 0 0 0 1px #b23f22;
}
.auth-password { display: flex; align-items: stretch; gap: 8px; }
.auth-password input { min-width: 0; flex: 1; }
.auth-password-toggle {
  flex: none;
  min-width: 64px;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid rgb(23 51 41 / 0.45);
  border-radius: 5px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.auth-panel h2:focus { outline: none; }
.auth-hint {
  font-size: 14px;
}
.auth-status:empty,
.auth-error:empty {
  display: none;
}
.auth-field [data-auth-shown]:empty {
  display: block; /* Retain measured error space until the next form step. */
}
.auth-error {
  color: #8f2c14;
  font-weight: 700;
}
.auth-submit {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  min-height: 48px;
  border: 0;
  cursor: pointer;
}
/* The pressed control is the one progress display
   (docs/customer-ux-principles.md): it keeps its colour, says what is
   happening, and carries the app's shared shimmer, a soft band swept beneath
   its label. No line appears above it, so nothing moves. */
.auth-submit[aria-busy="true"],
.auth-google[aria-busy="true"] {
  cursor: progress;
}
.auth-submit[aria-busy="true"]::after,
.auth-google[aria-busy="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 32%, rgb(255 253 248 / 0.34) 48%, transparent 64%);
  background-size: 240% 100%;
  animation: auth-sheen 1.6s cubic-bezier(0.2, 0.6, 0.2, 1) infinite;
}
.auth-google[aria-busy="true"]::after {
  background-image: linear-gradient(105deg, transparent 32%, rgb(23 51 41 / 0.09) 48%, transparent 64%);
}
@keyframes auth-sheen {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}
/* Announces the pressed control's progress once; its label shows it. */
.auth-progress {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}
.auth-link {
  min-height: 44px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.auth-dialog :focus-visible {
  outline: 3px solid #b23f22;
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce), (forced-colors: active) {
  .auth-dialog, .auth-dialog::backdrop { transition: none; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-submit[aria-busy="true"]::after,
  .auth-google[aria-busy="true"]::after {
    animation: none;
    background: rgb(255 253 248 / 0.12);
  }
}
@media (forced-colors: active) {
  .auth-dialog {
    border: 1px solid CanvasText;
  }
  .auth-submit[aria-busy="true"]::after,
  .auth-google[aria-busy="true"]::after {
    content: none;
  }
}
