/* 960px usable content, with the existing 30px gutter on smaller screens.
   Limit the inner Elementor area so section backgrounds remain full width. */
body.hdd-content-standard .elementor[data-elementor-type="wp-page"] > .e-con > .e-con-inner {
    max-width: 960px;
    margin-inline: auto;
}

/* The shared three hero cards use the normal width; body content stays narrow. */
body.hdd-content-standard .elementor[data-elementor-type="wp-page"] > .e-con.hdd-map-cards-section > .e-con-inner {
    max-width: 1140px;
}

/* Full-width hero widgets retain their parent background and alignment. */
body.hdd-content-standard .elementor[data-elementor-type="wp-page"] > .e-con-full:not(.hdd-map-fullwidth) > :is(.elementor-widget, .e-con) {
    max-width: 960px;
}

/* The location map spans the viewport; native Elementor padding can override. */
.elementor[data-elementor-type="wp-page"] > .e-con.hdd-map-fullwidth {
    --container-default-padding-left: 0px;
    --container-default-padding-right: 0px;
}

/* Classic / Gutenberg pages have no Elementor inner container. */
body.hdd-content-standard:not([class*="elementor-page-"]) main.site-main {
    width: 100%;
    max-width: 1020px;
    padding-inline: 30px;
    margin-inline: auto;
}

body.hdd-content-standard main > .page-content:not(:has(> .elementor)) {
    max-width: 960px;
    margin-inline: auto;
    overflow-wrap: anywhere;
}

/* The Gesuche overview shares the normal 960px content and 30px gutters. */
body.post-type-archive-job_offer main.site-main.ddhh-archive {
    max-width: 1020px;
    padding-inline: 30px;
}

.hdd-mentor-return {
    box-sizing: border-box;
    max-width: 1020px;
    margin-inline: auto;
    padding: 16px 30px 0;
}

.hdd-mentor-return > a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    color: var(--hdd-color-primary, #003063);
    text-decoration: underline;
}

.hdd-mentor-return > a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

/* The return link and the page heading belong to the same group. */
.hdd-mentor-return + main .elementor[data-elementor-type="wp-page"] > .hdd-section-tight-top:first-child,
.hdd-mentor-return + .elementor[data-elementor-type="wp-page"] > .hdd-section-tight-top:first-child {
    --container-default-padding-top: 16px;
}

body.post-type-archive-job_offer .hdd-mentor-return + main.site-main.ddhh-archive {
    padding-block-start: 16px;
}

/* Leave room for the sticky navigation when opening the overview directly. */
#mentor-uebersicht {
    scroll-margin-block-start: calc(9rem + var(--wp-admin--admin-bar--height, 0px));
}

/* Keep card text readable when the logo would consume a narrow phone column. */
@media (max-width: 600px) {
    .ddhh-archive .ddhh-gesuch-card {
        grid-template-columns: minmax(0, 1fr);
    }

    .ddhh-archive .ddhh-gesuch-card-location {
        padding-left: 0;
    }
}

/* Classic legal pages need the same space before the footer as our sections. */
body.hdd-legal-page:not([class*="elementor-page-"]) main.site-main {
    padding-block-end: clamp(64px, 8vw, 96px);
}

body.hdd-legal-page:not([class*="elementor-page-"]) main.site-main > .page-content > p + p {
    margin-block-start: 1.5rem;
}

body.hdd-legal-page:not([class*="elementor-page-"]) main.site-main > .page-content > h2.wp-block-heading {
    margin-block-start: 2rem;
    font-size: clamp(1.375rem, 2.1vw, 1.625rem);
}

/* Keep the four project phases in one row; tablets can scroll the row.
   The existing two-column phone layout remains active below 768px. */
@media (min-width: 768px) {
    .elementor .hdd-project-phases .e-n-tabs-heading {
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 12px;
    }

    .elementor .hdd-project-phases .e-n-tabs-heading .e-n-tab-title {
        flex: 1 0 auto;
        padding-inline: 12px;
        font-size: 18px;
        white-space: nowrap;
    }
}
