/*
 * Yail.Identity - auth-base.css
 *
 * What every sign-in document shares, on the role tokens in yail-tokens.css (loaded first; this file
 * second): _AuthLayout (with auth.css) and the standalone pages (sign-in, two-factor, required
 * two-factor set-up and its codes), each with its own auth-*.css after this one for its differences.
 * None of them loads yail-app-shell.css.
 *
 * Rules under :where(.auth-page) are for the editorial pages only (_AuthLayout and sign-in, whose
 * <body> carries .auth-page); :where keeps their specificity what it was before they moved here.
 */
:root {
  --font-display: "Fraunces", "Times New Roman", serif;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--yail-font-sans);
  background: var(--yail-page);
  color: var(--yail-text);
  min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; }

/* The editorial pages: smoother type, plain links and a faint grain over the page. */
:where(.auth-page) { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
:where(.auth-page) a { color: inherit; text-decoration: none; }
:where(.auth-page)::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, color-mix(in srgb, var(--yail-shadow) 4%, transparent) 50%, transparent 50%),
    radial-gradient(1px 1px at 70% 60%, color-mix(in srgb, var(--yail-shadow) 3%, transparent) 50%, transparent 50%),
    radial-gradient(1px 1px at 40% 80%, color-mix(in srgb, var(--yail-shadow) 4%, transparent) 50%, transparent 50%);
  background-size: 220px 220px, 180px 180px, 260px 260px;
  opacity: .9;
}

/* An organisation's customer portal sign-in (body.org-brand, set when the page wears anything of the
   organisation's): YAIL's own warmth (the cream page and fills, stone borders, coffee and amber text) is YAIL's
   brand, so those roles are re-derived from the page's text and surface colours as plain greys, in light and in
   dark. No colour is written here, only mixes of two roles; the organisation's own colours sit on top
   (_AuthBrandStyle). The membership module's customer pages carry the same seven lines (its site.css, body.customer). */
body.org-brand {
  background: var(--yail-surface);
  --yail-fill-subtle: color-mix(in srgb, var(--yail-text) 5%, var(--yail-surface));
  --yail-fill-neutral: color-mix(in srgb, var(--yail-text) 9%, var(--yail-surface));
  --yail-border: color-mix(in srgb, var(--yail-text) 16%, var(--yail-surface));
  --yail-border-strong: color-mix(in srgb, var(--yail-text) 55%, var(--yail-surface));
  --yail-text-strong: var(--yail-text);
  --yail-text-muted: color-mix(in srgb, var(--yail-text) 62%, var(--yail-surface));
  --yail-accent: var(--yail-text-muted);
}
body.org-brand .field input[type="email"], body.org-brand .field input[type="password"], body.org-brand .field input[type="text"] { background: var(--yail-surface); }

.brand-row { display: inline-flex; align-items: center; gap: 12px; }
.brand-row img { width: 32px; height: 32px; }
/* An organisation's own logo on its customer portal's sign-in (_AuthBrandLogo): a wordmark at its own proportions.
   With two logos, the one for light backgrounds by default and the other where the page is dark; which logo shows
   is not a colour, so it follows the theme here, by the tokens' own two dark selectors. */
.brand-row.is-wordmark img { width: auto; height: 64px; max-width: min(340px, 70vw); }
.brand-row.is-wordmark .brand-logo--on-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-yail-theme="light"]) .brand-row.is-wordmark .brand-logo--on-light { display: none; }
  :root:not([data-yail-theme="light"]) .brand-row.is-wordmark .brand-logo--on-dark { display: block; }
}
:root[data-yail-theme="dark"] .brand-row.is-wordmark .brand-logo--on-light { display: none; }
:root[data-yail-theme="dark"] .brand-row.is-wordmark .brand-logo--on-dark { display: block; }
.brand-row .lbl { font-weight: 600; font-size: 16px; color: var(--yail-text); letter-spacing: -.01em; }
.brand-row .lbl .os { color: var(--yail-accent); }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--yail-text-muted); font-weight: 600; margin-bottom: 8px; }
.field input[type="email"], .field input[type="password"], .field input[type="text"] {
  width: 100%; padding: 14px 16px;
  border: 1px solid var(--yail-border);
  border-radius: 12px;
  font: inherit; font-size: 15px;
  background: var(--yail-fill-subtle);
  color: var(--yail-text);
}
:where(.auth-page) .field input[type="email"], :where(.auth-page) .field input[type="password"], :where(.auth-page) .field input[type="text"] {
  transition: border-color .2s, background .2s;
}
/* 16px on a phone or tablet: iOS Safari zooms the page in when a field under 16px takes focus, and leaves
   it zoomed. The same rule as the shell's fields (yail-app-shell.css); these pages don't load that file. */
@media (max-width: 767.98px), (pointer: coarse) {
  .field input[type="email"], .field input[type="password"], .field input[type="text"] { font-size: 16px; }
}
.field input:focus { outline: none; border-color: var(--yail-border-strong); background: var(--yail-surface); box-shadow: 0 0 0 4px var(--yail-focus); }
:where(.auth-page) .field input::placeholder { color: var(--yail-text-faint); }

.btn-block { align-items: center; justify-content: center; gap: 10px; border-radius: 12px; font-size: 14px; font-weight: 500; border: 1px solid transparent; }
:where(.auth-page) .btn-block { display: flex; width: 100%; padding: 14px 20px; cursor: pointer; transition: background .15s, border-color .15s, transform .15s; }
:where(.auth-page) .btn-block:hover:not(:disabled) { transform: translateY(-1px); }
:where(.auth-page) .btn-block:disabled { opacity: .5; cursor: not-allowed; }
.btn-coffee { background: var(--yail-inverse); color: var(--yail-text-on-inverse); }
.btn-coffee:hover:not(:disabled) { background: var(--yail-inverse-hover); }
.btn-outline { background: var(--yail-surface); color: var(--yail-text-strong); border-color: var(--yail-border); }
.btn-outline:hover:not(:disabled) { border-color: var(--yail-border-strong); }

.auth-error { background: var(--yail-danger-tint); border: 1px solid var(--yail-danger-border); color: var(--yail-danger); padding: 12px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 18px; line-height: 1.45; }
.auth-error ul, .auth-error li { list-style: none; margin: 0; padding: 0; }
.field-error { display: block; color: var(--yail-danger); font-size: 12px; margin-top: 6px; }

.auth-foot a { color: var(--yail-text-strong); font-weight: 500; }
.auth-foot a:hover { text-decoration: underline; }
.auth-meta a:hover { color: var(--yail-text-strong); }
