/* agentella — öffentliche Demo-Strecke (/demo, /demo-anfrage, /demo/<token>).
   EINE Quelle für alle drei Seiten. Tokens 1:1 aus tokens.css / landing.css,
   damit die Demo sich anfühlt wie dieselbe Software wie die Landingpage.

   Liegt bewusst NICHT unter /static: das ist basic-auth-geschützt, die
   Demo-Seiten sind öffentlich. Ausgeliefert unter /demo/assets/ (der
   /demo-Präfix ist in server.py auth-exempt). Die Fonts kommen ohne Kopie
   direkt aus web/vendor/fonts — gemountet als /demo/assets/fonts. */

/* ---------- Fonts (selbst gehostet, DSGVO — nur die genutzten Schnitte) ---------- */
@font-face {
  font-family: 'Instrument Sans'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/instrument-sans-400-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Instrument Sans'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/instrument-sans-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Sans'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(fonts/instrument-sans-600-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Instrument Sans'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(fonts/instrument-sans-600-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Sora'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(fonts/sora-600-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Sora'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(fonts/sora-600-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Sora'; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/sora-700-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Sora'; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fonts/sora-700-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/jetbrains-mono-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  --bg: #0a0e0d;
  --bg-raise: #101614;
  --glass: rgba(255, 255, 255, .035);
  --glass-2: rgba(255, 255, 255, .07);
  --glass-hi: rgba(255, 255, 255, .10);
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .16);
  --text: #e9f2ee;
  --muted: #8a9a93;
  --accent: #86efce;
  --accent-dim: #3ec99b;
  --accent-ink: #052e21;
  --accent-soft: rgba(134, 239, 206, .10);
  --accent-glow: rgba(110, 231, 197, .22);
  --red: #ff8080;
  --red-ink: #2b0707;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "Instrument Sans", system-ui, sans-serif;
  --display: "Sora", var(--sans);
  --ease: cubic-bezier(.25, 1, .5, 1);
  --radius: 16px;
  --shadow-raise: 0 10px 30px rgba(0, 0, 0, .38),
                  0 1px 2px rgba(0, 0, 0, .5),
                  inset 0 1px 0 var(--glass-hi);
  --shadow-inset: inset 0 2px 8px rgba(0, 0, 0, .45),
                  inset 0 -1px 0 rgba(255, 255, 255, .05);
}

* { box-sizing: border-box; margin: 0; }
/* Eigene display-Regeln schlagen sonst das hidden-Attribut des Browsers —
   sichtbar geworden am Anruf-Orb auf einer abgelaufenen Kunden-Demo. */
[hidden] { display: none !important; }

body {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(20px, 5vw, 48px) 20px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* ---------- Atmosphäre: Aurora + Grain (wie Landingpage) ---------- */
/* Anders als auf der langen Landingpage ist die Demo genau einen Screen hoch —
   die Blobs sitzen deshalb im Sichtfeld statt weit darüber. */
.aurora {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; filter: blur(80px); opacity: 1;
}
.aurora span { position: absolute; border-radius: 50%; will-change: transform; }
.aurora .a {
  width: min(62vw, 620px); aspect-ratio: 1; top: -12%; left: 42%;
  background: radial-gradient(circle, rgba(110, 231, 197, .22), transparent 66%);
  animation: drift-a 17s var(--ease) infinite alternate;
}
.aurora .b {
  width: min(54vw, 540px); aspect-ratio: 1; bottom: -16%; left: -8%;
  background: radial-gradient(circle, rgba(56, 189, 178, .16), transparent 66%);
  animation: drift-b 21s var(--ease) infinite alternate;
}
@keyframes drift-a { to { transform: translate(-22%, 26%) scale(1.28); } }
@keyframes drift-b { to { transform: translate(26%, -20%) scale(1.2); } }

body::after {
  content: ""; position: fixed; inset: 0; z-index: 60;
  pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Karte ---------- */
.card {
  position: relative; z-index: 2;
  width: 100%; max-width: 540px;
}
.card.wide { max-width: 480px; }

/* Auftritt in Etappen statt als ein Block — die Seite baut sich einmal
   sichtbar auf. nth-child statt fester Selektoren, weil die drei Seiten
   unterschiedlich viele Kinder haben. */
/* h1 ausgenommen: die hat unten ihre eigene Wisch-Animation. Ohne das
   Ausnehmen gewinnt der ID-Selektor #body > * gegen .card h1, und auf
   /demo-anfrage bliebe der Wisch aus. */
.card > *:not(h1), #body > *:not(h1) { animation: enter .6s var(--ease) both; }
.card > :nth-child(1) { animation-delay: .02s; }
.card > :nth-child(2) { animation-delay: .12s; }
.card > :nth-child(3) { animation-delay: .22s; }
.card > :nth-child(4) { animation-delay: .32s; }
.card > :nth-child(5) { animation-delay: .42s; }
#body > :nth-child(1) { animation-delay: .10s; }
#body > :nth-child(2) { animation-delay: .18s; }
#body > :nth-child(3) { animation-delay: .26s; }
#body > :nth-child(4) { animation-delay: .34s; }
@keyframes enter { from { opacity: 0; transform: translateY(16px); } }

/* Überschrift wischt zusätzlich von links auf */
.card h1 { animation: enter-wipe .8s var(--ease) both; animation-delay: .1s; }
@keyframes enter-wipe {
  from { opacity: 0; transform: translateY(16px); clip-path: inset(0 100% 0 0); }
  60%  { opacity: 1; }
  to   { opacity: 1; transform: none; clip-path: inset(0 -8% 0 0); }
}

/* Der Orb kommt aus der Tiefe */
.card > .call { animation-name: enter-orb; animation-duration: .8s; }
@keyframes enter-orb { from { opacity: 0; transform: translateY(20px) scale(.9); } }

/* ---------- Marke ---------- */
.brand {
  display: inline-flex; gap: 11px; align-items: center;
  text-decoration: none; color: var(--text); margin-bottom: 34px;
}
.brand-mark { width: 30px; height: 30px; flex-shrink: 0; color: var(--accent); }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-name {
  font-family: var(--display); font-weight: 700; font-size: 17px;
  letter-spacing: -.015em;
}
.brand-name i { font-style: normal; color: var(--accent); margin-left: .06em; }

/* ---------- Typografie ---------- */
h1 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(30px, 6.2vw, 44px); line-height: 1.08;
  letter-spacing: -.03em; text-wrap: balance; margin-bottom: 14px;
}
.lead { color: var(--muted); font-size: 16.5px; max-width: 46ch; }
.lead strong { color: var(--text); font-weight: 600; }

/* Ladezustand der Kunden-Demo: erst zeigen, wenn der Betrieb bekannt ist */
.skel { display: grid; gap: 13px; max-width: 46ch; }
.skel i {
  display: block; height: 15px; border-radius: 6px;
  background: linear-gradient(90deg, var(--glass) 25%, var(--glass-2) 37%, var(--glass) 63%);
  background-size: 400% 100%; animation: shimmer 1.5s linear infinite;
}
.skel .t { height: clamp(32px, 6.2vw, 46px); width: 76%; margin-bottom: 8px; }
.skel .b { width: 58%; }
@keyframes shimmer { to { background-position: -400% 0; } }

/* ---------- Call-Panel: der Orb ---------- */
.call {
  display: grid; justify-items: center;
  /* Kopfraum für den Kranz, der über den Orb hinausragt */
  margin: clamp(56px, 10vw, 78px) 0 0;
}

.orb-btn {
  display: grid; justify-items: center; gap: 50px;
  background: none; border: 0; padding: 0; border-radius: 24px;
  font: inherit; color: var(--text); cursor: pointer;
}
.orb-btn[hidden] { display: none; }

/* Bezugsmitte des Kranzes ist der Orb — nicht der Button (der trägt
   zusätzlich die Beschriftung und wäre 19 px versetzt). */
.orb-ring {
  position: relative; display: grid; place-items: center;
  width: 126px; height: 126px;
}
.orb-ring canvas {
  position: absolute; left: 50%; top: 50%;
  width: 250px; height: 250px; transform: translate(-50%, -50%);
  pointer-events: none;
  /* Farbe der Wellenform-Kontur — das JS liest sie per getComputedStyle,
     dadurch wechselt sie mit dem Anruf-Zustand mit. */
  color: var(--accent);
}
.is-live .orb-ring canvas { color: var(--red); }

/* Atmender Lichthof hinter dem Orb — läuft dauerhaft, macht die Seite
   auch ohne Interaktion lebendig. Nur transform/opacity. */
.orb-ring::before {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 210px; height: 210px; margin: -105px 0 0 -105px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow), transparent 68%);
  pointer-events: none;
  animation: halo 3.4s var(--ease) infinite alternate;
}
@keyframes halo {
  from { opacity: .35; transform: scale(.82); }
  to   { opacity: .8;  transform: scale(1.12); }
}

.orb-face {
  position: relative;
  width: 126px; height: 126px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--accent), var(--accent-dim));
  color: var(--accent-ink);
  box-shadow: 0 14px 40px rgba(110, 231, 197, .28),
              inset 0 2px 0 rgba(255, 255, 255, .45);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease),
              background .3s var(--ease);
}
.orb-face svg { width: 42px; height: 42px; }
.orb-face .g-end { display: none; }
.is-live .orb-face .g-call { display: none; }
.is-live .orb-face .g-end { display: block; }

/* Mikrofonpegel des Anrufers: Lichtring INNEN im Orb — außen läge er im
   Kranz der Gegenstelle und würde ihn zerschneiden.
   Nur transform/opacity, damit der Compositor die Arbeit macht. */
.orb-mic {
  position: absolute; inset: 9px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .6); pointer-events: none;
  transform: scale(var(--mic-scale, .84)); opacity: var(--mic-alpha, 0);
  will-change: transform, opacity;
}

/* Verbindungsaufbau: umlaufender Sweep */
.orb-spin {
  position: absolute; inset: -14px; border-radius: 50%;
  opacity: 0; pointer-events: none;
  background: conic-gradient(from 0deg, transparent 0 62%,
              var(--accent) 88%, transparent 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 0);
          mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 0);
}
.is-connecting .orb-spin { opacity: .9; animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }

.orb-label {
  font-family: var(--display); font-weight: 600; font-size: 17px;
  letter-spacing: -.01em;
}

/* Zustände */
.is-connecting .orb-face { background: linear-gradient(160deg, #cdf6e6, var(--accent-dim)); }
.is-live .orb-face {
  background: linear-gradient(160deg, var(--red), #e05a5a);
  color: var(--red-ink);
  box-shadow: 0 14px 40px rgba(255, 128, 128, .26),
              inset 0 2px 0 rgba(255, 255, 255, .4);
}
.is-live .orb-mic { border-color: rgba(255, 255, 255, .5); }

@media (hover: hover) and (pointer: fine) {
  .orb-btn:hover .orb-face { transform: translateY(-2px) scale(1.02); }
}
.orb-btn:active .orb-face { transform: translateY(1px) scale(.985); }
.orb-btn:disabled { cursor: wait; }
.orb-btn:disabled .orb-face { transform: none; }

/* ---------- Status: eine Zeile, kein Layoutsprung ---------- */
.status {
  margin-top: 22px; min-height: 2.5em; max-width: 34ch;
  text-align: center; font-size: 14.5px; color: var(--muted);
  text-wrap: balance;
}
.status.err { color: var(--red); }
.status .dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); margin-right: 7px; vertical-align: middle;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ---------- Formular ---------- */
.field { margin-top: 16px; }
label {
  display: block; font-family: var(--mono); font-size: 10.5px;
  color: var(--muted); text-transform: uppercase; letter-spacing: .14em;
  margin-bottom: 6px;
}
label .opt { text-transform: none; letter-spacing: 0; opacity: .7; }
input, select {
  width: 100%; min-height: 48px; padding: 12px 14px;
  border-radius: 12px; font-family: inherit; font-size: 16px; /* < 16px zoomt auf iOS */
  border: 1px solid var(--line-strong); background: var(--glass);
  color: var(--text);
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
input::placeholder { color: #5d6d67; }
input:hover, select:hover { border-color: rgba(255, 255, 255, .26); }
input:focus, select:focus { outline: none; border-color: var(--accent); background: var(--glass-2); }
input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%238a9a93' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M4 6.5 8 10.5 12 6.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  background-size: 16px; padding-right: 40px;
}
select option { background: var(--bg-raise); color: var(--text); }

.btn {
  margin-top: 26px; width: 100%; min-height: 52px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--display); font-weight: 600; font-size: 16.5px;
  border: 0; border-radius: 14px; cursor: pointer; text-decoration: none;
  background: linear-gradient(160deg, var(--accent), var(--accent-dim));
  color: var(--accent-ink);
  box-shadow: 0 10px 30px rgba(110, 231, 197, .22);
  transition: transform .16s var(--ease), filter .16s var(--ease),
              box-shadow .16s var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
}
.btn:active { transform: translateY(1px); box-shadow: var(--shadow-inset); }
.btn:disabled { cursor: wait; filter: saturate(.5) brightness(.85); transform: none; }
.btn.inline { width: auto; padding: 0 28px; }
.btn .spin {
  width: 17px; height: 17px; border-radius: 50%;
  border: 2px solid rgba(5, 46, 33, .3); border-top-color: var(--accent-ink);
  animation: spin .7s linear infinite;
}

.form-status {
  margin-top: 14px; min-height: 1.4em; font-size: 14.5px;
  color: var(--red); text-align: center;
}

/* Erfolgszustand */
.done { text-align: center; }
.done .tick {
  width: 58px; height: 58px; margin: 0 auto 22px; border-radius: 50%;
  display: grid; place-items: center; color: var(--accent-ink);
  background: linear-gradient(160deg, var(--accent), var(--accent-dim));
  box-shadow: 0 10px 30px rgba(110, 231, 197, .22);
  animation: pop .45s var(--ease) both;
}
.done .tick svg { width: 26px; height: 26px; }
@keyframes pop { from { opacity: 0; transform: scale(.82); } }
.done h1 { font-size: clamp(26px, 5.4vw, 34px); }
.done .lead { margin: 0 auto; }
.done:focus-visible { outline: none; }

/* ---------- Fußzeile ---------- */
.foot {
  margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted); line-height: 1.6;
}
.foot a { color: var(--accent); text-decoration: none; }
.foot a:hover { text-decoration: underline; }
/* Padding statt reiner Textzeile: sonst wären die Links nur 21 px hoch
   und damit unter der 44-px-Trefferfläche für Daumen. */
.foot nav { margin-top: 0; display: flex; flex-wrap: wrap; gap: 0 18px; }
.foot nav a { padding: 11px 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

@media (max-width: 420px) {
  .orb-btn { gap: 44px; }
  .orb-ring { width: 112px; height: 112px; }
  .orb-ring canvas { width: 220px; height: 220px; }
  .orb-face { width: 112px; height: 112px; }
  .orb-face svg { width: 38px; height: 38px; }
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .orb-ring::before { animation: none; opacity: .5; transform: scale(1); }
  .card h1 { clip-path: none; }
  .is-connecting .orb-spin { opacity: .5; animation: none; }
  .orb-mic { display: none; }
}
