@import url("./design-system.css");

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body,
button,
input {
  font-family: var(--font-ui);
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.login-page {
  min-height: 100dvh;
}

.auth-shell {
  position: relative;
  display: grid;
  min-height: 100dvh;
  grid-template-columns: minmax(0, 1.15fr) minmax(380px, 0.85fr);
  overflow: hidden;
  background: var(--bg-main);
}

.auth-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent 49.9%,
    var(--panel-border) 50%,
    var(--panel-border) calc(50% + 1px),
    transparent calc(50% + 1px)
  );
  opacity: 0.55;
}

.login-brand {
  position: absolute;
  z-index: 1;
  top: 28px;
  right: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-brand-mark {
  width: 35px;
  height: 28px;
  flex: none;
}

.hub-link {
  position: absolute;
  z-index: 2;
  top: 26px;
  left: 38px;
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 9px;
  padding: 7px 10px 7px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  color: var(--text-muted);
  font: 600 11px var(--font-mono);
  letter-spacing: 0.04em;
  transition: border-color var(--transition), color var(--transition), transform 0.12s ease;
}

.hub-link svg {
  width: 16px;
  height: 16px;
  transition: transform 0.18s ease;
}

.hub-link:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.hub-link:hover svg {
  transform: translateX(2px);
}

.hub-link:active {
  transform: scale(0.97);
}

.auth-intro {
  align-self: end;
  max-width: 720px;
  padding: 72px clamp(40px, 7vw, 112px) 11vh;
}

.auth-eyebrow {
  display: block;
  color: var(--primary);
  font: 500 10px var(--font-mono);
  letter-spacing: 0.16em;
}

.auth-intro h1 {
  font-family: var(--font-display);
  max-width: 460px;
  margin: 18px 0 22px;
  font-size: clamp(44px, 5.2vw, 76px);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.auth-intro h1 span {
  display: block;
  width: 520px;
  color: var(--primary);
}

.auth-intro p {
  max-width: 46ch;
  margin: 0;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.65;
}

.auth-stage {
  z-index: 1;
  align-self: start;
  width: min(400px, calc(100% - 64px));
  max-height: calc(50dvh + 230px);
  margin-top: max(72px, calc(50dvh - 230px));
  margin-inline: auto;
  padding: 40px 0;
  overflow-y: auto;
}

.auth-center {
  display: grid;
  gap: 24px;
}

.auth-header h1,
.auth-header h2 {
  font-family: var(--font-display);
  margin: 12px 0 6px;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.auth-brand {
  width: 40px;
  height: 32px;
  color: var(--text);
}

.auth-brand svg {
  display: block;
  width: 100%;
  height: 100%;
}

.auth-back {
  position: absolute;
  top: 24px;
  left: 28px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  transition: color var(--transition), transform 0.12s ease;
}

.auth-back:hover {
  color: var(--primary);
  transform: translateX(-1px);
}

.auth-back-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--panel-border);
  border-radius: 5px;
}

.auth-back-icon svg {
  width: 14px;
  height: 14px;
}

.auth-standalone .auth-shell {
  grid-template-columns: 1fr;
  place-items: center;
  padding: 72px 20px 32px;
}

.auth-standalone .auth-shell::before {
  display: none;
}

.auth-standalone .auth-stage {
  position: relative;
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
}

.auth-standalone .auth-center {
  padding-top: 40px;
}

.auth-header p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.55;
}

.auth-error,
.auth-note {
  padding: 13px 14px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel-3);
  font-size: 12px;
  line-height: 1.55;
}

.auth-error {
  border-color: var(--btn-danger-border);
  background: var(--red-soft);
  color: var(--btn-danger-color);
}

.auth-note strong,
.auth-note span {
  display: block;
}

.auth-note strong {
  margin-bottom: 5px;
}

.auth-note span {
  color: var(--text-muted);
}

.auth-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 500;
}

.field input {
  width: 100%;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--input-border);
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  line-height: 20px;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.field input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.field input:hover {
  border-color: var(--input-border-hover);
}

.field input:focus {
  border-color: var(--input-border-focus);
  box-shadow: var(--input-focus-ring);
}

.btn-primary {
  min-height: 40px;
  margin-top: 2px;
  padding: 9px 16px;
  border: 1px solid rgba(34, 211, 238, 0.34);
  border-radius: 7px;
  background: var(--primary-soft);
  color: #67e3f4;
  font-size: 13px;
  font-weight: 600;
  transition: background var(--transition), border-color var(--transition), transform 0.12s ease;
}

.btn-primary:hover {
  background: var(--primary-soft-strong);
  border-color: var(--primary);
  color: var(--text-strong);
}

.btn-primary:active {
  transform: translateY(1px);
}

.magic-link {
  justify-self: start;
  color: var(--text-muted);
  font-size: 12px;
  transition: color var(--transition);
}

.magic-link:hover {
  color: var(--primary);
}

.remember {
  padding-top: 2px;
  border-top: 1px solid var(--panel-border);
}

.remember p,
.auth-footer p {
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.65;
}

.auth-footer {
  display: grid;
  gap: 6px;
}

.auth-footer a {
  color: var(--text-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-footer a:hover {
  color: var(--primary);
}

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

@media (max-width: 900px) {
  .auth-shell {
    grid-template-columns: 1fr;
    align-content: start;
    padding: 100px 24px 40px;
    overflow: auto;
  }

  .auth-shell::before,
  .auth-intro {
    display: none;
  }

  .login-brand {
    top: 26px;
    right: 24px;
  }

  .hub-link {
    top: 23px;
    left: 24px;
  }

  .auth-stage {
    align-self: start;
    width: min(400px, 100%);
    max-height: none;
    margin-top: max(0px, calc((100dvh - 540px) / 2));
    padding: 0;
    overflow: visible;
  }
}

@media (max-width: 520px) {
  .auth-shell {
    padding: 88px 16px 32px;
  }

  .auth-stage {
    margin-top: max(0px, calc((100dvh - 520px) / 2));
  }

  .login-brand {
    right: 16px;
  }

  .hub-link {
    left: 16px;
  }

  .auth-center {
    gap: 18px;
  }

  .auth-header h2 {
    font-size: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
