/* The sign-in window of the welcome page (templates/_landing_auth.html, auth-dialog.js). Colours are
   the tokens of landing.css; what is inside .auth-view is the card of the server's sign-in pages. */
dialog.auth {
  width: min(440px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  max-height: min(820px, calc(100dvh - 32px));
  margin: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 40px 90px -30px rgba(11, 11, 11, .5), 0 8px 24px rgba(11, 11, 11, .14);
  overflow: auto;
  overscroll-behavior: contain;
}
dialog.auth::backdrop { background: rgba(9, 14, 24, .55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
dialog.auth[open] { animation: auth-in .22s var(--ease-out); }
dialog.auth[open]::backdrop { animation: auth-fade .22s var(--ease-out); }
@keyframes auth-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes auth-up { from { transform: translateY(100%); } }
@keyframes auth-fade { from { opacity: 0; } }
html:has(dialog.auth[open]) { overflow: hidden; scrollbar-gutter: stable; }

.auth-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 0 28px; }
.auth-head .brand { pointer-events: none; }
.auth-body { min-height: 260px; padding: 18px 28px 6px; }
.auth-foot { padding: 8px 28px 20px; color: var(--lp-text-3); font-size: 13px; text-align: center; }
.auth-foot a { display: inline-block; padding: 8px 6px; color: var(--ink-2); text-decoration: none; }
.auth-foot a:hover { text-decoration: underline; }

.auth-wait { display: grid; place-items: center; min-height: 220px; }
.auth-spin { width: 30px; height: 30px; border: 3px solid color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent); border-radius: 50%; animation: auth-turn .8s linear infinite; }
@keyframes auth-turn { to { transform: rotate(1turn); } }
.auth-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---- the card of the sign-in pages ---- */
.auth-view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; text-align: left; }
.auth-view h2 { font-size: 26px; line-height: 1.2; letter-spacing: -.015em; }
.auth-view h2:focus { outline: none; }
.auth-view h3 { margin-top: 4px; font-size: 15px; }
.auth-view p { overflow-wrap: anywhere; font-size: 14px; line-height: 1.55; }
.auth-view h2 + p { margin-top: 6px; }
.auth-view .secondary { color: var(--ink-2); font-size: 15px; }
.auth-view .muted, .auth-view .hint { color: var(--ink-2); font-size: 12.5px; line-height: 1.5; }
.auth-view a:not(.btn) { color: var(--lp-link); }
.auth-view code { font-size: .92em; overflow-wrap: anywhere; }

.auth-view .btn { width: 100%; border-radius: 12px; }
.auth-view .providers { display: grid; gap: 10px; }
.auth-view .btn.provider { gap: 10px; border-color: var(--baseline); background: var(--surface); color: var(--ink); }
.auth-view .btn.provider:hover { background: var(--hover); }
.auth-view .btn:not(.primary):not(.provider):not(.pw-toggle) { border-color: var(--baseline); color: var(--ink); }
.auth-view .btn:disabled { opacity: .6; cursor: progress; transform: none; }
.auth-view .logo { flex: none; }

.auth-view .or { display: flex; align-items: center; gap: 12px; color: var(--lp-text-3); font-size: 12.5px; }
.auth-view .or::before, .auth-view .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

.auth-view form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.auth-view .field { display: grid; gap: 6px; }
.auth-view .field label { font-size: 13px; font-weight: 600; }
.auth-view input:not([type="hidden"]):not([type="checkbox"]) {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--baseline);
  border-radius: 12px;
  background: var(--page);
  color: var(--ink);
  font: inherit;
  font-size: 16px; /* a phone zooms into a field with smaller text */
}
.auth-view input:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.auth-view input[aria-invalid="true"] { border-color: var(--bad); }
.auth-view .pw-row { display: flex; gap: 8px; }
.auth-view .pw-row input:not([type="hidden"]) { flex: 1; }
.auth-view .pw-row .btn { flex: none; width: auto; min-height: 48px; padding: 0 14px; border: 1px solid var(--baseline); background: transparent; color: var(--ink-2); font-size: 13px; }
.auth-view .pw-row .btn[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); }

.auth-view .links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 18px; }
.auth-view .links a { display: inline-block; padding: 8px 0; font-weight: 560; }
.auth-view .terms-note a, .auth-view .muted a { font-weight: 560; }

/* (the page's own .notice is a wide band with a large margin: here it is a plain box) */
.auth-view .notice, .auth-body > .notice { display: block; margin: 0; padding: 11px 14px; border: 1px solid transparent; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.auth-view .notice.error, .auth-body .notice.error { background: color-mix(in srgb, var(--bad) 12%, var(--surface)); color: var(--bad-text); }
.auth-view .notice.success { background: color-mix(in srgb, var(--good-text) 12%, var(--surface)); color: var(--good-text); }
.auth-body .notice a { color: inherit; font-weight: 600; }
.auth-view .notice:focus { outline: none; }
.auth-view .captcha { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.auth-view .captcha-box { overflow-x: auto; }

@media (pointer: coarse) {
  .auth-view .links a { padding: 12px 0; }
}

/* a phone: a sheet from the bottom edge */
@media (max-width: 559px) {
  dialog.auth { width: 100%; max-height: 94vh; max-height: 94dvh; margin: auto 0 0; border-width: 1px 0 0; border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  dialog.auth[open] { animation-name: auth-up; animation-duration: .28s; }
  .auth-head { padding-left: 20px; padding-right: 12px; }
  .auth-body { padding-inline: 20px; }
  .auth-foot { padding-inline: 20px; }
}
@media (forced-colors: active) {
  dialog.auth { border: 1px solid CanvasText; }
}
