* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Dark, cinematic surface. The alyra wordmark is monochrome, so colour is
     spent only on the accent — focus rings and the primary action. */
  --bg: #08080a;
  --bg-2: #0d0d11;
  --surface: rgba(255, 255, 255, 0.032);
  --surface-2: rgba(255, 255, 255, 0.055);
  --line: rgba(255, 255, 255, 0.085);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f3f2ef;
  --muted: #93949a;
  --muted-dim: #63646b;
  --accent: #5b93ff;
  --accent-2: #2f6ff0;
  --danger: #ff8b80;

  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html, body { height: 100%; }

body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.page {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ============ left: brand panel ============ */
.brand-pane {
  position: relative;
  overflow: hidden;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 52px 56px;
  isolation: isolate;
}

/* Slow-drifting aurora. Two blurred radial blooms; cheap enough to composite
   on the GPU and subtle enough that it never competes with the headline. */
.aurora {
  position: absolute;
  inset: -30%;
  z-index: -1;
  background:
    radial-gradient(38% 42% at 22% 26%, rgba(91, 147, 255, 0.20), transparent 70%),
    radial-gradient(34% 38% at 78% 68%, rgba(150, 110, 255, 0.14), transparent 70%),
    radial-gradient(30% 34% at 62% 18%, rgba(70, 200, 220, 0.09), transparent 70%);
  filter: blur(28px);
  animation: drift 26s var(--ease) infinite alternate;
}

@keyframes drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(2.5%, -3%, 0) scale(1.07); }
  100% { transform: translate3d(-2%, 2.5%, 0) scale(1.03); }
}

/* Fine grain over the gradient so it reads as film, not as a CSS blur. */
.brand-pane::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.22'/%3E%3C/svg%3E");
}

.brand-logo { width: 132px; height: auto; display: block; }

/* Widths are in rem, not ch: `ch` resolves against the element's *own*
   font-size, so a ch cap on this wrapper would size off the 15px body text and
   crush the 44px headline into a narrow column. */
.brand-copy { max-width: 34rem; }

.brand-copy h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(30px, 3.1vw, 44px);
  line-height: 1.16;
  letter-spacing: -0.015em;
  margin-bottom: 18px;
}

.brand-copy p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
  max-width: 30rem;
}

.brand-points {
  list-style: none;
  margin-top: 34px;
  max-width: 30rem;
}

.brand-points li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  color: #c9c9c6;
  font-size: 13.5px;
  letter-spacing: 0.005em;
}
.brand-points li:last-child { border-bottom: 1px solid var(--line); }

.brand-points svg {
  width: 15px;
  height: 15px;
  flex: none;
  stroke: var(--accent);
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-foot {
  color: var(--muted-dim);
  font-size: 12.5px;
  letter-spacing: 0.02em;
}

/* ============ right: form ============ */
.form-pane {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background:
    radial-gradient(80% 60% at 50% 0%, rgba(255, 255, 255, 0.028), transparent 70%),
    var(--bg);
}

.auth-form {
  width: 100%;
  max-width: 384px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 38px 34px 30px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 24px 60px -24px rgba(0, 0, 0, 0.75);
  animation: rise 0.5s var(--ease) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.form-logo { display: none; width: 116px; margin: 0 auto 26px; }

h1 {
  font-family: var(--serif);
  font-size: 29px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 7px;
}

.subtitle {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 26px;
}

/* ---- floating-label fields ---- */
.field { position: relative; margin-bottom: 14px; }

.field input {
  width: 100%;
  height: 54px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.022);
  border-radius: 11px;
  padding: 20px 14px 6px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

/* Explicit class rather than :has(.pw-toggle) — one less baseline
   requirement, and without it the value would run under the toggle. */
.field-pw input { padding-right: 46px; }

.field label {
  position: absolute;
  left: 15px;
  top: 17px;
  font-size: 15px;
  color: var(--muted);
  pointer-events: none;
  transform-origin: 0 0;
  transition: transform 0.18s var(--ease), color 0.18s var(--ease);
}

/* Float the label when the field has content or focus. :-webkit-autofill is
   listed too — Chrome fills the value without ever un-setting
   :placeholder-shown, which would otherwise leave the label overlapping. */
.field input:focus + label,
.field input:not(:placeholder-shown) + label,
.field input:-webkit-autofill + label {
  transform: translateY(-10px) scale(0.75);
  color: var(--muted-dim);
}

.field input:focus {
  border-color: rgba(91, 147, 255, 0.55);
  background: rgba(255, 255, 255, 0.045);
  box-shadow: 0 0 0 3px rgba(91, 147, 255, 0.14);
}
.field input:focus + label { color: var(--accent); }

/* Chrome paints autofilled inputs opaque white — unreadable on this surface.
   The inset shadow is the only way to repaint the background. */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px #15151b inset;
  caret-color: var(--text);
}

.pw-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.15s, background 0.15s;
}
.pw-toggle:hover { color: var(--text); background: var(--surface-2); }
.pw-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pw-toggle .icon-off { display: none; }
.pw-toggle[aria-pressed="true"] .icon-on { display: none; }
.pw-toggle[aria-pressed="true"] .icon-off { display: block; }

.row-utility {
  display: flex;
  justify-content: flex-end;
  margin: 2px 0 22px;
}

.forgot-link, .signup-link {
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
  border-radius: 4px;
  transition: color 0.15s;
}
.forgot-link:hover, .signup-link:hover { color: #8fb4ff; text-decoration: underline; }

/* ---- primary action ---- */
.btn-signin {
  position: relative;
  width: 100%;
  height: 50px;
  border: none;
  border-radius: 11px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.005em;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 8px 22px -10px rgba(47, 111, 240, 0.9);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), filter 0.18s var(--ease);
}

.btn-signin:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.07);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 12px 28px -10px rgba(47, 111, 240, 1);
}
.btn-signin:active:not(:disabled) { transform: translateY(0); filter: brightness(0.96); }

/* auth.js disables the button for the duration of the request — that is the
   only signal available, so the busy state hangs off :disabled. */
.btn-signin:disabled { cursor: default; filter: saturate(0.75) brightness(0.9); }
.btn-signin:disabled .btn-label { opacity: 0; }
.btn-signin .spinner { display: none; }
.btn-signin:disabled .spinner {
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.signup-row {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
}
.signup-row .signup-link { font-size: 13.5px; }

/* auth.js sets display:block on this element, so its layout must work as a
   block — no flex here, or the inline style would fight the stylesheet. */
.error-msg {
  display: none;
  background: rgba(255, 107, 92, 0.10);
  color: var(--danger);
  border: 1px solid rgba(255, 107, 92, 0.28);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 18px;
  animation: rise 0.28s var(--ease) both;
}

/* ---- focus visibility ---- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.field input:focus-visible { outline: none; }

/* ============ responsive ============ */
@media (max-width: 940px) {
  .page { grid-template-columns: 1fr; }
  .brand-pane { display: none; }
  .form-logo { display: block; }
  .form-pane { padding: 32px 20px; }
}

@media (max-width: 420px) {
  .auth-form { padding: 30px 22px 24px; border-radius: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .aurora { animation: none; }
  .auth-form, .error-msg { animation: none; }
  .btn-signin:hover:not(:disabled) { transform: none; }
  * { transition-duration: 0.01ms !important; }
}
