/* KI-Branchenberater (site/assets/js/berater.js), Optik „Nacht“ (Sydneys Wahl, 02.11.2026):
   dunkle Fläche über fast die ganze Bildschirmbreite, Punktefeld dahinter (canvas.berater__dots),
   große gläserne Eingabeleiste, darunter die Antwort wie ein Chat: Ihre Eingabe links, ein Satz, Ideen als Karten,
   dann „Passt nicht ganz?“ und der Anfrage-Knopf. Eine Schrift, keine farbigen Punkte, kein Schimmer.
   Bewegung nach dem Apple-Design-Skill: Rückmeldung beim Drücken, Ideen tauchen aus der Unschärfe auf,
   alles kommt aus der Richtung der Eingabe; „Bewegung reduzieren“ und „Transparenz reduzieren“ werden beachtet. */

.berater {
  --text: #f0ebe1; --muted: #aaa498; --dim: #8f897f;
  --line: rgba(240, 235, 225, 0.1); --line-2: rgba(240, 235, 225, 0.2);
  --glass: rgba(255, 255, 255, 0.05); --glass-2: rgba(255, 255, 255, 0.08);
  --on-text: #12100e;
  --spring: cubic-bezier(0.2, 0.9, 0.25, 1);
  position: relative; isolation: isolate;
  display: grid; grid-template-columns: minmax(0, 1fr);
  margin-inline: calc(50% - min(820px, 50vw - 24px));
  overflow: hidden;
  padding: clamp(28px, 4.4vw, 72px) clamp(20px, 4.4vw, 72px) clamp(32px, 4.4vw, 72px);
  border-radius: clamp(28px, 3vw, 44px);
  background: radial-gradient(120% 80% at 50% 0%, #161412 0%, #0b0a09 60%);
  color: var(--text);
  box-shadow: 0 70px 120px -70px rgba(18, 16, 14, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.berater svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.berater > :not(.berater__dots) { position: relative; z-index: 1; }

/* Punktefeld: oben voll, nach unten ausblendend, damit lange Antworten ruhig bleiben */
.berater__dots {
  position: absolute; z-index: 0; inset: 0 0 auto 0; width: 100%; height: min(100%, 1100px);
  color: #f0ebe1; pointer-events: none;
  -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent);
}

/* ---------- Eingabe ---------- */
.berater__bar {
  display: flex; align-items: center; gap: 14px;
  height: clamp(70px, 6.2vw, 88px); padding: 0 10px 0 clamp(20px, 2vw, 30px);
  border: 1px solid var(--line-2); border-radius: 24px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px) saturate(140%); backdrop-filter: blur(10px) saturate(140%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 24px 50px -30px rgba(0, 0, 0, 0.8);
  transition: border-color 0.25s, background-color 0.25s, box-shadow 0.25s;
}
.berater__bar:focus-within { border-color: rgba(240, 235, 225, 0.5); background: var(--glass-2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 0 0 4px rgba(240, 235, 225, 0.06), 0 24px 50px -30px rgba(0, 0, 0, 0.8); }
.berater__bar input {
  flex: 1; min-width: 0; height: 100%;
  padding: 0; border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: clamp(20px, 2.1vw, 30px); letter-spacing: -0.025em;
  outline: none; caret-color: var(--text);
}
.berater__bar input::placeholder { color: var(--muted); opacity: 0.75; }
.berater__bar button, .berater__composer button {
  flex: none; display: grid; place-items: center;
  width: clamp(52px, 4.6vw, 64px); height: clamp(52px, 4.6vw, 64px);
  border: 0; border-radius: 17px;
  background: var(--text); color: var(--on-text);
  cursor: pointer; touch-action: manipulation;
  transition: transform 0.12s ease-out, opacity 0.2s;
}
.berater__bar button svg, .berater__composer button svg { width: 22px; height: 22px; transition: transform 0.3s var(--spring); }
@media (hover: hover) and (pointer: fine) {
  .berater__bar button:hover svg, .berater__composer button:hover svg { transform: translateX(2px); }
}
.berater__bar button:active, .berater__composer button:active { transform: scale(0.94); }
.berater__bar button[disabled], .berater__composer button[disabled] { opacity: 0.4; cursor: progress; }

.berater__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.berater__chips button {
  min-height: 40px; padding: 8px 16px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: rgba(11, 10, 9, 0.5); color: var(--text);
  font: inherit; font-size: 14.5px; font-weight: 500; letter-spacing: -0.005em;
  cursor: pointer; touch-action: manipulation;
  transition: border-color 0.2s, background-color 0.2s, transform 0.12s ease-out;
}
@media (hover: hover) and (pointer: fine) { .berater__chips button:hover { border-color: rgba(240, 235, 225, 0.5); background: var(--glass-2); } }
.berater__chips button:active { transform: scale(0.96); }
.berater__chips button[disabled] { opacity: 0.45; cursor: progress; }
.berater__fine { margin-top: 14px; color: var(--dim); font-size: 12.5px; line-height: 1.45; letter-spacing: 0.005em; }

/* ---------- Verlauf ---------- */
.berater__result { position: relative; margin-top: clamp(36px, 4vw, 56px); padding-top: clamp(30px, 3.4vw, 44px); border-top: 1px solid var(--line); }
/* Nach der ersten Frage: Beispiele und Hinweiszeile weg, Antwort direkt unter der Eingabe */
.berater.is-asked .berater__chips, .berater.is-asked .berater__fine { display: none; }
.berater.is-asked .berater__result { margin-top: 22px; padding-top: 0; border-top: 0; }
.berater.is-asked .berater__ki { position: static; margin: 0 0 12px; text-align: right; }
.berater__ki { position: absolute; top: 9px; right: 0; color: var(--dim); font-size: 12px; line-height: 1.3; letter-spacing: 0.01em; animation: b-fade 0.6s ease-out both; }
.berater__result:empty { display: none; }
.berater__thread { display: grid; gap: 22px; }

/* Ihre Eingabe links, so wie man liest; sie kommt von oben, aus der Richtung der Leiste */
.berater__me { display: flex; justify-content: flex-start; animation: b-drop 0.55s var(--spring) both; }
.berater__me p {
  max-width: min(640px, 90%); padding: 11px 18px;
  border: 1px solid rgba(185, 196, 232, 0.3); border-radius: 6px 20px 20px 20px;
  background: linear-gradient(135deg, #0a2a96 0%, #06268a 55%, #041a66 100%);
  color: var(--k-cream, #f4efe6);
  box-shadow: inset 0 1px 0 rgba(244, 239, 230, 0.16), 0 14px 30px -18px rgba(6, 38, 138, 0.9);
  font-size: 16px; line-height: 1.45; letter-spacing: -0.005em;
}
.berater__answer + .berater__me { margin-top: 18px; }
.berater__body { display: grid; gap: 22px; min-width: 0; }
.berater__satz { max-width: 820px; min-height: 1.5em; color: var(--text); font-size: clamp(18px, 1.6vw, 22px); line-height: 1.45; letter-spacing: -0.018em; }
.berater__satz .typing { display: inline-flex; padding-top: 10px; }
.berater__satz .typing i { background: var(--muted); }
.berater__w { display: inline-block; animation: b-word 0.5s var(--spring) both; animation-delay: calc(var(--w, 0) * 22ms); }

/* ---------- Ideen ---------- */
.berater__cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.berater__card {
  position: relative;
  border: 1px solid var(--line-2); border-radius: 20px;
  background: rgba(14, 13, 12, 0.78);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: border-color 0.25s, background-color 0.25s, transform 0.12s ease-out;
  transform-origin: 50% 0%;
  animation: b-deal 0.9s var(--spring) both; animation-delay: calc(0.12s + var(--i, 0) * 90ms);
}
/* Einmal läuft ein Kobalt-Licht über jede neue Karte */
.berater__card::after {
  content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; pointer-events: none;
  background: linear-gradient(100deg, rgba(77, 120, 242, 0) 35%, rgba(77, 120, 242, 0.32) 50%, rgba(77, 120, 242, 0) 65%) no-repeat;
  background-size: 260% 100%; background-position: 160% 0; opacity: 0;
  animation: b-sweep 1.3s cubic-bezier(0.4, 0, 0.2, 1) both; animation-delay: calc(0.45s + var(--i, 0) * 90ms);
}
@media (hover: hover) and (pointer: fine) { .berater__card:hover { border-color: rgba(240, 235, 225, 0.38); } }
.berater__card:has(.berater__pick:active) { transform: scale(0.985); }
.berater__card.is-picked { border-color: rgba(91, 132, 255, 0.85); background: linear-gradient(160deg, rgba(20, 73, 224, 0.22), rgba(6, 38, 138, 0.18) 60%, rgba(14, 13, 12, 0.85)); }
.berater__pick {
  display: grid; grid-template-columns: 26px minmax(0, 1fr);
  grid-template-areas: "tick title" ". text";
  column-gap: 14px; row-gap: 6px; align-content: start;
  width: 100%; height: 100%; padding: 20px 52px 20px 20px;
  border: 0; background: none; color: inherit; text-align: left;
  font: inherit; cursor: pointer; touch-action: manipulation;
}
.berater__pick:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; border-radius: 20px; }
.berater__num { display: none; }
.berater__title { grid-area: title; font-size: 17.5px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.3; }
.berater__text { grid-area: text; color: var(--muted); font-size: 15px; line-height: 1.5; }
.berater__tick {
  grid-area: tick; display: grid; place-items: center; align-self: start;
  width: 24px; height: 24px; margin-top: 1px;
  border: 1.5px solid var(--line-2); border-radius: 50%;
  transition: background-color 0.2s, border-color 0.2s, transform 0.35s var(--spring);
}
.berater__tick svg { width: 13px; height: 13px; stroke: #f4efe6; stroke-width: 3; stroke-dasharray: 22; stroke-dashoffset: 22; transition: stroke-dashoffset 0.3s ease-out 0.05s; }
.is-picked .berater__tick { border-color: #4d78f2; background: #1449e0; transform: scale(1.08); }
.is-picked .berater__tick svg { stroke-dashoffset: 0; }
.berater__more {
  position: absolute; top: 12px; right: 12px;
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 999px;
  color: var(--dim); text-decoration: none;
  transition: color 0.2s, background-color 0.2s;
}
.berater__more svg { width: 14px; height: 14px; transition: transform 0.3s var(--spring); }
@media (hover: hover) and (pointer: fine) {
  .berater__more:hover { color: var(--text); background: var(--line); }
  .berater__more:hover svg { transform: translate(1px, -1px); }
}
.berater__more:focus-visible { outline: 2px solid var(--text); outline-offset: 0; }

/* ---------- Nachfrage und Anfrage ---------- */
.berater__foot {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center;
  margin-top: 30px;
  animation: b-rise 0.7s var(--spring) both; animation-delay: 0.5s;
}
.berater__composer {
  display: flex; align-items: center; gap: 10px;
  height: 64px; padding: 0 7px 0 20px;
  border: 1px solid var(--line-2); border-radius: 20px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: border-color 0.25s, background-color 0.25s;
}
.berater__composer:focus-within { border-color: rgba(240, 235, 225, 0.5); background: var(--glass-2); }
.berater__composer input {
  flex: 1; min-width: 0; height: 100%; padding: 0;
  border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: max(16px, 1rem); outline: none;
}
.berater__composer input::placeholder { color: var(--muted); opacity: 0.85; }
.berater__composer button { width: 50px; height: 50px; border-radius: 14px; }
.berater__composer button svg { width: 20px; height: 20px; }
.berater__cta, .berater__go {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 64px; padding: 0 30px;
  border: 1px solid rgba(240, 235, 225, 0.55); border-radius: 20px;
  background: transparent; color: var(--text);
  font: inherit; font-size: 16px; font-weight: 500; letter-spacing: -0.01em; text-decoration: none;
  cursor: pointer; touch-action: manipulation;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s, transform 0.12s ease-out;
}
.berater__go { justify-self: start; min-height: 56px; }
.berater__cta:active, .berater__go:active { transform: scale(0.97); }
.berater__cta.is-ready, .berater__go { border-color: var(--text); background: var(--text); color: var(--on-text); }
.berater__cta svg, .berater__go svg { width: 18px; height: 18px; transition: transform 0.3s var(--spring); }
@media (hover: hover) and (pointer: fine) { .berater__cta:hover svg, .berater__go:hover svg { transform: translateX(3px); } }

/* ---------- Abschicken als Erlebnis (07.11.2026) ---------- */
/* Fliegender Text von der Leiste in die Sprechblase; die Blase wartet, bis er landet */
.berater__ghost {
  position: fixed; z-index: 90; margin: 0; padding: 0;
  color: #f4efe6; font-family: var(--sans, inherit); font-weight: 400; line-height: 1.2; letter-spacing: -0.02em; white-space: nowrap;
  transform-origin: 0 0; pointer-events: none;
}
.berater__me.is-landing { animation: none; }
.berater__me.is-landing p { animation: b-land 0.6s var(--spring) 0.4s both; }
/* Leiste startet: Kobalt-Rand und ein Licht, das einmal hindurchläuft */
.berater__bar { position: relative; overflow: hidden; }
.berater__bar::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0;
  background: linear-gradient(100deg, rgba(20, 73, 224, 0) 30%, rgba(77, 120, 242, 0.42) 50%, rgba(185, 196, 232, 0.2) 55%, rgba(20, 73, 224, 0) 70%) no-repeat;
  background-size: 240% 100%; background-position: 150% 0;
}
.berater__bar.is-launch { animation: b-launch-border 1.4s ease-out both; }
.berater__bar.is-launch::after { animation: b-launch 0.9s cubic-bezier(0.3, 0.7, 0.2, 1) both; }
.berater__bar.is-launch button svg { animation: b-shoot 0.6s var(--spring) both; }
/* Während die KI arbeitet: drei Schritte und eine laufende Kobalt-Leiste */
.berater__scan { display: grid; gap: 14px; padding-top: 4px; }
.berater__steps { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; padding: 0; list-style: none; }
.berater__steps li { position: relative; display: inline-flex; align-items: center; gap: 9px; color: var(--dim); font-size: 15px; letter-spacing: -0.005em; transition: color 0.4s; }
.berater__steps li::before {
  content: ""; flex: none; width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid currentColor; opacity: 0.6;
  transition: background-color 0.3s, border-color 0.3s, opacity 0.3s;
}
.berater__steps li.is-on { color: var(--text); }
.berater__steps li.is-on::before { border-color: #4d78f2; border-top-color: transparent; opacity: 1; animation: b-spin 0.8s linear infinite; }
.berater__steps li.is-done { color: var(--muted); }
.berater__steps li.is-done::before { border-color: #1449e0; background: #1449e0 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f4efe6' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / 9px no-repeat; opacity: 1; }
.berater__scanbar { position: relative; display: block; width: min(420px, 100%); height: 3px; overflow: hidden; border-radius: 3px; background: rgba(240, 235, 225, 0.08); }
.berater__scanbar i { position: absolute; inset: 0; width: 38%; border-radius: inherit; background: linear-gradient(90deg, rgba(20, 73, 224, 0), #1449e0 40%, #8ea8ff 70%, rgba(185, 196, 232, 0)); animation: b-scan 1.3s cubic-bezier(0.45, 0, 0.3, 1) infinite; }

@keyframes b-land { 0% { opacity: 0; transform: scale(0.92); } 45% { opacity: 1; } 70% { transform: scale(1.03); } 100% { transform: none; } }
@keyframes b-launch { 0% { opacity: 1; background-position: 150% 0; } 100% { opacity: 1; background-position: -60% 0; } }
@keyframes b-launch-border { 0% { border-color: rgba(77, 120, 242, 0.9); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 0 4px rgba(20, 73, 224, 0.18), 0 24px 50px -30px rgba(0, 0, 0, 0.8); } }
@keyframes b-shoot { 0% { transform: translateX(0); } 40% { transform: translateX(14px); opacity: 0; } 41% { transform: translateX(-14px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes b-spin { to { transform: rotate(360deg); } }
@keyframes b-scan { 0% { transform: translateX(-110%); } 100% { transform: translateX(280%); } }
@keyframes b-deal { from { opacity: 0; transform: perspective(900px) translateY(-24px) rotateX(-58deg) scale(0.96); filter: blur(6px); } 60% { opacity: 1; filter: blur(0); } }
@keyframes b-sweep { 0% { opacity: 1; background-position: 160% 0; } 100% { opacity: 1; background-position: -60% 0; } }
@keyframes b-drop { from { opacity: 0; transform: translateY(-14px); filter: blur(4px); } }
@keyframes b-rise { from { opacity: 0; transform: translateY(18px) scale(0.98); filter: blur(8px); } }
@keyframes b-word { from { opacity: 0; transform: translateY(5px); filter: blur(4px); } }
@keyframes b-fade { from { opacity: 0; } }

/* ---------- Größen ---------- */
@media (max-width: 1199px) { .berater__cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 759px) {
  .berater { margin-inline: calc(var(--gutter, 16px) * -1 + 8px); padding: 20px 16px 24px; border-radius: 28px; }
  .berater__cards { grid-template-columns: 1fr; gap: 10px; }
  .berater__bar { height: 64px; padding: 0 7px 0 18px; border-radius: 20px; }
  .berater__bar input { font-size: 18px; }
  .berater__bar button { width: 50px; height: 50px; border-radius: 14px; }
  .berater__chips { margin-top: 14px; }
  .berater__chips button { min-height: 38px; padding: 7px 14px; font-size: 14px; }
  .berater__satz { font-size: 18px; }
  .berater__pick { padding: 18px 48px 18px 16px; }
  .berater__foot { grid-template-columns: minmax(0, 1fr); }
  .berater__composer { height: 58px; padding-left: 16px; }
  .berater__composer button { width: 46px; height: 46px; }
  .berater__cta { width: 100%; min-height: 58px; }
}

/* ---------- Barrierefreiheit ---------- */
@media (prefers-reduced-motion: reduce) {
  .berater__me, .berater__card, .berater__foot, .berater__w, .berater__ki, .berater__card::after, .berater__me p, .berater__scanbar i, .berater__steps li::before { animation: none !important; }
  .berater__tick svg { transition: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .berater__bar, .berater__composer, .berater__card { -webkit-backdrop-filter: none; backdrop-filter: none; background: #1a1816; }
}
@media (prefers-contrast: more) {
  .berater { --muted: #d4cec4; --dim: #c2bcb2; --line: rgba(240, 235, 225, 0.35); --line-2: rgba(240, 235, 225, 0.55); }
}
