/* Shared design system for the public auth pages:
   login.html, reset-password.html, accept-invite.html.
   "Aurora Stage": dark stage, drifting brand aurora, giant breathing wave,
   film grain, glass card. CSS only, honors prefers-reduced-motion.
   One copy on purpose: brand.js exists because a duplicated brand rule once
   diverged between pages. Same lesson, same fix. */

:root {
  --pink: #EC0D99;
  --blue: #2F72E8;
  --violet: #8B3FE8;
  --ink-0: #05070F;
  --fg: #F2F4FA;
  --fg-muted: rgba(226, 232, 248, 0.62);
  /* Schwaechste Stufe, die noch lesbar ist. War 0.40, damit lagen Fusszeile,
     Platzhalter und die Labels der Einladungs-Box bei 3,3:1 und damit unter den
     4,5:1, die WCAG AA fuer Text unter 18px verlangt. Nicht weiter absenken,
     ohne nachzumessen. Gemessen 19.08.2026 (Lena-Abnahme). */
  --fg-dim: rgba(226, 232, 248, 0.56);
  --card: rgba(13, 17, 34, 0.62);
  --line: rgba(255, 255, 255, 0.09);
  --field: rgba(255, 255, 255, 0.045);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  /* Gegenstueck zu viewport-fit=cover im Meta-Tag: ohne diese vier Zeilen
     rutschen im Querformat auf einem Notch-Geraet Karte und Ueberschrift unter
     die Kerbe, und als Web-App liegt die Fusszeile unter dem Home-Balken. */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  font-family: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
  background: var(--ink-0);
  color: var(--fg);
  /* Karte bleibt bei offener Tastatur erreichbar: auto-Hoehe + Scroll
     statt hartem 100vh-Zentrieren (Steve-Fund A12). */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ============ Stage: aurora, wave, grain (CSS only) ============ */

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(120% 90% at 78% 8%, rgba(47, 114, 232, 0.14), transparent 55%),
    radial-gradient(110% 90% at 12% 92%, rgba(236, 13, 153, 0.10), transparent 55%),
    linear-gradient(180deg, #06080F 0%, #05070F 100%);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  will-change: transform;
}
.blob--pink {
  width: 62vmax; height: 62vmax;
  left: -18vmax; top: -22vmax;
  background: radial-gradient(circle at 40% 40%, rgba(236, 13, 153, 0.34), transparent 65%);
  animation: drift-a 34s ease-in-out infinite alternate;
}
.blob--blue {
  width: 58vmax; height: 58vmax;
  right: -20vmax; bottom: -24vmax;
  background: radial-gradient(circle at 60% 60%, rgba(47, 114, 232, 0.30), transparent 65%);
  animation: drift-b 41s ease-in-out infinite alternate;
}
.blob--violet {
  width: 40vmax; height: 40vmax;
  left: 34%; top: 30%;
  background: radial-gradient(circle, rgba(139, 63, 232, 0.16), transparent 65%);
  animation: drift-c 47s ease-in-out infinite alternate;
}
@keyframes drift-a {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(9vmax, 6vmax, 0) scale(1.12); }
  100% { transform: translate3d(-4vmax, 10vmax, 0) scale(0.95); }
}
@keyframes drift-b {
  0%   { transform: translate3d(0, 0, 0) scale(1.05); }
  50%  { transform: translate3d(-8vmax, -5vmax, 0) scale(0.94); }
  100% { transform: translate3d(5vmax, -9vmax, 0) scale(1.1); }
}
@keyframes drift-c {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-10vmax, 8vmax, 0); }
}

/* The brand wave drawn huge and quiet across the stage. */
.wave {
  position: absolute;
  left: 50%; top: 58%;
  width: 175vmax;
  transform: translate(-50%, -50%);
  opacity: 0.5;
  animation: wave-breathe 18s ease-in-out infinite alternate;
}
.wave--echo {
  top: 40%;
  opacity: 0.16;
  filter: blur(2px);
  animation-duration: 26s;
  animation-direction: alternate-reverse;
}
@keyframes wave-breathe {
  0%   { transform: translate(-52%, -50%) rotate(-1.2deg); }
  100% { transform: translate(-48%, -52%) rotate(1.2deg); }
}

/* Film grain so the dark stage never looks like a flat default gradient. */
.grain {
  position: absolute;
  /* -10% statt -50%: dieselbe Wirkung, aber ein Viertel der Texturflaeche.
     Bei -50% sind es auf einem Telefon rund 12 Megapixel, die 2,5 mal pro
     Sekunde neu gemischt werden. */
  inset: -10%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.05;
  mix-blend-mode: overlay;
  animation: grain-shift 1.2s steps(3) infinite;
}
@keyframes grain-shift {
  0%   { transform: translate(0, 0); }
  33%  { transform: translate(-2%, 1%); }
  66%  { transform: translate(1%, -2%); }
  100% { transform: translate(0, 0); }
}

/* ============ Layout ============ */

.page {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(28px, 5vh, 64px) clamp(20px, 4vw, 56px);
  padding-top: max(clamp(28px, 5vh, 64px), env(safe-area-inset-top));
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: clamp(32px, 5vw, 88px);
}

/* Single-purpose pages (reset password, accept invite) center one card
   instead of the split brand stage. */
.page--center {
  grid-template-columns: 1fr;
  justify-items: center;
  align-content: center;
}

/* ============ Brand side (split layout) ============ */

.brand { max-width: 540px; }

.brand__mark {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-bottom: clamp(28px, 5vh, 56px);
}
/* Breite fest, nicht auto: brand.js tauscht die Bildquelle erst bei
   DOMContentLoaded, und die beiden Marken sind unterschiedlich breit. Mit
   width:auto sprang der Schriftzug daneben um 30px zur Seite, sobald das
   richtige Logo da war. Die Klasse am <html> setzt brand.js sofort im head. */
.brand__mark img { height: 30px; width: 30px; object-fit: contain; display: block; }
html.marke-st .brand__mark img { width: 60px; }
.brand__word {
  font-family: 'Schibsted Grotesk', sans-serif;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.02em;
}

/* Compact variant used inside the card on centered pages. */
.brand__mark--compact { margin-bottom: 26px; }

.brand__eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  background: linear-gradient(90deg, var(--pink), var(--blue));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 18px;
}

.brand h1 {
  font-family: 'Schibsted Grotesk', sans-serif;
  font-weight: 800;
  font-size: clamp(38px, 4.6vw, 62px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  margin-bottom: 22px;
}
.brand h1 .glow {
  background: linear-gradient(92deg, var(--pink) 0%, var(--violet) 48%, var(--blue) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand__sub {
  font-size: 17px;
  line-height: 1.55;
  color: var(--fg-muted);
  max-width: 420px;
}

.brand__foot {
  margin-top: clamp(36px, 7vh, 72px);
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 28px;
  font-size: 13px;
  color: var(--fg-dim);
}
.brand__foot b {
  display: block;
  color: var(--fg);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

/* ============ Card ============ */

.card-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
}

.card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--card);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  backdrop-filter: blur(22px) saturate(1.3);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: clamp(28px, 4vw, 40px);
  box-shadow:
    0 40px 90px -30px rgba(0, 0, 0, 0.75),
    0 0 120px -40px rgba(236, 13, 153, 0.25);
}
/* Hairline gradient along the top edge. */
.card::before {
  content: "";
  position: absolute;
  top: -1px; left: 12%; right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(236, 13, 153, 0.8), rgba(47, 114, 232, 0.8), transparent);
}

.card h1,
.card h2 {
  /* Die Einladung schreibt hier den Projektnamen des Kunden hinein. Ein langes
     Wort wie "Veranstaltungszentrum" ist bei 22px breiter als die Karte auf
     einem 320px-Geraet und wuerde von overflow-x:hidden abgeschnitten. */
  overflow-wrap: anywhere;
  hyphens: auto;
  font-family: 'Schibsted Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}
.card > p,
.card p.sub {
  font-size: 14px;
  color: var(--fg-muted);
  margin-bottom: 26px;
  line-height: 1.5;
}

/* Invite page: who is being invited, read-only. */
.identity {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-left: 3px solid var(--pink);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 20px;
}
.identity-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.identity-row + .identity-row { margin-top: 8px; }
.identity-label { color: var(--fg-dim); font-weight: 600; white-space: nowrap; }
.identity-value { color: var(--fg); text-align: right; word-break: break-word; }
.skeleton { height: 14px; border-radius: 6px; background: rgba(255, 255, 255, 0.08); }

/* ============ Messages ============ */

.msg {
  border-radius: 10px;
  padding: 11px 14px;
  /* 14px, nicht 13: das ist oft die einzige Erklaerung auf der Seite und war
     damit der leiseste Text im Bild. */
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 18px;
  display: none;
}
.msg.visible { display: block; }
.msg--error {
  background: rgba(248, 113, 113, 0.10);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: #FDA4AF;
}
.msg--ok {
  background: rgba(52, 211, 153, 0.10);
  border: 1px solid rgba(52, 211, 153, 0.22);
  color: #6EE7B7;
}
/* Dritter Ton neben gelungen und kaputt: der neutrale Hinweis. Muss NACH
   .msg--ok stehen, die betroffenen Kaesten tragen beide Klassen und die
   spaetere Regel gewinnt. Gruen fuer "dein Einladungslink ist veraltet" hat
   den Fall wie einen Erfolg aussehen lassen. */
.msg--info {
  background: rgba(120, 162, 255, 0.10);
  border: 1px solid rgba(120, 162, 255, 0.28);
  color: #BBD0FF;
}

/* ============ Form ============ */

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 7px;
}
.field .control { position: relative; }
.field input {
  width: 100%;
  padding: 13px 15px;
  /* 16px Minimum, sonst zoomt iOS-Safari beim Fokus (Steve-Fund A11). */
  font-size: 16px;
  font-family: inherit;
  color: var(--fg);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), background 0.2s;
}
.field input::placeholder { color: var(--fg-dim); }
/* Hilfszeile unter dem Feld. Traegt Regeln, die im Platzhalter verschwinden,
   sobald jemand tippt. */
.field-hint {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--fg-dim);
}
.field-hint--error { color: #FDA4AF; }
.field input.is-error,
.field input.is-error:focus {
  border-color: rgba(248, 113, 113, 0.65);
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.12);
}
.field input:focus {
  border-color: rgba(236, 13, 153, 0.55);
  background: rgba(255, 255, 255, 0.065);
  box-shadow:
    0 0 0 3px rgba(236, 13, 153, 0.16),
    0 0 24px -6px rgba(47, 114, 232, 0.35);
}
.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--fg);
  -webkit-box-shadow: 0 0 0 60px #11162B inset;
  transition: background-color 99999s ease-out;
}

/* 44x44 als Klickflaeche, nicht 35: das ist das Mindestmass der
   UI-Abnahme-Checkliste fuer Bedienelemente auf dem Telefon. Das Symbol bleibt
   19px, nur die Flaeche darum waechst. */
.eye {
  position: absolute;
  right: 4px; top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--fg-dim);
  border-radius: 10px;
  display: grid;
  place-items: center;
  touch-action: manipulation;
  transition: color 0.15s;
}
.eye:hover { color: var(--fg); }
.eye:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: -2px;
  color: var(--fg);
}
.eye svg { width: 19px; height: 19px; display: block; }
/* Room for the eye button so the password never hides underneath it. */
.field .control input[type="password"],
.field .control input[type="text"].pw { padding-right: 50px; }

.login-btn {
  width: 100%;
  margin-top: 10px;
  padding: 15px;
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  background: linear-gradient(120deg, var(--pink) 0%, var(--violet) 55%, var(--blue) 115%);
  background-size: 160% 100%;
  box-shadow: 0 12px 32px -10px rgba(236, 13, 153, 0.55);
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out), background-position 0.5s var(--ease-out), opacity 0.18s;
}
.login-btn:hover {
  transform: translateY(-1px);
  background-position: 80% 0;
  box-shadow: 0 16px 40px -10px rgba(47, 114, 232, 0.55);
}
.login-btn:active { transform: translateY(0) scale(0.99); }
.login-btn:disabled {
  opacity: 0.75;
  cursor: wait;
  transform: none;
}

.toggle-mode,
.back-link {
  margin-top: 12px;
  text-align: center;
  font-size: 13px;
  color: var(--fg-dim);
}
/* Ein leeres #toggleMode wuerde sonst als tote Flaeche in der Karte stehen. */
.toggle-mode:empty { display: none; }

/* In vier Zustaenden (Link tot, Token verbraucht, Sitzung abgelaufen) ist so
   ein Textlink die EINZIGE Handlung der ganzen Seite. Deshalb 44px hoch, das
   Mindestmass der UI-Abnahme-Checkliste, statt der 19px, die reiner Text
   ergibt. Das Polster ersetzt den frueheren margin-top von 20px.
   toggle-mode traegt einen echten <button>, weil ein <a> ohne href per
   Tastatur nicht erreichbar ist. */
.toggle-mode button,
.back-link a {
  display: inline-block;
  min-height: 44px;
  padding: 12px 14px;
  box-sizing: border-box;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  background: linear-gradient(90deg, var(--pink), var(--blue)) bottom 12px left 14px / 0% 1px no-repeat;
  transition: background-size 0.3s var(--ease-out), color 0.15s;
}
.toggle-mode button:hover,
.back-link a:hover { color: var(--fg); background-size: calc(100% - 28px) 1px; }
.toggle-mode button:focus-visible,
.back-link a:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 2px;
  border-radius: 8px;
  color: var(--fg);
}

/* Wenn die Seite in einer Sackgasse steht, ist der Rueckweg die einzige
   moegliche Handlung. Dann traegt er auch die Optik der Haupthandlung statt
   die eines grauen Kleingedruckten. */
.back-link--cta { margin-top: 4px; }
.back-link--cta a {
  display: block;
  touch-action: manipulation;
  width: 100%;
  padding: 15px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(120deg, var(--pink) 0%, var(--violet) 55%, var(--blue) 115%);
  box-shadow: 0 12px 32px -10px rgba(236, 13, 153, 0.55);
}
.back-link--cta a:hover {
  color: #fff;
  filter: brightness(1.06);
  /* Der Unterstrich-Hover der Textlinks oben wuerde die Verlaufsflaeche des
     Knopfs sonst in 1px-Streifen kacheln. Auf iOS bleibt :hover nach dem
     Antippen stehen, das waere also nicht nur ein Desktop-Fehler. */
  background-size: auto;
}

.trust {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 20px 26px;
  padding-bottom: max(26px, calc(env(safe-area-inset-bottom) + 12px));
  font-size: 12.5px;
  color: var(--fg-dim);
}
.trust .t-item { display: inline-block; white-space: nowrap; }
.trust .dot { margin: 0 8px; opacity: 0.5; }

/* ============ Entrance ============ */

.rise {
  opacity: 0;
  transform: translateY(18px);
  animation: rise 0.9s var(--ease-out) forwards;
}
.rise-1 { animation-delay: 0.05s; }
.rise-2 { animation-delay: 0.15s; }
.rise-3 { animation-delay: 0.25s; }
.rise-4 { animation-delay: 0.4s; }
@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

/* Error shake, toggled from JS when something fails. opacity:1 is required
   here: applying .shake replaces the rise animation, and without the fill
   from rise the element would fall back to the .rise base opacity of 0 and
   the whole card would vanish right when the error matters most. */
.card.shake { animation: shake 0.45s var(--ease-out); opacity: 1; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(8px); }
  60%  { transform: translateX(-5px); }
  80%  { transform: translateX(3px); }
}

/* ============ Responsive ============ */

@media (max-width: 900px) {
  .page {
    grid-template-columns: 1fr;
    gap: 26px;
    align-content: start;
    align-content: safe center;
  }
  .brand { max-width: 460px; margin: 0 auto; }
  .brand__mark { margin-bottom: 18px; }
  .brand h1 { font-size: clamp(30px, 7.6vw, 40px); }
  .brand__foot { display: none; }
  .card-wrap { justify-content: stretch; }
  .card { max-width: 460px; margin: 0 auto; }
  .wave { width: 260vmax; top: 30%; opacity: 0.35; }
}

/* Fliesstext und Claim-Zeile fallen weg, sobald es eng wird. Auf einem Telefon
   stand die Buehne sonst auf dem ganzen ersten Bildschirm und der
   Anmelden-Knopf lag unter der Kante: genau im Fall "Sitzung abgelaufen"
   musste man erst scrollen, um wieder hineinzukommen. Logo und Ueberschrift
   bleiben, damit oben steht, wo man ist.
   Bedingung ist die HOEHE, nicht nur die Breite: ein Tablet im Hochformat ist
   schmal genug fuer eine Spalte, hat aber reichlich Platz und soll den Text
   behalten. */
@media (max-width: 900px) and (max-height: 900px) {
  .brand__sub, .brand__eyebrow { display: none; }
}

/* Touchgeraete: die Buehne kommt zur Ruhe, sobald sie einmal steht.
   Drei weichgezeichnete Flaechen, ein blendender Grain-Layer und der
   backdrop-filter der Karte darueber laufen sonst endlos weiter, auf einer
   Seite, die gern minutenlang offen liegt. Das Standbild bleibt dasselbe. */
/* Telefon im Querformat: gut 400px hoch, davon die Haelfte Tastatur. Hier
   zaehlt nur noch das Formular.
   Die Bedingung haengt bewusst NICHT an der Breite: ein iPhone 15 Pro Max quer
   ist 932px breit und waere durch jede max-width-Schranke unter 932 gefallen,
   also genau bei den Geraeten, um die es hier geht. pointer:coarse trennt das
   Telefon stattdessen vom kurzen Fenster am Rechner, das die Buehne behalten
   soll. */
@media (max-height: 480px) and (orientation: landscape) and (pointer: coarse) {
  .page {
    grid-template-columns: 1fr;
    padding-top: 12px;
    gap: 12px;
  }
  .brand__eyebrow, .brand h1, .brand__sub, .brand__foot { display: none; }
  .brand__mark { margin-bottom: 0; }
  .card { padding: 20px 22px; }
  .card > p, .card p.sub { margin-bottom: 14px; }
  .field { margin-bottom: 10px; }
  .field label { margin-bottom: 4px; }
}

@media (hover: none) and (pointer: coarse) {
  .blob, .wave, .grain { animation: none; }
  /* Ohne Animation braucht keine der drei Flaechen mehr eine eigene
     GPU-Textur. */
  .blob { filter: blur(70px); will-change: auto; }
  .grain { mix-blend-mode: normal; opacity: 0.04; }
}

@media (prefers-reduced-motion: reduce) {
  .blob, .wave, .grain { animation: none; will-change: auto; }
  .rise { animation: none; opacity: 1; transform: none; }
  .card.shake { animation: none; }
  * { transition-duration: 0.01ms !important; }
}
