/* Site tweaks — soft hyphens, mobile header, mobile submenu, hero phones, UX */

/* Soft hyphens / automatic German hyphenation */
html {
  hyphens: auto;
  -webkit-hyphens: auto;
  -ms-hyphens: auto;
  hyphenate-limit-chars: 8 4 4;
  -webkit-hyphenate-limit-before: 4;
  -webkit-hyphenate-limit-after: 4;
}

h1, h2, h3, h4, h5, h6,
.et_pb_button,
.et_pb_menu a,
.et_mobile_menu a,
nav a {
  hyphens: none;
  -webkit-hyphens: none;
}

/* Prevent horizontal page overflow on small screens */
html, body {
  overflow-x: hidden;
}

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

/* Tiny hero clearance so H1 doesn't sit in the header */
.et-l--post > .et_builder_inner_content > .et_pb_section:first-child {
  padding-top: 12px !important;
}

/* Mobile header: a bit wider logo / taller bar */
@media (max-width: 980px) {
  .et-db #et-boc .et-l .et_pb_menu_0_tb_header .et_pb_menu__logo-slot,
  .et-db #et-boc .et-l .et_pb_menu_1_tb_header .et_pb_menu__logo-slot,
  .et-db #et-boc .et-l .et_pb_menu_0_tb_header .et_pb_menu__logo-wrap,
  .et-db #et-boc .et-l .et_pb_menu_1_tb_header .et_pb_menu__logo-wrap,
  .et_pb_menu_0_tb_header .et_pb_menu__logo-wrap,
  .et_pb_menu_1_tb_header .et_pb_menu__logo-wrap {
    width: 280px !important;
    max-width: 72vw !important;
    flex: 0 0 auto !important;
  }

  .et-db #et-boc .et-l .et_pb_menu_0_tb_header .et_pb_menu__logo,
  .et-db #et-boc .et-l .et_pb_menu_1_tb_header .et_pb_menu__logo {
    width: 100% !important;
  }

  .et-db #et-boc .et-l .et_pb_menu_0_tb_header .et_pb_menu__logo img,
  .et-db #et-boc .et-l .et_pb_menu_1_tb_header .et_pb_menu__logo img,
  .et_pb_menu_0_tb_header .et_pb_menu__logo img,
  .et_pb_menu_1_tb_header .et_pb_menu__logo img {
    width: 100% !important;
    max-width: 280px !important;
    height: auto !important;
    max-height: none !important;
  }

  .et-db #et-boc .et-l .et_pb_row_0_tb_header.et_pb_row {
    padding-top: 12px !important;
    padding-bottom: 12px !important;
  }

  .et_pb_section_0_tb_header.et_pb_section {
    min-height: 76px;
  }
}

/* Mobile menu: collapse Leistungen submenu by default */
@media (max-width: 980px) {
  .et_mobile_menu li.menu-item-has-children > ul.sub-menu {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .et_mobile_menu li.menu-item-has-children.mobile-submenu-open > ul.sub-menu {
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .et_mobile_menu li.menu-item-has-children > a {
    position: relative;
    padding-right: 2.2em !important;
    cursor: pointer;
  }

  .et_mobile_menu li.menu-item-has-children > a::after {
    content: "+" !important;
    position: absolute;
    right: 0.75em;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.15em;
    font-weight: 600;
    line-height: 1;
    opacity: 0.85;
    border: none !important;
    font-family: inherit !important;
  }

  .et_mobile_menu li.menu-item-has-children.mobile-submenu-open > a::after {
    content: "−" !important;
  }
}

/* Hero phone CTAs — same look as site buttons (btn_nw) */
.hero-cta-phones {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 14px;
}

.hero-cta-phones > .et_pb_button {
  flex: 0 0 auto;
  text-decoration: none !important;
  hyphens: none !important;
  -webkit-hyphens: none !important;
  box-sizing: border-box;
}

@media (max-width: 767px) {
  .hero-cta-phones {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
  }

  .hero-cta-phones > .et_pb_button {
    width: auto !important;
    max-width: 260px !important;
    min-width: 210px;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Referenzen: long heading must wrap on small screens */
#vertrauen-sie-auf-unsere-erfahrung,
.et_pb_text_8 h2 {
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

@media (max-width: 767px) {
  #vertrauen-sie-auf-unsere-erfahrung,
  .et_pb_text_8 h2 {
    font-size: clamp(22px, 7.2vw, 34px) !important;
    line-height: 1.2 !important;
  }
}

/* Kontakt (and generally): keep hero/content images inside the viewport */
@media (max-width: 980px) {
  .et_pb_section_0 .et_pb_image_0,
  .et_pb_section_0 .et_pb_image_0 .et_pb_image_wrap,
  .et_pb_section_0 .et_pb_column_0,
  .et_pb_section_0 .et_pb_row_0 {
    max-width: 100% !important;
    width: 100% !important;
    overflow: hidden !important;
  }

  .et_pb_section_0 .et_pb_image_0 img,
  .et_pb_section_0 .et_pb_image_0 .et_pb_image_wrap img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    display: block !important;
  }
}

/* WhatsApp float (all viewports) — bottom right */
#site-whatsapp {
  position: fixed;
  right: 16px;
  bottom: 18px;
  z-index: 100000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #25d366;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  text-decoration: none !important;
  line-height: 0;
  overflow: hidden;
  transition: transform 0.15s ease, background 0.15s ease;
}

#site-whatsapp:hover,
#site-whatsapp:focus {
  background: #1ebe57;
  transform: scale(1.06);
  outline: none;
}

#site-whatsapp svg {
  width: 28px !important;
  height: 28px !important;
  max-width: 28px !important;
  max-height: 28px !important;
  display: block;
  flex: 0 0 28px;
  fill: currentColor;
  aspect-ratio: 1 / 1;
}

/* Back-to-top button (mobile) — sits above WhatsApp */
#site-back-to-top {
  position: fixed;
  right: 22px;
  bottom: 86px;
  z-index: 99999;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #d82d30;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

#site-back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

#site-back-to-top:hover,
#site-back-to-top:focus {
  background: #b82427;
  outline: none;
}

@media (min-width: 981px) {
  #site-back-to-top {
    display: none !important;
  }
}
