/*
 * Responsive overrides for the public site (mobile + tablet).
 * Loaded after main.css. Desktop (>= 1024px) is not changed.
 * Plain CSS on purpose: main.css is a Tailwind build that also covers classes
 * used in CMS content from the DB, so it is not rebuilt for this change.
 */

#nav-toggle,
.nav-sub-toggle {
    display: none;
}

/* Side gutter so content does not touch the screen edge */
@media (max-width: 1279px) {
    #page {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* ---------- Tablet + mobile (< 1024px) ---------- */
@media (max-width: 1023px) {
    /* Language switch: keep DE | ENG | FR on one line */
    #lang-switch a {
        display: inline-block;
        margin-top: 0;
    }

    /* Main navigation: hamburger instead of a wrapping bar with hover menus */
    #nav-main {
        background: linear-gradient(180deg, #707173 20%, #a6a7a8, #707173 70%);
    }

    #nav-toggle {
        display: flex;
        align-items: center;
        gap: .5rem;
        width: 100%;
        padding: .75rem 1rem;
        color: #fff;
        font-weight: 700;
        text-align: left;
    }

    #nav-main > ul {
        display: none;
        padding: 0;
        background: #707173;
    }

    #nav-main.open > ul {
        display: block;
    }

    #nav-main li {
        display: block;
        min-width: 0;
        margin: 0;
    }

    #nav-main > ul > li {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        border-top: 1px solid rgba(255, 255, 255, .25);
    }

    #nav-main > ul > li > a {
        flex: 1;
        padding: .75rem 1rem;
    }

    .nav-sub-toggle {
        display: block;
        padding: .75rem 1rem;
        color: #fff;
    }

    .nav-sub-toggle i {
        transition: transform .2s;
    }

    /* No hover menus on touch screens */
    #nav-main > ul > li:hover > ul,
    #nav-main > ul > li.submenu:hover:before {
        display: none;
    }

    #nav-main > ul > li > ul,
    #nav-main > ul > li.last > ul {
        position: static;
        display: none;
        width: 100%;
        min-width: 0;
        margin: 0;
        padding: 0 1rem .25rem 2rem;
        border-radius: 0;
        box-shadow: none;
        background: #ddd;
    }

    #nav-main > ul > li.sub-open > ul {
        display: block;
    }

    #nav-main > ul > li.sub-open > .nav-sub-toggle i {
        transform: rotate(180deg);
    }

    #nav-main > ul > li > ul a {
        padding: .75rem 0;
        white-space: normal;
    }

    /* Home teaser boxes: 2 columns */
    #teaser-boxen .flex {
        flex-wrap: wrap;
        row-gap: 2rem;
    }

    #teaser-boxen .flex > * {
        width: 50%;
    }
}

/* ---------- Mobile (< 768px) ---------- */
@media (max-width: 767px) {
    /* Home slider: text under the image instead of absolute pixel positions from the CMS */
    #slider,
    #slider .swiper {
        height: auto;
    }

    #slider .swiper-slide {
        max-height: none;
        height: auto;
        padding-bottom: 2.5rem;
    }

    #slider .swiper-slide > img {
        margin: 0 auto;
    }

    #slider .swiper-slide > .absolute {
        position: static;
        left: auto !important;
        top: auto !important;
        width: auto !important;
        height: auto !important;
        margin-top: 1rem;
    }

    /* Footer: wrap instead of fixed-height floats */
    #footer-zeile {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        padding: .25rem 0;
        color: #fff;
        background: #707173 url("/images/footerverlauf.jpg") 0 0 repeat-x;
        background-size: auto 100%;
    }

    #comlogo-footer,
    #footer-search,
    #footer-fb {
        float: none;
    }

    #footer-search {
        margin: 0 0 0 .5rem;
    }

    #footer-links {
        height: auto;
        padding: .5rem 1rem;
        line-height: 2;
        background: none;
    }

    #footer-fb {
        padding: .5rem 0 0;
    }

    #footer-fb img {
        margin: 0 auto;
    }
}

/* ---------- Small phones (< 640px) ---------- */
@media (max-width: 639px) {
    #teaser-boxen .flex > * {
        width: 100%;
    }

    #teaser-boxen .flex > * p {
        padding-right: 0;
    }
}
