/* KI-Assistent für Unternehmen (Alwisr): live chat demo, connections and page details.
   Used by /ki-assistent-unternehmen and /en/ai-assistant-for-business; the chat demo part is also
   loaded by /ki-texte-erkennen and /en/detecting-ai-generated-text (cards there: ki-nachweis.css).
   Animations use transform and opacity only; prefers-reduced-motion shows every scene complete. */

/* ─── Alwisr live: stage ─────────────────────────────────────────────────── */
.alw-live { position: relative; overflow-x: clip; }
.alw-live__stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 40px);
  align-items: stretch;
  margin-top: clamp(32px, 4vw, 56px);
}

/* Spotlight beam: picks up the hero photo and falls onto the chat window. */
.alw-live__beam {
  position: absolute;
  top: -120px;
  right: 8%;
  width: min(640px, 70%);
  height: 560px;
  pointer-events: none;
  background: radial-gradient(ellipse 46% 60% at 50% 0%, rgba(120, 166, 228, .26), rgba(120, 166, 228, .08) 55%, transparent 72%);
  transform-origin: 50% 0;
  transform: rotate(-12deg);
  opacity: .9;
  z-index: 0;
}
.js .alw-live__beam { animation: alw-beam 9s var(--ease-in-out) infinite alternate; }
@keyframes alw-beam {
  from { transform: rotate(-14deg) scaleY(.96); opacity: .75; }
  to { transform: rotate(-8deg) scaleY(1.04); opacity: 1; }
}

/* ─── Tabs ─────────────────────────────────────────────────────────────── */
.alw-live__tabs { position: relative; z-index: 1; display: grid; grid-auto-rows: 1fr; gap: 10px; }
.alw-tab {
  position: relative;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 14px 16px 16px 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: border-color .25s ease, background-color .25s ease;
}
.alw-tab strong { font-size: 16px; font-weight: 600; }
.alw-tab span { color: var(--muted); font-size: 14px; }
.alw-tab::before {
  content: '';
  position: absolute;
  inset: 12px auto 12px 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--blue);
  transform: scaleY(0);
  transition: transform .35s var(--ease-out);
}
.alw-tab__progress {
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: var(--blue);
  transform: scaleX(0);
  transform-origin: 0 50%;
}
.alw-tab:hover { border-color: var(--line-strong); }
.alw-tab:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.alw-tab.is-active { border-color: var(--blue); background: var(--blue-soft); }
.alw-tab.is-active::before { transform: scaleY(1); }
.alw-tab:active { transform: scale(.99); }

/* ─── Chat window ──────────────────────────────────────────────────────── */
.alw-window {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: var(--radius-l);
  background: linear-gradient(180deg, #151a24 0%, #0b0d12 60%);
  color: #e6ebf3;
  box-shadow: 0 2px 6px rgba(11, 13, 18, .18), 0 40px 90px rgba(15, 39, 68, .28);
}
.alw-window__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  font-size: 14px;
}
.alw-window__dots { display: flex; gap: 6px; }
.alw-window__dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .16); }
.alw-window__title { display: flex; align-items: center; color: #f3f6fb; }
.alw-window__status { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; color: #aeb8c8; font-size: 13px; }
.alw-window__status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #3ccf91; }

.alw-window__body {
  position: relative;
  height: clamp(420px, 58vh, 560px);
  overflow-y: auto;
  padding: 22px clamp(16px, 2.4vw, 28px) 26px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .2) transparent;
}
.alw-scene { display: grid; gap: 14px; }
.alw-scene[hidden] { display: none; }
.alw-scene + .alw-scene { margin-top: 28px; padding-top: 28px; border-top: 1px dashed rgba(255, 255, 255, .14); }
.is-enhanced .alw-scene + .alw-scene { margin-top: 0; padding-top: 0; border-top: 0; }

/* Messages */
.alw-msg { max-width: 92%; font-size: 15.5px; line-height: 1.55; }
.alw-msg p { margin: 0; }
.alw-msg p + p, .alw-msg p + ul, .alw-msg ul + p { margin-top: 6px; }
.alw-msg ul { margin: 6px 0 0; padding-left: 18px; }
.alw-msg li + li { margin-top: 3px; }
.alw-msg li span { color: #9aa6b8; }
.alw-msg--user {
  justify-self: end;
  padding: 10px 15px;
  border-radius: 16px 16px 4px 16px;
  background: #222d3d;
  color: #f3f6fb;
}
/* When the question scrolls out of view, a one-line pin keeps it readable (JS only). */
.alw-window__view { position: relative; }
.alw-window__pin {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: flex-end;
  padding: 8px clamp(16px, 2.4vw, 28px) 10px;
  background: linear-gradient(180deg, #141923 72%, rgba(20, 25, 35, 0));
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s var(--ease-out);
}
.alw-window__pin.is-on { opacity: 1; transform: none; }
.alw-window__pin span { max-width: min(100%, 560px); overflow: hidden; padding: 6px 12px; border-radius: 12px 12px 4px 12px; background: #222d3d; box-shadow: 0 0 0 1px rgba(143, 182, 238, .22); color: #f3f6fb; font-size: 13.5px; white-space: nowrap; text-overflow: ellipsis; }
.alw-msg--ai { justify-self: start; }
.alw-system { justify-self: center; margin: 4px 0 0; padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, .06); color: #9aa6b8; font-size: 12.5px; letter-spacing: .02em; }
.alw-msg__who { display: block; margin-bottom: 4px; color: #8fb6ee; font-size: 11.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }

.alw-typing { display: inline-flex; align-items: center; gap: 5px; justify-self: start; padding: 10px 14px; border-radius: 14px; background: rgba(255, 255, 255, .06); }
.alw-typing i { width: 6px; height: 6px; border-radius: 50%; background: #aeb8c8; }
.js .alw-typing.is-shown i { animation: alw-dot 1s ease-in-out infinite; }
.js .alw-typing.is-shown i:nth-child(2) { animation-delay: .15s; }
.js .alw-typing.is-shown i:nth-child(3) { animation-delay: .3s; }
@keyframes alw-dot { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
.alw-typing span { margin-right: 6px; color: #aeb8c8; font-size: 13.5px; }
.alw-typing { display: none; }
.is-enhanced .alw-typing.is-shown { display: inline-flex; }

/* Result cards */
.alw-result { display: grid; gap: 10px; margin-top: 10px; padding: 12px 14px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 12px; background: rgba(255, 255, 255, .04); }
.alw-result__metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.alw-result__metrics span { display: grid; gap: 1px; padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, .05); color: #9aa6b8; font-size: 12px; }
.alw-result__metrics strong { color: #fff; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.alw-result__metrics .ok strong { color: #6fe0ae; }
.alw-result__rows { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: 13.5px; }
.alw-result__rows li { display: flex; justify-content: space-between; gap: 12px; }
.alw-result__rows li span:last-child { color: #9fc2f2; }
/* Keyword table: search term, competitor position, own position; the leader is green. */
.alw-kw li { display: grid; grid-template-columns: minmax(0, 1fr) 84px 52px; gap: 10px; align-items: baseline; }
.alw-kw li span { color: #c9d2df; }
.alw-kw li span:first-child { min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
.alw-kw li span:nth-child(n+2) { color: #8f9bad; font-variant-numeric: tabular-nums; text-align: right; }
.alw-kw li span.is-ahead { color: #6fe0ae; font-weight: 600; }
.alw-kw--ads li { grid-template-columns: minmax(0, 1fr) 92px 92px; }
.alw-kw .alw-kw__head span { color: #8f9bad; font-size: 12px; letter-spacing: .02em; }
.alw-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; margin: 0; }
.alw-fields div { display: grid; gap: 2px; }
.alw-fields dt { color: #9aa6b8; font-size: 12px; }
.alw-fields dd { margin: 0; padding: 6px 9px; border: 1px solid rgba(143, 182, 238, .35); border-radius: 7px; background: rgba(143, 182, 238, .08); font-size: 14px; overflow-wrap: anywhere; }
.alw-check { display: flex; align-items: center; gap: 8px; color: #6fe0ae; font-size: 13.5px; }
.alw-check::before { content: '✓'; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #2f9e74; color: #fff; font-size: 11px; }
.alw-diff { overflow: hidden; border: 1px solid rgba(255, 255, 255, .1); border-radius: 10px; font-family: ui-monospace, Consolas, 'SFMono-Regular', monospace; font-size: 13px; }
.alw-diff__file { padding: 6px 12px; border-bottom: 1px solid rgba(255, 255, 255, .1); color: #aeb8c8; font-size: 12px; }
.alw-diff code { display: block; padding: 3px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.alw-diff .del { background: rgba(214, 84, 96, .16); color: #ffb3ba; }
.alw-diff .add { background: rgba(60, 207, 145, .14); color: #a8f0cf; }

/* Simulated buttons */
.alw-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.alw-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 8px;
  color: #e6ebf3;
  font-size: 13.5px;
  font-weight: 600;
}
.alw-btn--primary { border-color: #3b74c9; background: #2f63b3; color: #fff; }
.alw-btn::after {
  content: '';
  position: absolute;
  inset: -5px;
  border: 2px solid #8fb6ee;
  border-radius: 12px;
  opacity: 0;
  transform: scale(.9);
}
.js .alw-btn.is-pressed { animation: alw-press .45s var(--ease-out) both; }
.js .alw-btn.is-pressed::after { animation: alw-ring .9s var(--ease-out) both; }
@keyframes alw-press { 40% { transform: scale(.94); } 100% { transform: scale(1); } }
@keyframes alw-ring { 0% { opacity: .9; transform: scale(.9); } 100% { opacity: 0; transform: scale(1.18); } }
.alw-approval { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 11px 14px; border: 1px solid rgba(240, 198, 98, .45); border-radius: 12px; background: rgba(240, 198, 98, .08); color: #f4dfa6; font-size: 14px; }
.alw-approval p { flex: 1 1 220px; margin: 0; }
.alw-approval .alw-actions { margin-top: 0; }
.alw-done { color: #6fe0ae; }

/* Streaming answers (JS only): words, then tables and buttons block by block. */
.is-enhanced .alw-stream { opacity: 0; }
.is-enhanced .alw-stream.is-on { opacity: 1; transition: opacity .22s ease-out; }

/* Step reveal (JS only). Without JS every scene is shown in full. */
.is-enhanced [data-step] { opacity: 0; transform: translateY(10px); }
.is-enhanced [data-step].is-shown { opacity: 1; transform: none; transition: opacity .45s var(--ease-out), transform .45s var(--ease-out); }
.is-enhanced .alw-btn[data-step] { opacity: 1; transform: none; }
.is-enhanced .alw-typing[data-step] { transform: none; }

/* Composer: the question is typed here before it is sent (JS only). */
.alw-composer { display: none; }
.is-enhanced .alw-composer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 clamp(12px, 2vw, 20px) clamp(12px, 2vw, 18px);
  padding: 8px 8px 8px 16px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px;
  background: rgba(255, 255, 255, .04);
  transition: border-color .25s ease;
}
.alw-composer.is-typing, .alw-composer.is-ready { border-color: rgba(143, 182, 238, .55); }
.alw-composer.is-ready .alw-composer__send { box-shadow: 0 0 0 4px rgba(47, 99, 179, .35); }
.alw-composer__text { flex: 0 1 auto; min-width: 0; overflow: hidden; color: #f3f6fb; font-size: 15px; white-space: nowrap; text-overflow: ellipsis; direction: ltr; }
.alw-composer__text:empty::before { content: attr(data-placeholder); color: #7d8797; }
.alw-composer__caret { width: 2px; height: 18px; margin-left: -8px; border-radius: 1px; background: #8fb6ee; opacity: 0; }
.alw-composer.is-typing .alw-composer__caret { opacity: 1; animation: alw-caret 1s steps(1) infinite; }
@keyframes alw-caret { 50% { opacity: 0; } }
.alw-composer__send { display: grid; flex: 0 0 auto; margin-left: auto; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #2f63b3; color: #fff; }
.alw-composer__send svg { width: 16px; height: 16px; }
.js .alw-composer.is-sending .alw-composer__send { animation: alw-press .45s var(--ease-out) both; }

.alw-live__note { position: relative; z-index: 1; margin-top: 18px; color: var(--muted); font-size: 14px; }

/* ─── Connections ──────────────────────────────────────────────────────── */
.alw-connect { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
.alw-connect__media { overflow: hidden; border-radius: var(--radius-l); box-shadow: var(--shadow-1); }
.alw-connect__media img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.alw-connect__list { display: grid; gap: 0; margin: 28px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.alw-connect__list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 18px; align-items: start; padding: 18px 0; border-bottom: 1px solid var(--line); }
.alw-connect__list strong { font-size: 17px; font-weight: 600; }
.alw-connect__list p { grid-column: 1; margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.5; }
.alw-state { grid-column: 2; grid-row: 1 / span 2; align-self: center; padding: 5px 11px; border-radius: 999px; background: #e8f6ef; color: #1d6a4b; font-size: 13px; font-weight: 600; white-space: nowrap; }
.alw-state--choice { background: var(--blue-soft); color: var(--blue); }
.alw-state--soon { background: #fff; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }

/* ─── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .alw-live__stage { grid-template-columns: minmax(0, 1fr); }
  .alw-live__tabs { display: flex; gap: 8px; margin: 0 calc(-1 * var(--gutter)); padding: 2px var(--gutter) 6px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter); scrollbar-width: none; }
  .alw-live__tabs::-webkit-scrollbar { display: none; }
  .alw-tab { flex: 0 0 auto; min-width: 168px; scroll-snap-align: start; padding: 11px 14px 13px 16px; }
  .alw-tab span { font-size: 13px; }
  .alw-live__beam { right: -10%; width: 100%; }
  .alw-window__body { height: 420px; }
  .alw-composer__text { font-size: 14.5px; }
  .alw-msg { max-width: 100%; font-size: 15px; }
  .alw-result__metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .alw-fields { grid-template-columns: minmax(0, 1fr); }
  .alw-window__status { display: none; }
  .alw-connect { grid-template-columns: minmax(0, 1fr); }
  .alw-connect__media img { aspect-ratio: 16 / 10; }
}
@media (max-width: 520px) {
  .alw-result__rows li { flex-direction: column; gap: 1px; }
  .alw-kw li { grid-template-columns: minmax(0, 1fr) 66px 34px; gap: 8px; }
  .alw-kw--ads li { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: 2px; }
  .alw-kw--ads li span:first-child { grid-column: 1 / -1; }
  .alw-kw--ads li span:nth-child(n+2) { text-align: left; }
}
@media (max-width: 420px) {
  .alw-window__bar { padding: 12px 14px; }
  .alw-connect__list li { grid-template-columns: minmax(0, 1fr); }
  .alw-state { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .js .alw-live__beam { animation: none; }
  .is-enhanced [data-step], .is-enhanced .alw-stream { opacity: 1 !important; transform: none !important; transition: none !important; }
  .js .alw-btn.is-pressed, .js .alw-btn.is-pressed::after, .js .alw-typing.is-shown i, .js .alw-composer.is-sending .alw-composer__send { animation: none !important; }
  .is-enhanced .alw-composer { display: none; }
}

/* ─── Alwisr wordmark (inline SVG, crisp at every size) ─────────────────── */
.alw-wordmark { display: inline-block; width: auto; overflow: visible; color: currentColor; }
.alw-wordmark path { fill: none; stroke: currentColor; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.alw-wordmark__lines { stroke-width: 1.1px; }
.alw-wordmark__dots { stroke-width: 3.3px; }
.alw-eyebrow { display: inline-flex; align-items: center; gap: 10px; }
.alw-wordmark--hero { height: 17px; }
.alw-wordmark--bar { display: block; height: 13px; }
.alw-wordmark--bar .alw-wordmark__lines { stroke-width: .9px; }
.alw-wordmark--bar .alw-wordmark__dots { stroke-width: 2.4px; }
.alw-wordmark--hero .alw-wordmark__dots { stroke-width: 2.9px; }
@media (max-width: 420px) {
  .alw-wordmark--hero { height: 15px; }
}

/* ─── Im Hintergrund: works, checks, automates, improves ─────────────────── */
.alw-loop-wrap { position: relative; margin-top: clamp(32px, 4vw, 56px); }
.alw-loop { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(16px, 2.4vw, 32px); margin: 0; padding: 0; list-style: none; }
.alw-loop-wrap::before { content: ''; position: absolute; top: 9px; left: 8px; right: 0; height: 2px; background: linear-gradient(90deg, var(--blue), rgba(26, 78, 140, .18)); }
.alw-loop__step { position: relative; padding-top: 42px; }
.alw-loop__step::before { content: ''; position: absolute; top: 0; left: 0; width: 20px; height: 20px; box-sizing: border-box; border: 3px solid var(--blue); border-radius: 50%; background: var(--bg-soft); }
.alw-loop__num { display: block; color: var(--blue); font-size: 13px; font-weight: 700; letter-spacing: .12em; }
.alw-loop__step h3 { margin: 6px 0 10px; font-size: clamp(24px, 2.2vw, 30px); font-weight: 400; letter-spacing: -.02em; line-height: 1.1; }
.alw-loop__step p { margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.55; }
.alw-loop__tag { display: inline-block; margin-top: 14px; padding: 4px 11px; border-radius: 999px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); color: var(--blue); font-size: 13px; font-weight: 600; }
/* A signal runs along the track: the cycle never stops. */
.alw-loop__signal { position: absolute; z-index: 1; top: 6px; left: 8px; right: 0; height: 8px; overflow: hidden; pointer-events: none; }
.alw-loop__signal i { position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, rgba(26, 78, 140, 0) 70%, rgba(26, 78, 140, .55) 99%, transparent 99%); }
.alw-loop__signal i::after { content: ''; position: absolute; top: 0; right: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 4px rgba(26, 78, 140, .16); }
.js .alw-loop__signal i { animation: alw-signal 5.5s var(--ease-in-out) infinite; }
@keyframes alw-signal { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@media (max-width: 900px) {
  .alw-loop { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .alw-loop-wrap::before { top: 8px; bottom: 8px; left: 9px; right: auto; width: 2px; height: auto; background: linear-gradient(180deg, var(--blue), rgba(26, 78, 140, .18)); }
  .alw-loop__step { padding: 0 0 0 44px; }
  .alw-loop__signal { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .js .alw-loop__signal i { animation: none; transform: translateX(0); }
}
