/* ==========================================================================
   Sign in / sign up modal on the home page.
   The markup and the module script are the live page's, unchanged (same ids,
   same classes, same fields). Only the look is new: the tokens of site.css,
   solid Pulse violet for actions, no gradient text.
   Loaded after site.css.
   ========================================================================== */

/* The nav and CTA triggers are buttons now (they open this modal); make them
   render exactly like the links they replace. */
button.bar__login { background: none; border: 0; cursor: pointer; font-size: inherit; }
button.btn { cursor: pointer; font-family: inherit; }
@media (max-width: 860px) {
  button.bar__login { border: 1px solid var(--line-strong); width: 100%; }
}

.modal {
  display: none;
  position: fixed; inset: 0;
  z-index: 10000;
  align-items: center; justify-content: center;
  padding: 16px;
  background: rgb(8 6 12 / .72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.modal.show { display: flex; }

.modal-content {
  position: relative;
  width: 100%; max-width: 500px;
  max-height: 90vh; max-height: 90dvh;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 2.75rem 2.5rem 2.5rem;
  background: var(--sc-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sc-e3, 0 24px 60px rgb(0 0 0 / .45));
  color: var(--sc-ink);
  font-family: var(--sc-font-text);
  line-height: 1.5;
}
@media (max-width: 480px) {
  .modal { padding: 10px; }
  .modal-content { padding: 3.5rem 1.25rem 1.5rem; }   /* room for the close button above the tabs */
}

.modal-close {
  position: absolute; top: .75rem; right: .75rem;
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: var(--r-sm);
  color: var(--sc-ink-soft); font-size: 1.5rem; line-height: 1; cursor: pointer;
  transition: background-color 160ms var(--sc-ease-out), color 160ms var(--sc-ease-out);
}
.modal-close:hover { background: rgb(243 240 250 / .08); color: var(--sc-ink); }

.modal-tabs {
  display: flex; gap: 4px;
  margin-bottom: 2rem; padding: 4px;
  background: var(--sc-canvas);
  border: 1px solid var(--line);
  border-radius: calc(var(--r-sm) + 4px);
}
.modal-tab {
  flex: 1;
  min-height: 42px; padding: 0 1rem;
  background: none; border: 0; border-radius: var(--r-sm);
  color: var(--sc-ink-soft); font-weight: 500; cursor: pointer;
  transition: background-color 160ms var(--sc-ease-out), color 160ms var(--sc-ease-out);
}
.modal-tab:hover { color: var(--sc-ink); }
.modal-tab.active { background: var(--sc-accent); color: #fff; box-shadow: inset 0 1px 0 rgb(255 255 255 / .18); }

.auth-form { display: none; }
.auth-form.active { display: block; }
.forgot-password-form { display: none; }
.forgot-password-form.active { display: block; }

.login-header { text-align: center; margin-bottom: 2rem; }
.login-title {
  margin: 0 0 .4rem;
  font-family: var(--sc-font-display);
  font-size: clamp(1.6rem, 4vw, 2rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1;
  color: var(--sc-ink);
}
.login-subtitle { margin: 0; color: var(--sc-ink-soft); font-size: 1rem; }

.auth-error, .auth-success {
  display: none;
  margin-bottom: 1.25rem; padding: .85rem 1.1rem;
  border-radius: var(--r-sm);
  font-size: .92rem;
}
.auth-error { background: rgb(240 113 107 / .10); border: 1px solid rgb(240 113 107 / .38); color: #ff9a94; }
.auth-success { background: rgb(185 150 255 / .10); border: 1px solid rgb(185 150 255 / .38); color: var(--violet-text); }
.auth-error.show, .auth-success.show { display: block; }

.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block; margin-bottom: .5rem;
  color: var(--sc-ink-soft); font-size: .8rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
}
.form-input {
  width: 100%;
  min-height: 50px; padding: .8rem 1.1rem;
  background: var(--sc-canvas);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--sc-ink); font-size: 1rem;
  outline: none;
  transition: border-color 160ms var(--sc-ease-out), box-shadow 160ms var(--sc-ease-out);
}
.form-input:focus { border-color: var(--sc-accent); box-shadow: 0 0 0 3px rgb(143 60 250 / .28); }
.form-input::placeholder { color: #8f8aa0; }
.name-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 480px) { .name-grid { grid-template-columns: 1fr; gap: 0; } }

.password-container { position: relative; }
.password-container .form-input { padding-right: 3.25rem; }
.password-toggle {
  position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: var(--r-sm);
  color: var(--sc-ink-soft); cursor: pointer;
}
.password-toggle:hover { color: var(--sc-ink); background: rgb(243 240 250 / .06); }
.password-toggle svg { width: 20px; height: 20px; }

.form-options { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 1.5rem; }
.checkbox-group { display: flex; align-items: center; gap: .5rem; }
.form-checkbox { width: 18px; height: 18px; margin: 0; accent-color: var(--sc-accent); }
.checkbox-label { color: var(--sc-ink-soft); font-size: .92rem; cursor: pointer; }
.forgot-link, .back-to-signin { color: var(--violet-text); font-size: .92rem; font-weight: 500; cursor: pointer; }
.forgot-link:hover, .back-to-signin:hover { color: #d7c4ff; text-decoration: underline; text-underline-offset: .22em; }
.back-to-signin { display: inline-flex; align-items: center; gap: .5rem; margin-bottom: 1.25rem; }
.back-to-signin svg { display: inline-block; }

.login-button {
  width: 100%; min-height: 52px; padding: 0 1.5rem;
  background: var(--sc-accent); color: #fff;
  border: 1px solid transparent; border-radius: var(--r-sm);
  font-size: 1rem; font-weight: 600; letter-spacing: .005em; cursor: pointer;
  box-shadow: var(--sc-e2), inset 0 1px 0 rgb(255 255 255 / .18);
  transition: background-color 160ms var(--sc-ease-out), transform 120ms var(--sc-ease-out);
}
.login-button:active { transform: translateY(1px) scale(.985); }
.login-button:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }
@media (hover: hover) and (pointer: fine) {
  .login-button:hover:not(:disabled) { background: #7427c8; }
}

.social-login { margin-top: .25rem; }
.social-btn {
  width: 100%; min-height: 52px; padding: 0 1.5rem;
  display: flex; align-items: center; justify-content: center; gap: .75rem;
  background: transparent; color: var(--sc-ink);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  font-size: 1rem; font-weight: 600; cursor: pointer;
  transition: border-color 160ms var(--sc-ease-out), background-color 160ms var(--sc-ease-out);
}
.social-btn svg { flex: none; }
.social-btn:disabled { opacity: .55; cursor: not-allowed; }
@media (hover: hover) and (pointer: fine) {
  .social-btn:hover:not(:disabled) { border-color: var(--violet-text); background: rgb(243 240 250 / .04); }
}
.social-divider { position: relative; text-align: center; margin: 1.5rem 0 1.25rem; }
.social-divider::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--line); }
.social-divider span { position: relative; padding: 0 1rem; background: var(--sc-surface); color: #8f8aa0; font-size: .875rem; }

.modal .loading { opacity: .7; pointer-events: none; }
.modal .loading .login-button { background: var(--raised); }

/* The terms line under the sign-up form carries inline colours from the live
   markup; bring them onto this palette without touching the markup. */
#signup-form > div[style] { color: var(--sc-ink-soft) !important; }
#signup-form > div[style] a { color: var(--violet-text) !important; }

.modal :focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
