/* Shared outer spacing for the four modern landing page heroes only. */
body.kierunek2-route:has(.k2-hero),
body.progi-route:has(.pp-page--home),
body.podyplomowe-route:has(.pd-hero),
body.matura-route:has(.matura-home-flow) {
    /* Route shells reserve 91px for the fixed header on desktop. */
    padding-top: 91px !important;
}

body.kierunek2-route:has(.k2-hero) .k2-hero,
body.progi-route:has(.pp-page--home) .pp-page--home .pp-hero,
body.podyplomowe-route:has(.pd-hero) .pd-hero {
    margin-top: 0;
}

/* Matura keeps its breadcrumb outside the image panel; preserve its lower gap. */
/* Use the same shell as Matura, including the 14px phone gutters. */
body.kierunek2-route .k2-hero__surface,
body.kierunek2-route .k2-hero__strip,
body.podyplomowe-route .pd-hero,
body.progi-route .pp-page--home .pp-hero {
    width: min(calc(100% - 28px), calc(90% + max(0px, 120px - 15vw)), var(--ui-container-max));
    margin-inline: auto;
}

/* Landing-only contract, based on Matura. Subpage heroes are unaffected. */
body :is(.k2, .pd-page, .pp-page--home, .matura-home-flow) .landing-hero__breadcrumb {
    position: absolute;
    z-index: 6;
    top: 20px;
    left: 32px;
    right: 32px;
    width: auto;
    margin: 0;
    padding: 0;
}
body :is(.k2, .pd-page, .pp-page--home, .matura-home-flow) .landing-hero__heading h1 {
    font-size: clamp(30px, 2.85vw, 40px);
    line-height: 1.08;
    letter-spacing: -.025em;
    font-weight: 700;
    margin: 0 0 10px;
}
body :is(.k2, .pd-page, .pp-page--home, .matura-home-flow) .landing-hero__description {
    font-size: 15px;
    line-height: 1.5;
    color: #355268;
}
@media (min-width: 768px) {
    body.kierunek2-route .k2-hero__grid {padding: 52px clamp(24px, 3vw, 42px) 28px}
    body.podyplomowe-route .pd-hero__inner {padding: 52px clamp(24px, 3vw, 42px) 28px}
    body.progi-route .pp-page--home .pp-hero__content {position: static;padding: 52px 0 28px clamp(24px, 3vw, 42px)}
}
@media (min-width: 768px) and (max-width: 991px) {
    body.kierunek2-route .k2-hero__grid,
    body.podyplomowe-route .pd-hero__inner {padding: 52px clamp(20px, 4vw, 32px) 26px}
}
@media (min-width: 768px) and (max-width: 900px) {
    body.progi-route .pp-page--home .pp-hero {display: block;background: #f2f7fb;border: 1px solid #cbdfea;border-radius: var(--ui-radius-hero);box-shadow: var(--ui-shadow-subtle)}
    body.progi-route .pp-page--home .pp-hero__content {display: block;width: 100%;padding: 52px clamp(20px, 4vw, 32px) 26px}
    body.progi-route .pp-page--home .pp-hero__media {position: absolute;z-index: -2;inset: 0;width: 100%;height: 100%;margin: 0;border-radius: var(--ui-radius-hero)}
    body.progi-route .pp-page--home .pp-hero__media:after {display: block}
    body.progi-route .pp-page--home .pp-search-card {margin-top: 18px}
    body.progi-route .pp-page--home .pp-stats {position: relative;display: grid;grid-template-columns: repeat(3, minmax(0, 1fr));margin: 0;padding: 0 clamp(20px, 4vw, 32px) 26px;right: auto;top: auto;transform: none}
}
@media (max-width: 767px) {
    body :is(.k2, .pd-page, .pp-page--home, .matura-home-flow) .landing-hero__breadcrumb {
        position: static;
        width: 100%;
        margin: 0 0 10px;
        padding: 0;
    }
    body :is(.k2, .pd-page, .pp-page--home, .matura-home-flow) .landing-hero__card {
        overflow: hidden;
        border: 1px solid #cbdfea;
        border-radius: 16px;
        background: #f2f7fb;
        box-shadow: var(--ui-shadow-subtle);
    }
    /* Reserve the same photograph area even when the title takes fewer lines. */
    body :is(.k2, .pd-page, .pp-page--home, .matura-home-flow) .landing-hero__heading {
        position: relative;
        isolation: isolate;
        min-height: 220px;
        padding: 26px clamp(16px, 4vw, 20px);
        overflow: hidden;
    }
    body :is(.k2, .pd-page, .pp-page--home, .matura-home-flow) .landing-hero__heading h1 {
        max-width: none;
        margin: 0;
        font-size: clamp(28px, 7.5vw, 34px);
    }
    body :is(.k2, .pd-page, .pp-page--home, .matura-home-flow) .landing-hero__description {
        max-width: none;
        margin: 0 !important;
        padding: 20px clamp(16px, 4vw, 20px) 24px;
        background: #f2f7fb;
        font-size: 14px;
        line-height: 1.5;
    }
    body :is(.k2, .pd-page, .pp-page--home, .matura-home-flow) .landing-hero__heading:before {
        position: absolute;
        z-index: 1;
        inset: 0;
        content: "";
        pointer-events: none;
        background: linear-gradient(90deg, #f2f7fbdb 0%, #f2f7fbd1 26%, #f2f7fba3 60%, #f2f7fb61 100%), linear-gradient(0deg, #f2f7fb 0%, #f2f7fb57 12%, transparent 42%);
    }
    body :is(.k2, .pd-page, .pp-page--home, .matura-home-flow) .landing-hero__heading :is(h1, .modern-hero-eyebrow) {position: relative;z-index: 2}
    body :is(.k2, .pd-page, .pp-page--home, .matura-home-flow) .landing-hero__heading :is(picture, .pd-hero__photo) {
        position: absolute;
        z-index: 0;
        inset: 0;
        display: block;
        width: 100%;
        height: 100%;
        margin: 0;
        border-radius: 0;
    }
    body :is(.k2, .pd-page, .pp-page--home, .matura-home-flow) .landing-hero__heading img {width: 100%;height: 100%;object-fit: cover;object-position: 68% 40%}
    body.progi-route .pp-page--home .pp-hero {display: block}
    body.progi-route .pp-page--home .pp-hero__content {display: block;width: 100%;padding: 0}
    body.progi-route .pp-page--home .pp-hero__media:after {display: none}
    body.progi-route .pp-page--home .pp-search-card {margin-top: 8px;padding: 15px;background: #fff;box-shadow: 0 3px 10px #1234510a;backdrop-filter: none}
    body.progi-route .pp-page--home .pp-search {flex-direction: column}
    body.progi-route .pp-page--home :is(.pp-search__field, .pp-search__select) {flex: none;width: 100%}
    body.progi-route .pp-page--home .pp-search>button {width: 100%;min-height: 48px;font-size: 14px}
    body.progi-route .pp-page--home .pp-stats {position: static;display: grid;grid-template-columns: minmax(0, 1fr);gap: 10px;width: 100%;margin: 16px 0 0;padding: 0;transform: none}
}

body.matura-route:has(.matura-home-flow) .matura-home-breadcrumb-slot {
    margin-top: 0;
}

@media (max-width: 991px) {
    body.kierunek2-route:has(.k2-hero),
    body.progi-route:has(.pp-page--home),
    body.podyplomowe-route:has(.pd-hero),
    body.matura-route:has(.matura-home-flow) {
        /* Match the existing tablet/mobile route-shell clearance. */
        padding-top: 70px !important;
    }
}

@media (max-width: 767px) {
    body.kierunek2-route:has(.k2-hero) .k2-hero,
    body.progi-route:has(.pp-page--home) .pp-page--home .pp-hero,
    body.podyplomowe-route:has(.pd-hero) .pd-hero {margin-top: 12px}
    body.matura-route:has(.matura-home-flow) .matura-home-breadcrumb-slot {
        margin-top: 0;
        margin-bottom: 10px;
    }
}
