/* auth.css — Login + OAuth-Zustimmung als Kosmos-Szene (passend zur Landing).
   Ebenen: Canvas hinten (z 0) < Karte (z 2) < Canvas vorne (z 3, Orbit-
   Vorderseite, klickdurchlaessig). Die 3D-Neigung der Karte kommt per CSS-
   Variablen aus auth-scene.js; ohne JS bleibt alles flach und funktioniert. */

@property --edge {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

:root {
  --space-900: #04060d;
  --space-700: #101833;
  --ink: #eef3fd;
  --ink-dim: #b9c6e2;
  --ink-faint: #7a89ad;
  --glow: #7ea2ff;
  --gold: #e0ad52;
  --green: #2f9c78;
  --green-deep: #1f6f54;
  --danger: #ff6b6b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body.auth {
  font-family: "Hanken Grotesk", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse 90% 70% at 50% 40%, var(--space-700) 0%, var(--space-900) 72%),
    var(--space-900);
  min-height: 100svh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.auth-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
.auth-canvas--front { z-index: 3; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Buehne + Karte ---------- */

.auth-stage {
  position: relative;
  z-index: 2;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  perspective: 1100px;
}

.auth-card {
  --rx: 0deg;
  --ry: 0deg;
  --gx: 50%;
  --gy: 30%;
  position: relative;
  width: min(100%, 380px);
  padding: 34px 30px 28px;
  border-radius: 24px;
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.025));
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow:
    0 30px 80px -30px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 0 60px -10px rgba(126, 162, 255, 0.18);
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.25s ease-out, box-shadow 0.4s ease;
  /* Einflug ueber translate/scale/opacity — eigene Eigenschaften, damit er
     sich nicht mit der Neigung (transform, pro Frame aus JS) ueberschreibt */
  animation: card-in 1.1s cubic-bezier(0.2, 0.9, 0.2, 1) backwards;
}

/* umlaufender Leuchtrand (Maske schneidet nur den 1.5px-Rand frei) */
.auth-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(from var(--edge),
    rgba(126, 162, 255, 0) 0deg,
    rgba(126, 162, 255, 0.9) 60deg,
    rgba(224, 173, 82, 0.9) 120deg,
    rgba(47, 156, 120, 0) 200deg,
    rgba(126, 162, 255, 0) 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: edge-spin 6s linear infinite;
  pointer-events: none;
}

/* Lichtreflex, folgt dem Zeiger */
.auth-card__glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--gx) var(--gy),
    rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 45%);
  pointer-events: none;
  mix-blend-mode: screen;
}

@keyframes card-in {
  from { opacity: 0; translate: 0 28px; scale: 0.93; }
  to   { opacity: 1; translate: 0 0; scale: 1; }
}
@keyframes edge-spin { to { --edge: 360deg; } }

/* ---------- Marke + Wortmarke ---------- */

.auth-mark {
  width: 74px;
  height: 74px;
  display: block;
  filter: drop-shadow(0 0 18px rgba(126, 162, 255, 0.45));
}
.auth-mark svg { width: 100%; height: 100%; overflow: visible; }
.auth-mark__ring {
  transform-origin: 50% 50%;
  animation: ring-spin 18s linear infinite;
}
.auth-mark__belt circle { animation: belt-pulse 2.8s ease-in-out infinite; }
.auth-mark__belt circle:nth-child(2) { animation-delay: 0.35s; }
.auth-mark__belt circle:nth-child(3) { animation-delay: 0.7s; }

@keyframes ring-spin { to { transform: rotate(360deg); } }
@keyframes belt-pulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; filter: drop-shadow(0 0 6px #ffd38a); }
}

.auth-word {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.55em;
  margin-right: -0.55em; /* Sperrung optisch zentrieren */
  background: linear-gradient(100deg, #cfdcff 0%, #ffffff 35%, var(--gold) 50%, #ffffff 65%, #cfdcff 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 7s ease-in-out infinite;
}
@keyframes shimmer {
  0%, 100% { background-position: 100% 0; }
  50% { background-position: 0% 0; }
}

.auth-sub {
  margin-top: -6px;
  font-size: 12px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------- Formular ---------- */

.auth-form { display: grid; gap: 12px; width: 100%; margin-top: 6px; }

.auth-input {
  width: 100%;
  padding: 13px 16px;
  font: inherit;
  font-size: 16px; /* iOS zoomt sonst beim Fokus */
  color: var(--ink);
  background: rgba(4, 8, 20, 0.45);
  border: 1px solid rgba(185, 198, 226, 0.22);
  border-radius: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.3s ease, background 0.3s ease;
}
.auth-input::placeholder { color: var(--ink-faint); }
.auth-input:focus {
  border-color: rgba(126, 162, 255, 0.75);
  background: rgba(4, 8, 20, 0.6);
  box-shadow: 0 0 0 4px rgba(126, 162, 255, 0.16), 0 0 30px -4px rgba(126, 162, 255, 0.5);
}

.auth-btn {
  position: relative;
  overflow: hidden;
  width: 100%;
  padding: 13px 16px;
  font: inherit;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: #fff;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  background: linear-gradient(120deg, var(--green-deep), var(--green) 55%, #3d7fd6);
  box-shadow: 0 10px 30px -10px rgba(47, 156, 120, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  transition: transform 0.15s ease, box-shadow 0.3s ease, filter 0.3s ease;
}
.auth-btn::after { /* Lichtstreifen beim Hover */
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s ease;
}
.auth-btn:hover { filter: brightness(1.08); box-shadow: 0 14px 40px -10px rgba(47, 156, 120, 0.95); }
.auth-btn:hover::after { left: 130%; }
.auth-btn:active { transform: scale(0.98); }
.auth-btn:focus-visible { outline: 2px solid var(--glow); outline-offset: 3px; }

.auth-btn--ghost {
  background: transparent;
  color: var(--ink-dim);
  box-shadow: 0 0 0 1px rgba(185, 198, 226, 0.22) inset;
  font-weight: 500;
}
.auth-btn--ghost::after { display: none; }
.auth-btn--ghost:hover { color: var(--ink); box-shadow: 0 0 0 1px rgba(185, 198, 226, 0.45) inset; filter: none; }

.auth-error {
  color: #ffd2d2;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.35);
}

/* ---------- Zustimmung (OAuth) ---------- */

.auth-lead { font-size: 17px; line-height: 1.45; }
.auth-lead strong { color: #fff; }
.auth-text { font-size: 14px; line-height: 1.5; color: var(--ink-dim); }
.auth-target { font-size: 13px; color: var(--ink-faint); }
.auth-target code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink-dim);
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
}
.auth-warn {
  font-size: 13px;
  line-height: 1.45;
  padding: 10px 12px;
  border-radius: 12px;
  color: #ffe9c4;
  background: rgba(224, 173, 82, 0.12);
  border: 1px solid rgba(224, 173, 82, 0.35);
}

/* ---------- Zustaende ---------- */

.auth-card.is-error {
  animation: card-in 0.6s cubic-bezier(0.2, 0.9, 0.2, 1) backwards, shake 0.55s 0.25s ease both;
  box-shadow:
    0 30px 80px -30px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(255, 107, 107, 0.35) inset,
    0 0 70px -10px rgba(255, 107, 107, 0.35);
}
@keyframes shake {
  10%, 90% { translate: -2px 0; }
  20%, 80% { translate: 4px 0; }
  30%, 50%, 70% { translate: -7px 0; }
  40%, 60% { translate: 7px 0; }
}

/* Warp-Sprung: Karte fliegt nach vorn weg (JS setzt die Klasse beim Absenden) */
.auth-card.is-launching {
  transition: transform 0.75s cubic-bezier(0.6, 0, 0.9, 0.4), opacity 0.6s ease 0.15s, filter 0.6s ease;
  transform: translateZ(520px) rotateX(0deg) rotateY(0deg);
  opacity: 0;
  filter: blur(4px);
}

@media (max-width: 420px) {
  .auth-card { padding: 28px 20px 22px; border-radius: 20px; }
  .auth-word { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-card, .auth-card::before, .auth-word, .auth-mark__ring, .auth-mark__belt circle {
    animation: none !important;
  }
  .auth-card { transition: none; }
}
