/* ===== 1. ALLGEMEINE STYLING-ANPASSUNGEN (Desktop + Mobile) ===== */
/* Horizontales SCROLLEN verhindern - ÜBERALL */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
}

/* Links */
.entry-content a {
  text-decoration: underline;
}
.main-navigation a, .main-navigation a:hover, .main-navigation a:focus {
  text-decoration: none;
}

/* Header Hintergrund & Bilder */
.header-bg {
  background-color: #fefdfa !important;
}
.header-bg, .custom-header-media, .site-header .custom-header {
  height: 260px !important;
  min-height: 260px !important;
  max-height: 260px !important;
  overflow: hidden !important;
}
.header-bg img, .custom-header-media img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}

/* Blendet alle PINGBACKS und Trackbacks in den Kommentaren aus */
.comment-list .pingback, .comment-list .trackback {
  display: none !important;
}

/* Mobile ausblenden */
.hide-mobile {
  display: none;
}

/* Spalten-Styles */
.meine-spalte {
  border: 1px solid #4C3C0D;
  padding: 20px;
  margin: 5px;
}
.meine-spalte-abstand {
  border: 0px solid #4C3C0D;
  padding: 0px;
  margin: 0px;
}

/* ===== 2. TABELLENFARBEN ===== */
/* Alle Rahmenlinien der Tabelle entfernen */
.wp-block-table, .wp-block-table th, .wp-block-table td, .wp-block-table tr {
  border: none !important;
  border-width: 0 !important;
}
/* Äussere RAHMEN und Rahmen am Tabellenende komplett entfernen */
table, thead, tbody, tfoot {
  border: 1px solid !important;
  border-width: 1 !important;
  box-shadow: none !important;
}
/* Verhindert, dass die allerletzte Zelle eine Linie nach unten zieht */
.wp-block-table td, .wp-block-table th {
  border-bottom: none !important;
  border-bottom-width: 0 !important;
}
/* Farbe für die Titelzeile (Tabellenkopf) definieren */
.wp-block-table th {
  background-color: #5c4f46 !important;
  color: #ffffff !important;
  font-weight: bold !important;
}
/* Abwechselnde Zeilenfarben (Ungerade Zeilen: helle Farbe) */
.wp-block-table tr:nth-child(odd) {
  background-color: #f8f9fa !important;
}
/* Abwechselnde Zeilenfarben: Hintergrund für die dunkle Zeile */
.wp-block-table tr:nth-child(even) {
  background-color: #736357 !important;
}
/* Textfarbe in den Zellen der dunklen Zeile erzwingen */
.wp-block-table tr:nth-child(even) td {
  color: #f8f9fa !important;
}
/* Linkfarbe in den Zellen der dunklen Zeile erzwingen */
.wp-block-table tr:nth-child(even) td a {
  color: #f8f9fa !important;
}
/* Verhindert dunkle Links auf dunklem Hintergrund */
.wp-block-table tr:nth-child(even) a {
  color: #f8f9fa !important;
  text-decoration: underline;
}

/* ===== 3. GOOGLE MAPS IFRAMES ===== */
iframe[src*="google.com/maps"] {
  width: 80% !important;
  height: 450px !important;
  display: block !important;
  margin: 0 auto !important;
}
iframe.karte[src*="google.com/maps"] {
  width: 100% !important;
  height: 450px !important;
  display: block !important;
  margin: 0 auto !important;
  border: 0px solid red !important;
}
@media (max-width: 768px) {
  iframe[src*="google.com/maps"] {
    width: 100% !important;
    height: 350px !important;
  }
}

/* ===== 4. NAVIGATION & MENÜ-STYLING ===== */
/* Abstände Untermenü-Punkte */
html body .main-navigation ul.sub-menu li, html body .main-navigation ul ul li, html body .main-navigation ul ul ul li, html body .main-navigation ul ul ul ul li {
  margin-bottom: 5px !important;
}
/* Untermenü-Hintergrundfarbe */
.main-navigation ul.sub-menu, .main-navigation ul ul {
  background-color: #FFFDF9 !important;
}

/* --- Nur ab 994px (Desktop) - damit Mobile Menu unberührt bleibt --- */
@media (min-width: 994px) {
  /* Sticky Navigation: Klebt am oberen Bildschirmrand beim Scrollen */
  .main-navigation, nav.main-navigation, .navigation-top, nav.navigation-top {
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
    background-color: #fefdfa !important;
  }
  /* HAUPTMENÜ (Erste sichtbare Ebene) */
  html body .main-navigation > div > ul > li > a, html body .site-header .main-navigation > div > ul > li > a, html body nav.main-navigation > div > ul > li > a, .main-navigation ul li a {
    font-size: 17px !important;
    text-transform: none !important;
  }
  /* Erste Ebene Untermenü Dropdown */
  html body .main-navigation ul.sub-menu > li > a, html body .site-header .main-navigation ul.sub-menu > li > a, html body nav.main-navigation ul.sub-menu > li > a {
    font-size: 14.5px !important;
    text-transform: none !important;
    padding-top: 0px !important;
    padding-bottom: 2px !important;
  }
  /* Zweite Ebene Untermenü und tiefer */
  html body .main-navigation ul.sub-menu ul li a, html body .site-header .main-navigation ul.sub-menu ul li a, html body nav.main-navigation ul.sub-menu ul li a {
    font-size: 13px !important;
    text-transform: none !important;
    padding-top: 0px !important;
    padding-bottom: 1px !important;
  }
}

/* ===== 5. DESKTOP: VOLLE BREITEN FÜR KATEGORIEN & BEITRÄGE (ab 1024px) ===== */
@media only screen and (min-width: 1024px) {
  /* Kategorieseiten auf 100% ausweiten */
  .category .site-content, .category .container, .category .site-main {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 5% !important;
    padding-right: 5% !important;
  }
  /* KORREKTUR: Nur die Seitenleiste auf Kategorieseiten ausblenden - Footer bleibt! */
  .category #secondary.widget-area, .category .sidebar {
    display: none !important;
  }
  /* Beitragsliste auf Kategorieseiten 85% strecken */
  .category .content-area {
    width: 85% !important;
    max-width: 85% !important;
    float: none !important;
  }
  /* Einzelne Beitragsseiten auf 100% ausweiten */
  .single .site-content, .single .container, .single .site-main {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 5% !important;
    padding-right: 5% !important;
  }
  /* NUR Seitenleisten-Widgets in Einzelbeiträgen ausblenden */
  .single #secondary.widget-area {
    display: none !important;
  }
  /* Textbereich in Einzelbeiträgen strecken */
  .single .content-area {
    width: 85% !important;
    max-width: 85% !important;
    float: none !important;
  }
}

/* ===== 6. MOBILE-SPEZIFISCHE ANPASSUNGEN (unter 993px) ===== */
@media (max-width: 993px) {
  html, body {
    width: 100% !important;
    touch-action: pan-y !important;
    overscroll-behavior-x: none !important;
    -webkit-overflow-scrolling: touch !important;
  }
  /* Mobile: Bilder auf Startseite quadratisch */
  .home .post-thumbnail img, .home .wp-post-image, .home article img {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: cover !important;
  }
  /* Mobile Menu Plugin */
  .mm-wrapper, .mm-wrapper__blocker, .mm-menu, .mm-page, .mm-slideout, #mm-blocker, .mobile-menu-wrapper {
    max-width: 100vw !important;
    width: 100% !important;
    overflow-x: hidden !important;
    transform: none !important;
    left: 0 !important;
    right: auto !important;
  }
  .mm-wrapper--opened .mm-page {
    transform: translate3d(0, 0, 0) !important;
  }
  .site, .wrapper, #page, main, article, section, .mm-page, #mm-blocker {
    max-width: 100vw !important;
    overflow-x: hidden !important;
    width: 100% !important;
  }
  * {
    max-width: 100%;
    box-sizing: border-box;
  }
  img, video, iframe, embed, object {
    max-width: 100% !important;
    height: auto !important;
  }
  /* Content Padding für Mobile */
  #content.site-content, .site-content, #primary, .home #content.site-content, .home .site-content, .home #primary, .single #content.site-content, .single .site-content, .single #primary, .page #content.site-content, .page .site-content, .page #primary, .archive #content.site-content, .archive .site-content, .archive #primary, .category #content.site-content, .category .site-content, .category #primary {
    margin-top: 0 !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
  }
  /* Mobile - Header und Navigation entfixieren */
  .header-bg, .site-header, .main-navigation, .navigation-top {
    position: relative !important;
    top: auto !important;
  }
}

/* KORREKTUR: Keine Sidebar bei mittleren Ansichten (Tablets/kleine Laptops) - Footer bleibt! */
@media only screen and (max-width: 1200px) {
  #sidebar, .sidebar, #secondary {
    display: none !important;
  }
}
