/* MovitaMed: editable subpage header, shared background and navigation overlay. */
.movitamed-site {
    --mm-overlay-header-height: 118px;
    --mm-hero-image-tail: 200px;
}

/* Height is measured by JS; these defaults also support an initial CSS-only render. */
.movitamed-site .mm-editorial-hero {
    position: relative;
    isolation: isolate;
    z-index: 0;
    box-sizing: border-box;
    min-height: calc(var(--mm-overlay-header-height) + 315px);
    margin-top: calc(-1 * var(--mm-overlay-header-height));
    padding: calc(var(--mm-overlay-header-height) + 52px) 0 48px;
    overflow: visible;
    background: var(--mm-cream, #f9f7f5);
}

/* Reines Bild: kompakter Bildkopf, Verlauf und Überlappung bleiben erhalten. */
.movitamed-site .mm-editorial-hero:not(:has(.mm-heading, .mm-top__text, .mm-subheader)) {
    min-height: calc(var(--mm-overlay-header-height) + 190px);
    padding: calc(var(--mm-overlay-header-height) + 48px) 0 48px;
}

.movitamed-site .mm-editorial-hero > .mm-top__image {
    position: absolute;
    inset: 0 0 auto;
    width: 100%;
    max-width: none;
    height: calc(100% + var(--mm-hero-image-tail));
    object-fit: cover;
    object-position: center 45%;
    z-index: -2;
    pointer-events: none;
}

/* Light text area on the left; the treatment room remains visible on the right. */
.movitamed-site .mm-editorial-hero::before {
    content: '';
    position: absolute;
    inset: 0 0 calc(-1 * var(--mm-hero-image-tail));
    z-index: -1;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(255,255,255,.95) 0%, rgba(255,255,255,.84) 34%, rgba(255,255,255,.28) 65%, rgba(255,255,255,.06) 100%);
}

/* The photograph extends behind the first content block and fades into white. */
.movitamed-site .mm-editorial-hero::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(-1 * var(--mm-hero-image-tail));
    height: var(--mm-hero-image-tail);
    z-index: -1;
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(255,255,255,0), #fff 96%);
}

.movitamed-site .mm-editorial-hero .mm-top__content {
    width: min(780px, 72%);
}

/* Typografie folgt der zentralen .mm-top__text-Regel in movitamed.css. */
.movitamed-site .mm-editorial-hero .mm-top__text {
    max-width: 620px;
    margin-top: 28px;
}

.movitamed-site .mm-editorial-hero + :is(.mm-page-content, .mm-detail-grid) {
    position: relative;
    z-index: 1;
    padding-top: 0;
    background: transparent;
}

/* Der erste Inhaltsrahmen nutzt ebenfalls die gewählten TYPO3-Abstände. */

/* Header keeps its existing sticky positioning and existing menu behavior. */
.movitamed-site:is(.mm-has-editorial-hero, :has(.mm-editorial-hero)) header#pq-header.mm-header {
    background: rgba(255,255,255,.24) !important;
    box-shadow: none;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    transition: background-color .2s ease, box-shadow .2s ease;
}

.movitamed-site:is(.mm-has-editorial-hero, :has(.mm-editorial-hero)) header#pq-header.mm-header .pq-bottom-header {
    background: transparent !important;
}

.movitamed-site.mm-has-editorial-hero.mm-hero-scrolled header#pq-header.mm-header,
.movitamed-site.mm-has-editorial-hero.mm-hero-menu-open header#pq-header.mm-header,
.movitamed-site:has(.mm-editorial-hero) header#pq-header.mm-header:has(.mm-menu-toggle[aria-expanded="true"]) {
    background: rgba(255,255,255,.96) !important;
    box-shadow: 0 2px 16px rgba(10,45,78,.08);
}

@media (max-width: 1199px) {
    .movitamed-site { --mm-overlay-header-height: 98px; }
}

@media (max-width: 767px) {
    .movitamed-site {
        --mm-overlay-header-height: 92px;
        --mm-hero-image-tail: 125px;
    }
    .movitamed-site .mm-editorial-hero {
        min-height: 0;
        padding: calc(var(--mm-overlay-header-height) + 36px) 0 36px;
    }
    .movitamed-site .mm-editorial-hero:not(:has(.mm-heading, .mm-top__text, .mm-subheader)) {
        min-height: calc(var(--mm-overlay-header-height) + 125px);
        padding: calc(var(--mm-overlay-header-height) + 32px) 0 32px;
    }
    .movitamed-site .mm-editorial-hero > .mm-top__image { object-position: 62% center; }
    .movitamed-site .mm-editorial-hero::before {
        background: linear-gradient(90deg, rgba(255,255,255,.96), rgba(255,255,255,.77) 65%, rgba(255,255,255,.54));
    }
    .movitamed-site .mm-editorial-hero .mm-top__content { width: 100%; }
    .movitamed-site .mm-editorial-hero .mm-top__text {
        margin-top: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .movitamed-site.mm-has-editorial-hero header#pq-header.mm-header { transition: none; }
}

@media print {
    .movitamed-site .mm-editorial-hero,
    .movitamed-site .mm-editorial-hero:not(:has(.mm-heading, .mm-top__text, .mm-subheader)) {
        min-height: 0;
        margin-top: 0;
        padding: 20px 0;
    }
    .movitamed-site .mm-editorial-hero::after { display: none; }
    .movitamed-site .mm-editorial-hero::before { inset: 0; }
    .movitamed-site .mm-editorial-hero > .mm-top__image { height: 100%; }
}
