/*
 * mobile-overrides.css — Mobile-Optimierungen ohne Desktop-Layout zu verändern.
 * Wird nur bei Viewport <= 1024px aktiv. Desktop bleibt unverändert.
 */

/* Burger-Button und Overlay standardmäßig versteckt (für Desktop) */
.mobile-burger-btn,
.mobile-nav-overlay {
  display: none;
}

@media (max-width: 1024px) {
  /* === Desktop-Navigation auf Mobile verstecken === */
  .con-kit-atom-menu-v2--device-desktop,
  .con-kit-atom-menu-v2--in-header,
  .con-kit-component-menu-v2-more {
    display: none !important;
  }

  /* === Header-CTA-Buttons (z.B. "Jetzt bewerben") auf Mobile verstecken
     (kommt ins Burger-Menü) === */
  .con-kit-molecule-header-v2 a.con-kit-component-button {
    display: none !important;
  }

  /* === Mobile-Burger-CTA hervorheben === */
  .mobile-nav-item--cta .mobile-nav-link {
    background: #75b828;
    color: #fff !important;
    text-align: center;
    border-radius: 8px;
    margin: 12px 0;
    padding: 16px;
    justify-content: center;
  }
  .mobile-nav-item--cta {
    border-bottom: none !important;
  }

  /* === Burger-Button === */
  .mobile-burger-btn {
    display: flex !important;
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 9998;
    width: 48px;
    height: 48px;
    background: rgba(23, 81, 136, 0.95);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    padding: 0;
  }

  .mobile-burger-btn:active {
    transform: scale(0.95);
  }

  .mobile-burger-btn__lines {
    display: block;
    width: 24px;
    height: 18px;
    position: relative;
  }

  .mobile-burger-btn__lines::before,
  .mobile-burger-btn__lines::after,
  .mobile-burger-btn__lines span {
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    background: #fff;
    border-radius: 2px;
  }

  .mobile-burger-btn__lines::before { top: 0; }
  .mobile-burger-btn__lines span { top: 7px; display: block; }
  .mobile-burger-btn__lines::after { bottom: 0; }

  /* === Mobile-Nav-Overlay === */
  .mobile-nav-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 9999;
    overflow-y: auto;
    padding: 72px 20px 32px;
    -webkit-overflow-scrolling: touch;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    visibility: hidden;
  }

  .mobile-nav-overlay.is-open {
    transform: translateX(0);
    visibility: visible;
  }

  .mobile-nav-overlay__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 48px;
    height: 48px;
    background: rgba(23, 81, 136, 0.95);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    z-index: 1;
  }

  .mobile-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .mobile-nav-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }

  .mobile-nav-link {
    color: #175188;
    font-size: 18px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    padding: 8px 4px;
    cursor: pointer;
    user-select: none;
  }

  .mobile-nav-link__arrow {
    width: 14px;
    height: 14px;
    border-right: 2px solid #175188;
    border-bottom: 2px solid #175188;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    margin-right: 8px;
    flex-shrink: 0;
  }

  .mobile-nav-item.is-open .mobile-nav-link__arrow {
    transform: rotate(-135deg);
    margin-top: 6px;
  }

  .mobile-nav-sub {
    list-style: none;
    padding: 0 0 12px 16px;
    margin: 0;
    display: none;
  }

  .mobile-nav-item.is-open .mobile-nav-sub {
    display: block;
  }

  .mobile-nav-sub-item {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
  }

  .mobile-nav-sub-link {
    color: #333;
    font-size: 16px;
    font-family: inherit;
    text-decoration: none;
    display: block;
    min-height: 48px;
    line-height: 1.4;
    padding: 14px 4px;
  }

  /* Body sperren wenn Menü offen */
  body.mobile-nav-locked {
    overflow: hidden;
  }

  /* === Akkordeon-Buttons: Touch-Target ≥44×44px === */
  .con-kit-component-list-item-accordion__trigger button,
  .con-kit-component-list-item-accordion__toggle {
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 10px !important;
  }

  /* === Footer-Texte vergrößern (Kontaktdaten) === */
  .con-kit-component-text,
  .con-kit-component-text .con-kit-quark-paragraph,
  .con-kit-atom-plain-text {
    font-size: 16px !important;
  }

  /* === Links touch-freundlich === */
  footer a,
  .con-kit-component-link-group a {
    min-height: 44px;
    display: inline-block;
    line-height: 1.5;
    padding: 4px 0;
  }

  /* === tel: und mailto: Links: garantierte Touch-Target-Größe === */
  a[href^="tel:"],
  a[href^="mailto:"] {
    min-height: 44px !important;
    line-height: 44px !important;
    display: inline-block;
    padding: 4px 8px;
  }

  /* === Alle Schriften mindestens 14px (Onepage-Quarks korrigieren) === */
  .con-kit-quark,
  .con-kit-quark-paragraph,
  span,
  div {
    font-size: max(14px, 1em);
  }

  /* Schrumpfen verhindern: zu kleine font-size: ... ersetzen wir */
  [style*="font-size: 13"],
  [style*="font-size:13"] {
    font-size: 14px !important;
  }

  /* === Verhindere horizontales Overflow generell === */
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  /* Hero-Bereiche: sorge dass nichts überlappt */
  .con-kit-organism,
  .con-kit-frame,
  .con-kit-container {
    max-width: 100vw !important;
  }

  /* === Masonry-Layout: Mehrspaltig → 1 Spalte gestapelt === */
  .con-kit-component-masonry,
  .con-kit-component-masonry--columns-2,
  .con-kit-component-masonry--columns-3,
  .con-kit-component-masonry--columns-4 {
    flex-direction: column !important;
    width: 100% !important;
  }
  .con-kit-component-masonry__column {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  .con-kit-component-masonry__item {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* === Grid-Timeline (Tag-im-Leben Liste) auf Mobile stacken ===
     Live behält __item als flex-row (Icon + Card nebeneinander),
     nur die Items werden auf volle Breite gezwungen. */
  .con-kit-component-grid-timeline,
  .con-kit-component-grid-timeline__container {
    flex-direction: column !important;
    width: 100% !important;
  }
  .con-kit-component-grid-timeline__item {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
    flex-basis: auto !important;
  }
  /* Icon und Card im __item: behalten ihre row-Anordnung,
     Card nimmt den Rest-Platz */
  .con-kit-component-grid-timeline__icon {
    flex: 0 0 auto !important;
  }
  .con-kit-component-grid-timeline__item .con-kit-molecule-grid-item {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  /* === Timeline-Alignment: auf Mobile immer linksbündig (wie Live) ===
     Onepage's JS schaltet auf Mobile die Klasse von --align-center auf
     --align-left. Wir simulieren das per CSS-Override. */
  .con-kit-component-grid-timeline--align-center,
  .con-kit-component-grid-timeline--align-right {
    align-items: flex-start !important;
  }
  .con-kit-component-grid-timeline--align-center .con-kit-component-grid-timeline__item,
  .con-kit-component-grid-timeline--align-right .con-kit-component-grid-timeline__item {
    align-self: flex-start !important;
    transform: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    left: 0 !important;
    right: auto !important;
  }


  /* Plain-Text Container darf nicht auf Inhaltsbreite schrumpfen */
  .con-kit-atom-plain-text {
    min-width: 0 !important;
    width: 100% !important;
  }

  /* === Allgemein: Multi-Column-Grids zu Single-Column === */
  .con-kit-component-grid-list--columns-2,
  .con-kit-component-grid-list--columns-3,
  .con-kit-component-grid-list--columns-4 {
    grid-template-columns: 1fr !important;
  }
  .con-kit-component-grid-list-item {
    width: 100% !important;
  }

  /* === Allgemein: enge Flex-Container öffnen === */
  .con-kit-row {
    flex-direction: column !important;
  }
  .con-kit-row > .con-kit-col {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 auto !important;
  }

  /* === Video-Container responsive === */
  .con-kit-atom-video,
  .con-kit-component-video,
  .con-kit-component-video-preview {
    max-width: 100% !important;
    width: 100% !important;
  }

  video {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
  }

  /* Parallax-Video-Container: zwingt Video auf Viewport-Breite */
  .con-kit-organism-parallax--video,
  .parallax-banner-layer-0,
  .parallax-inner {
    max-width: 100vw !important;
    overflow: hidden !important;
  }
  .con-kit-organism-parallax--video video,
  .parallax-banner-layer-0 video,
  .parallax-inner video {
    width: 100% !important;
    max-width: 100vw !important;
    height: 100% !important;
    object-fit: cover !important;
    left: 0 !important;
  }
}

/* === JOHS-Oldenburg-spezifisch: USP-Widget Mobile === */
@media (max-width: 1024px) {
  /* USP-Cards: überdimensioniertes Padding von 50px auf Mobile reduzieren */
  .usp-card {
    padding: 24px 20px !important;
    min-height: auto !important;
    border-radius: 16px !important;
  }
  .foehr-usp-widget {
    padding: 20px 10px !important;
  }
  .usp-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* Bento-Grid (Deine Benefits): explizit 1 Spalte erzwingen */
  .con-kit-layout[data-kit-grid-type=bento] {
    grid-template-columns: 1fr !important;
    --one-kit-grid-columns: 1 !important;
  }
  .con-kit-layout[data-kit-grid-type=bento] > * {
    grid-column: 1 !important;
  }

  /* molecule-textBlock in Bento: volle Breite */
  .con-kit-molecule-textBlock {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Kontakt-Seite: Schriften < 14px korrigieren */
  .con-kit-component-contacts,
  .con-kit-component-contacts *,
  .con-kit-component-data-item-list,
  .con-kit-component-data-item-list * {
    font-size: max(14px, 1em) !important;
  }

  /* Touch-Targets: Icon-Buttons mind. 44×44px */
  .con-kit-component-button--type-transparent:not([class*="--title"]),
  .con-kit-component-button--icon {
    min-width: 44px !important;
    min-height: 44px !important;
  }

  /* Adress-Links und Kontakt-Buttons: Mindesthöhe */
  .con-kit-component-button--type-transparent {
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  /* Skip-to-content: Mindesthöhe */
  .skip-to-content {
    min-height: 44px !important;
  }

  /* Verifikations-Button Telefonnummer */
  .con-kit-atom-phone-number__verification-button {
    min-height: 44px !important;
    padding: 8px 16px !important;
  }

  /* Service-Cards (Leistungen): Bilder nicht zu hoch */
  .con-kit-component-list-item__head img,
  .con-kit-component-image img {
    max-height: 240px !important;
    object-fit: cover !important;
    width: 100% !important;
  }

  /* Atom-List Items: immer volle Breite auf Mobile */
  .con-kit-component-atom-list .con-kit-component-list-item,
  .con-kit-component-list-plain .con-kit-component-list-item {
    width: 100% !important;
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
}

/* Sehr kleine Geräte (< 480px) zusätzliche Anpassungen */
@media (max-width: 480px) {
  .mobile-nav-overlay {
    padding-left: 16px;
    padding-right: 16px;
  }

  .mobile-nav-link {
    font-size: 17px;
  }
}
