/* ConquestReborn — auth modal (self-injected by js/auth.js).
   Layers on the design tokens in css/style.css; include AFTER it. */

/* Lock page scroll while the dialog is up */
body.auth-open { overflow: hidden; }

/* ---------- Overlay ---------- */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 200; /* above the sticky nav (z-index: 50) */
  display: flex;
  overflow-y: auto;
  padding: 24px;
  background: rgba(6, 8, 14, 0.78);
  backdrop-filter: blur(3px);
  animation: auth-fade 0.18s ease;
}
/* display:flex above would defeat the UA's [hidden] rule — restore it, and
   cover injected children (forms are flex) too. */
.auth-overlay[hidden],
.auth-overlay [hidden] { display: none !important; }

/* ---------- Card ---------- */
.auth-modal {
  position: relative;
  width: min(420px, 100%);
  margin: auto; /* centers, and still scrolls when taller than the viewport */
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 34px 34px 30px;
  animation: auth-rise 0.22s ease;
}
.auth-modal::before {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.auth-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 4px;
  background: none;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.auth-close:hover { color: var(--gold-bright); }
.auth-close:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }

.auth-kicker {
  margin: 0 0 4px;
  font-family: Cinzel, "Times New Roman", serif;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  color: var(--gold);
}
.auth-kicker em { font-style: normal; color: var(--gold-bright); }

.auth-title {
  margin: 0 0 20px;
  font-size: 1.5rem;
  font-weight: 800;
}

/* ---------- Tabs ---------- */
.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--line-faint);
  margin-bottom: 22px;
}
.auth-tab {
  flex: 1;
  margin-bottom: -1px;
  padding: 10px 4px 12px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: Cinzel, "Times New Roman", serif;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.auth-tab:hover { color: var(--ink); }
.auth-tab.is-active { color: var(--gold-bright); border-bottom-color: var(--gold); }
.auth-tab:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: -2px; }

/* ---------- Forms ---------- */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-field label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.auth-field input {
  font-family: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px 12px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.auth-field input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold-deep), 0 0 14px rgba(200, 169, 94, 0.15);
}

/* Inline error area (no red in the palette: gold-warning treatment; picks up
   a --bad token automatically if style.css ever grows one). */
.auth-error {
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--gold-deep);
  border-left: 3px solid var(--gold);
  border-radius: 4px;
  background: rgba(200, 169, 94, 0.08);
  color: var(--bad, var(--gold-bright));
  font-size: 0.9rem;
}

.auth-submit { width: 100%; margin-top: 6px; }
.auth-submit:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.auth-alt {
  margin: 0;
  text-align: center;
  font-size: 0.85rem;
}
.auth-alt a { color: var(--muted); }
.auth-alt a:hover { color: var(--gold-bright); }

.auth-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.auth-legal {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}
.auth-legal a { color: var(--muted); }
.auth-legal a:hover { color: var(--gold-bright); }

/* Placeholder-link flash hook (main.js/auth.js add .todo-flash on click) */
.auth-modal .todo-flash {
  outline: 1px dashed var(--gold-deep);
  outline-offset: 2px;
}

/* ---------- Motion ---------- */
@keyframes auth-fade {
  from { opacity: 0; }
}
@keyframes auth-rise {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
}
@media (prefers-reduced-motion: reduce) {
  .auth-overlay, .auth-modal { animation: none; }
  .auth-tab, .auth-field input { transition: none; }
}

/* ---------- Small screens ---------- */
@media (max-width: 480px) {
  .auth-overlay { padding: 14px; }
  .auth-modal { padding: 28px 20px 24px; }
}
