/*
 * Sign-in modal, /login and the username step (includes/auth-*.php).
 * Loaded on every page because the modal lives in the shared header; the
 * .auth2 prefix keeps it clear of the older .login-modal__* rules in style.css.
 */
.login-modal.auth2-modal {
  padding: clamp(8px, 3vw, 24px);
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(10px);
}

.login-modal.auth2-modal .login-modal__backdrop {
  background: transparent;
}

.login-modal.auth2-modal .auth2-dialog {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  width: min(100%, 860px);
  max-height: calc(100dvh - 16px);
  margin: 0;
  padding: 0 !important;
  overflow: auto;
  border: 1px solid var(--cp-line-strong) !important;
  border-radius: 28px !important;
  background: var(--cp-bg-soft, #0c0c0f) !important;
  box-shadow: 0 50px 140px -30px rgba(0, 0, 0, .9);
  animation: auth2-in .28s cubic-bezier(.2, .8, .2, 1);
}

.login-modal.auth2-modal .auth2-dialog > .auth2-close {
  position: absolute !important;
  z-index: 2;
  top: 14px !important;
  right: 14px !important;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--cp-line-strong);
  border-radius: 50%;
  color: var(--cp-text-2);
  background: rgba(255, 255, 255, .04);
  cursor: pointer;
}

.auth2-close svg,
.auth2-error svg,
.auth2-provider svg,
.auth2-perks svg,
.auth2-submit svg,
.auth2-identity small svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth2-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, .1);
}

/* ---------- Illustration ---------- */
.auth2-art {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  min-height: 100%;
  padding: 32px;
  overflow: hidden;
  border-right: 1px solid var(--cp-line);
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .07) 1px, transparent 0) 0 0 / 22px 22px,
    linear-gradient(160deg, #111114, #08080a);
}

.auth2-art__svg {
  width: min(100%, 360px);
  height: auto;
  overflow: visible;
}

.auth2-art__knob {
  animation: auth2-toggle 3.2s ease-in-out infinite;
}

.auth2-art__cursor {
  animation: auth2-cursor 3.2s ease-in-out infinite;
}

.auth2-art__glow {
  animation: auth2-pulse 3.2s ease-in-out infinite;
}

.auth2-art__tile--button {
  animation: auth2-press 3.2s ease-in-out infinite;
  transform-origin: 127px 115px;
}

.auth2-stat {
  margin: 0;
  color: var(--cp-muted);
  font-size: 14px;
  text-align: center;
}

.auth2-stat strong {
  color: var(--cp-text);
  font-family: var(--cp-font-display);
}

/* ---------- Copy and providers ---------- */
.auth2-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: clamp(28px, 4vw, 48px);
}

.auth2-kicker {
  align-self: flex-start;
  padding: 5px 10px;
  border: 1px solid color-mix(in srgb, var(--cp-accent) 35%, transparent);
  border-radius: 999px;
  color: var(--cp-accent);
  background: color-mix(in srgb, var(--cp-accent) 8%, transparent);
  font: 600 11px/1 var(--cp-font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.auth2-body h1,
.auth2-body h2 {
  margin: 0;
  color: #fff;
  font: 700 clamp(1.7rem, 3.2vw, 2.4rem)/1.08 var(--cp-font-display);
  letter-spacing: -.025em;
}

.auth2-lead {
  margin: 0;
  color: var(--cp-muted);
  font-size: 15px;
  line-height: 1.55;
}

.auth2-lead strong {
  color: var(--cp-text-2);
}

.auth2-error {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid rgba(255, 107, 107, .35);
  border-radius: 14px;
  color: #ffc2c2;
  background: rgba(255, 80, 80, .08);
  font-size: 14px;
}

.auth2-providers {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.auth2-provider {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  padding: 0 18px;
  border: 1px solid var(--cp-line-strong);
  border-radius: 16px;
  color: var(--cp-text);
  background: var(--cp-surface-2);
  font-weight: 600;
  text-decoration: none;
  transition: transform .15s ease, border-color .15s ease, background-color .15s ease;
}

.auth2-provider > span {
  flex: 1;
}

.auth2-provider > svg:first-child {
  width: 22px;
  height: 22px;
  fill: currentColor;
  stroke: none;
}

.auth2-provider--github {
  border-color: transparent;
  color: var(--cp-accent-ink);
  background: var(--cp-accent);
}

.auth2-provider:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, .28);
}

.auth2-provider--github:hover {
  color: var(--cp-accent-ink);
  background: color-mix(in srgb, var(--cp-accent) 88%, #fff);
}

.auth2-provider__arrow {
  transition: transform .15s ease;
}

.auth2-provider:hover .auth2-provider__arrow {
  transform: translateX(3px);
}

.auth2-unavailable {
  margin: 0;
  color: var(--cp-muted);
}

.auth2-perks {
  display: grid;
  gap: 8px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.auth2-perks li {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--cp-text-2);
  font-size: 14px;
}

.auth2-perks svg {
  color: var(--cp-accent);
}

.auth2-legal {
  margin: 4px 0 0;
  color: var(--cp-subtle);
  font-size: 12px;
  line-height: 1.5;
}

/* ---------- Full pages: /login and the username step ---------- */
.auth2-shell {
  display: grid;
  place-items: center;
  min-height: calc(100dvh - 160px);
  padding-top: clamp(24px, 6vw, 72px);
  padding-bottom: clamp(32px, 8vw, 96px);
}

.auth2-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  /* Fill the shared page width so the card's edges match the header. */
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--cp-line-strong);
  border-radius: 32px;
  background: var(--cp-bg-soft, #0c0c0f);
  box-shadow: 0 50px 140px -40px rgba(0, 0, 0, .9);
}

.auth2-identity {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--cp-line);
  border-radius: 18px;
  background: var(--cp-surface);
}

.auth2-identity img,
.auth2-identity > span {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  object-fit: cover;
  color: var(--cp-accent-ink);
  background: var(--cp-accent);
  font: 700 20px var(--cp-font-display);
}

.auth2-identity div {
  display: grid;
  min-width: 0;
}

.auth2-identity small {
  display: flex;
  gap: 5px;
  align-items: center;
  color: var(--cp-accent);
  font-size: 12px;
}

.auth2-identity small svg {
  width: 14px;
  height: 14px;
}

.auth2-identity strong {
  color: #fff;
}

.auth2-identity span {
  overflow: hidden;
  color: var(--cp-subtle);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth2-form {
  display: grid;
  gap: 16px;
  margin-top: 4px;
}

.auth2-field {
  display: grid;
  gap: 8px;
}

.auth2-field__label {
  color: var(--cp-text-2);
  font-size: 13px;
  font-weight: 600;
}

.auth2-field__control {
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: 0 16px;
  border: 1px solid var(--cp-line-strong);
  border-radius: 16px;
  background: var(--cp-surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.auth2-field__control:focus-within {
  border-color: var(--cp-accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--cp-accent) 18%, transparent);
}

.auth2-field__control b {
  color: var(--cp-subtle);
  font: 600 18px var(--cp-font-mono);
}

.auth2-field__control input {
  flex: 1;
  min-width: 0;
  padding: 0 0 0 6px;
  border: 0;
  outline: 0;
  color: #fff;
  background: transparent;
  font: 500 18px var(--cp-font-mono);
}

.auth2-field__status {
  min-height: 20px;
  color: var(--cp-subtle);
  font-size: 13px;
}

.auth2-field__status[data-state="ok"] {
  color: var(--cp-accent);
}

.auth2-field__status[data-state="error"] {
  color: #ff9f9f;
}

.auth2-submit {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  border: 0;
  border-radius: 16px;
  color: var(--cp-accent-ink);
  background: var(--cp-accent);
  font: 700 16px var(--cp-font);
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease;
}

.auth2-submit:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

/* ---------- Motion ---------- */
@keyframes auth2-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
}

@keyframes auth2-toggle {
  0%, 35% { transform: translateX(0); fill: #f4f4f5; }
  50%, 85% { transform: translateX(42px); fill: var(--cp-accent, #c6ff3d); }
  100% { transform: translateX(0); }
}

@keyframes auth2-cursor {
  0%, 100% { transform: translate(0, 0); }
  40% { transform: translate(-40px, -6px); }
  45% { transform: translate(-40px, -2px); }
  70% { transform: translate(60px, -20px); }
}

@keyframes auth2-press {
  40%, 46% { transform: scale(1); }
  43% { transform: scale(.96); }
}

@keyframes auth2-pulse {
  0%, 100% { opacity: .6; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .auth2-art *,
  .login-modal.auth2-modal .auth2-dialog {
    animation: none !important;
  }
}

/* ---------- Small screens: illustration on top, compact ---------- */
@media (max-width: 767.98px) {
  .login-modal.auth2-modal .auth2-dialog,
  .auth2-card {
    grid-template-columns: 1fr;
    border-radius: 24px !important;
  }

  .auth2-art {
    min-height: 0;
    padding: 18px 18px 0;
    border-right: 0;
    border-bottom: 1px solid var(--cp-line);
  }

  .auth2-art__svg {
    width: min(100%, 260px);
  }

  .login-modal.auth2-modal .auth2-art {
    display: none;
  }

  .auth2-body {
    padding: 24px 20px;
  }
}
