/*
 * Heidenheim.info – Unterseiten-CI 0.1.170
 * Grafik-Pass 3: strukturelle Breitenkorrektur ohne Abhaengigkeit von Body-Klassen.
 * Der vorige Pass konnte wirkungslos bleiben, wenn die Portal-Body-Klasse nicht
 * am ausgelieferten Dokument hing. Diese Datei adressiert deshalb die realen
 * Template- und Shortcode-Elemente direkt.
 */

/* Das Standard-Seitentemplate liefert den Post-Content nun als wide/default.
 * Hier wird die 1200-px-Achse explizit abgesichert. */
main.hi-page-shell > .wp-block-post-content,
main.hi-page-shell--wide > .wp-block-post-content{
  box-sizing:border-box!important;
  width:min(1200px,calc(100vw - 48px))!important;
  max-width:1200px!important;
  margin-left:auto!important;
  margin-right:auto!important;
}

/* Normale redaktionelle Lesetexte bleiben gut lesbar. Portal-Komponenten sind
 * hiervon nicht betroffen, weil sie eigene Klassen besitzen. */
main.hi-page-shell > .wp-block-post-content > :where(p,ul,ol,blockquote,pre,table),
main.hi-page-shell > .wp-block-post-content > :where(h2,h3,h4,h5,h6){
  max-width:760px;
  margin-left:auto;
  margin-right:auto;
}

/* Portalwurzel: bewusst ohne body.hi-ci-* Abhaengigkeit. */
:is(
  .hi-place-portal,.hi-gastro-portal,.hi-service-portal,.hi-destination-portal,
  .hi-topic-landing,.hi-event-directory,.hi-public-page,.hi-newsletter-page,
  .hi-owner-menu,.hi-doctor-portal,.hi-driving-school-portal,.hi-martial-arts-portal,
  .hi-clubs-bars,.hi-daily-menu-page,.hi-public-infrastructure
){
  box-sizing:border-box!important;
  width:100%!important;
  max-width:1200px!important;
  margin-left:auto!important;
  margin-right:auto!important;
}

@media (min-width:981px){
  :is(
    .hi-place-portal__hero,.hi-gastro-portal__hero,.hi-service-portal__hero,
    .hi-topic-landing__hero,.hi-public-page__hero,.hi-newsletter-page__hero,
    .hi-owner-menu__hero,.hi-event-directory__head
  ){
    width:100%!important;
    max-width:none!important;
    min-height:315px!important;
    padding:46px 52px!important;
    margin:0 0 26px!important;
    box-sizing:border-box!important;
  }
  :is(
    .hi-place-portal__hero,.hi-gastro-portal__hero,.hi-service-portal__hero,
    .hi-topic-landing__hero,.hi-public-page__hero,.hi-newsletter-page__hero,
    .hi-owner-menu__hero,.hi-event-directory__head
  ) :is(h1,h2){
    max-width:760px!important;
    font-size:clamp(2.7rem,3.55vw,4.05rem)!important;
    line-height:1.02!important;
  }
  :is(
    .hi-place-portal__intro,.hi-gastro-portal__intro,.hi-service-portal__intro,
    .hi-topic-landing__intro,.hi-public-page__hero p,.hi-newsletter-page__hero p,
    .hi-owner-menu__hero p,.hi-event-directory__head p
  ){
    max-width:780px!important;
    font-size:1.03rem!important;
  }
  :is(
    .hi-place-search,.hi-gastro-search,.hi-service-search,.hi-topic-search,
    .hi-doctor-search,.hi-driving-school-search,.hi-martial-arts-search,
    .hi-event-range-search,.hi-search-filters,.hi-new-entries__filter
  ){
    width:min(100%,940px)!important;
    max-width:940px!important;
    margin-top:24px!important;
  }
  :is(.hi-place-type-grid,.hi-gastro-type-grid,.hi-service-topic-grid,.hi-municipality-useful-links){
    width:100%!important;
    max-width:none!important;
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    gap:16px!important;
    margin:26px 0 38px!important;
  }
  :is(.hi-place-type-grid a,.hi-gastro-type-grid a,.hi-service-topic,.hi-municipality-useful-links a){
    min-height:104px!important;
    padding:19px 20px!important;
    border-radius:16px!important;
    box-sizing:border-box!important;
  }
  :is(.hi-place-directory,.hi-gastro-directory,.hi-service-directory,.hi-ui-event-grid){
    width:100%!important;
    max-width:none!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:20px!important;
  }
}

@media (max-width:980px){
  main.hi-page-shell > .wp-block-post-content,
  main.hi-page-shell--wide > .wp-block-post-content{
    width:min(100% - 18px,1200px)!important;
  }
}
