/* AMBECK — Kontakt-Panel (Seitenpanel ≥768px, Sheet von unten <768px) + fester Einstieg „Anfrage“.
   Nur Klassen + CSS-Variablen, keine Inline-Styles. JS: js/kontakt-panel.js */

/* Scroll-Sperre ohne Layoutsprung (Scrollbar-Breite kompensiert) */
html.kp-lock { overflow: hidden; padding-right: var(--kp-sbw, 0px); }
html.kp-lock .site-header { padding-right: 0; }

/* Dialog füllt den Viewport; eigene Dimm-Ebene statt ::backdrop (animierbar) */
.kp { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: transparent; color: var(--text); overflow: hidden; overflow: clip; } /* clip: kein programmatisches Mitscrollen des Dialogs */
.kp::backdrop { background: transparent; }
.kp:not([open]) { display: none; }
.kp-dim { position: absolute; inset: 0; background: rgba(12,14,17,0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.kp-noblur .kp-dim { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(12,14,17,0.66); }

/* Panel */
.kp-panel { --kp-w: min(520px, 44vw); --kp-f: 56px; position: absolute; top: 0; right: 0; bottom: 0; width: var(--kp-w); }
@media (min-width: 768px) and (max-width: 1100px) { .kp-panel { --kp-f: 32px; } .kp-body, .kp-head { padding-right: 1.25rem; } }
.kp-sheet { position: absolute; inset: 0; display: flex; flex-direction: column;
  background: linear-gradient(165deg, #252A30 0%, #202429 45%, #1D2126 100%);
  clip-path: polygon(var(--kp-f) 0, 100% 0, 100% 100%, 0 100%); }
.kp-edge { position: absolute; left: 0; top: 0; width: var(--kp-f); height: 100%; z-index: 2; pointer-events: none; overflow: visible; }
.kp-edge-line { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 0; filter: drop-shadow(0 0 6px rgba(95,168,211,0.8)); }
.kp-grab { display: none; }
.kp-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: clamp(1.5rem, 4vh, 2.5rem) clamp(1.5rem, 3vw, 2.5rem) 0.75rem calc(var(--kp-f) + 1.25rem); }
.kp-title { font-family: var(--font-head); font-weight: 800; font-size: clamp(1.8rem, 2.6vw, 2.4rem); letter-spacing: -0.035em; line-height: 1.05; }
.kp-close { position: relative; flex: none; width: 44px; height: 44px; border-radius: 999px; border: 1px solid rgba(242,243,245,0.16); background: transparent; color: var(--text); cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.kp-close:hover { border-color: var(--accent); background: rgba(95,168,211,0.1); }
.kp-close span::before, .kp-close span::after { content: ""; position: absolute; left: 13px; right: 13px; top: 50%; height: 2px; margin-top: -1px; background: currentColor; transform: rotate(45deg); }
.kp-close span::after { transform: rotate(-45deg); }
.kp-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0.25rem clamp(1.5rem, 3vw, 2.5rem) calc(2rem + env(safe-area-inset-bottom, 0px)) calc(var(--kp-f) + 1.25rem); } /* links frei von der Facetten-Kante */
.kp-intro { color: var(--muted); margin-bottom: 1.5rem; max-width: 34rem; }

/* Formular */
.kp-form { display: grid; gap: 1.15rem; }
.kp-field { display: grid; gap: 0.4rem; }
.kp-field > label, .kp-chips legend, .kp-contact legend { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.kp input[type="text"], .kp input[type="email"], .kp input[type="tel"], .kp textarea {
  width: 100%; font: inherit; font-family: var(--font-body); font-size: 1rem; /* ≥16px: kein iOS-Zoom */
  color: var(--text); background: #16191D; border: 1px solid rgba(242,243,245,0.14); border-radius: 10px; padding: 0.75rem 0.9rem; min-height: 48px;
  transition: border-color 0.2s, box-shadow 0.2s; }
.kp textarea { resize: vertical; min-height: 8.5rem; line-height: 1.5; }
.kp input::placeholder, .kp textarea::placeholder { color: #8B939C; opacity: 1; }
.kp input:focus, .kp textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(95,168,211,0.28), 0 0 18px rgba(95,168,211,0.18); }
.kp input:focus-visible, .kp textarea:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.kp [aria-invalid="true"] { border-color: #E08A7A; }
.kp-hint { font-size: 0.85rem; color: var(--muted); }
.kp-err { font-size: 0.86rem; color: #F2A597; font-weight: 500; } /* 7,9:1 auf #202429 */
.kp-contact, .kp-chips { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 0.6rem; }
.kp-contact { padding: 0.9rem 1rem 1rem; border: 1px solid rgba(242,243,245,0.08); border-radius: 12px; }
.kp-contact legend { padding: 0 0.35rem; margin-left: -0.35rem; }
.kp-chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.kp-chip { position: relative; cursor: pointer; }
.kp-chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kp-chip span { display: inline-flex; align-items: center; min-height: 44px; padding: 0.55rem 1rem; border-radius: 999px; border: 1px solid rgba(242,243,245,0.18); color: var(--text); font-size: 0.95rem; transition: background 0.2s, border-color 0.2s, color 0.2s; }
.kp-chip:hover span { border-color: var(--accent); }
.kp-chip input:checked + span { background: var(--accent); border-color: var(--accent); color: #0E1216; font-weight: 600; }
.kp-chip input:focus-visible + span { outline: 2px solid var(--accent-hi); outline-offset: 3px; }
.kp-check { grid-template-columns: auto 1fr; align-items: start; column-gap: 0.75rem; }
.kp-check input { width: 22px; height: 22px; margin-top: 0.1rem; accent-color: var(--accent); }
.kp-check input:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.kp-check label { font-size: 0.92rem; font-weight: 400; color: var(--text); }
.kp-check .kp-err { grid-column: 2; }
.kp a { color: var(--accent-hi); text-decoration: underline; text-underline-offset: 3px; }
.kp-hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; } /* Honeypot */
.kp-req { font-size: 0.82rem; color: var(--muted); }
.kp-summary, .kp-senderr { border-radius: 10px; padding: 0.8rem 1rem; font-size: 0.92rem; }
.kp-summary { background: rgba(224,138,122,0.12); border: 1px solid rgba(224,138,122,0.45); color: #F6C1B7; }
.kp-senderr { background: rgba(224,138,122,0.12); border: 1px solid rgba(224,138,122,0.45); color: var(--text); }
.kp-actions { display: grid; gap: 0.9rem; justify-items: start; }
.kp-submit { min-height: 48px; gap: 0.6rem; }
.kp-submit[disabled] { cursor: progress; opacity: 0.85; }
.kp-spin { display: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(14,18,22,0.3); border-top-color: #0E1216; animation: kp-spin 0.8s linear infinite; }
.kp-submit.is-sending .kp-spin { display: inline-block; }
@keyframes kp-spin { to { transform: rotate(360deg); } }
.kp-direct { font-size: 0.92rem; color: var(--muted); }
.kp-direct a, .kp-senderr a { white-space: nowrap; }

/* Erfolg */
.kp-view-ok { display: grid; gap: 1.25rem; justify-items: start; padding-top: 1.5rem; }
.kp-view-ok[hidden] { display: none; }
.kp-okicon { width: 72px; height: 72px; overflow: visible; }
.kp-check-ring, .kp-check-mark { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; filter: drop-shadow(0 0 6px rgba(95,168,211,0.6)); }
.kp-check-ring { stroke-width: 1.5; }
.kp-ok-text { font-family: var(--font-head); font-weight: 700; font-size: clamp(1.3rem, 2vw, 1.6rem); line-height: 1.3; letter-spacing: -0.015em; max-width: 26rem; }
.kp-ok-text:focus { outline: none; }

/* Mobile: Vollbild-Sheet von unten */
@media (max-width: 767px) {
  .kp-panel { --kp-f: 0px; width: 100%; top: 0; }
  .kp-sheet { clip-path: none; border-radius: 0; padding-top: env(safe-area-inset-top, 0px); }
  .kp-edge { display: none; }
  .kp-grab { display: block; width: 44px; height: 5px; border-radius: 3px; background: rgba(242,243,245,0.25); margin: 0.6rem auto 0; flex: none; }
  .kp-head { position: sticky; top: 0; z-index: 3; background: #22262B; padding: 0.6rem calc(1rem + env(safe-area-inset-right, 0px)) 0.75rem calc(1rem + env(safe-area-inset-left, 0px)); border-bottom: 1px solid rgba(242,243,245,0.06); }
  .kp-title { font-size: 1.6rem; }
  .kp-body { padding: 1rem calc(1rem + env(safe-area-inset-right, 0px)) calc(2rem + env(safe-area-inset-bottom, 0px)) calc(1rem + env(safe-area-inset-left, 0px)); }
  .kp-submit { width: 100%; }
  .kp-actions { justify-items: stretch; }
}

/* Fester Einstieg „Anfrage“ (Platz reserviert für späteren gemeinsamen Einstieg mit Elsa-Chat) */
.kp-fab { position: fixed; z-index: 950; right: calc(1.25rem + var(--kp-sbw, 0px) + env(safe-area-inset-right, 0px)); bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  display: inline-flex; align-items: center; gap: 0.55rem; min-height: 44px; padding: 0.6rem 1.05rem 0.6rem 0.9rem; border-radius: 999px;
  background: rgba(26,29,33,0.92); border: 1px solid rgba(95,168,211,0.4); color: var(--text); font-weight: 600; font-size: 0.9rem; box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  opacity: 0; visibility: hidden; transform: translateY(12px); transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), visibility 0s linear 0.3s, border-color 0.2s; }
.kp-fab.is-shown { opacity: 1; visibility: visible; transform: none; transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), visibility 0s, border-color 0.2s; }
.kp-fab:hover { border-color: var(--accent); }
.kp-fab-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-hi); box-shadow: 0 0 8px rgba(124,185,232,0.8); }

@media (prefers-reduced-motion: reduce) {
  .kp-dim { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(12,14,17,0.66); }
  .kp-check-ring, .kp-check-mark, .kp-edge-line { stroke-dashoffset: 0; }
  .kp-spin { animation-duration: 1.6s; animation-iteration-count: infinite !important; }
  .kp-fab { transition: opacity 0.15s linear, visibility 0s; transform: none; }
}

/* <button class="btn"> im Panel: UA-Hintergrund/Schrift zurücksetzen */
.kp button.btn { font-family: var(--font-body); cursor: pointer; }
.kp .btn-ghost { background: transparent; }
.kp .btn-ghost:hover { background: rgba(95,168,211,0.12); }

/* —— Ohne JavaScript ——
   Die Anruf-Karte verlinkt auf #kontakt-panel; ohne .kp-js zeigt :target das Panel (nicht modal) und
   das Formular sendet normal an /kontakt.php. Schließen per Link zurück auf #kontakt. */
html:not(.kp-js) .kp:target { display: block; z-index: 1100; }
html:not(.kp-js) .kp-close:not(.kp-close-nojs) { display: none; }
.kp-close-nojs { display: none; }
html:not(.kp-js) .kp-close-nojs { display: inline-block; color: var(--text); text-decoration: none; }

/* —— Rückmeldung nach dem Formular ohne JS (kontakt.php → 303 auf /#kontakt-gesendet bzw. /#kontakt-fehler) ——
   Standard versteckt, sichtbar per :target. Dunkle Karte mit Ice-Blue-Lichtkante oben (wie Panel-Kante), Facette oben links.
   Kante bewusst oben statt links: mobil läuft die Lichtlinie 9 px links neben dem Inhalt, zwei parallele Linien wären unruhig. */
.kontakt-notice { display: none; position: relative; max-width: 44rem; margin: -0.75rem 0 2.25rem; padding: 1.15rem 1.35rem 1.2rem 1.5rem;
  background: linear-gradient(165deg, #252A30 0%, #202429 60%, #1D2126 100%); border: 1px solid rgba(242,243,245,0.08); border-radius: 0 12px 12px 12px;
  clip-path: polygon(22px 0, 100% 0, 100% 100%, 0 100%, 0 22px);
  scroll-margin-top: 1.5rem; /* zusätzlich zu html scroll-padding-top = Header-Höhe */ box-shadow: 0 18px 40px rgba(0,0,0,0.28); }
.kontakt-notice::before { content: ""; position: absolute; left: 22px; right: 0; top: 0; height: 1.5px; background: linear-gradient(90deg, var(--accent) 0%, rgba(95,168,211,0.55) 55%, rgba(95,168,211,0) 100%); box-shadow: 0 0 10px rgba(95,168,211,0.7); }
.kontakt-notice::after { content: ""; position: absolute; left: 0; top: 0; width: 31.5px; height: 1.5px; background: var(--accent); transform-origin: 0 0; transform: translate(0, 22px) rotate(-45deg); box-shadow: 0 0 10px rgba(95,168,211,0.7); }
.kontakt-notice:target { display: block; }
.kontakt-notice:focus { outline: none; }
.kontakt-notice-text { color: var(--text); font-size: 1.05rem; line-height: 1.55; }
.kontakt-notice a { color: var(--accent-hi); font-weight: 600; white-space: nowrap; border-bottom: 1px solid rgba(124,185,232,0.4); }
.kontakt-notice a:hover { border-bottom-color: var(--accent-hi); }
@media (max-width: 767px) { .kontakt-notice { margin: -1rem 0 1.75rem; padding: 1rem 1.1rem 1.05rem 1.25rem; } .kontakt-notice-text { font-size: 1rem; } }
