/*
 * Mobile responsiveness overrides
 * ============================================================
 * Loaded AFTER all Webflow stylesheets so these rules win on
 * narrow viewports without affecting desktop layout.
 */

html,
body {
  overflow-x: clip !important;
  max-width: 100% !important;
}

img,
video {
  max-width: 100%;
  height: auto;
}

@media (max-width: 991px) {
  /* Force inline-styled multi-column grids to single column */
  .w-layout-grid.features-grid[style*="repeat(3"],
  .w-layout-grid.features-grid[style*="repeat(4"],
  .w-layout-grid.features-grid[style*="repeat(2"] {
    grid-template-columns: 1fr !important;
  }

  .hero-home {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    overflow: hidden !important;
  }
  .hero-home .image-15 {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    margin-left: 0 !important;
    transform: none !important;
  }

  .div-block-14,
  .div-block-14.left {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .image-11 {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
  }

  .project-creation-_features,
  .pricing-grid.project-creation-grid,
  .industrie-features-grid {
    grid-template-columns: 1fr !important;
  }

  .wide-card-text {
    max-width: 100% !important;
  }

  .features-grid,
  .w-layout-grid.features-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 767px) {
  .heading-1,
  .heading-2,
  .heading-3 {
    word-break: break-word;
    overflow-wrap: anywhere;
    hyphens: auto;
    white-space: normal !important;
  }

  .two-column-cta {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
  }
  .two-column-cta .button.w-button {
    width: 100% !important;
    text-align: center !important;
  }

  .container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    max-width: 100% !important;
  }

  /* Reduce inline marginLeft on hero images */
  .image-15[style*="margin-left"] {
    margin-left: 0 !important;
  }

  /* Webinar popup full-bleed safety */
  .webinar-popup-card {
    margin-left: 0.5rem !important;
    margin-right: 0.5rem !important;
  }

  /* Add top padding before hero images in two-column layouts on mobile */
  .w-layout-grid._2-column-grid .hero-home {
    padding-top: 2.5rem !important;
  }

  /* Webinar hero: more padding and smaller image on mobile */
  .webinar-hero .hero-home {
    padding-top: calc(4rem + 80px) !important;
  }
  .webinar-hero .hero-home .image-15 {
    width: 80% !important;
    max-width: 80% !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  /* Hide hamburger menu on webinar page navbar on mobile */
  .webinar-page .menu-button.w-nav-button {
    display: none !important;
  }

  /* Hero subtext: left align on mobile */
  .hero-subtext {
    text-align: left !important;
    max-width: 90% !important;
  }

  /* Platform hero: less padding between text and cards on mobile */
  .platform-hero {
    padding-bottom: 0.5rem !important;
  }
  .platform-hero .section-heading-container-centered._100-w {
    padding-bottom: 0 !important;
  }

  .mobile-block {
    display: block;
  }

  /* Buttons with mobile-block spans: stack text in two centered rows */
  .button:has(.mobile-block) {
    display: inline-flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    white-space: normal !important;
    text-align: center !important;
    width: 100% !important;
  }

  .ausschreibung-cta-wrap {
    display: block;
    text-align: center;
  }
}

.ausschreibung-cta-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.ausschreibung-cta-wrap .text-small {
  width: 100%;
  text-align: center;
}

.mobile-block {
  display: inline;
}

/* Add a space between the two inline spans on desktop */
.mobile-block:first-child::after {
  content: " ";
}

@media (min-width: 768px) {
  /* Webinar hero: restore desktop order — text left, image right */
  .webinar-hero .w-layout-grid._2-column-grid ._2-column-text-container {
    order: 1;
  }
  .webinar-hero .w-layout-grid._2-column-grid .hero-home {
    order: 2;
  }
}

@media (max-width: 767px) {
  .wrapper-central.section-button {
    margin-top: 0 !important;
  }
}

@media (max-width: 479px) {
  .heading-1 {
    font-size: 2.25rem !important;
    line-height: 1.15 !important;
    letter-spacing: -0.02em !important;
  }
  .heading-2 {
    font-size: 1.75rem !important;
    line-height: 1.2 !important;
  }
  .heading-3 {
    font-size: 1.5rem !important;
    line-height: 1.25rem !important;
  }
}

/* Rounded corners for homepage CTA containers */
.centered-narrow-container.lean.home {
  border-radius: 2.5rem;
  overflow: hidden;
}

/* Fix Vertrauen section cards on mobile */
@media (max-width: 767px) {
  #gaeb .feature-container {
    padding: 1.5rem !important;
  }

  #gaeb .feature-container[style*="gridColumn"] {
    padding-right: 1.5rem !important;
  }

  #gaeb .feature-container img[alt="KI Innovator 2025 Award"] {
    position: relative !important;
    right: auto !important;
    bottom: auto !important;
    height: 160px !important;
    margin-top: 1rem !important;
    align-self: center !important;
  }
}

/* Warum Electrofy cards: stack to single column on mobile */
@media (max-width: 767px) {
  #find .div-block-14 .label.dark-gray {
    text-align: center !important;
    display: block;
    width: fit-content !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  #find > div:nth-of-type(2) {
    grid-template-columns: 1fr !important;
    padding: 3.5rem 1rem 1.5rem !important;
  }

  #find > div:nth-of-type(2) > div {
    padding: 0 1rem !important;
  }

  /* Reduce top padding before Warum Electrofy & CTA sections on mobile */
  .hero-section.cta.white.home.lean.gaeb,
  .hero-section.cta.white.home.lean {
    padding-top: calc(6rem - 80px) !important;
  }

  /* GAEB hero image: fit inside viewport and center on mobile */
  .hero-section.gaeb .hero-home .hero-img {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    height: auto !important;
  }

  /* Fertiges Angebot card: image first, text second on mobile only */
  .features-grid .project-creation-_features:nth-child(3) .image-17.new {
    order: -1 !important;
  }
}

/* Datenquellen & Schnittstellen section: extra top/bottom padding on mobile */
@media (max-width: 767px) {
  .hero-section.calendly {
    padding-top: calc(18rem + 80px) !important;
    padding-bottom: 40px !important;
  }

  .webinar-page .calendly-alt {
    padding-top: calc(2rem + 80px) !important;
  }

  /* Webinar Exklusiver Zugang CTA: rounded corners on mobile */
  .webinar-page .centered-narrow-container.gaeb {
    border-radius: 2.5rem;
    overflow: hidden;
  }

  /* Remove bottom padding under body text in Exklusiver Zugang section */
  .webinar-page .centered-narrow-container.gaeb .wrapper-central.solutions.in-box {
    padding-top: 0;
  }

  /* Remove bottom padding under Webinar Registrierung subtitle on mobile */
  .webinar-page #webinar-registration p.text-medium.centered.in-box {
    margin-bottom: 0 !important;
  }

  /* Extra space before Ausschreibungs-Assistent button on mobile */
  .webinar-page .calendly-alt .button.w-button {
    margin-top: 40px !important;
  }

  /* Countdown grid: 2 columns on mobile */
  .webinar-page .countdown-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 1rem !important;
  }

  .webinar-page .countdown-grid > div {
    max-width: none !important;
    aspect-ratio: auto !important;
  }
}

/* Mobile navbar hamburger: vertically centre icon and ensure nav links stack */
@media (max-width: 991px) {
  .menu-button.w-nav-button {
    align-self: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .nav-links-container .nav-link {
    display: block !important;
    width: 100% !important;
    text-align: left !important;
  }
}