/* ═══════════════════════════════════════════════════════════════════════
   auth-gate.css — the required sign-in screen (js/auth-gate.js)

   A modal <dialog> in the top layer, so the app behind it is inert and the
   gate can never be dismissed with Escape. The card follows the same tokens
   and glass language as the rest of the app; the backdrop carries a quiet
   version of the aurora.
   ═══════════════════════════════════════════════════════════════════════ */

/* While the gate is up the app is not painted and does not scroll. The
   dialog itself lives in the top layer, so hiding its siblings is safe. */
html.auth-locked { overflow: hidden; }
html.auth-locked body > *:not(#auth-gate) { visibility: hidden !important; }

#auth-gate {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  overflow-y: auto;
  overscroll-behavior: contain;
}

#auth-gate::backdrop {
  background:
    radial-gradient(58% 48% at 18% 8%, color-mix(in srgb, var(--focus-tint) 26%, transparent), transparent 72%),
    radial-gradient(52% 56% at 86% 92%, color-mix(in srgb, #7c5cbf 22%, transparent), transparent 74%),
    radial-gradient(40% 40% at 78% 18%, color-mix(in srgb, #2aa198 12%, transparent), transparent 70%),
    rgba(7, 7, 11, 0.86);
  backdrop-filter: blur(26px) saturate(125%);
  -webkit-backdrop-filter: blur(26px) saturate(125%);
}

:root[data-theme="light"] #auth-gate::backdrop {
  background:
    radial-gradient(58% 48% at 18% 8%, color-mix(in srgb, var(--focus-tint) 18%, transparent), transparent 72%),
    radial-gradient(52% 56% at 86% 92%, color-mix(in srgb, #7c5cbf 14%, transparent), transparent 74%),
    rgba(243, 242, 239, 0.9);
}

.auth-shell {
  min-height: 100%;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(18px, 4vh, 44px) 20px;
  padding-top: max(clamp(18px, 4vh, 44px), env(safe-area-inset-top));
  padding-bottom: max(clamp(18px, 4vh, 44px), env(safe-area-inset-bottom));
}

.auth-card {
  width: min(432px, 100%);
  padding: clamp(26px, 5vw, 40px);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow:
    0 50px 130px -40px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(34px) saturate(155%);
  -webkit-backdrop-filter: blur(34px) saturate(155%);
}

:root[data-theme="light"] .auth-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.72));
  border-color: rgba(11, 11, 11, 0.1);
  box-shadow:
    0 40px 110px -40px rgba(30, 25, 20, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
  color: var(--focus-text);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.auth-brand svg {
  width: 26px;
  height: 26px;
  display: block;
}

.auth-brand span { color: var(--text-primary); }

.auth-eyebrow {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--focus-text);
}

.auth-title {
  margin: 0;
  font-size: clamp(26px, 4.4vw, 32px);
  line-height: 1.12;
  font-weight: 760;
  letter-spacing: -0.035em;
}

.auth-lead {
  margin: 10px 0 24px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-secondary);
}

/* ── checking / connecting ── */

.auth-checking {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 34px 0 26px;
  text-align: center;
}

.auth-checking p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-checking.is-error .auth-spinner { display: none; }
.auth-checking.is-error p { max-width: 32ch; color: #ff9d8d; }
:root[data-theme="light"] .auth-checking.is-error p { color: #b02a1c; }

.auth-spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, var(--focus-tint) 24%, transparent);
  border-top-color: var(--focus-tint);
  animation: auth-spin 0.85s linear infinite;
}

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

/* ── buttons ── */

.auth-google {
  width: 100%;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  border: 1px solid #d8dbe0;
  background: #fff;
  color: #1f1f1f;
  font: inherit;
  font-size: 14.5px;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
  transition: background 0.16s, box-shadow 0.16s, transform 0.14s;
}

.auth-google:hover { background: #f6f7f8; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2); }
.auth-google:active { transform: scale(0.985); }
.auth-google:focus-visible { outline: 2px solid var(--focus-tint); outline-offset: 3px; }
.auth-google:disabled { opacity: 0.6; cursor: default; }
.auth-google svg { width: 18px; height: 18px; flex: none; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 18px;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: rgba(255, 255, 255, 0.11);
}

:root[data-theme="light"] .auth-divider::before,
:root[data-theme="light"] .auth-divider::after { background: rgba(11, 11, 11, 0.1); }

/* ── form ── */

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

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

.auth-field > span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
}

.auth-field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.24);
  color: var(--text-primary);
  font: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}

:root[data-theme="light"] .auth-field input {
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(11, 11, 11, 0.14);
}

.auth-field input:focus {
  border-color: color-mix(in srgb, var(--focus-tint) 70%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus-tint) 24%, transparent);
}

.auth-field input::placeholder { color: color-mix(in srgb, var(--text-muted) 80%, transparent); }

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 3px;
}

.auth-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.auth-check input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--focus-tint);
  cursor: pointer;
}

.auth-link {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  text-underline-offset: 3px;
}

.auth-link:hover { color: var(--text-primary); }
.auth-link:focus-visible { outline: 2px solid var(--focus-tint); outline-offset: 3px; border-radius: 4px; }

.auth-submit {
  width: 100%;
  height: 48px;
  margin-top: 3px;
  font-size: 15px;
  font-weight: 700;
}

.auth-submit:disabled { opacity: 0.65; cursor: default; transform: none; }

/* ── status + switch ── */

.auth-status {
  min-height: 19px;
  margin: 13px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
  text-align: center;
}

.auth-status[data-kind="error"] { color: #ff9d8d; }
.auth-status[data-kind="ok"] { color: #86dcb0; }

:root[data-theme="light"] .auth-status[data-kind="error"] { color: #b02a1c; }
:root[data-theme="light"] .auth-status[data-kind="ok"] { color: #1d6b47; }

.auth-switch-line {
  margin: 16px 0 0;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.auth-switch {
  appearance: none;
  border: 0;
  background: none;
  padding: 2px;
  color: var(--focus-text);
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
}

.auth-switch:hover { text-decoration: underline; text-underline-offset: 3px; }
.auth-switch:focus-visible { outline: 2px solid var(--focus-tint); outline-offset: 3px; border-radius: 4px; }

/* ── footnote ── */

.auth-note {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 7px;
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-muted);
  text-align: center;
}

:root[data-theme="light"] .auth-note { border-top-color: rgba(11, 11, 11, 0.08); }

.auth-note svg { width: 14px; height: 14px; flex: none; margin-top: 1px; }

/* ── narrow screens ── */

@media (max-width: 480px) {
  .auth-card { border-radius: 24px; }
  .auth-brand { margin-bottom: 20px; }
  .auth-row { align-items: flex-start; flex-direction: column; gap: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-spinner { animation-duration: 2.4s; }
}
