/* =========================================================
   WIRKRAUM — Seiten-Check (Chat-Assistent)
   Nutzt die Farb- und Schrift-Tokens aus styles.css.
   Wird auf index.html eingebunden. Liegt über dem Körnungs-Overlay (z-index 9999), damit die
   Schrift im Chat nicht von der Textur überlagert wird.
   ========================================================= */

.wkc{ font-family:var(--sans); color:var(--ink); }
.wkc *, .wkc *::before, .wkc *::after{ box-sizing:border-box; }

/* ---------- Launcher + Teaser ---------- */
.wkc-launcher{
  position:fixed; right:24px; bottom:24px; z-index:10001;
  width:62px; height:62px; border-radius:50%; border:0; cursor:pointer;
  background:var(--terra-solid); color:#fff; box-shadow:var(--shadow-lift);
  display:grid; place-items:center;
  opacity:0; transform:translateY(16px) scale(.9); pointer-events:none;
  transition:opacity .45s var(--ease), transform .45s var(--ease), background .2s;
}
.wkc-launcher:hover{ background:#943F26; }
.wkc-launcher:focus-visible{ outline:3px solid var(--petrol); outline-offset:3px; }
.wkc.is-ready .wkc-launcher{ opacity:1; transform:none; pointer-events:auto; }
.wkc.is-open .wkc-launcher{ opacity:0; transform:scale(.8); pointer-events:none; }
.wkc-launcher svg{ width:28px; height:28px; }
.wkc-launcher-dot{
  position:absolute; top:4px; right:4px; width:13px; height:13px; border-radius:50%;
  background:var(--petrol); border:2px solid var(--paper);
}
.wkc.was-opened .wkc-launcher-dot{ display:none; }

.wkc-teaser{
  position:fixed; right:24px; bottom:100px; z-index:10001;
  width:min(300px, calc(100vw - 48px));
  background:var(--paper); border:1px solid var(--line); border-radius:var(--r-md);
  box-shadow:var(--shadow-deep); padding:16px 40px 16px 18px;
  font-size:15px; line-height:1.45; cursor:pointer;
  opacity:0; transform:translateY(10px); pointer-events:none;
  transition:opacity .45s var(--ease) .15s, transform .45s var(--ease) .15s;
}
.wkc-teaser::after{
  content:""; position:absolute; right:24px; bottom:-8px; width:16px; height:16px;
  background:var(--paper); border-right:1px solid var(--line); border-bottom:1px solid var(--line);
  transform:rotate(45deg);
}
.wkc.has-teaser .wkc-teaser{ opacity:1; transform:none; pointer-events:auto; }
.wkc.is-open .wkc-teaser{ opacity:0; pointer-events:none; }
.wkc-teaser strong{ font-family:var(--serif); font-weight:500; font-size:18px; display:block; margin-bottom:2px; }
.wkc-teaser-x{
  position:absolute; top:8px; right:8px; width:28px; height:28px; border:0; border-radius:50%;
  background:transparent; color:var(--muted); font-size:18px; line-height:1; cursor:pointer;
}
.wkc-teaser-x:hover{ background:var(--linen-deep); color:var(--ink); }

/* ---------- Panel ---------- */
.wkc-panel{
  position:fixed; right:24px; bottom:24px; z-index:10002;
  width:390px; height:min(640px, calc(100vh - 48px)); height:min(640px, calc(100dvh - 48px));
  background:var(--linen); border-radius:var(--r-lg); overflow:hidden;
  box-shadow:var(--shadow-deep); border:1px solid var(--line);
  display:flex; flex-direction:column;
  opacity:0; transform:translateY(20px) scale(.97); transform-origin:bottom right;
  pointer-events:none; visibility:hidden;
  transition:opacity .35s var(--ease), transform .35s var(--ease), visibility 0s linear .35s;
}
.wkc.is-open .wkc-panel{
  opacity:1; transform:none; pointer-events:auto; visibility:visible;
  transition:opacity .35s var(--ease), transform .35s var(--ease), visibility 0s;
}

.wkc-head{
  background:var(--anchor); color:var(--anchor-text);
  padding:16px 14px 14px 18px; display:flex; align-items:center; gap:12px; flex:none;
}
.wkc-avatar{
  width:40px; height:40px; border-radius:50%; flex:none;
  background:var(--linen); display:grid; place-items:center;
}
.wkc-avatar img{ width:24px; height:24px; }
.wkc-head-text{ flex:1; min-width:0; }
.wkc-title{ font-family:var(--serif); font-size:19px; font-weight:500; line-height:1.15; }
.wkc-sub{ font-size:12.5px; opacity:.78; margin-top:2px; }
.wkc-progress{ display:flex; gap:5px; margin-top:8px; }
.wkc-progress i{
  height:4px; flex:1; max-width:28px; border-radius:2px; background:rgba(233,237,235,.22);
  transition:background .4s var(--ease);
}
.wkc-progress i.is-done{ background:var(--anchor-lift); }
.wkc-icon-btn{
  width:34px; height:34px; border-radius:50%; border:0; flex:none; cursor:pointer;
  background:transparent; color:var(--anchor-text); display:grid; place-items:center;
}
.wkc-icon-btn:hover{ background:rgba(255,255,255,.1); }
.wkc-icon-btn:focus-visible{ outline:2px solid var(--anchor-lift); outline-offset:1px; }
.wkc-icon-btn svg{ width:18px; height:18px; }

.wkc-body{
  flex:1; overflow-y:auto; padding:20px 16px 8px; scroll-behavior:smooth;
  display:flex; flex-direction:column; gap:8px;
  overscroll-behavior:contain;
}

/* ---------- Nachrichten ---------- */
.wkc-msg{
  max-width:86%; padding:11px 15px; font-size:15px; line-height:1.5; border-radius:18px;
  animation:wkc-in .35s var(--ease) both;
}
.wkc-msg--bot{ background:var(--paper); border:1px solid var(--line); border-bottom-left-radius:6px; align-self:flex-start; }
.wkc-msg--user{
  background:var(--petrol); color:#fff; border-bottom-right-radius:6px; align-self:flex-end;
  margin:4px 0;
}
.wkc-msg--bot + .wkc-msg--user{ margin-top:8px; }
.wkc-msg a{ color:var(--petrol); font-weight:600; }
.wkc-msg-note{ font-size:12.5px; color:var(--muted); align-self:center; text-align:center; padding:4px 10px; }

.wkc-typing{
  align-self:flex-start; background:var(--paper); border:1px solid var(--line);
  border-radius:18px; border-bottom-left-radius:6px; padding:14px 16px; display:flex; gap:5px;
}
.wkc-typing span{
  width:7px; height:7px; border-radius:50%; background:var(--muted); opacity:.4;
  animation:wkc-dot 1.1s infinite ease-in-out;
}
.wkc-typing span:nth-child(2){ animation-delay:.15s; }
.wkc-typing span:nth-child(3){ animation-delay:.3s; }

/* ---------- Antwort-Buttons ---------- */
.wkc-options{
  display:flex; flex-wrap:wrap; gap:8px; justify-content:flex-end;
  margin:6px 0 4px; animation:wkc-in .35s var(--ease) both;
}
.wkc-opt{
  font:inherit; font-size:14.5px; font-weight:600; color:var(--petrol-deep);
  background:var(--paper); border:1.5px solid var(--petrol); border-radius:999px;
  padding:9px 16px; cursor:pointer; text-align:left;
  transition:background .2s, color .2s, transform .15s;
}
.wkc-opt:hover{ background:var(--petrol); color:#fff; }
.wkc-opt:active{ transform:scale(.97); }
.wkc-opt:focus-visible{ outline:3px solid var(--terra); outline-offset:2px; }
.wkc-opt--quiet{ border-color:var(--line); color:var(--muted); font-weight:500; }
.wkc-opt--quiet:hover{ background:var(--linen-deep); color:var(--ink); }
.wkc-opt--main{ background:var(--terra-solid); border-color:var(--terra-solid); color:#fff; }
.wkc-opt--main:hover{ background:#943F26; border-color:#943F26; }
.wkc-opt-ico{ display:inline-block; width:1.3em; }

/* ---------- Formular ---------- */
.wkc-form{
  align-self:stretch; background:var(--paper); border:1px solid var(--line);
  border-radius:var(--r-md); padding:14px; display:grid; gap:10px;
  animation:wkc-in .35s var(--ease) both;
}
.wkc-form-row{ display:flex; gap:8px; }
.wkc-form input[type=email], .wkc-form input[type=tel]{
  font:inherit; font-size:16px; padding:10px 12px; border-radius:var(--r-sm);
  border:1.5px solid var(--line); background:var(--linen); color:var(--ink); flex:1; min-width:0;
}
.wkc-form input:focus{ outline:none; border-color:var(--petrol); background:#fff; }
.wkc-form input[aria-invalid=true]{ border-color:var(--terra-solid); }
.wkc-hp{ position:absolute !important; left:-9999px !important; width:1px; height:1px; overflow:hidden; }
.wkc-legal{ font-size:12px; line-height:1.45; color:var(--muted); margin:0; }
.wkc-legal a{ color:var(--muted); }
.wkc-error{ font-size:13px; color:var(--terra-text); margin:0; min-height:0; }
.wkc-submit{
  width:46px; height:46px; flex:none; border:0; border-radius:50%; cursor:pointer;
  background:var(--terra-solid); color:#fff; display:grid; place-items:center;
}
.wkc-submit svg{ width:20px; height:20px; }
.wkc-submit:hover{ background:#943F26; }
.wkc-submit:disabled{ opacity:.6; cursor:wait; }

.wkc-foot{
  flex:none; padding:8px 16px 12px; font-size:11.5px; color:var(--muted); text-align:center;
}

@keyframes wkc-in{ from{ opacity:0; transform:translateY(8px); } to{ opacity:1; transform:none; } }
@keyframes wkc-dot{ 0%,80%,100%{ opacity:.35; transform:none; } 40%{ opacity:1; transform:translateY(-3px); } }

/* ---------- Handy: Panel als Blatt von unten ---------- */
@media (max-width:600px){
  .wkc-launcher{ right:16px; bottom:16px; width:56px; height:56px; }
  .wkc-teaser{ right:16px; bottom:86px; width:calc(100vw - 32px); max-width:340px; }
  .wkc-panel{
    right:0; left:0; bottom:0; width:auto;
    height:88vh; height:88dvh; border-radius:var(--r-lg) var(--r-lg) 0 0;
    border-left:0; border-right:0; border-bottom:0; transform-origin:bottom center;
  }
  .wkc-msg{ max-width:90%; }
}

@media (prefers-reduced-motion:reduce){
  .wkc *, .wkc-launcher, .wkc-teaser, .wkc-panel{ animation:none !important; transition:none !important; }
}
