/*
 * Heidenheim.info – Unterseiten-CI 0.1.183
 * Ein verbindliches Layout fuer ALLE Unterseiten.
 *
 * Ziel:
 * - Hero darf full-bleed ueber die Browserbreite laufen.
 * - Alle eigentlichen Inhalte bleiben auf einer ruhigen 1320px-Achse.
 * - Keine 84vw-/Viewport-Streckung von Karten, Maps oder Ergebnislisten.
 * - Kein grauer Leerraum oberhalb des Heros.
 * - Default- und Wide-Template verhalten sich identisch.
 */

:root{
  --hi-subpage-axis:1320px;
  --hi-subpage-gutter:32px;
  --hi-subpage-text:900px;
  --hi-subpage-gap:18px;
}

/* ---------- universelle Seitenachse ---------- */
body:not(.home){overflow-x:hidden}
body:not(.home) main{
  box-sizing:border-box;
}
body:not(.home) main.hi-page-shell,
body:not(.home) main.hi-place-main,
body:not(.home) main.hi-gastro-main,
body:not(.home) main.hi-service-main,
body:not(.home) main.hi-destination-main,
body:not(.home) main.hi-event-archive-main,
body:not(.home) main.hi-municipality-main,
body:not(.home) main.hi-district-main,
body:not(.home) main.hi-event-single,
body:not(.home) main.hi-single-shell,
body:not(.home) main.hi-search-shell,
body:not(.home) main.hi-archive-shell{
  width:100%!important;
  max-width:none!important;
  margin:0!important;
  padding-top:0!important;
}

/* Gutenberg/Post-Content darf Portalmodule nicht mehr in contentSize einsperren. */
body:not(.home) main.hi-page-shell>.wp-block-post-content,
body:not(.home) main.hi-page-shell>.wp-block-post-content.alignfull,
body:not(.home) main.hi-page-shell>.wp-block-post-content.alignwide{
  width:100%!important;
  max-width:none!important;
  margin:0!important;
  padding:0!important;
}
body:not(.home) main.hi-page-shell>.wp-block-post-content>.wp-block-shortcode{
  width:100%!important;
  max-width:none!important;
  margin-left:auto!important;
  margin-right:auto!important;
  overflow:visible!important;
}

/* Normale Seiten ohne Portal bleiben lesbar und werden nicht auf 1320px Textbreite gezogen. */
body:not(.home):not(.hi-ci-portal-page) main.hi-page-shell>.wp-block-post-title,
body:not(.home):not(.hi-ci-portal-page) main.hi-page-shell>.wp-block-post-featured-image,
body:not(.home):not(.hi-ci-portal-page) main.hi-page-shell>.wp-block-post-content,
body:not(.home):not(.hi-ci-portal-page) main.hi-page-shell>.wp-block-shortcode{
  width:min(var(--hi-subpage-text),calc(100vw - 2 * var(--hi-subpage-gutter)))!important;
  max-width:var(--hi-subpage-text)!important;
  margin-left:auto!important;
  margin-right:auto!important;
}
body:not(.home):not(.hi-ci-portal-page) main.hi-page-shell>.wp-block-post-title{
  margin-top:38px!important;
}

/* ---------- Portal-Wurzeln: immer exakt dieselbe Inhaltsachse ---------- */
body:not(.home) :is(
  .hi-place-portal,
  .hi-gastro-portal,
  .hi-service-portal,
  .hi-topic-landing,
  .hi-event-directory,
  .hi-daily-menu-portal,
  .hi-municipality-portal,
  .hi-district-page,
  .hi-municipality-page,
  .hi-map-overview--portal,
  .hi-newsletter-page,
  .hi-newsletter-archive,
  .hi-public-page,
  .hi-owner-menu,
  .hi-daily-menu-page,
  .hi-public-infrastructure,
  .hi-clubs-bars
){
  position:relative!important;
  left:auto!important;
  right:auto!important;
  transform:none!important;
  width:min(var(--hi-subpage-axis),calc(100vw - 2 * var(--hi-subpage-gutter)))!important;
  max-width:var(--hi-subpage-axis)!important;
  min-width:0!important;
  margin-left:auto!important;
  margin-right:auto!important;
  box-sizing:border-box!important;
}

/* Alle direkten Inhaltsmodule bleiben innerhalb dieser Achse. */
body:not(.home) :is(
  .hi-place-portal,.hi-gastro-portal,.hi-service-portal,.hi-topic-landing,
  .hi-event-directory,.hi-daily-menu-portal,.hi-municipality-portal
) > :not(
  .hi-place-portal__hero,.hi-gastro-portal__hero,.hi-service-portal__hero,
  .hi-topic-landing__hero,.hi-event-directory__hero,.hi-daily-menu-portal__hero,
  .hi-municipality-portal__hero
){
  width:100%!important;
  max-width:none!important;
  margin-left:0!important;
  margin-right:0!important;
  box-sizing:border-box!important;
}

/* ---------- Full-bleed Hero, aber nur der Hero ---------- */
body:not(.home) :is(
  .hi-place-portal__hero,.hi-gastro-portal__hero,.hi-service-portal__hero,
  .hi-topic-landing__hero,.hi-event-directory__hero,.hi-daily-menu-portal__hero,
  .hi-municipality-portal__hero
){
  position:relative!important;
  left:50%!important;
  width:100vw!important;
  max-width:none!important;
  margin:0 0 28px!important;
  margin-left:-50vw!important;
  margin-right:0!important;
  border-radius:0!important;
  box-sizing:border-box!important;
  overflow:hidden!important;
}

/* innere Hero-Inhalte bleiben ruhig auf der Portalachse */
body:not(.home) :is(
  .hi-place-portal__hero-inner,.hi-portal-hero-inner
){
  width:min(var(--hi-subpage-axis),calc(100vw - 2 * var(--hi-subpage-gutter)))!important;
  max-width:var(--hi-subpage-axis)!important;
  margin-left:auto!important;
  margin-right:auto!important;
  box-sizing:border-box!important;
}

/* Alte Hero-Layouts ohne Inner-Wrapper bekommen denselben Innenraum. */
body:not(.home) :is(
  .hi-gastro-portal__hero,.hi-service-portal__hero
):not(:has(>.hi-portal-hero-inner)){
  padding-left:max(var(--hi-subpage-gutter),calc((100vw - var(--hi-subpage-axis))/2))!important;
  padding-right:max(var(--hi-subpage-gutter),calc((100vw - var(--hi-subpage-axis))/2))!important;
}

/* Orte im Landkreis: eigener CI-Hero statt nackter Kartenliste. */
body:not(.home) .hi-municipality-portal__hero{
  min-height:300px!important;
  display:flex!important;
  align-items:center!important;
  background:
    linear-gradient(90deg,rgba(7,35,48,.82),rgba(7,35,48,.42) 55%,rgba(7,35,48,.22)),
    url('../images/home/hero-haertsfeldsee.webp') center 53%/cover no-repeat!important;
  color:#fff!important;
}
body:not(.home) .hi-municipality-portal__hero .hi-portal-hero-inner{
  padding:48px 0!important;
}
body:not(.home) .hi-municipality-portal__hero h1{
  margin:.15rem 0 .55rem!important;
  color:#fff!important;
  font-size:clamp(2.3rem,4.4vw,4.2rem)!important;
  line-height:1.02!important;
  letter-spacing:-.035em!important;
}
body:not(.home) .hi-municipality-portal__hero p{
  max-width:760px!important;
  margin:.35rem 0!important;
  color:#fff!important;
  font-size:clamp(.98rem,1.35vw,1.14rem)!important;
}
body:not(.home) .hi-municipality-portal__content{padding-top:4px!important}

/* ---------- Ergebnislisten und Karten: nicht mehr viewport-breit ---------- */
body:not(.home) :is(
  .hi-place-directory-section,.hi-gastro-directory-section,.hi-service-directory-section,
  .hi-gastro-map-section,.hi-service-map-section,.hi-event-map-section,
  .hi-topic-landing__section,.hi-new-entries__map,.hi-daily-menu-days,
  .hi-place-type-grid,.hi-gastro-type-grid,.hi-service-topic-grid,
  .hi-event-grid,.hi-ui-event-grid,.hi-municipality-grid
){
  width:100%!important;
  max-width:none!important;
  margin-left:0!important;
  margin-right:0!important;
  box-sizing:border-box!important;
}

body:not(.home) :is(.hi-place-directory,.hi-gastro-directory,.hi-service-directory){
  display:grid!important;
  grid-template-columns:repeat(3,minmax(0,1fr))!important;
  gap:16px!important;
  width:100%!important;
  max-width:none!important;
  margin-left:0!important;
  margin-right:0!important;
}

body:not(.home) :is(.hi-place-type-grid,.hi-gastro-type-grid,.hi-service-topic-grid,.hi-municipality-grid){
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:16px!important;
}

/* Karten/Maps sollen exakt die Inhaltsachse nutzen, niemals 100vw. */
body:not(.home) :is(
  .hi-place-portal,.hi-gastro-portal,.hi-service-portal,.hi-topic-landing,
  .hi-event-directory,.hi-daily-menu-portal,.hi-municipality-portal,
  .hi-district-page,.hi-municipality-page,.hi-map-overview--portal,
  .hi-newsletter-page,.hi-newsletter-archive,.hi-public-page,.hi-owner-menu,
  .hi-daily-menu-page,.hi-public-infrastructure,.hi-clubs-bars
) :is(.hi-map,.hi-portal-map,.leaflet-container,[class*="map"]){
  max-width:100%!important;
  box-sizing:border-box!important;
}

/* Feedback und Anzeigen ebenfalls auf der ruhigen Achse. */
body:not(.home) main>.wp-block-shortcode:has(.hi-feedback-cta),
body:not(.home) main>.hi-feedback-cta,
body:not(.home) .hi-feedback-cta{
  width:min(var(--hi-subpage-axis),calc(100vw - 2 * var(--hi-subpage-gutter)))!important;
  max-width:var(--hi-subpage-axis)!important;
  margin-left:auto!important;
  margin-right:auto!important;
}

/* Archive/Taxonomien/Suche/Singles teilen dieselbe 1320px-Achse. */
body:not(.home) :is(
  main.hi-place-main,main.hi-gastro-main,main.hi-service-main,main.hi-destination-main,
  main.hi-event-archive-main,main.hi-event-single,main.hi-single-shell,
  main.hi-search-shell,main.hi-archive-shell
) > :not(.alignfull){
  width:min(var(--hi-subpage-axis),calc(100vw - 2 * var(--hi-subpage-gutter)))!important;
  max-width:var(--hi-subpage-axis)!important;
  margin-left:auto!important;
  margin-right:auto!important;
  box-sizing:border-box!important;
}

/* Entfernt den grauen Rand/Leerraum direkt zwischen Header und Titelbild. */
body:not(.home) :is(
  main.hi-page-shell,main.hi-place-main,main.hi-gastro-main,main.hi-service-main,
  main.hi-destination-main,main.hi-event-archive-main,main.hi-municipality-main,
  main.hi-district-main
){padding-top:0!important;margin-top:0!important}
body:not(.home) header+main{margin-top:0!important}

/* ---------- responsive ---------- */
@media (max-width:1100px){
  :root{--hi-subpage-gutter:22px}
  body:not(.home) :is(.hi-place-directory,.hi-gastro-directory,.hi-service-directory){grid-template-columns:repeat(2,minmax(0,1fr))!important}
  body:not(.home) :is(.hi-place-type-grid,.hi-gastro-type-grid,.hi-service-topic-grid,.hi-municipality-grid){grid-template-columns:repeat(3,minmax(0,1fr))!important}
}
@media (max-width:760px){
  :root{--hi-subpage-gutter:14px}
  body:not(.home) :is(.hi-place-directory,.hi-gastro-directory,.hi-service-directory){grid-template-columns:1fr!important}
  body:not(.home) :is(.hi-place-type-grid,.hi-gastro-type-grid,.hi-service-topic-grid,.hi-municipality-grid){grid-template-columns:repeat(2,minmax(0,1fr))!important}
  body:not(.home) :is(
    .hi-place-portal__hero,.hi-gastro-portal__hero,.hi-service-portal__hero,
    .hi-topic-landing__hero,.hi-event-directory__hero,.hi-daily-menu-portal__hero,
    .hi-municipality-portal__hero
  ){margin-bottom:20px!important}
}
@media (max-width:520px){
  body:not(.home) :is(.hi-place-type-grid,.hi-gastro-type-grid,.hi-service-topic-grid,.hi-municipality-grid){grid-template-columns:1fr!important}
}

/* Detail-/Suchseiten ohne Portal-Hero brauchen weiterhin einen sauberen Abstand zum Header. */
body:not(.home) :is(main.hi-single-shell,main.hi-event-single,main.hi-search-shell,main.hi-archive-shell){
  padding-top:38px!important;
}
