/* Saywit log in + sign up pages. Depends on base.css and chat.css. */

.auth {
  display: grid;
  grid-template-columns: minmax(380px, 1fr) minmax(0, 1.12fr);
  min-height: 100vh;
  min-height: 100dvh;
}

/* ───────── Form panel ───────── */
.auth__panel { display: flex; flex-direction: column; min-width: 0; padding: 30px clamp(28px, 5vw, 72px) 26px; }
.auth__top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.auth__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  transition: color .2s var(--ease);
}
.auth__back:hover { color: var(--ink); }

.auth__form { width: 100%; max-width: 400px; margin: auto; padding: 56px 0; }
.auth__form h1 {
  margin: 0 0 14px;
  font-size: clamp(42px, 4.2vw, 60px);
  font-weight: 650;
  line-height: 1;
  letter-spacing: -.058em;
}
.auth__form h1:focus { outline: none; }
.auth__sub { margin: 0 0 36px; font-size: 17px; line-height: 1.5; color: var(--muted); }

.field { margin-bottom: 18px; }
.field > label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 650; }
.field__control { position: relative; }
.field input:not([type="checkbox"]) {
  width: 100%;
  min-height: 56px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  font-size: 16px;
  color: var(--ink);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease);
}
.field input::placeholder { color: var(--faint); }
.field input:not([type="checkbox"]):hover { border-color: #b7beb1; }
.field input:not([type="checkbox"]):focus { outline: none; border-color: var(--ink); background: #fff; box-shadow: 0 0 0 4px rgba(168, 190, 146, .95); }
.field input.has-toggle { padding-right: 84px; }
.field input[aria-invalid="true"], .field.has-error input:not([type="checkbox"]) { border-color: #a94a50; }
.field__toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  min-width: 64px;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  cursor: pointer;
  translate: 0 -50%;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.field__toggle:hover { background: var(--paper-2); color: var(--ink); }

.field-help { margin-top: 8px; font-size: 12.5px; line-height: 1.6; color: var(--muted); }
.field-help ul { margin: 6px 0 0; padding-left: 18px; }
.field-help li + li { margin-top: 2px; }

.password-guide { margin-top: 4px; }
.password-guide summary {
  width: fit-content;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}
.password-guide summary::-webkit-details-marker { display: none; }
.password-guide summary::before { content: "+"; width: 18px; height: 18px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; transition: transform .3s var(--ease); }
.password-guide[open] summary::before { content: "−"; }
.password-guide summary:hover { color: var(--ink); }
.password-guide .field-help { margin-top: 0; }

/* Custom checkbox, still a native input. */
.field--check { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line-soft); }
.field > .check { display: flex; align-items: flex-start; margin: 0; gap: 12px; min-height: 44px; font-size: 14px; font-weight: 600; line-height: 1.45; cursor: pointer; }
.check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  flex: none;
  display: grid;
  place-items: center;
  margin: 0;
  border: 1.5px solid #b7beb1;
  border-radius: 7px;
  background: var(--surface);
  cursor: pointer;
  transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.check input[type="checkbox"]::after {
  content: "";
  width: 5px;
  height: 10px;
  margin-top: -2px;
  border: solid var(--ink);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .3s var(--ease-spring);
}
.check input[type="checkbox"]:checked { border-color: var(--lime-strong); background: var(--lime); }
.check input[type="checkbox"]:checked::after { transform: rotate(45deg) scale(1); }
.check input[type="checkbox"]:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.field--check .field-help { margin: 2px 0 0 34px; }

.field-error, .form-error { font-size: 13px; line-height: 1.6; color: #91383f; }
.field-error ul, .form-error ul { margin: 0; padding: 0; list-style: none; }
.field-error { margin-top: 8px; }
.form-error { margin-bottom: 20px; padding: 12px 14px; border: 1px solid #eed6d3; border-radius: 14px; background: #fbefed; }

.auth__submit { margin-top: 10px; min-height: 58px; }
.auth__submit.is-loading { cursor: progress; }
.auth__submit.is-loading .btn__arrow { position: relative; color: transparent; transform: none; }
.auth__submit.is-loading .btn__arrow::after {
  content: "";
  position: absolute;
  inset: 11px;
  border: 2px solid rgba(35, 53, 47, .25);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.auth__note { margin: 18px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--muted); }

.auth__switch { margin: 22px 0 0; font-size: 14px; color: var(--muted); }
.auth__switch a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 650;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--lime-strong);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}
.auth__switch a:hover { text-decoration-color: var(--ink); }

.auth__foot { display: flex; justify-content: space-between; gap: 16px; font-size: 10px; color: var(--faint); }

.js .auth__form > * { opacity: 0; animation: auth-up .8s var(--ease) forwards; }
.js .auth__form > :nth-child(2) { animation-delay: .08s; }
.js .auth__form > :nth-child(3) { animation-delay: .16s; }
.js .auth__form > :nth-child(n + 4) { animation-delay: .24s; }

/* ───────── Stage ───────── */
.auth__stage {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 14px 14px 14px 0;
  padding: 30px clamp(28px, 4vw, 56px);
  border-radius: 36px;
  background: #e8ecdf;
  color: var(--ink);
}
.auth__stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(63, 95, 77, .1) 1px, transparent 1.5px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 60% 62%, #000, transparent);
  mask-image: radial-gradient(ellipse 70% 60% at 60% 62%, #000, transparent);
}
.auth__stage::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: -18%;
  bottom: -14%;
  width: 78%;
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(168, 190, 146, .26), rgba(168, 190, 146, 0) 64%);
  animation: float 10s ease-in-out infinite;
}

.auth__hud { display: flex; justify-content: space-between; gap: 16px; font-size: 10px; color: var(--faint); font-variant-numeric: tabular-nums; }
.auth__hud span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.auth__hud i { width: 6px; height: 6px; border-radius: 50%; background: var(--signal); animation: hud-blink 1.6s steps(1) infinite; }

.auth__headline { margin: 44px 0 0; font-size: clamp(36px, 3.7vw, 58px); font-weight: 650; line-height: 1.02; letter-spacing: -.052em; }

.auth__demo { flex: 1; display: grid; place-items: center; padding: 26px 0 24px; }
.chat--auth { max-width: 420px; animation: float 9s ease-in-out infinite; }
.chat--auth .chat__body { height: 400px; }
.chat--auth .msg__photo { width: 210px; }
.chat--tall .chat__body { height: 440px; }
.js .chat--auth { opacity: 0; animation: auth-up 1s var(--ease) .2s forwards, float 9s ease-in-out 1.2s infinite; }

.auth__facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.auth__facts li { padding: 8px 12px; border: 1px solid rgba(63, 95, 77, .2); border-radius: 999px; font-size: 10px; color: var(--ink); }

@keyframes auth-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes hud-blink { 50% { opacity: .25; } }

/* ───────── Responsive ───────── */
@media (max-width: 1080px) {
  .auth { grid-template-columns: minmax(360px, 1fr) minmax(0, 1fr); }
  .chat--auth .chat__body { height: 380px; }
  .chat--tall .chat__body { height: 430px; }
}

@media (max-width: 860px) {
  .auth { display: flex; flex-direction: column; }
  .auth__panel { padding: 22px 24px 28px; }
  .auth__form { margin: 0 auto; padding: 48px 0 40px; }
  .auth__foot { display: none; }
  .auth__stage { margin: 0 10px 10px; padding: 28px 22px 26px; border-radius: 30px; }
  .auth__headline { margin-top: 32px; }
  .auth__demo { padding: 28px 0; }
}

@media (max-width: 480px) {
  .auth__back { display: none; }
  .auth__form h1 { font-size: 42px; }
  .auth__sub { font-size: 16px; margin-bottom: 28px; }
}
