/* ==========================================================================
   504Labs — Base, Reset & Komponenten
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }

::selection { background: var(--color-iron); color: var(--color-white); }

/* ── Layout ── */
.wrap {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--page-margin-x);
}

.section {
  padding-block: var(--section-padding-y);
}

/* ── Typografie-Primitives ── */
.eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-quiet);
}

h1, h2, h3 {
  font-weight: var(--weight-light);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
  text-wrap: balance;
}

/* Ein Fokus-System für alles Interaktive: sichtbarer Ring nur bei
   Tastatur-Navigation, auf Navy klar erkennbar (5.3:1). */
:focus-visible {
  outline: 2px solid var(--color-accent-light);
  outline-offset: 2px;
  border-radius: 2px;
}
.btn:focus-visible,
.nav-cta:focus-visible,
.chatbot-avatar:focus-visible {
  border-radius: var(--radius-pill);
}

/* Daten-Auszeichnung: Mono nur für Zahlen/Zähler, nie für Fließtext. */
.data-label {
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: 0;
}

.display-1 {
  font-size: var(--text-4xl);
  line-height: var(--leading-tight);
}

.display-2 {
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
}

.display-3 {
  font-size: var(--text-2xl);
  line-height: var(--leading-snug);
}

.lede {
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  max-width: var(--prose-max);
}

.body-text {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
}

em, .emphasis {
  font-style: italic;
  color: var(--color-accent-ghost);
}

/* ── Buttons (Shape Lock: Pill) ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  white-space: nowrap;
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-normal);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--duration-base) var(--ease-out),
              border-color var(--duration-base) var(--ease-out),
              color var(--duration-base) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}

.btn:active { transform: translateY(1px) scale(0.98); }

/* Primär-Button passt sich dem Untergrund an:
   dunkle Sektionen → weiße Fläche mit Navy-Text · helle Sektionen → Navy-Fläche mit weißem Text.
   (Kein Akzent-Lila mehr — ruhiger, seriöser.) */
.btn-primary {
  background: var(--color-white);
  color: #12142a;
  border: 1px solid transparent;
  padding: 0.9rem 1.75rem;
}
.btn-primary:hover {
  background: #e7ebf3;
}
.theme-light .btn-primary {
  background: #16315c;
  color: var(--color-white);
}
.theme-light .btn-primary:hover {
  background: #1e3f74;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  padding: 0.9rem 1.75rem;
}
.btn-ghost:hover { color: var(--text-primary); border-color: var(--color-fog); }

.btn-sm { padding: 0.6rem 1.25rem; font-size: var(--text-xs); }

/* ── Karten (Shape Lock: 4px) ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: background var(--duration-base) var(--ease-out),
              border-color var(--duration-base) var(--ease-out);
}
.card:hover { background: var(--bg-surface-hover); border-color: var(--border-strong); }

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--border-subtle);
}

/* ── Scroll-Reveal ──
   Nur für echte Listen (Prozess-Steps), mit Stagger. Inhalte sind ohne JS
   voll sichtbar: das Ausblenden greift erst, wenn JS .has-js setzt. */
.has-js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
  transition-delay: calc(var(--reveal-index, 0) * 70ms);
}
.has-js .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .has-js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ── Utility ── */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

@media (max-width: 768px) {
  .section { padding-block: clamp(3.5rem, 12vw, var(--space-2xl)); }
}

/* ── NAV (geteilt über alle Seiten, 1:1 Original-Spacing) ── */
.nav {
  position: fixed; inset-block-start: 0; inset-inline: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px var(--gutter-chrome);
  /* volldeckend statt halbtransparent: der Header bleibt über hellen
     Sektionen exakt gleich dunkel und crisp (kein Durchscheinen, kein Blur) */
  background: var(--color-obsidian);
  border-bottom: 1px solid rgba(112, 112, 125, 0.14);
}
.nav-brand { display: flex; align-items: center; gap: 16px; }
.nav-logo { height: 28px; width: auto; filter: brightness(0) invert(1) opacity(0.76); }
.nav-tagline {
  font-size: 11px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-quiet);
  padding-left: 16px;
  border-left: 1px solid var(--border-strong);
  white-space: nowrap;
}
.nav-links { display: flex; align-items: center; gap: 32px; list-style: none; }
.nav-links a {
  font-size: 14px; font-weight: 400; letter-spacing: 0.01em;
  color: var(--text-secondary); text-decoration: none;
  transition: color var(--duration-base) var(--ease-out);
}
.nav-links a:hover { color: var(--text-primary); }

/* Steht der (dunkle) Header über einer hellen Sektion, zieht die Schrift
   auf Weiß an — sonst wirkt sie neben dem hellen Inhalt zu schwach.
   Die Klasse setzt js/site.js beim Scrollen. */
.nav-logo { transition: filter var(--duration-base) var(--ease-out); }
.nav-tagline { transition: color var(--duration-base) var(--ease-out); }
.nav--on-light .nav-links a { color: var(--color-cloud); }
.nav--on-light .nav-links a:hover { color: var(--color-white); }
.nav--on-light .nav-tagline { color: var(--color-mist); }
.nav--on-light .nav-logo { filter: brightness(0) invert(1) opacity(0.95); }

.nav-cta {
  background: rgba(205, 221, 255, 0.12) !important;
  color: var(--text-primary) !important;
  border: 1px solid rgba(205, 221, 255, 0.2) !important;
  padding: 8px 20px !important;
  border-radius: 40px !important;
  font-size: 13px !important;
  transition: background var(--duration-base) var(--ease-out) !important;
}
.nav-cta:hover { background: rgba(205, 221, 255, 0.22) !important; }

@media (max-width: 900px) {
  .nav-tagline { display: none; }
}
@media (max-width: 768px) {
  .nav-links { display: none; }
}

/* ── FOOTER (geteilt über alle Seiten, gleiche Breite wie die Nav) ── */
.site-footer {
  padding-block: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
}
.site-footer .footer-inner.wrap {
  max-width: none;
  padding-inline: var(--gutter-chrome);
}
.footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: var(--space-sm);
}
.footer-logo { height: 22px; opacity: 0.4; }
.footer-links { display: flex; gap: var(--space-md); list-style: none; }
.footer-links a { font-size: var(--text-xs); color: var(--text-quiet); text-decoration: none; }
.footer-links a:hover { color: var(--text-tertiary); }
.footer-copy { font-size: var(--text-xs); color: var(--text-quiet); }

/* exali Haftpflicht-Siegel (Vertrauenssignal + DL-InfoV-Nachweis).
   Weißer Korpus + Rahmen sind im PNG eingebrannt — wirkt auf dunklem
   Footer als eigenständige Karte, kein Container nötig. */
.exali-siegel {
  display: inline-block;
  line-height: 0;
  border-radius: 4px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.exali-siegel:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(58, 216, 255, 0.25); /* Cyan-Glow passend zum Design-System */
}
.exali-siegel img { width: 90px; height: auto; display: block; }

@media (max-width: 640px) {
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

/* ── INNENSEITEN: Prose-Layout (Über mich, Impressum, Datenschutz) ── */
.page-main {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--page-margin-x);
  padding-block-start: clamp(7rem, 12vw, 9rem);
  padding-block-end: var(--space-3xl);
}
.page-main--narrow { max-width: 760px; }
.page-eyebrow { margin-bottom: var(--space-sm); }
.page-title {
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-xl);
}
.prose {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  max-width: var(--prose-max);
}
.prose p { margin-bottom: var(--space-md); }
.prose p:last-child { margin-bottom: 0; }
.prose h2 {
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  margin: var(--space-xl) 0 var(--space-sm);
}
.prose h3 {
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  margin: var(--space-lg) 0 var(--space-2xs);
}
.prose a {
  color: var(--color-accent-ghost);
  text-decoration: none;
  border-bottom: 1px solid rgba(205, 221, 255, 0.3);
}
.prose a:hover { border-color: var(--color-accent-ghost); }
.prose ul { padding-left: 1.25rem; margin-bottom: var(--space-md); }
.prose ul li { margin-bottom: var(--space-2xs); }
.prose .divider { margin-block: var(--space-lg); }

.note-block {
  display: flex; gap: var(--space-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  margin-block: var(--space-md);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

@media (max-width: 768px) {
  .page-main { padding-block-start: clamp(6rem, 16vw, 7rem); }
}

/* ── CHATBOT-WIDGET (geteilt über alle Seiten) ──
   Roboter-Avatar unten rechts, fixiert. Aktuell Marketing-Trigger mit
   Teaser-Sprechblase + Platzhalter-Panel; die eigentliche FAQ-Bot-Logik
   (regelbasiert, siehe Briefing) wird modular nachgerüstet, ohne dieses
   Markup ändern zu müssen. */
.chatbot-widget {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-sm);
}
.chatbot-bubble {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  max-width: 240px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity var(--duration-slow) var(--ease-out),
              transform var(--duration-slow) var(--ease-out);
}
.chatbot-bubble.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.chatbot-bubble-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-quiet); font-size: var(--text-md); line-height: 1;
  padding: 0; flex-shrink: 0;
}
.chatbot-bubble-close:hover { color: var(--text-tertiary); }

.chatbot-avatar {
  width: 110px; height: 110px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  padding: 0;
  display: block;
  transition: border-color var(--duration-base) var(--ease-out),
              transform var(--duration-fast) var(--ease-out),
              opacity var(--duration-slow) var(--ease-out);
}

/* Hero-Modus: solange der große Roboter im Hero sichtbar ist, bleibt das
   untere Widget (Avatar + Teaser-Bubble) ausgeblendet. Das Panel bleibt
   bedienbar, falls der Hero-Roboter den Chat öffnet. */
.chatbot-widget.hero-mode .chatbot-avatar,
.chatbot-widget.hero-mode .chatbot-bubble {
  opacity: 0;
  transform: translateY(16px) scale(0.94);
  pointer-events: none;
}
.chatbot-avatar:hover { border-color: var(--color-fog); }
.chatbot-avatar:active { transform: scale(0.96); }
.chatbot-avatar video {
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1.08);
}

.chatbot-panel {
  display: none;
  width: min(360px, calc(100vw - 2rem)); /* etwas breiter für den FAQ-Chat */
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.chatbot-panel.is-open { display: block; }
.chatbot-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
}
.chatbot-panel-header strong { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-primary); }
.chatbot-panel-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-quiet); font-size: var(--text-md); line-height: 1; padding: 0;
}
.chatbot-panel-close:hover { color: var(--text-tertiary); }
.chatbot-panel-body { padding: var(--space-md); }
.chatbot-panel-body p {
  font-size: var(--text-sm); color: var(--text-secondary);
  line-height: var(--leading-relaxed); margin-bottom: var(--space-sm);
}
.chatbot-panel-body p:last-child { margin-bottom: 0; }

/* ── FAQ-Chat im Panel (UI wird per JS in .chatbot-panel-body gebaut) ── */
.chatbot-panel-body--chat { padding: 0; }
.chatbot-msgs {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  max-height: min(340px, 46vh);
  overflow-y: auto;
  padding: var(--space-sm) var(--space-sm) var(--space-2xs);
}
.chatbot-msg {
  max-width: 88%;
  padding: var(--space-2xs) var(--space-xs);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
}
.chatbot-msg--bot {
  align-self: flex-start;
  background: var(--bg-surface-hover);
  color: var(--text-secondary);
}
.chatbot-msg--bot a { color: var(--color-accent-ghost); text-underline-offset: 2px; }
.chatbot-msg--user {
  align-self: flex-end;
  background: #16315c; /* Navy — wie Header/Timeline-Knoten */
  color: var(--color-white);
}
/* Tipp-Indikator: drei pulsierende Punkte */
.chatbot-typing { display: inline-flex; gap: 4px; padding: 2px 0; }
.chatbot-typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-quiet);
  animation: chatbot-typing 1s ease-in-out infinite;
}
.chatbot-typing i:nth-child(2) { animation-delay: 0.15s; }
.chatbot-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatbot-typing {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .chatbot-typing i { animation: none; }
}
.chatbot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3xs);
  padding: var(--space-2xs) var(--space-sm);
}
.chatbot-chip {
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color var(--duration-base) var(--ease-out),
              color var(--duration-base) var(--ease-out);
}
.chatbot-chip:hover { border-color: var(--color-fog); color: var(--text-primary); }
.chatbot-input-row {
  display: flex;
  gap: var(--space-2xs);
  padding: var(--space-2xs) var(--space-sm) var(--space-sm);
  border-top: 1px solid var(--border-subtle);
}
.chatbot-input-row input {
  flex: 1;
  min-width: 0;
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-2xs) var(--space-xs);
  font-size: var(--text-sm);
  font-family: inherit;
  color: var(--text-primary);
}
.chatbot-input-row input::placeholder { color: var(--text-quiet); }
.chatbot-input-row input:focus-visible {
  outline: 2px solid var(--color-accent-light);
  outline-offset: 1px;
}
.chatbot-input-row button {
  background: #16315c;
  color: var(--color-white);
  border: none;
  border-radius: var(--radius-sm);
  padding: var(--space-2xs) var(--space-xs);
  font-size: var(--text-sm);
  font-family: inherit;
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: background var(--duration-base) var(--ease-out);
}
.chatbot-input-row button:hover { background: #1d3f75; }

@media (max-width: 480px) {
  .chatbot-avatar { width: 84px; height: 84px; }
}

/* ── Akzent-Band: invertierte Buttons + weißer Fokus-Ring ── */
.theme-accent .btn-primary {
  background: #ffffff;
  color: var(--color-accent);
}
.theme-accent .btn-primary:hover { background: #e8ecfd; }
.theme-accent .btn-ghost {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.55);
}
.theme-accent .btn-ghost:hover { color: #ffffff; border-color: #ffffff; }
.theme-accent :focus-visible { outline-color: #ffffff; }
