/* Globale Basics – kein overflow-x:clip am Body (bricht Sticky/Hero auf Desktop) */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Scroll-Lock nur mobil sinnvoll */
body.is-scroll-locked {
  position: fixed;
  inset-inline: 0;
  width: 100%;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

@media (max-width: 899px) {
  :root {
    --header-h: 58px;
  }

  html {
    scroll-behavior: auto;
    overscroll-behavior-y: none;
    background: #050608;
  }

  body {
    overflow-x: clip;
    overscroll-behavior-y: none;
    padding-top: var(--header-h);
    background: #fff;
  }

  /* Sticky flackert auf iOS; fixed + Spacer ist ruhiger.
     KEIN transform hier – sonst wird position:fixed am Menü am Header
     festgenagelt und nur 1–2 Einträge sind sichtbar. */
  .site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    transform: none;
    -webkit-backface-visibility: visible;
    backface-visibility: visible;
    z-index: 3000;
    overflow: visible;
  }

  .header-inner {
    padding: 0 0.85rem;
    gap: 0.5rem;
    overflow: visible;
  }

  .logo-mark {
    font-size: 1.35rem;
  }

  /* Auf schmalen Screens nur Sprache + Menü */
  .header-actions .icon-btn {
    display: none;
  }

  .lang-btn span {
    font-size: 0.75rem;
  }

  /* Mobile Navigation: voller Bildschirm, alle Punkte ohne Scrollen */
  .nav.is-open {
    display: flex !important;
    position: fixed !important;
    top: var(--header-h) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: calc(100vh - var(--header-h)) !important;
    height: calc(100dvh - var(--header-h)) !important;
    height: calc(100svh - var(--header-h)) !important;
    max-height: none !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 0 !important;
    background: #fff !important;
    padding: 0.15rem 0 max(0.75rem, env(safe-area-inset-bottom, 0px)) !important;
    overflow: hidden !important;
    box-shadow: none !important;
    z-index: 2990 !important;
    border-bottom: 0 !important;
    margin: 0 !important;
    inset-inline: 0 !important;
  }

  body.is-mobile-nav-open {
    overflow: hidden !important;
  }

  body.is-mobile-nav-open .hero-flythrough,
  body.is-mobile-nav-open .hero-fly-bits,
  body.is-mobile-nav-open .fly-bit,
  body.is-mobile-nav-open .hero-typewriter,
  body.is-mobile-nav-open .whatsapp-fab {
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .nav.is-open .nav-item,
  .nav.is-open .nav-link {
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
  }

  .nav.is-open .nav-item {
    display: flex !important;
    flex: 0 0 auto !important;
  }

  .nav.is-open .nav-link {
    padding: 0.72rem 1.15rem !important;
    font-size: 1rem !important;
    border-bottom: 1px solid #f0f0f0 !important;
    min-height: 0 !important;
    height: auto !important;
    line-height: 1.3 !important;
    justify-content: space-between !important;
  }

  .nav.is-open .nav-link.is-active,
  .nav.is-open .nav-link[aria-current="true"] {
    color: var(--brand-red);
  }

  .nav.is-open .nav-link.is-active[data-nav-theme="order"],
  .nav.is-open .nav-link[aria-current="true"][data-nav-theme="order"] {
    color: var(--brand-green);
  }

  .nav.is-open .nav-link.is-active[data-nav-theme="software"],
  .nav.is-open .nav-link[aria-current="true"][data-nav-theme="software"] {
    color: var(--brand-blue);
  }

  .nav.is-open .nav-link.is-active[data-nav-theme="process"],
  .nav.is-open .nav-link[aria-current="true"][data-nav-theme="process"] {
    color: var(--brand-orange);
  }

  /* Mega-Menü: alle Bereiche auf einen Blick, ohne Scrollen */
  .mega-panel:not([hidden]) {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    bottom: auto;
    width: 100%;
    max-height: calc(100svh - var(--header-h));
    max-height: calc((var(--app-height, 100svh)) - var(--header-h));
    overflow: hidden;
    z-index: 1200;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
    background: #fff;
    color: #121212;
    isolation: isolate;
    display: block !important;
  }

  .mega-inner,
  .mega-inner--overview {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 0.85rem 0.75rem 0.95rem;
    gap: 0.65rem 0.75rem;
    align-items: start;
    background: #fff;
  }

  .mega-inner--overview .mega-col h3 {
    margin: 0 0 0.4rem;
    padding-bottom: 0.35rem;
  }

  .mega-inner--overview .mega-col h3 a {
    font-size: 0.82rem;
    line-height: 1.25;
  }

  .mega-col a {
    font-size: 0.8rem;
    padding: 0.15rem 0;
    line-height: 1.3;
  }

  .mega-side--compact {
    grid-column: 1 / -1;
    gap: 0.35rem 0.75rem;
    padding-top: 0.25rem;
  }

  .mega-quick {
    font-size: 0.78rem;
  }

  .mega-cats {
    display: none;
  }

  .mega-content {
    display: contents;
  }

  .mega-panel-body,
  .mega-panel-body[hidden] {
    display: block !important;
  }

  .mega-side:not(.mega-side--compact) {
    display: none;
  }

  /* Hero: stabile Höhe (svh), kein Nachziehen bei Browser-Leiste */
  .hero,
  .hero-text-page {
    min-height: calc(100vh - var(--header-h));
    min-height: calc(100dvh - var(--header-h));
    min-height: calc(100svh - var(--header-h));
    min-height: calc((var(--app-height, 100svh)) - var(--header-h));
  }

  .hero-shell,
  .hero-shell--split {
    width: calc(100% - 1.5rem);
    min-height: calc(100svh - var(--header-h) - 2.5rem);
    min-height: calc((var(--app-height, 100svh)) - var(--header-h) - 2.5rem);
    padding: 1.5rem 0 4.25rem;
    gap: 1.35rem;
    align-content: center;
  }

  .fly-bit {
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
  }

  .hero-shell--split {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .hero-shell--split .hero-left {
    text-align: left;
  }

  .hero-shell--split .hero-full {
    justify-self: center;
    width: 100%;
  }

  .hero-full {
    min-height: 240px;
  }

  .hero-text-page .hero-cta {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
  }

  .hero-text-page .hero-cta .btn {
    width: auto;
    flex: 1 1 auto;
    min-width: min(100%, 9.5rem);
    justify-content: center;
  }

  .hero-full .glow-frame {
    width: min(100%, 340px);
  }

  .hero-px-symbol {
    margin-top: 0.85rem;
    padding: 0.4rem 0.75rem 0.4rem 0.45rem;
    gap: 0.45rem;
  }

  .hero-px-icon {
    width: 1.75rem;
    height: 1.75rem;
  }

  .hero-px-icon svg {
    width: 22px;
    height: 22px;
  }

  .hero-px-name {
    font-size: 0.72rem;
  }

  .px-showcase {
    padding: 3.75rem 0 3.5rem;
  }

  .px-showcase-inner {
    gap: 2rem;
  }

  .px-showcase-orb {
    width: min(100%, 260px);
  }

  .px-showcase-copy h2 {
    max-width: none;
  }

  .hero-copy h1 {
    max-width: 14ch;
    font-size: clamp(1.85rem, 7.5vw, 2.6rem);
  }

  .hero-sub {
    max-width: 36ch;
  }

  .hero-cta {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .hero-cta .btn {
    width: auto;
  }

  .hero-dots {
    right: 0.55rem;
    gap: 0.55rem;
  }

  .dot {
    width: 8px;
    height: 8px;
  }

  .scroll-hint {
    bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
  }

  .hero-flythrough {
    opacity: 1;
  }

  /* Sections */
  .services-section,
  .acl-section,
  .order-section,
  .clients-section {
    padding: 3.25rem 0;
  }

  .order-trust {
    margin-bottom: 1.75rem !important;
  }

  .order-trust-text {
    font-size: 0.98rem !important;
  }

  .clients-section {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    overflow: hidden !important;
  }

  .clients-logos,
  .clients-single {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 1.5rem 2rem !important;
    min-height: 5.5rem !important;
    width: max-content !important;
    margin-inline: auto !important;
    opacity: 1 !important;
    visibility: visible !important;
    overflow: visible !important;
    animation: clientsDriftMobile 10s ease-in-out infinite alternate !important;
  }

  .clients-logo {
    display: inline-flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    animation: none !important;
  }

  .clients-logo-mark {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  .clients-logo-mark svg,
  .clients-logo-mark img {
    display: block !important;
    width: min(220px, 70vw) !important;
    height: auto !important;
    max-width: 100% !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  .section-inner,
  .sp-wrap {
    width: calc(100% - 1.5rem);
  }

  .local-landing {
    padding: 3rem 0 3.5rem !important;
  }

  .page-local-landing .sp-hero-inner h1 {
    max-width: none !important;
  }

  .about-intro {
    gap: 1.15rem !important;
  }

  .page-about .about-intro-media {
    margin-top: -1.35rem !important;
  }

  .about-intro .about-copy p {
    font-size: 0.98rem !important;
  }

  .team-roster {
    gap: 2.25rem !important;
  }

  .team-card-grid {
    grid-template-columns: 1fr !important;
  }

  .team-card {
    min-height: 0 !important;
  }

  .team-card-media {
    max-width: none !important;
  }

  .team-card-figure {
    width: 68% !important;
    opacity: 1 !important;
  }

  .team-externals {
    text-align: start !important;
  }

  .siw-showcase {
    display: block !important;
    overflow: visible !important;
  }

  .siw-showcase-grid {
    display: block !important;
  }

  .siw-showcase-media {
    display: block !important;
    width: 100% !important;
    max-width: 22rem !important;
    margin: 0 auto 1.25rem !important;
  }

  .siw-showcase-media img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  .siw-showcase-copy {
    display: block !important;
  }

  .section-head {
    margin-bottom: 1.75rem;
  }

  .pillar {
    gap: 0.85rem;
    padding: 1.1rem 0;
  }

  .pillar-letter {
    min-width: 1em;
  }

  .order-form {
    padding: 1.1rem;
    border-radius: 14px;
  }

  .contact-strip {
    padding: 2.5rem 0;
  }

  .contact-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .contact-inner .btn {
    width: 100%;
  }

  /* Footer */
  .site-footer {
    padding: 2.25rem 0 calc(2rem + env(safe-area-inset-bottom, 0px));
  }

  .footer-inner--wide {
    gap: 1.35rem;
  }

  .footer-cols {
    gap: 1.35rem;
  }

  /* WhatsApp über Safe-Area */
  .whatsapp-fab {
    right: max(0.9rem, env(safe-area-inset-right, 0px));
    bottom: max(0.9rem, env(safe-area-inset-bottom, 0px));
    width: 54px;
    height: 54px;
  }

  /* Legal */
  .legal-main {
    padding: 2.25rem 0 3rem;
  }

  .legal-wrap h1 {
    font-size: 1.7rem;
  }
}

@media (max-width: 899px) {
  .process-section {
    padding: 3.5rem 0 3rem;
  }

  .process-intro {
    margin-bottom: 1.75rem !important;
  }

  .process-intro-text {
    font-size: 0.98rem !important;
  }

  .process-trigger {
    padding: 0.95rem 1rem;
    font-size: 0.95rem;
  }

  .process-panel p {
    padding: 1.05rem 1rem 1.2rem;
    font-size: 0.92rem;
  }
}

/* Breite Phones / kleine Tablets: Text + Grafik nebeneinander wie Desktop */
@media (min-width: 640px) and (max-width: 899px) {
  .hero-shell--split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.25rem 1.75rem;
    align-items: center;
  }

  .hero-shell--split .hero-full {
    justify-self: end;
  }

  .hero-full .glow-frame {
    width: min(100%, 360px);
  }
}

@media (max-width: 480px) {
  .brand-signal {
    font-size: 1.45rem;
  }

  .glow-caption .glow-title {
    letter-spacing: 0.06em;
  }

  .lang-menu {
    min-width: 9.5rem;
    inset-inline-end: -0.25rem;
  }

  .sp-icon-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem 0.5rem;
  }

  .sp-hero-inner {
    padding: 3rem 0 4rem;
  }

  .sp-hero h1 {
    font-size: clamp(1.55rem, 9vw, 2.2rem);
    letter-spacing: 0.02em;
  }

  .sp-hero-title-row {
    gap: 0.35rem;
    width: 100%;
  }

  .sp-hero-nav {
    width: 2.35rem;
    height: 2.35rem;
  }

  .sp-hero-nav svg {
    width: 22px;
    height: 22px;
  }

  .sp-hero--page h1 {
    font-size: clamp(2rem, 8vw, 3.2rem);
    letter-spacing: 0.02em;
  }

  .sp-hero--page .sp-hero-inner {
    min-height: 0;
    padding: 1.25rem;
  }

  .sp-hero-cta {
    flex-direction: column;
    align-items: stretch;
  }

  .sp-hero-cta .btn {
    width: 100%;
  }

  /* Kategorie- & Projektseiten: gleiche Struktur wie Desktop */
  .category-page .sp-hero-cta,
  .page-project .project-cta {
    align-items: start;
    justify-items: start;
  }

  .category-page .cat-child-link {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
  }

  .category-page .cat-children {
    grid-template-columns: 1fr;
  }

  /* PerceptaX / Projektseite: Hero & Text wie am PC */
  .page-project .sp-hero--page {
    min-height: calc(100vh - var(--header-h));
    min-height: calc(100dvh - var(--header-h));
    min-height: calc(100svh - var(--header-h));
    min-height: calc((var(--app-height, 100svh)) - var(--header-h));
  }

  .page-project .sp-hero--page .sp-hero-inner {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    min-height: 0;
    padding: 1.25rem;
    text-align: center;
  }

  .page-project .sp-hero--page h1 {
    font-size: clamp(2.35rem, 10vw, 4.5rem);
    max-width: min(96vw, 42rem);
    line-height: 1.1;
    letter-spacing: 0.02em;
  }

  .page-project .project-article {
    padding: 3.25rem 0 4rem;
    background: #fff;
  }

  .page-project .project-article-inner {
    max-width: 46rem;
    width: min(46rem, calc(100% - 2rem));
    margin-inline: auto;
  }

  .page-project .project-kicker {
    font-size: 0.8rem;
  }

  .page-project .project-article h2 {
    font-size: clamp(1.55rem, 5vw, 2.15rem);
  }

  .page-project .project-article h3 {
    font-size: 1.2rem;
    margin: 2.25rem 0 1rem;
  }

  .page-project .project-copy p {
    font-size: 1.05rem;
    line-height: 1.7;
  }

  .page-project .project-cta {
    margin-top: 2.5rem;
    padding-top: 1.75rem;
    display: grid;
    gap: 1rem;
    justify-items: start;
  }

  .page-project .project-cta .btn {
    width: auto;
    min-width: 0;
    display: inline-flex;
  }

  @media (max-width: 520px) {
    .mega-inner,
    .mega-inner--overview {
      grid-template-columns: 1fr 1fr;
      padding: 0.75rem 0.7rem 0.85rem;
      gap: 0.75rem 0.85rem;
    }

    .mega-inner--overview .mega-col[data-mega-panel="support"] {
      grid-column: 1 / -1;
    }

    .mega-side--compact {
      grid-column: 1 / -1;
    }
  }

  @media (max-width: 380px) {
    .mega-inner,
    .mega-inner--overview {
      grid-template-columns: 1fr 1fr;
      gap: 0.55rem 0.65rem;
      padding: 0.65rem 0.55rem 0.75rem;
    }

    .mega-inner--overview .mega-col h3 a {
      font-size: 0.75rem;
    }

    .mega-col a {
      font-size: 0.74rem;
    }
  }

  .sp-cta-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .sp-cta-actions {
    flex-direction: column;
  }

  .sp-cta-actions .btn,
  .btn-ghost-dark {
    width: 100%;
  }
}

/* Landscape phones – weiterhin volle Abschnitte, kompakter */
@media (max-width: 899px) and (max-height: 480px) {
  .hero-shell--split {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
    gap: 1rem 1.25rem;
    padding: 0.75rem 0 2.75rem;
    min-height: calc(100svh - var(--header-h) - 1.5rem);
    min-height: calc((var(--app-height, 100svh)) - var(--header-h) - 1.5rem);
  }

  .hero-full {
    min-height: 150px;
  }

  .hero-full .glow-frame {
    width: min(100%, 200px);
  }

  .hero-copy h1 {
    font-size: clamp(1.35rem, 5vw, 1.85rem);
  }

  .hero-cta {
    margin-top: 0.85rem;
  }
}
