/* Ipso One — Auth Page Styles */
/* Imports design tokens from parent site */

/* ---- Grain Texture Overlay ---- */
.auth-page::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ---- Page Layout ---- */
.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl) var(--space-sm);
  background: var(--bg);
  position: relative;
  overflow-x: hidden;
}

.auth-container {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 1;
}

html, body {
  overflow-x: hidden;
}

/* ---- Logo "o" with dot ---- */
.auth-logo {
  position: relative;
  display: inline-block;
  font-family: var(--font);
  font-weight: 400;
  font-size: 7rem;
  line-height: 1;
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
  margin-bottom: var(--space-sm);
  opacity: 0;
  animation: auth-reveal 0.8s var(--ease) forwards;
  animation-delay: 0ms;
}

.auth-logo__dot {
  position: absolute;
  width: 0.055em;
  height: 0.055em;
  background: currentColor;
  border-radius: 50%;
  top: 58%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* ---- Wordmark + Tagline ---- */
.auth-wordmark {
  font-family: var(--font);
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 0.25rem;
  opacity: 0;
  animation: auth-reveal 0.8s var(--ease) forwards;
  animation-delay: 100ms;
}

.auth-tagline {
  font-family: var(--font);
  font-weight: 400;
  font-size: var(--text-small);
  color: var(--text-tertiary);
  margin: 0 0 var(--space-lg);
  opacity: 0;
  animation: auth-reveal 0.8s var(--ease) forwards;
  animation-delay: 200ms;
}

/* ---- Glass Card ---- */
.auth-card {
  width: 100%;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: var(--space-lg);
  opacity: 0;
  animation: auth-reveal 0.8s var(--ease) forwards;
  animation-delay: 350ms;
}

[data-theme="light"] .auth-card {
  background: rgba(0, 0, 0, 0.02);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* ---- Tabs ---- */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  font-family: var(--font);
  font-size: var(--text-small);
  font-weight: 400;
  color: var(--text-tertiary);
  padding: 0 0 0.75rem;
  cursor: pointer;
  position: relative;
  transition: color var(--dur) var(--ease);
}

.auth-tab::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform var(--dur) var(--ease);
}

.auth-tab--active {
  color: var(--text);
  font-weight: 500;
}

.auth-tab--active::after {
  transform: scaleX(1);
}

.auth-tab:hover:not(.auth-tab--active) {
  color: var(--text-secondary);
}

/* ---- Views ---- */
.auth-view {
  display: none;
}

.auth-view--active {
  display: block;
  animation: auth-fade 0.3s var(--ease) forwards;
}

/* ---- Form Fields ---- */
.auth-field {
  margin-bottom: var(--space-md);
}

.auth-field input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--border-strong);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 400;
  color: var(--text);
  padding: 0.75rem 0;
  outline: none;
  transition: border-color var(--dur) var(--ease);
  box-sizing: border-box;
}

.auth-field input::placeholder {
  color: var(--text-tertiary);
}

.auth-field input:focus {
  border-bottom-color: var(--accent);
}

/* Code input (verification) */
.auth-field--code input {
  text-align: center;
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: 0.5em;
  padding-left: 0.5em;
}

/* ---- Password hint ---- */
.auth-hint {
  font-family: var(--font);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin: -0.75rem 0 var(--space-md);
}

/* ---- Submit Button ---- */
.auth-submit {
  width: 100%;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-pill);
  font-family: var(--font);
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 0.875rem 1.5rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease),
              opacity var(--dur-fast) var(--ease);
}

.auth-submit:hover {
  background: #6d28d9;
  transform: translateY(-1px);
}

.auth-submit:active {
  background: #5b21b6;
  transform: translateY(0);
}

.auth-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Loading spinner */
.auth-submit--loading {
  color: transparent;
  pointer-events: none;
}

.auth-submit--loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: auth-spin 0.6s linear infinite;
}

/* ---- Link Buttons ---- */
.auth-link {
  display: block;
  background: none;
  border: none;
  font-family: var(--font);
  font-size: var(--text-small);
  color: var(--text-tertiary);
  padding: 0.5rem 0;
  cursor: pointer;
  text-align: center;
  width: 100%;
  margin-top: var(--space-xs);
  transition: color var(--dur-fast) var(--ease);
}

.auth-link:hover {
  color: var(--accent);
}

/* ---- Divider ---- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-md) 0;
  color: var(--text-tertiary);
  font-family: var(--font);
  font-size: var(--text-xs);
  text-transform: lowercase;
  letter-spacing: 0.05em;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---- Social Buttons ---- */
.auth-social {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.auth-social-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  background: transparent;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-pill);
  font-family: var(--font);
  font-size: var(--text-small);
  font-weight: 400;
  color: var(--text);
  padding: 0.75rem 1.5rem;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}

.auth-social-btn:hover {
  border-color: var(--text-tertiary);
  background: var(--surface-hover);
}

.auth-social-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ---- Error Banner ---- */
.auth-error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  color: #ef4444;
  font-family: var(--font);
  font-size: var(--text-small);
  padding: 0.75rem 1rem;
  margin-bottom: var(--space-md);
  animation: auth-fade 0.3s var(--ease) forwards;
}

[data-theme="light"] .auth-error {
  background: rgba(239, 68, 68, 0.06);
  color: #dc2626;
}

/* ---- Success State ---- */
.auth-success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(124, 58, 237, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
}

.auth-success-icon svg {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.auth-message {
  font-family: var(--font);
  font-size: var(--text-small);
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: var(--space-md);
  line-height: 1.5;
}

.auth-message strong {
  color: var(--text);
  font-weight: 500;
}

/* ---- Footer ---- */
.auth-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: var(--space-lg);
  font-family: var(--font);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  opacity: 0;
  animation: auth-reveal 0.8s var(--ease) forwards;
  animation-delay: 500ms;
}

.auth-footer a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}

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

/* ---- Animations ---- */
@keyframes auth-reveal {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes auth-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@media (prefers-reduced-motion: reduce) {
  .auth-logo,
  .auth-wordmark,
  .auth-tagline,
  .auth-card,
  .auth-footer {
    animation: none;
    opacity: 1;
  }
  .auth-view--active {
    animation: none;
  }
  .auth-submit--loading::after {
    animation-duration: 1.2s;
  }
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .auth-page {
    padding: var(--space-lg) var(--space-sm);
    justify-content: flex-start;
    padding-top: 15vh;
  }
  .auth-logo {
    font-size: 5.5rem;
  }
  .auth-card {
    padding: var(--space-md);
    border-radius: var(--radius-md);
  }
}
