/* ============================================================================
   Auth modals — sign-in, register, forgot, reset, verify
   Reuses the .module-modal infrastructure (.module-modal-backdrop +
   .module-modal-shell + open/close animations). Adds form-specific styles.
   ============================================================================ */

.auth-modal { z-index: var(--z-modal); }

.auth-modal-shell {
  width: min(440px, 100%);
  background: var(--canvas-paper);
  border-radius: 24px;
  box-shadow:
    0 24px 80px rgba(11, 15, 31, 0.4),
    0 0 0 1px var(--ink-line),
    0 0 64px rgba(199, 248, 72, 0.15);
  overflow: hidden;
  transform: scale(0.94) translateY(12px);
  transition: transform 360ms var(--ease-out-back);
  display: flex;
  flex-direction: column;
  position: relative;
}
.auth-modal.open .auth-modal-shell { transform: scale(1) translateY(0); }

@media (max-width: 540px) {
  .auth-modal-shell { width: 100%; height: 100%; border-radius: 0; max-height: 100vh; }
  .auth-modal { padding: 0; align-items: stretch; }
}

/* Decorative bracket corners */
.am-corner {
  position: absolute;
  width: 14px; height: 14px;
  border: 1.5px solid var(--lime);
  filter: drop-shadow(0 0 4px var(--lime-shadow));
  pointer-events: none;
}
.am-corner.tl { top: 14px;    left: 14px;    border-right: none; border-bottom: none; }
.am-corner.tr { top: 14px;    right: 14px;   border-left: none;  border-bottom: none; }
.am-corner.bl { bottom: 14px; left: 14px;    border-right: none; border-top: none; }
.am-corner.br { bottom: 14px; right: 14px;   border-left: none;  border-top: none; }

.auth-modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  display: inline-flex;
  align-items: center; justify-content: center;
  background: var(--canvas);
  border: 1px solid var(--ink-line);
  color: var(--ink);
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  transition: all 180ms;
}
.auth-modal-close:hover { background: var(--ink); color: var(--lime); border-color: var(--ink); }

.auth-modal-inner {
  padding: 36px 32px 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
@media (max-width: 540px) { .auth-modal-inner { padding: 28px 22px 24px; } }

/* Header */
.am-header { padding-bottom: 14px; border-bottom: 1px dashed var(--ink-line); }
.am-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--t-mono-sm);
  color: var(--ink-mute);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}
.am-eyebrow::before { content: '{ '; color: var(--lime); }
.am-eyebrow::after  { content: ' }'; color: var(--lime); }
.am-title {
  font: 700 clamp(1.5rem, 2.6vw, 2rem) var(--font-sans);
  letter-spacing: -0.018em;
  color: var(--ink);
  line-height: 1.15;
  margin-bottom: 4px;
}
.am-sub { font: 400 var(--t-body-sm) var(--font-sans); color: var(--ink-soft); line-height: 1.5; }
.am-sub a { color: var(--violet); font-weight: 600; }

/* Form rows */
.am-form { display: flex; flex-direction: column; gap: 14px; }
.am-field { display: flex; flex-direction: column; gap: 6px; }
.am-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}
.am-label::before { content: '{ '; color: var(--lime); }
.am-label::after  { content: ' }'; color: var(--lime); }
.am-input, .am-select {
  font: 500 var(--t-body) var(--font-sans);
  color: var(--ink);
  background: var(--canvas);
  border: 1.5px solid var(--ink-line);
  border-radius: 10px;
  padding: 11px 14px;
  outline: none;
  transition: border-color 180ms, background 180ms, box-shadow 180ms;
  width: 100%;
  box-sizing: border-box;
}
.am-input:hover { border-color: var(--ink-mute); }
.am-input:focus, .am-select:focus {
  border-color: var(--lime);
  background: var(--canvas-paper);
  box-shadow: 0 0 0 3px var(--lime-shadow);
}
.am-input::placeholder { color: var(--ink-mute); opacity: 0.7; }
.am-input.invalid {
  border-color: var(--signal-error);
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.18);
}

/* Password field (with show/hide) */
.am-pw-wrap { position: relative; }
.am-pw-toggle {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--ink-mute);
  font: 500 0.78rem var(--font-mono);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}
.am-pw-toggle:hover { color: var(--ink); background: var(--canvas-deep); }

/* Password strength meter */
.am-pw-strength {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 6px;
}
.am-pw-strength span {
  height: 3px;
  background: var(--ink-line);
  border-radius: 2px;
  transition: background 220ms;
}
.am-pw-strength.s1 span:nth-child(-n+1) { background: var(--signal-error); }
.am-pw-strength.s2 span:nth-child(-n+2) { background: var(--signal-warn); }
.am-pw-strength.s3 span:nth-child(-n+3) { background: var(--lime); }
.am-pw-strength.s4 span                  { background: var(--lime); }
.am-pw-hint { font-size: 0.74rem; color: var(--ink-mute); margin-top: 4px; font-family: var(--font-mono); }

/* Field error */
.am-error {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--signal-error);
  margin-top: 2px;
  min-height: 14px;
}

/* Form errors (top of form) */
.am-form-error {
  background: rgba(229, 72, 77, 0.1);
  border: 1px solid rgba(229, 72, 77, 0.3);
  color: #B43237;
  padding: 10px 12px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}
.am-form-success {
  background: rgba(43, 182, 115, 0.08);
  border: 1px solid rgba(43, 182, 115, 0.3);
  color: #1F8A56;
  padding: 10px 12px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

/* Inline meta row */
.am-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: -4px;
}
.am-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}
.am-checkbox input {
  appearance: none;
  width: 16px; height: 16px;
  border: 1.5px solid var(--ink-line);
  border-radius: 4px;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: all 160ms;
  background: var(--canvas);
}
.am-checkbox input:checked {
  background: var(--lime);
  border-color: var(--lime);
}
.am-checkbox input:checked::before {
  content: '✓';
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}
.am-link {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--violet);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}
.am-link:hover { color: var(--violet-deep); text-decoration: underline; }

/* Submit button */
.am-submit {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}
.am-submit.loading {
  pointer-events: none;
  opacity: 0.7;
}
.am-submit .spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: am-spin 800ms linear infinite;
}
@keyframes am-spin { to { transform: rotate(360deg); } }

/* Switch link (bottom) */
.am-switch {
  text-align: center;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px dashed var(--ink-line);
  font-family: var(--font-mono);
  font-size: var(--t-mono-sm);
  color: var(--ink-mute);
}
.am-switch button { font: inherit; color: var(--violet); background: none; border: none; cursor: pointer; }
.am-switch button:hover { color: var(--violet-deep); text-decoration: underline; }

/* "Check your email" screen */
.am-info-state {
  text-align: center;
  padding: 8px 0 0;
}
.am-info-state .am-info-icon {
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--lime);
  filter: drop-shadow(0 0 12px var(--lime-shadow));
  margin-bottom: 16px;
  line-height: 1;
}
.am-info-state p { color: var(--ink-soft); line-height: 1.55; margin-bottom: 10px; }
.am-info-state code {
  font-family: var(--font-mono);
  background: var(--canvas-deep);
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--ink);
}

/* User pill in top-nav when signed in */
.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 12px;
  background: var(--canvas-paper);
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 200ms;
}
.user-pill:hover {
  border-color: var(--lime);
  color: var(--ink);
  box-shadow: 0 0 12px var(--lime-shadow);
}
.user-pill .user-pill-dot {
  width: 8px; height: 8px;
  background: var(--signal-success);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--signal-success);
}
