/* Login — left: white field of floating letters; right: black sign-in pane. */

.login {
  height: 100svh;
  overflow: hidden;
  background: var(--paper);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(360px, 32vw, 460px);
  height: 100svh;
}

/* ---------- left ---------- */

.letters {
  position: relative;
  overflow: hidden;
  background: var(--paper);
}

#letters-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.letters-top {
  position: absolute;
  top: 30px;
  left: 40px;
  z-index: 2;
}

.letters-hint {
  position: absolute;
  left: 40px;
  bottom: 28px;
  margin: 0;
  z-index: 2;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
  pointer-events: none;
}

/* ---------- right ---------- */

.pane {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  color: var(--on-panel);
  padding: clamp(40px, 13vh, 128px) clamp(30px, 3.2vw, 54px) 30px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.pane::-webkit-scrollbar {
  width: 8px;
}

.pane::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 999px;
}

.pane::-webkit-scrollbar-track {
  background: transparent;
}

.pane h1 {
  margin: 0 0 16px;
  font-size: clamp(1.35rem, 1.55vw, 1.6rem);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.005em;
  max-width: 16em;
  text-wrap: balance;
}

.pane .hint {
  margin: 0 0 clamp(34px, 6vh, 54px);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--on-panel-muted);
  max-width: 32ch;
}

form {
  display: flex;
  flex-direction: column;
}

.field + .field {
  margin-top: 22px;
}

.field label {
  display: block;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--on-panel-muted);
}

.control {
  position: relative;
}

.field input {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  border: 1px solid var(--panel-line);
  border-radius: 6px;
  background: var(--panel-field);
  color: var(--on-panel);
  font-family: inherit;
  font-size: 15px;
  letter-spacing: 0.02em;
  transition:
    border-color 0.22s var(--ease),
    background 0.22s var(--ease);
}

.field input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.field input:hover {
  border-color: rgba(255, 255, 255, 0.32);
}

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

.field input:focus {
  outline: none;
  border-color: var(--on-panel);
  background: #191919;
}

.field input:focus-visible {
  outline: 2px solid var(--on-panel);
  outline-offset: 2px;
}

.control.with-toggle input {
  padding-right: 62px;
}

.reveal {
  position: absolute;
  top: 0;
  right: 6px;
  height: 50px;
  padding: 0 10px;
  border: 0;
  background: none;
  color: var(--on-panel-muted);
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 0.2s var(--ease);
}

.reveal:hover {
  color: var(--on-panel);
}

.error {
  margin: 16px 0 0;
  min-height: 18px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--danger);
}

form.invalid .field input {
  border-color: rgba(255, 138, 115, 0.55);
}

.submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 52px;
  margin-top: 6px;
  border: 0;
  border-radius: 999px;
  background: var(--on-panel);
  color: #0a0a0a;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition:
    transform 0.45s var(--ease),
    background 0.2s var(--ease),
    opacity 0.2s var(--ease);
}

.submit:hover:not(:disabled) {
  background: #ffffff;
  transform: translateY(-1px);
}

.submit:active:not(:disabled) {
  transform: translateY(0) scale(0.99);
}

.submit:disabled {
  cursor: default;
  opacity: 0.72;
}

.submit .spinner {
  width: 13px;
  height: 13px;
  border: 1.5px solid rgba(10, 10, 10, 0.25);
  border-top-color: #0a0a0a;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.submit.loading .spinner {
  display: block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.pane-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding-top: clamp(32px, 6vh, 56px);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(247, 247, 245, 0.52);
}

.pane-foot a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

.pane-foot a:hover {
  color: var(--on-panel);
}

/* pane content entrance */
.pane > * {
  animation: paneIn 0.9s var(--ease) both;
}

.pane > :nth-child(2) {
  animation-delay: 0.08s;
}
.pane > form {
  animation-delay: 0.14s;
}

@keyframes paneIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .login {
    height: auto;
    overflow: auto;
  }

  .split {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(220px, 38svh) auto;
    min-height: 100svh;
    height: auto;
  }

  .pane {
    padding: 40px 22px 28px;
    overflow: visible;
  }

  .letters-top {
    top: 20px;
    left: 22px;
  }

  .letters-hint {
    left: 22px;
    bottom: 16px;
    font-size: 11px;
    letter-spacing: 0.06em;
  }

  .pane h1 {
    font-size: 1.3rem;
  }

  /* 16px keeps iOS Safari from zooming the layout on focus. */
  .field input {
    font-size: 16px;
  }

  .letters-hint {
    max-width: 70%;
  }

  .pane .hint {
    margin-bottom: 30px;
  }
}

@media (max-height: 620px) and (min-width: 901px) {
  .pane {
    padding-top: 32px;
  }
  .pane h1 {
    font-size: 1.2rem;
  }
  .pane .hint {
    margin-bottom: 24px;
  }
}
