/* Auth pages (login, register) */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; }

body {
  background: radial-gradient(900px 480px at 50% -10%, rgba(107,159,232,0.09), transparent 70%), var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  opacity: 0.035;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.auth-shell {
  position: relative; z-index: 1;
  width: 100%;
  display: grid;
  justify-items: center;
}

/* Brand panel (desktop only) */
.brand { display: none; }

.eq { display: inline-flex; align-items: center; justify-content: center; gap: 10%; }
.eq i {
  display: block; width: 16%; height: 100%;
  background: var(--accent); border-radius: 999px;
  transform-origin: center;
  transform: scaleY(0.6);
  animation: eq-breathe 2.4s var(--ease-inout) infinite;
}
.eq i:nth-child(2) { animation-delay: -0.6s; }
.eq i:nth-child(3) { animation-delay: -1.2s; }
.eq i:nth-child(4) { animation-delay: -1.8s; }
.auth-shell:has(form.is-loading) .eq i { animation-duration: 1.2s; }
@keyframes eq-breathe {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}

.card-mark { display: flex; justify-content: center; margin-bottom: 8px; }
.card-mark .eq { width: 48px; height: 48px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-3), var(--highlight);
  display: flex; flex-direction: column; align-items: stretch; gap: 8px;
  animation: card-in 360ms var(--ease) both;
}
@keyframes card-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.card.shake { animation: shake 320ms var(--ease-inout); }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(3px); }
}

h1 {
  font-size: var(--fs-xl); font-weight: 600; letter-spacing: var(--tracking-tight); line-height: 1.3;
  text-align: center; text-wrap: balance;
}

.subtitle {
  font-size: 13.5px; color: var(--text-2); margin-bottom: 16px; line-height: 1.5;
  text-align: center; text-wrap: pretty;
}

.form-wrap { width: 100%; display: flex; flex-direction: column; gap: 14px; }

.field-row {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  animation: field-in var(--dur-3) var(--ease) both;
}
.form-wrap > :nth-child(1) { animation-delay: 80ms; }
.form-wrap > :nth-child(2) { animation-delay: 120ms; }
.form-wrap > :nth-child(3) { animation-delay: 160ms; }
.form-wrap > :nth-child(4) { animation-delay: 200ms; }
@keyframes field-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }

.input-wrap { position: relative; display: block; }

input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-family: inherit;
  height: 44px; padding: 0 12px; font-size: var(--fs-base); outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease);
  width: 100%; display: block;
}
.input-wrap input { padding-right: 44px; }

input::placeholder { color: var(--muted); opacity: 0.8; }
input:hover { border-color: var(--border-strong); }
input:focus { border-color: var(--accent); box-shadow: var(--ring); }
input[aria-invalid="true"],
input[aria-invalid="true"]:hover { border-color: var(--danger); }
input[aria-invalid="true"]:focus { border-color: var(--danger); box-shadow: var(--ring-danger); }

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--surface2) inset;
  box-shadow: 0 0 0 1000px var(--surface2) inset;
  transition: background-color 9999s ease-out;
}

.pw-toggle {
  position: absolute; top: 0; right: 0;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: none; border: none; border-radius: var(--radius);
  color: var(--muted); cursor: pointer;
  transition: color var(--dur) var(--ease);
}
.pw-toggle:hover { color: var(--text); }
.pw-toggle svg { width: 18px; height: 18px; display: block; }
.pw-toggle .eye-off { display: none; }
.pw-toggle[aria-pressed="true"] .eye { display: none; }
.pw-toggle[aria-pressed="true"] .eye-off { display: block; }

.error-msg {
  display: none;
  font-size: 12.5px; padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--danger-soft); color: var(--danger);
  border: 1px solid var(--danger-line);
  line-height: 1.5;
}
.error-msg.visible { display: block; animation: banner-in 180ms var(--ease) both; }
@keyframes banner-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.caps-hint, .hint {
  font-size: var(--fs-sm); line-height: 1.4; color: var(--text-2);
}
.caps-hint { color: var(--warn); display: flex; align-items: center; gap: 6px; }
.caps-hint[hidden], .hint[hidden] { display: none; }
.hint { display: flex; align-items: center; gap: 6px; }
.hint::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--border-strong); flex: none;
  transition: background-color var(--dur) var(--ease);
}
.hint.ok { color: var(--success); }
.hint.ok::before { background: var(--success); }

.banner {
  font-size: 13px; line-height: 1.5; padding: 10px 12px;
  border-radius: var(--radius); border: 1px solid;
}
.banner[hidden] { display: none; }
.banner:not([hidden]) { animation: banner-in 180ms var(--ease) both; }
#form-error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
#form-info { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }

#btn-submit {
  background: var(--accent);
  color: var(--accent-ink); border: none; border-radius: var(--radius);
  height: 44px; padding: 0 12px; font-family: inherit; font-size: var(--fs-base); font-weight: 600;
  cursor: pointer; width: 100%; margin-top: 4px;
  transition: background-color var(--dur) var(--ease), transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
#btn-submit:hover:not(:disabled) { background: var(--accent-hover); }
#btn-submit:active:not(:disabled) { transform: translateY(1px); }
#btn-submit:disabled { opacity: 0.6; cursor: not-allowed; }
#btn-submit { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 100%; }
#btn-submit.is-loading { cursor: progress; }
#btn-submit.is-loading::after {
  content: ''; flex: none;
  width: 16px; height: 16px;
  border: 2px solid rgba(26,18,6,0.3); border-top-color: var(--accent-ink);
  border-radius: 50%; animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.footer-text { font-size: 13px; text-align: center; margin-top: 14px; color: var(--text-2); }
.footer-text a {
  color: var(--text); font-weight: 500;
  text-decoration: underline; text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--dur) var(--ease);
}
.footer-text a:hover { text-decoration-color: var(--accent); }

@media (max-width: 768px) {
  input { font-size: 16px; }
  .card { padding: 28px 24px; }
}

@media (min-width: 960px) {
  body { padding: 0; }
  .auth-shell {
    min-height: 100dvh;
    grid-template-columns: 5fr 4fr;
    justify-items: stretch;
    align-items: center;
  }
  .card-mark { display: none; }
  .card { justify-self: center; }
  .brand {
    display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
    gap: 28px; padding: 48px clamp(48px, 7vw, 120px);
    justify-self: end; width: 100%; max-width: 640px;
    animation: field-in 480ms var(--ease) both;
  }
  .brand .eq { width: 120px; height: 120px; justify-content: flex-start; }
  .wordmark { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: var(--tracking-tight); line-height: 1.1; }
  .values { list-style: none; display: flex; flex-direction: column; gap: 16px; }
  .values li { display: flex; align-items: center; gap: 12px; font-size: var(--fs-md); color: var(--text-2); }
  .values .ico {
    width: 32px; height: 32px; flex: none; display: grid; place-items: center;
    border-radius: var(--radius); background: var(--accent-soft); color: var(--accent);
    border: 1px solid var(--accent-line);
  }
  .values svg { width: 16px; height: 16px; display: block; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .eq i { transform: scaleY(0.65); }
  .eq i:nth-child(2) { transform: scaleY(0.9); }
  .eq i:nth-child(3) { transform: scaleY(0.5); }
  .eq i:nth-child(4) { transform: scaleY(0.78); }
  #btn-submit.is-loading::after { border-top-color: var(--accent-ink); border-right-color: var(--accent-ink); }
}
