/**
 * AuditKompass – Design-System & Cursor-Ergänzungen
 * Tailwind deckt Layout ab; hier: Tokens, Cursor, Feinschliff.
 */
:root {
  --ink: #141a22;
  --surface: #f6f4ef;
  --surface-2: #ebe7de;
  --line: #d6d1c6;
  --accent: #1f5c52;
  --accent-2: #0f3d36;
  --signal: #b24a1f;
  --muted: #5c6470;
  --glass: rgba(255, 255, 255, 0.55);
  --shadow: 0 24px 80px rgba(20, 26, 34, 0.12);
  --radius: 1rem;
  --font-display: "Instrument Serif", Georgia, serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --cursor-smooth: 0.18;
}

html {
  scroll-behavior: smooth;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.875rem;
  box-shadow: var(--shadow);
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--surface);
}

.font-display {
  font-family: var(--font-display);
}

/* --- Custom Cursor (Desktop, feine Pointer) --- */
@media (pointer: fine) {
  html:not(.cursor-disabled) body.custom-cursor-active {
    cursor: none;
  }

  .custom-cursor {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: difference;
    display: none;
  }

  html:not(.cursor-disabled) body.custom-cursor-active .custom-cursor {
    display: block;
  }

  .cursor-dot,
  .cursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    will-change: transform;
    border-radius: 9999px;
    pointer-events: none;
  }

  .cursor-dot {
    z-index: 3;
    width: 6px;
    height: 6px;
    margin: -3px 0 0 -3px;
    background: #fff;
    transform: translate3d(-100px, -100px, 0);
  }

  .cursor-ring {
    z-index: 2;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 1px solid rgba(255, 255, 255, 0.85);
    transform: translate3d(-100px, -100px, 0);
    transition: width 0.35s ease, height 0.35s ease, margin 0.35s ease,
      border-radius 0.35s ease, opacity 0.25s ease;
  }

  /**
   * Kontext via :has() auf interaktive Ziele mit .cursor-target
   * → skaliert Ring, leicht andere Form, ohne JS-Hover pro Element.
   */
  body.custom-cursor-active:has(.cursor-target:hover) .cursor-ring,
  body.custom-cursor-active:has(.cursor-target:focus-visible) .cursor-ring {
    width: 56px;
    height: 56px;
    margin: -28px 0 0 -28px;
    border-radius: 1.1rem;
    opacity: 0.95;
  }

  body.custom-cursor-active:has(button.cursor-target:hover) .cursor-ring,
  body.custom-cursor-active:has(button.cursor-target:focus-visible) .cursor-ring,
  body.custom-cursor-active:has([type="submit"].cursor-target:hover) .cursor-ring {
    border-color: rgba(255, 255, 255, 1);
  }

  body.custom-cursor-active:has(img.cursor-target:hover) .cursor-ring,
  body.custom-cursor-active:has(article.cursor-target:hover) .cursor-ring {
    width: 64px;
    height: 64px;
    margin: -32px 0 0 -32px;
    border-radius: 0.35rem;
  }

  /** Variante C: zweiter Ring mit stärkerer Trägheit (Trail) */
  .cursor-ring--trail {
    z-index: 1;
    width: 48px;
    height: 48px;
    margin: -24px 0 0 -24px;
    opacity: 0.35;
    border-color: rgba(255, 255, 255, 0.55);
  }

  /** Variante B: dezentes Pulsieren des Haupt-Rings */
  .cursor-ring--pulse {
    animation: cursorPulse 2.4s ease-in-out infinite;
  }

  @keyframes cursorPulse {
    0%,
    100% {
      opacity: 0.9;
    }
    50% {
      opacity: 0.55;
    }
  }
}

/* Reduced motion: Systemcursor, kein Custom */
@media (prefers-reduced-motion: reduce) {
  html body {
    cursor: auto !important;
  }

  .custom-cursor {
    display: none !important;
  }
}

/* Prose-Skala für lange Texte */
.prose-local {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--muted);
}

.prose-local h2 {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  color: var(--ink);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.15;
}

.prose-local h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink);
  margin-top: 1.75rem;
  margin-bottom: 0.65rem;
}

.prose-local p {
  margin-bottom: 1rem;
}

.prose-local ul {
  list-style: disc;
  padding-left: 1.25rem;
  margin-bottom: 1rem;
}

/* Dropdown Panel Animation (dezent) */
.nav-current {
  color: var(--accent) !important;
  font-weight: 600 !important;
}

.nav-dd-panel {
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.group:hover .nav-dd-panel,
.group:focus-within .nav-dd-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .nav-dd-panel {
    transition: none;
  }
}

/* --- Conversion: Sticky CTA, Modal, Exit-Intent --- */
body.has-sticky-cta {
  padding-bottom: 5.5rem;
}

.ak-sticky-cta {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9980;
  display: flex;
  justify-content: center;
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
  pointer-events: none;
}

.ak-sticky-cta-inner {
  pointer-events: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  max-width: 42rem;
  width: 100%;
  border-radius: 1rem;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, white);
  box-shadow: var(--shadow);
  padding: 0.5rem 0.75rem;
  backdrop-filter: blur(10px);
}

.ak-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  background: var(--signal);
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.65rem 1rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 12px 40px rgba(178, 74, 31, 0.35);
}

.ak-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.65rem 1rem;
  cursor: pointer;
}

.ak-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9990;
  background: rgba(20, 26, 34, 0.55);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s;
}

.ak-modal-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

.ak-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 9991;
  width: min(96vw, 32rem);
  max-height: min(90vh, 40rem);
  overflow: auto;
  transform: translate(-50%, -48%) scale(0.98);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  border-radius: 1.25rem;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.ak-modal-close {
  position: absolute;
  right: 0.75rem;
  top: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.35rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

#ak-modal-slot {
  padding-top: 1.5rem;
}

.ak-exit-card h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1.2;
  color: var(--ink);
  margin: 0;
}

.ak-exit-card p {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--muted);
}

.ak-exit-card .ak-actions {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ak-modal.is-open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.ak-exit {
  position: fixed;
  inset: 0;
  z-index: 9988;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(20, 26, 34, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s;
}

.ak-exit.is-open {
  opacity: 1;
  visibility: visible;
}

.ak-exit-card {
  max-width: 26rem;
  width: 100%;
  border-radius: 1.25rem;
  background: #fff;
  border: 1px solid var(--line);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.ak-countdown {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  border-radius: 1rem;
  border: 1px solid var(--line);
  background: color-mix(in srgb, #fff 88%, transparent);
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  color: var(--ink);
}

.ak-countdown strong {
  color: var(--signal);
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  .ak-modal,
  .ak-modal-backdrop,
  .ak-exit {
    transition: none;
  }
}

/* Förder-Check Wizard (Modal) */
.ak-fc-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0 0 0.5rem;
  color: var(--ink);
}

.ak-fc-sub {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--muted);
}

.ak-fc-step {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ak-fc-opt {
  text-align: left;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
}

.ak-fc-opt:hover {
  border-color: var(--accent);
}

.ak-fc-input {
  width: 100%;
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.65rem 0.75rem;
  font-size: 0.875rem;
}

.ak-fc-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.ak-fc-progress {
  height: 0.35rem;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: 1rem;
}

.ak-fc-progress > span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.25s ease;
}
