:root {
  --bg-dark: #07080f;
  --bg-card: rgba(18, 20, 32, 0.65);
  --border-card: rgba(255, 255, 255, 0.08);
  --accent-cyan: #00f2fe;
  --accent-purple: #9d4edd;
  --accent-pink: #ff2a85;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: #f1f5f9;
  overflow-x: hidden;
  position: relative;
  width: 100%;
  min-height: 100vh;
}

/* Prevent body scroll when modal is open */
body.modal-open {
  overflow: hidden;
  touch-action: none;
}

/* Fluid Typography and Word Wrapping */
h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: 'Space Grotesk', sans-serif;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

p, span, li {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Nav links, logos, and icon buttons must never wrap into multiple lines */
header nav a, .nav-link, .brand-logo, #lang-switch-btn, #audio-toggle-btn {
  white-space: nowrap !important;
  overflow-wrap: normal !important;
  word-wrap: normal !important;
}

/* Responsive Ecosystem Bar & Mobile Drawer */
.ecosystem-bar {
  background: rgba(4, 5, 10, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#mobile-menu {
  background: rgba(7, 8, 15, 0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.85), 0 0 1px 1px rgba(255, 255, 255, 0.08);
}

/* Mobile iOS Safari: Prevent automatic zoom on focus by enforcing min 16px font-size */
@media (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

/* Safe area insets for iOS devices with notch / Dynamic Island */
header {
  padding-top: env(safe-area-inset-top, 0px);
}
footer {
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 16px);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #080911;
}
::-webkit-scrollbar-thumb {
  background: #25283d;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3b3f60;
}

/* ========================================================
   CURSOR HANDLING: Premium Animated Custom Cursor with Robust Fallback
   ======================================================== */
body {
  cursor: default;
}

a, button, [role="button"], input[type="submit"], input[type="button"], .btn-glow, [data-interactive] {
  cursor: pointer;
}

input[type="text"], input[type="email"], input[type="tel"], textarea {
  cursor: text !important;
}

/* Base styling for custom cursor elements */
.custom-cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  background-color: #00f2fe;
  border-radius: 50%;
  pointer-events: none;
  z-index: 999999;
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.95), 0 0 20px rgba(0, 242, 254, 0.5);
  transition: opacity 0.2s ease, width 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), height 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.2s, box-shadow 0.2s;
  will-change: transform;
}

.custom-cursor-follower {
  position: fixed;
  top: 0;
  left: 0;
  width: 36px;
  height: 36px;
  border: 1.5px solid rgba(157, 78, 221, 0.7);
  background-color: rgba(157, 78, 221, 0.05);
  border-radius: 50%;
  pointer-events: none;
  z-index: 999998;
  box-shadow: 0 0 16px rgba(157, 78, 221, 0.25);
  transition: opacity 0.2s ease, width 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), height 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.25s, background-color 0.25s, box-shadow 0.25s;
  will-change: transform;
}

/* Hover state on clickable / interactive elements */
body.cursor-hover .custom-cursor-dot {
  width: 14px;
  height: 14px;
  background-color: #ff2a85;
  box-shadow: 0 0 15px rgba(255, 42, 133, 1), 0 0 30px rgba(255, 42, 133, 0.6);
}

body.cursor-hover .custom-cursor-follower {
  width: 52px;
  height: 52px;
  border-color: #00f2fe;
  background-color: rgba(0, 242, 254, 0.12);
  box-shadow: 0 0 25px rgba(0, 242, 254, 0.4);
}

/* Click state */
body.cursor-clicking .custom-cursor-dot {
  width: 6px !important;
  height: 6px !important;
  background-color: #ff2a85 !important;
}

body.cursor-clicking .custom-cursor-follower {
  width: 28px !important;
  height: 28px !important;
  border-color: #ff2a85 !important;
  background-color: rgba(255, 42, 133, 0.22) !important;
}

/* Responsive display rules */
@media (min-width: 768px) {
  .custom-cursor-dot,
  .custom-cursor-follower {
    display: block !important;
  }
}

@media (max-width: 767px) {
  .custom-cursor-dot,
  .custom-cursor-follower {
    display: none !important;
  }
}

/* When custom cursor is active on desktop, hide the OS cursor on body & interactive elements */
@media (hover: hover) and (pointer: fine), (min-width: 1024px) {
  body.custom-cursor-active,
  body.custom-cursor-active a,
  body.custom-cursor-active button,
  body.custom-cursor-active [role="button"],
  body.custom-cursor-active .btn-glow,
  body.custom-cursor-active [data-interactive] {
    cursor: none !important;
  }

  body.custom-cursor-active input,
  body.custom-cursor-active textarea,
  body.custom-cursor-active select {
    cursor: text !important;
  }
}

/* Glassmorphism Classes */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
}

.glass-nav {
  background: rgba(7, 8, 15, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

/* Gradient Glowing Text */
.gradient-text {
  background: linear-gradient(135deg, #ffffff 10%, #00f2fe 50%, #9d4edd 90%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.gradient-text-alt {
  background: linear-gradient(135deg, #00f2fe 0%, #a855f7 50%, #ff2a85 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Spotlight Card Effect */
.spotlight-card {
  position: relative;
  background: rgba(18, 20, 32, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 1.25rem;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), border-color 0.3s, box-shadow 0.3s;
}

@media (hover: hover) and (pointer: fine) {
  .spotlight-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    background: radial-gradient(600px circle at var(--mouse-x, -500px) var(--mouse-y, -500px), rgba(0, 242, 254, 0.12), transparent 40%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
  }

  .spotlight-card:hover::before {
    opacity: 1;
  }

  .spotlight-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 242, 254, 0.3);
    box-shadow: 0 15px 35px -10px rgba(0, 242, 254, 0.15);
  }
}

/* Glowing Button */
.btn-glow {
  position: relative;
  background: linear-gradient(135deg, #00f2fe 0%, #7928ca 100%);
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.35);
  min-height: 44px;
}

.btn-glow:hover {
  transform: translateY(-2px) scale(1.015);
  box-shadow: 0 0 30px rgba(0, 242, 254, 0.55), 0 0 15px rgba(121, 40, 202, 0.4);
}

.btn-glow:active {
  transform: translateY(0) scale(0.98);
}

/* Pulse animation */
@keyframes pulseGlow {
  0%, 100% {
    transform: scale(1);
    opacity: 0.85;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

.pulse-glow {
  animation: pulseGlow 3s infinite ease-in-out;
}

/* Infinite Marquee */
@keyframes marquee {
  0% { transform: translateX(0%); }
  100% { transform: translateX(-50%); }
}

.animate-marquee {
  display: flex;
  width: max-content;
  animation: marquee 25s linear infinite;
  will-change: transform;
}

@media (max-width: 640px) {
  .animate-marquee {
    animation-duration: 20s;
  }
}

.animate-marquee:hover {
  animation-play-state: paused;
}

/* Floating Animation */
@keyframes floatSlow {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(1deg); }
}

@keyframes floatReverse {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(10px) rotate(-1deg); }
}

.animate-float-1 {
  animation: floatSlow 6s ease-in-out infinite;
}

.animate-float-2 {
  animation: floatReverse 7s ease-in-out infinite;
}

/* Touch-optimized Range input */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  background: #1f2337;
  border-radius: 9999px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #00f2fe;
  cursor: pointer;
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.85);
  border: 3px solid #07080f;
  transition: transform 0.15s ease, background 0.15s ease;
}

@media (max-width: 768px) {
  input[type="range"]::-webkit-slider-thumb {
    width: 32px;
    height: 32px; /* Bigger touch target on mobile */
  }
}

input[type="range"]::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #00f2fe;
  cursor: pointer;
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.85);
  border: 3px solid #07080f;
}

/* Audio visualizer bars */
.audio-bar {
  width: 3px;
  height: 14px;
  background: #00f2fe;
  border-radius: 2px;
  animation: soundBars 0.8s ease-in-out infinite alternate;
}

.audio-bar:nth-child(2) {
  animation-delay: 0.2s;
  height: 18px;
}
.audio-bar:nth-child(3) {
  animation-delay: 0.4s;
  height: 10px;
}
.audio-bar:nth-child(4) {
  animation-delay: 0.1s;
  height: 16px;
}

@keyframes soundBars {
  0% { transform: scaleY(0.3); }
  100% { transform: scaleY(1); }
}

.audio-paused .audio-bar {
  animation: none;
  transform: scaleY(0.25);
  background: #64748b;
}

/* Toast alert notification */
#toast-notification {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
  max-width: calc(100vw - 32px);
}

/* Mobile Drawer Transition */
#mobile-menu {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Responsive Table Helper */
.table-scroll-container {
  position: relative;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ==========================================
   MOBILE HIGH-SPEED & GPU OPTIMIZATIONS
   ========================================== */
@media (max-width: 768px) {
  /* Lightweight glass panels on mobile: avoids heavy GPU composite lag and blank screen */
  .glass-panel {
    background: rgba(14, 16, 26, 0.94) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
  }
  
  .glass-nav {
    background: rgba(7, 8, 15, 0.96) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
  }

  /* Optimize heavy glow orbs on mobile: disable continuous CPU/GPU pulse repaint */
  .mobile-glow-orb {
    filter: blur(35px) !important;
    animation: none !important;
    opacity: 0.45 !important;
    transform: none !important;
  }

  /* Content visibility for below-the-fold sections: massive initial paint speedup */
  #stats-section,
  #leistungen,
  #cases,
  #rechner,
  #wizard-section,
  #faq,
  footer {
    content-visibility: auto;
    contain-intrinsic-size: 1px 500px;
  }
}

/* ========================================================
   MODAL & IFRAME CONFINEMENT (Zero-Blowout on iOS WebKit)
   ======================================================== */
#email-preview-modal {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
  padding: 8px !important;
  z-index: 9999 !important;
}

@media (min-width: 640px) {
  #email-preview-modal {
    padding: 24px !important;
  }
}

#email-preview-modal > div {
  width: calc(100vw - 16px) !important;
  max-width: 48rem !important;
  height: 94vh !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  margin: auto !important;
}

#email-preview-modal iframe,
#email-preview-iframe {
  width: 1px !important;
  min-width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  border: none !important;
  display: block !important;
  box-sizing: border-box !important;
}

#email-preview-modal #email-modal-close-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
  flex-shrink: 0 !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.18) !important;
  border: 1px solid rgba(255, 255, 255, 0.35) !important;
  color: #ffffff !important;
  cursor: pointer !important;
  z-index: 100 !important;
  transition: all 0.2s ease !important;
}

#email-preview-modal #email-modal-close-btn:hover {
  background: rgba(239, 68, 68, 0.3) !important;
  border-color: rgba(239, 68, 68, 0.6) !important;
}

/* ========================================================
   WIZARD & CONTACT FORM MOBILE BUTTON OPTIMIZATION
   ======================================================== */
@media (max-width: 639px) {
  #wizard-step-1 .pt-6,
  #wizard-step-2 .pt-6,
  #wizard-step-3 .pt-6 {
    display: flex !important;
    flex-direction: column-reverse !important;
    gap: 12px !important;
    width: 100% !important;
  }

  #wizard-step-1 .pt-6 button,
  #wizard-step-2 .pt-6 button,
  #wizard-step-3 .pt-6 button,
  #submit-btn {
    width: 100% !important;
    min-height: 48px !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    word-break: break-word !important;
  }
}

/* ========================================================
   FOOTER MOBILE SYMMETRY & TOUCH TARGETS
   ======================================================== */
@media (max-width: 639px) {
  footer nav {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px 12px !important;
    width: 100% !important;
    text-align: center !important;
  }
  footer nav a {
    padding: 8px 10px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    border-radius: 8px !important;
    display: block !important;
    color: #cbd5e1 !important;
  }
  footer nav a:hover {
    background: rgba(0, 242, 254, 0.08) !important;
    border-color: rgba(0, 242, 254, 0.3) !important;
    color: #00f2fe !important;
  }
}

/* ========================================================
   SVG ICON PRESERVATION (Guarantees icons never vanish)
   ======================================================== */
.glass-panel svg:not(.hidden),
.btn-glow svg:not(.hidden),
header svg:not(.hidden),
footer svg:not(.hidden) {
  display: inline-block !important;
  vertical-align: middle !important;
  flex-shrink: 0 !important;
}

/* Explicit rule for hidden SVGs and mobile menu toggle icons */
svg.hidden,
header svg.hidden,
footer svg.hidden,
#mobile-menu-toggle svg.hidden,
.mobile-menu-icon-bars.hidden,
.mobile-menu-icon-close.hidden,
.glass-panel svg.hidden {
  display: none !important;
}

/* Desktop Navigation & Header Visibility Guarantees */
@media (min-width: 1280px) {
  header nav.xl\:flex {
    display: flex !important;
  }
  header #mobile-menu-toggle {
    display: none !important;
  }
}

@media (max-width: 1279px) {
  header #mobile-menu-toggle {
    display: inline-flex !important;
  }
}

@media (min-width: 768px) {
  header a.md\:inline-flex {
    display: inline-flex !important;
  }
}

/* Mobile dropdown drawer visibility guarantees */
#mobile-menu.hidden {
  display: none !important;
}
#mobile-menu:not(.hidden) {
  display: block !important;
}



/* ========================================================
   HIGH-PERFORMANCE RENDERING & ZERO-FOUC OPTIMIZATIONS
   ======================================================== */

/* Zero-FOUC & Anti-Jitter during language switch */
[data-i18n], [data-i18n-html] {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html.vanguard-lang-en [data-i18n],
html.vanguard-lang-en [data-i18n-html] {
  animation: none !important;
}

/* GPU Hardware Layer Promotion for 60/120 FPS ProMotion Displays */
.glass-panel,
.spotlight-card,
header,
#aurora-canvas {
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Smooth Accordion Interactions */
.faq-chevron {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reduce Paint Complexity on Background Canvases */
#aurora-canvas {
  contain: strict;
}

/* ========================================================
   MODAL MOBILE CONFINEMENT & RESPONSIVE PERFECTION
   ======================================================== */
#case-modal .glass-panel,
#email-preview-modal .glass-panel {
  box-sizing: border-box !important;
}

#modal-close-btn {
  position: static !important;
  flex-shrink: 0 !important;
  margin-left: auto !important;
}

#modal-stats {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 8px !important;
  margin-bottom: 20px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

#modal-stats > div {
  padding: 10px 4px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 12px !important;
  text-align: center !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

#modal-stats .stat-number,
#modal-stats .gradient-text {
  font-size: 13.5px !important;
  white-space: nowrap !important;
  letter-spacing: -0.4px !important;
  line-height: 1.2 !important;
  display: block !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

#modal-stats .stat-label,
#modal-stats .text-slate-400 {
  font-size: 9px !important;
  line-height: 1.25 !important;
  margin-top: 4px !important;
  display: block !important;
}

@media (min-width: 440px) {
  #modal-stats .stat-number,
  #modal-stats .gradient-text {
    font-size: 16px !important;
  }
  #modal-stats .stat-label,
  #modal-stats .text-slate-400 {
    font-size: 10.5px !important;
  }
}

@media (min-width: 640px) {
  #modal-stats > div {
    padding: 12px 8px !important;
  }
  #modal-stats .stat-number,
  #modal-stats .gradient-text {
    font-size: 20px !important;
  }
}

@media (max-width: 639px) {
  #case-modal,
  #email-preview-modal {
    padding: 10px !important;
  }

  #case-modal .glass-panel {
    padding: 16px !important;
    max-height: 94vh !important;
    width: calc(100vw - 20px) !important;
  }

  #email-preview-modal .glass-panel {
    height: 96vh !important;
  }
}

/* ========================================================
   MOBILE SAFARI VIEWPORT & FOOTER SAFE-AREA INSET
   ======================================================== */
footer {
  padding-bottom: calc(3rem + env(safe-area-inset-bottom, 24px)) !important;
}

/* ========================================================
   MOBILE CTA BUTTON CENTERING & RESPONSIVE REFINEMENTS
   ======================================================== */
@media (max-width: 639px) {
  .btn-glow {
    white-space: normal;
    text-align: center;
    line-height: 1.35;
  }
  .btn-glow.whitespace-nowrap {
    white-space: nowrap !important;
  }
}

/* Synergy & Comparison Cards Responsive Safety */
.synergy-header-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 0.75rem !important;
  padding-bottom: 0.25rem !important;
}

