/*
 * Theme: Thomas Krause — Mobile Stylesheet (komplett, v6)
 * 2026-06-18 — strikte Mobile/Desktop-Trennung.
 * Geladen NACH style.css in functions.php.
 * AUSSCHLIESSLICH @media-Regeln. NIEMALS Desktop-Regeln hier rein.
 *
 * Specificity-Trick: `body:not(#_)` davor = +1 attribute → schlägt
 * desktop-rules sicher ohne IDs erfinden zu müssen.
 */

/* =====================================================================
   MOBILE (≤ 768px) — Smartphone (Specificity-bumped via body:not(#_))
   ===================================================================== */
@media (max-width: 768px) {

  /* ============ FOUNDATION ============ */
  html, body:not(#_) {
    overflow-x: hidden !important;
    max-width: 100vw !important;
  }
  body:not(#_) main .wp-block-group.has-global-padding {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* ============ HEADER (fixed, kompakt) ============ */
  body:not(#_) header.top,
  body:not(#_) header.wp-block-template-part {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
  body:not(#_) .tk-header-inner {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    padding: 8px 16px !important;
    min-height: 56px !important;
    max-width: 100vw !important;
  }
  body:not(#_) .tk-brand {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    flex-shrink: 0 !important;
  }
  body:not(#_) .tk-brand .tk-logo {
    display: inline-flex !important;
    width: 36px !important;
    height: 36px !important;
  }
  body:not(#_) .tk-brand .tk-logo img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }
  body:not(#_) .tk-header-inner .tk-brand-name,
  body:not(#_) .tk-header-inner .tk-brand-sub {
    display: none !important;
  }
  body:not(#_) .tk-header-inner a[href*='tel:'] {
    display: none !important;
  }
  body:not(#_) .tk-header-inner a[href*='mailto'] {
    font-size: 11px !important;
    letter-spacing: 0 !important;
    max-width: 220px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* ============ COOKIE-NOTICE: an unteren Rand kleben, nicht mehr mitte ============ */
  body:not(#_) > div[style*='position:fixed'],
  body:not(#_) > div:not(.tk-lang):not(.wp-site-blocks)[id^=''] {
    /* Generischer Sticky-Banner unten */
  }
  /* Cookie-Notice ist <div id="tk-cookie"> — fixed position kommt aus style.css */
  body:not(#_) #tk-cookie,
  html body #tk-cookie,
  #tk-cookie {
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    border-radius: 0 !important;
    padding: 12px 16px !important;
    font-size: 12px !important;
    line-height: 1.4 !important;
    z-index: 9999 !important;
    box-shadow: 0 -4px 16px rgba(0,10,48,0.18) !important;
  }

  /* ============ LANG-SWITCHER: nicht über Inhalt schweben ============ */
  body:not(#_) .tk-lang {
    bottom: 8px !important;
    right: 8px !important;
    top: auto !important;
    z-index: 9998 !important;
  }
  body:not(#_) .tk-lang-toggle {
    width: 36px !important;
    height: 36px !important;
    box-shadow: 0 4px 12px rgba(0,10,48,0.35) !important;
  }
  body:not(#_) .tk-lang-toggle svg {
    width: 16px !important;
    height: 16px !important;
  }
  body:not(#_) .tk-lang-flag {
    width: 30px !important;
    height: 30px !important;
  }

  /* ============ SPALTEN: IMMER als BLOCK stapeln, NIE side-by-side ============ */
  body:not(#_) .wp-block-columns,
  body:not(#_) .wp-block-columns.are-vertically-aligned-center,
  body:not(#_) .wp-block-columns.proj-row,
  body:not(#_) .wp-block-columns.svc-row,
  body:not(#_) .wp-block-columns.detail-body,
  body:not(#_) .wp-block-columns.intro-block,
  body:not(#_) .wp-block-columns.intro-bottom-row,
  body:not(#_) .wp-block-columns.tk-footer-grid,
  body:not(#_) .wp-block-columns.wrap {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    gap: 0 !important;
  }
  body:not(#_) .wp-block-columns > .wp-block-column,
  body:not(#_) .wp-block-columns > .wp-block-column[style],
  body:not(#_) .wp-block-columns > .wp-block-column[style*='flex-basis'],
  body:not(#_) .wp-block-columns > div[class*='wp-block-column'],
  body:not(#_) section.services .svc-row > .wp-block-column,
  body:not(#_) section.services .svc-row > .wp-block-column[style*='flex-basis'],
  body:not(#_) section.services .proj-row > .wp-block-column,
  body:not(#_) section.services .proj-row > .wp-block-column[style*='flex-basis'],
  body:not(#_) .entry-content .wp-block-columns > .wp-block-column {
    display: block !important;
    flex: 0 0 100% !important;
    flex-basis: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    margin: 0 0 20px 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  body:not(#_) .wp-block-columns > .wp-block-column:last-child {
    margin-bottom: 0 !important;
  }

  /* ============ KARUSSELL: vollbreit, klein, Pfeile WEG ============ */
  body:not(#_) .tk-carousel-wrap,
  body:not(#_) .wp-block-group.alignfull.tk-carousel {
    max-width: 100vw !important;
    width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
    padding: 16px 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }
  body:not(#_) .tk-carousel-track {
    max-width: none !important;
  }
  body:not(#_) .tk-carousel-btn,
  body:not(#_) .tk-carousel-btn.prev,
  body:not(#_) .tk-carousel-btn.next {
    display: none !important;
  }

  /* ============ HERO H1 (Homepage) ============ */
  body:not(#_) .tk-hero h1 {
    font-size: clamp(28px, 7.5vw, 36px) !important;
    line-height: 1.15 !important;
    letter-spacing: -0.02em !important;
    max-width: 100% !important;
  }
  body:not(#_) .tk-hero {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  /* ============ SECTION-HEAD H2 ('Von der Idee...') ============ */
  body:not(#_) section.services .section-head h2,
  body:not(#_) section.services .section-head h2.wp-block-heading {
    text-align: left !important;
    margin: 0 !important;
    padding: 0 16px !important;
    font-size: clamp(28px, 7vw, 36px) !important;
  }

  /* ============ SERVICES-SECTION ============ */
  body:not(#_) section.services .svc-row .svc-photo,
  body:not(#_) section.services .svc-row figure.wp-block-image.svc-photo {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: 100% !important;
  }
  body:not(#_) section.services .svc-row {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 16px !important;
  }

  /* ============ FOOTER ============ */
  body:not(#_) .tk-footer-band {
    padding: 32px 0 !important;
  }
  body:not(#_) .tk-footer-band .tk-footer-grid {
    display: block !important;
    margin-bottom: 24px !important;
    padding: 0 16px !important;
  }
  body:not(#_) .tk-footer-band .tk-footer-col-contact,
  body:not(#_) .tk-footer-band .tk-footer-col-services,
  body:not(#_) .tk-footer-band .tk-footer-col-hero {
    width: 100% !important;
    max-width: 100% !important;
    flex-basis: 100% !important;
    margin-bottom: 24px !important;
    padding: 0 !important;
  }
  body:not(#_) .tk-footer-band .tk-footer-wordmark {
    font-size: 11px !important;
    margin: 0 0 24px 0 !important;
    padding: 0 16px !important;
  }
  body:not(#_) footer .tk-footer-band .tk-footer-col-hero .tk-footer-kicker,
  body:not(#_) .tk-footer-band .tk-footer-col-hero .tk-footer-kicker {
    font-size: clamp(14px, 4.5vw, 18px) !important;
    line-height: 1.15 !important;
    margin: 0 0 8px 0 !important;
  }
  body:not(#_) footer .tk-footer-band .tk-footer-col-hero .tk-footer-hero-h,
  body:not(#_) .tk-footer-band .tk-footer-col-hero .tk-footer-hero-h {
    font-size: clamp(18px, 5.2vw, 24px) !important;
    line-height: 1.15 !important;
    letter-spacing: -0.01em !important;
    margin: 0 0 16px 0 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }
  body:not(#_) footer .tk-footer-band .tk-footer-col-hero .tk-footer-hero-h .accent-orange {
    font-size: inherit !important;
  }

  /* ============ FOOTER-PILLS: vertikal stapeln (war überall noch breit) ============ */
  body:not(#_) .tk-footer-band .tk-footer-pills,
  body:not(#_) .wp-block-buttons.tk-footer-pills,
  body:not(#_) .wp-block-buttons.tk-footer-pills.is-content-justification-right,
  body:not(#_) .wp-block-buttons.tk-footer-pills.is-content-justification-left {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 4px !important;
    margin: 0 !important;
    padding: 0 16px !important;
  }
  body:not(#_) .tk-footer-band .tk-footer-pills .wp-block-button,
  body:not(#_) .wp-block-buttons.tk-footer-pills .wp-block-button {
    width: 100% !important;
    max-width: 100% !important;
    flex-basis: auto !important;
  }
  body:not(#_) .tk-footer-band .tk-footer-pills .wp-block-button__link,
  body:not(#_) .wp-block-buttons.tk-footer-pills .wp-block-button__link {
    display: block !important;
    width: 100% !important;
    padding: 10px 0 !important;
    text-align: left !important;
  }

  /* ============ LEAFLET-KARTE: nicht über Viewport ============ */
  body:not(#_) .leaflet-container,
  body:not(#_) .worldmap .leaflet-container,
  body:not(#_) #tk-worldmap {
    max-width: 100vw !important;
    width: 100% !important;
    height: 280px !important;
    overflow: hidden !important;
  }
  body:not(#_) .leaflet-tile-container {
    max-width: 100vw !important;
  }

  /* ============ SINGLE-HERO Bild auf Projekt-Seiten ============ */
  body:not(#_) figure.single-hero,
  body:not(#_) .single-hero,
  body:not(#_) .hero-row .single-hero {
    max-height: 280px !important;
    overflow: hidden !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
  body:not(#_) figure.single-hero img,
  body:not(#_) .single-hero img {
    max-height: 280px !important;
    object-fit: cover !important;
    object-position: center center !important;
    width: 100% !important;
    height: auto !important;
  }

  /* ============ TAP-TARGETS ============ */
  body:not(#_) a[href='#wp--skip-link--target'],
  body:not(#_) a.skip-link {
    /* Skip-link bleibt unsichtbar (1x1) — Accessibility-Standard */
  }
}

/* =====================================================================
   TABLET (769–1024px)
   ===================================================================== */
@media (min-width: 769px) and (max-width: 1024px) {
  body:not(#_) .tk-header-inner {
    padding-left: 24px !important;
    padding-right: 24px !important;
  }
}

/* =====================================================================
   MOBILE v8 — Service-Section Bilder: Container an Bild-Aspect anpassen
   Vorher: Bilder 393×294 Querformat in 257×380 Hochformat-Container
           → object-fit:cover schneidet links/rechts ab.
   Jetzt: Container nimmt Bild-Aspect (4/3), height:auto, keine Crops.
   ===================================================================== */
@media (max-width: 768px) {
  html body:not(#_) section.services .svc-row,
  html body:not(#_) section.services .svc-row.wp-block-columns {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
  }
  html body:not(#_) section.services .svc-row .svc-photo,
  html body:not(#_) section.services .svc-row figure.wp-block-image.svc-photo,
  html body:not(#_) section.services .svc-row figure.svc-photo,
  html body:not(#_) section.services .svc-row .wp-block-image.svc-photo {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    margin: 0 0 12px 0 !important;
  }
  html body:not(#_) section.services .svc-row .svc-photo img,
  html body:not(#_) section.services .svc-row figure.wp-block-image.svc-photo img,
  html body:not(#_) section.services .svc-row figure.wp-block-image img,
  html body:not(#_) section.services .svc-row figure img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: 4 / 3 !important;
    object-fit: cover !important;
    object-position: center center !important;
    display: block !important;
  }
  /* Spalten-Höhe auch killen — Original setzt height:380px auf .wp-block-column */
  html body:not(#_) section.services .svc-row > .wp-block-column {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
  }
}

/* =====================================================================
   MOBILE v8.1 — Services-Section auf volle Breite
   Container war nur 289px auf 393 Viewport (104px Gesamt-Rand).
   Mit padding-Reduktion auf Eltern-Container: volle Breite (-12 Rand).
   ===================================================================== */
@media (max-width: 768px) {
  html body:not(#_) section.services {
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: 100vw !important;
    width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
  }
  html body:not(#_) section.services > .wp-block-group,
  html body:not(#_) section.services > .wrap,
  html body:not(#_) section.services .wrap {
    padding-left: 12px !important;
    padding-right: 12px !important;
    max-width: 100vw !important;
    width: 100% !important;
    margin: 0 !important;
  }
  html body:not(#_) section.services .svc-rows,
  html body:not(#_) section.services .svc-row {
    padding-left: 0 !important;
    padding-right: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }
}
