/* The way in (templates/auth_frame.html): sign-in, verification codes, password reset.

   A light window on a pale page; behind frosted glass, pale discs with strokes of
   colour on their rims overlap like waves. Left: one
   glass card with the form. Right: a framed stage with a clay Chicago in a glass cube
   and a Benmore helicopter (live 3D; a soft sphere until it loads). The form is the ui suite in its light palette; this file adds the window,
   the colour, the card, and taller fields and a wide black button for a way-in page.
   Nothing moves if the person has asked for less motion. */

html.auth-root {
  --auth-accent: #1d54e2;                 /* focus colour; a white-label organisation's colour replaces it */
  --auth-ink: #0b0b0f;
  --auth-edge: rgba(22, 22, 44, 0.13);
  --auth-gutter: clamp(14px, 1.6vw, 24px);  /* the one margin: window to stage, stage to its edges */
  --auth-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;   /* the code field */
  --ui-radius: 14px;
  color-scheme: light;
  background: #e3e5f0;
}
html.auth-root body.auth {
  min-height: 100vh; min-height: 100dvh; margin: 0; display: flex;
  padding: clamp(14px, 4.5vh, 56px) clamp(14px, 4.5vw, 80px);
  background: linear-gradient(180deg, #e9edf8 0%, #d6dcee 100%) !important; color: var(--auth-ink);
}

/* ── The window ────────────────────────────────────────────────────────────── */
.auth-window { position: relative; isolation: isolate; flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 560px; overflow: hidden; border-radius: 36px; background: #fdfbfb;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8) inset, 0 70px 120px -60px rgba(24, 60, 156, 0.45), 0 24px 50px -30px rgba(24, 60, 156, 0.22); }

/* Colour: large pale discs with a stroke of colour on their rims, overlapping like waves (drawn in the
   template as one SVG). The drawing never changes; the whole layer drifts a little, which costs nothing. */
.auth-aurora { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.auth-waves { position: absolute; left: -4%; top: -4%; width: 108%; height: 108%; will-change: transform;
  animation: auth-drift 24s ease-in-out infinite alternate; }
@keyframes auth-drift { from { transform: translate3d(-1.2%, 0.8%, 0) scale(1); } to { transform: translate3d(1.2%, -1%, 0) scale(1.035); } }

/* ── Left: the card ────────────────────────────────────────────────────────── */
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px var(--auth-gutter); min-width: 0; }
.auth-column { width: 100%; }
.auth-card { padding: 44px 46px 40px; border-radius: 30px; background: rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(30px) saturate(150%); backdrop-filter: blur(30px) saturate(150%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85) inset, 0 0 0 1px rgba(22, 22, 44, 0.06), 0 40px 70px -50px rgba(24, 60, 156, 0.4);
  opacity: 0; transform: translateY(10px); animation: auth-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.05s forwards; }
@keyframes auth-rise { to { opacity: 1; transform: none; } }

.auth-brand { display: flex; align-items: center; gap: 9px; margin-bottom: 30px; font-size: 16px; font-weight: 500; letter-spacing: -0.02em; color: var(--auth-ink); }
.auth-brand img { border-radius: 7px; }
.auth-brand .auth-logo-custom { height: 32px; max-width: 200px; object-fit: contain; border-radius: 0; }

.auth-card-head { margin-bottom: 26px; }
.auth-card .ui-title { font-size: 36px; font-weight: 500; letter-spacing: -0.04em; line-height: 1.08; color: var(--auth-ink); }
.auth-card .ui-subtitle { margin-top: 8px; font-size: 16px; line-height: 1.5; color: #62626d; }
.auth-card .ui-form { display: grid; gap: 18px; }
.auth-card .ui-field > label, .auth-card .ui-field-label { font-size: 14px; font-weight: 500; color: var(--auth-ink); }
.auth-card .ui-field > input:not([type='checkbox']):not([type='radio']), .auth-card .ui-field > select, .auth-card .ui-input {
  height: 54px; padding: 0 16px; font-size: 16px; color: var(--auth-ink); background: rgba(255, 255, 255, 0.72);
  border: 1.5px solid var(--auth-edge); border-radius: 14px; box-shadow: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease; }
.auth-card .ui-field > input:hover, .auth-card .ui-field > select:hover { border-color: rgba(22, 22, 44, 0.26); }
.auth-card .ui-field > input:focus, .auth-card .ui-field > select:focus, .auth-card .ui-input:focus {
  outline: none; background: #fff; border-color: var(--auth-ink); box-shadow: 0 0 0 4px rgba(11, 11, 15, 0.08); }
.auth-card input::placeholder { color: #9a9aa6; }

/* The six-digit code: one real field (so a texted code can autofill), set like a display. */
.auth-card .ui-field > input[data-code-input]:not([type='checkbox']):not([type='radio']) { height: 66px; padding: 0 0 0 0.5em; text-align: center;
  font: 500 28px/1 var(--auth-mono); letter-spacing: 0.5em; font-variant-numeric: tabular-nums; }
.auth-card input[data-code-input]::placeholder { letter-spacing: 0.5em; color: #c9c9d2; }

.auth-card .ui-btn { border-radius: 14px; }
.auth-card .ui-btn-primary { width: 100%; height: 56px !important; font-size: 16px; font-weight: 500; background: #060608; color: #fff; border: 0;
  box-shadow: 0 18px 30px -18px rgba(6, 6, 8, 0.7); transition: transform 0.12s ease, box-shadow 0.2s ease, background-color 0.15s ease; }
.auth-card .ui-btn-primary:hover { background: #1c1c22; box-shadow: 0 22px 34px -18px rgba(6, 6, 8, 0.8); }
.auth-card .ui-btn-primary:active { transform: translateY(1px) scale(0.995); }
.auth-card .ui-btn-primary .ui-spinner { border-color: rgba(255, 255, 255, 0.3); border-top-color: #fff; }
.auth-card .ui-btn-outline { width: 100%; height: 56px !important; font-size: 16px; background: rgba(255, 255, 255, 0.6); border: 1.5px solid var(--auth-edge); color: var(--auth-ink); }
.auth-card .ui-btn-outline:hover { background: #fff; border-color: rgba(22, 22, 44, 0.26); }
.auth-card .ui-btn:focus-visible, .auth-card a:focus-visible { outline: 2px solid var(--auth-accent); outline-offset: 3px; }
.auth-card .ui-link { color: var(--auth-ink); font-weight: 500; text-decoration: none; }
.auth-card .ui-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.auth-card .ui-notice { background: rgba(255, 255, 255, 0.7); border-color: var(--auth-edge); margin-bottom: 18px; }

.auth-under:empty { display: none; }
.auth-under { margin-top: 26px; }
.auth-under > p { margin: 0; }
.auth-under, .auth-under a { color: #7a7a86; }
.auth-under a:hover { color: var(--auth-ink); }

/* ── Right: the stage for the 3D model ─────────────────────────────────────── */
.auth-stage { position: relative; margin: var(--auth-gutter) var(--auth-gutter) var(--auth-gutter) 0; min-width: 0; overflow: hidden;
  border: 1.5px solid var(--auth-edge); border-radius: 26px; background: rgba(255, 255, 255, 0.14); }
.auth-model { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
/* The scene: a canvas filling the stage (portal-auth.js draws on it). */
.auth-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; animation: auth-arrive 0.8s ease both; }
@keyframes auth-arrive { from { opacity: 0; } to { opacity: 1; } }
/* What shows until the mark has loaded, or if it cannot: a soft sphere. */
.auth-orb { width: min(42%, 260px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #ffffff 0%, #eef2fd 14%, #a9c1ff 40%, #3f6fee 68%, #1d54e2 84%, #183c9c 100%);
  box-shadow: inset -22px -28px 60px rgba(14, 34, 110, 0.4), inset 14px 16px 40px rgba(255, 255, 255, 0.6), 0 30px 60px -30px rgba(29, 84, 226, 0.55);
  animation: auth-float 6s ease-in-out infinite alternate; }
.auth-model.has-mark .auth-orb, .auth-model.has-mark .auth-orb-shadow { display: none; }
.auth-orb-shadow { width: min(30%, 190px); height: 18px; margin-top: 30px; border-radius: 50%; background: rgba(24, 60, 156, 0.24); filter: blur(12px);
  animation: auth-shadow 6s ease-in-out infinite alternate; }
.auth-model-logo { max-width: 46%; max-height: 30%; object-fit: contain; }
@keyframes auth-float { from { transform: translateY(10px); } to { transform: translateY(-14px); } }
@keyframes auth-shadow { from { transform: scale(1.05); opacity: 1; } to { transform: scale(0.82); opacity: 0.6; } }

/* ── Smaller screens: the form alone ───────────────────────────────────────── */
@media (max-width: 980px) {
  .auth-window { grid-template-columns: minmax(0, 1fr); }
  .auth-stage { display: none; }
}
@media (max-width: 640px) {
  html.auth-root body.auth { padding: 0; }
  .auth-window { border-radius: 0; min-height: 100dvh; }
  .auth-main { padding: 20px 14px; }
  .auth-card { padding: 30px 22px 26px; border-radius: 24px; }
  .auth-card .ui-title { font-size: 31px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-waves, .auth-orb, .auth-canvas, .auth-orb-shadow, .auth-card { animation: none; }
  .auth-card { opacity: 1; transform: none; }
}
