/* The auth pages (Twig) take everything from design/tokens.css and design/components.css. This file holds what belongs
   to neither: the page owns the viewport, and the two-panel frame of layout/auth.html.twig (form left 38 %, decorative
   preview right 62 %). Colours, spacing, radii and type come from tokens only. */
body {
  margin: 0;
  background: var(--bg);
}

/* ---- Frame ---------------------------------------------------------------------------------------------------- */
.vc-shell.auth-split {
  min-height: 100vh;
  grid-template-columns: 38fr 62fr;
  grid-template-rows: minmax(0, 1fr);
}

.auth-form {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  background: var(--bg);
}

/* The bar and the footer of components.css are full-width strips with a line; here they are plain rows of the panel. */
.auth-form .vc-shell__bar,
.auth-form .vc-shell__foot {
  background: none;
  border: 0;
}

.auth-form .vc-shell__inner {
  max-width: none;
  padding-inline: var(--space-7);
}

.auth-form .vc-shell__bar .vc-shell__inner {
  min-height: var(--space-9);
}

/* The form block is narrow because the preview stands beside it; the panel around it uses the full width. */
.auth-form .vc-shell__body > .vc-shell__inner {
  display: grid;
  align-items: center;
}

.auth-form .vc-gate {
  max-width: 25rem;
  margin: var(--space-5) auto;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
}

.auth-form .vc-shell__foot .vc-shell__inner {
  min-height: var(--space-8);
}

/* The panel is narrow at every window width, so the links never fit beside the name: the spacer always breaks the row
   (components.css does it under 560 px) and the links stay together on a row of their own. */
.auth-form .vc-shell__foot .vc-shell__sp {
  flex-basis: 100%;
  height: 0;
}

/* The operator's identification: the last row of the footer, in the footer's own type and colour. */
.auth-operator {
  flex-basis: 100%;
  margin: 0;
  text-wrap: pretty;
  overflow-wrap: anywhere;
}

.auth-heading {
  display: grid;
  gap: var(--space-1);
}

.auth-heading .vc-gate__text {
  font: var(--type-body);
}

/* ---- Form pieces ------------------------------------------------------------------------------------------------- */
.auth-field-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.auth-input {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input .vc-input {
  height: 44px;
  padding-inline: var(--space-7) var(--space-7);
}

/* A field of a gate form without the icon wrapper (the welcome page's two password fields): the same 44px target. */
.auth-form .vc-gate .vc-input {
  height: 44px;
}

.auth-input__icon {
  position: absolute;
  inset-inline-start: var(--space-3);
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  pointer-events: none;
}

.auth-input__toggle {
  position: absolute;
  inset-inline-end: var(--space-1);
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}

.auth-input__toggle[hidden] {
  display: none;
}

.auth-input__toggle:hover {
  background: var(--surface-raised);
  color: var(--text);
}

.auth-input__toggle svg {
  width: 20px;
  height: 20px;
}

.auth-input__toggle .auth-input__eye-off,
.auth-input__toggle[aria-pressed="true"] .auth-input__eye {
  display: none;
}

.auth-input__toggle[aria-pressed="true"] .auth-input__eye-off {
  display: block;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
  font: var(--type-body-sm);
  color: var(--text-muted);
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-social {
  display: grid;
  gap: var(--space-3);
}

/* Sign in with Apple. Apple's guidelines allow only a black or a white button with the logo and the title in the other
   colour: white on the dark themes, black on the light one (tokens apple-button-bg / apple-button-fg, used nowhere
   else). Same size and shape as the GitHub and Google buttons. */
.auth-apple {
  background: var(--apple-button-bg);
  border-color: var(--apple-button-bg);
  color: var(--apple-button-fg);
}

.auth-apple:hover {
  background: var(--apple-button-bg);
  opacity: 0.88;
}

.auth-switch {
  font: var(--type-body-sm);
  text-align: center;
}

/* The legal line under the provider buttons: small and muted, its links in the size of the line. */
.auth-legal {
  margin: 0;
  font: var(--type-meta);
  color: var(--text-muted);
  text-wrap: pretty;
}

.auth-legal .vc-link,
.auth-form .vc-field__hint .vc-link {
  font: inherit;
}

/* The local demo account line under Log in (dev only). */
.auth-demo {
  margin: 0;
  font: var(--type-body-sm);
  color: var(--text-muted);
  text-align: center;
}

/* ---- Preview panel --------------------------------------------------------------------------------------------- */
.auth-preview {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: var(--space-6);
  min-width: 0;
  padding: var(--space-8) var(--space-7) var(--space-7);
  overflow: hidden;
  background: var(--brand-tint);
  color: var(--text);
  user-select: none;
}

.auth-preview__intro {
  display: grid;
  gap: var(--space-3);
}

.auth-preview__headline {
  margin: 0;
  font: var(--type-display);
  letter-spacing: -0.02em;
}

.auth-preview__lede {
  margin: 0;
  font: var(--type-body-lg);
  color: var(--text);
}

/* The stage holds the tilted corral and the floating cards; the corral takes the whole width of the panel. */
.auth-preview__stage {
  position: relative;
  align-self: center;
  /* Room above and below for the floating cards, so they overlap the edge of the corral and never its text. */
  padding: var(--space-7) 0;
}

.auth-preview__corral {
  --corral: var(--group-1);
  --corral-on: var(--on-group-1);
  background: var(--bg);
  box-shadow: var(--shadow-card);
  transform: rotate(-2deg);
}

.auth-preview__agents {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  padding: var(--space-1);
}

.auth-preview .vc-agent {
  box-shadow: none;
}

.auth-stat {
  position: absolute;
  gap: var(--space-1);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}

.auth-stat p {
  margin: 0;
}

.auth-stat__text {
  max-width: 18rem;
  font: var(--type-body-sm);
  color: var(--text);
}

.auth-stat--agents {
  top: 0;
  right: 0;
}

.auth-stat--local {
  bottom: 0;
  left: var(--space-5);
}

.auth-stat--corrals {
  bottom: 0;
  right: var(--space-7);
}

/* ---- Narrower windows ------------------------------------------------------------------------------------------ */
@media (max-width: 1200px) {
  .auth-preview {
    padding: var(--space-7) var(--space-5) var(--space-5);
  }

  .auth-preview__headline {
    font: var(--type-h1);
  }

  .auth-preview__agents {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Under 900 px only the form panel is shown, at full width. */
@media (max-width: 900px) {
  .vc-shell.auth-split {
    grid-template-columns: minmax(0, 1fr);
  }

  .auth-preview {
    display: none;
  }

  .auth-form .vc-shell__inner {
    padding-inline: var(--space-5);
  }

  .auth-form .vc-shell__bar .vc-shell__inner {
    min-height: var(--space-8);
  }
}

/* ---- Honeypot of the sign-up form ------------------------------------------------------------------------------- */
/* A field no person should fill in (templates/registration/register.html.twig). It stays in the page for the scripts
   that fill every field, so it is moved out of sight instead of display: none; no token covers these values. */
.vc-hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
