/* Responsive additions. The original desktop layout remains unchanged. */

img {
    max-width: 100%;
}

@media screen and (max-width: 1024px) {
    #wrapper {
        width: auto;
        margin: 10px;
    }

    #head,
    #middle {
        display: flex;
        gap: 14px;
    }

    #head > br.clear,
    #middle > br.clear {
        display: none;
    }

    #head {
        align-items: stretch;
    }

    #head-left,
    #middle-left,
    #head-right,
    #middle-right {
        flex: 0 0 175px;
        margin-left: 0;
    }

    #head-center,
    #middle-center {
        flex: 1 1 auto;
        float: none;
        min-width: 0;
        margin-left: 0;
        width: auto;
    }

    #head-center img.logo {
        width: 100%;
    }

    #middle-left,
    #middle-right,
    #head-left,
    #head-right {
        float: none;
    }

    #middle-center .p_image,
    #middle-center #vertical_scroller {
        max-width: 100%;
    }

    #popupContact {
        box-sizing: border-box;
        left: 2.5%;
        width: 95%;
        max-height: 90vh;
        overflow: auto;
    }
}

@media screen and (max-width: 900px) {
    /* Keep the catalogue and checkout usable before switching to one column. */
    #head-left,
    #middle-right {
        display: none;
    }
}

@media screen and (max-width: 760px) {
    *,
    *::before,
    *::after {
        box-sizing: border-box;
    }

    body {
        font-size: 13px;
        overflow-x: hidden;
    }

    #wrapper {
        width: 100%;
        margin: 0;
    }

    #ram {
        border-right: 0;
        border-left: 0;
        margin-bottom: 0;
        overflow: visible;
    }

    #navi-top ul {
        display: flex;
        flex-wrap: wrap;
        margin: 0;
        background: #666;
    }

    #navi-top li,
    #navi-top li.active-top,
    #navi-top a,
    #navi-top a span,
    #navi-top li span.active-top {
        float: none;
    }

    #navi-top li {
        display: block;
        flex: 1 1 50%;
        padding: 0;
    }

    #navi-top a,
    #navi-top li.active-top {
        display: block;
        padding: 0;
        background: none;
        text-align: center;
    }

    #navi-top a span,
    #navi-top li span.active-top {
        display: block;
        padding: 10px 6px;
        background: none;
    }

    #head {
        height: auto;
        padding: 8px;
        flex-direction: column;
    }

    #head-center {
        order: 1;
        flex: none;
        width: 100%;
        height: min(37.7vw, 230px);
        min-height: 115px;
        background-size: 100% 100%;
    }

    #head-center img.logo {
        width: 100%;
        height: 100%;
    }

    #head-right {
        order: 2;
        flex: none;
        width: 100%;
        height: auto;
        min-height: 0;
        background: #eee;
    }

    #head-left {
        display: none;
    }

    #head-right .modul {
        padding-bottom: 8px;
    }

    #head-right input[type="text"],
    #head-right input[type="search"] {
        max-width: calc(100vw - 90px);
    }

    #middle {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 8px;
    }

    #middle-center {
        order: 1;
        width: 100%;
        padding-bottom: 8px;
    }

    #middle-left {
        order: 2;
        width: 100%;
        flex: none;
    }

    #middle-right {
        order: 3;
        width: 100%;
        flex: none;
    }

    #middle #middle-left .modul,
    #middle #middle-right .modul {
        width: 100%;
    }

    #middle .modul ul li a,
    #middle .modul ul li a:hover,
    #middle .modul ul li .active,
    #middle .modul ul ul li a,
    #middle .modul ul ul li a:hover,
    #middle .modul ul li ul li .active {
        width: 100%;
    }

    #middle-center h1 {
        font-size: 1.45em;
        overflow-wrap: anywhere;
    }

    #middle-center h2,
    #middle-center h3,
    #middle-center h4,
    #middle-center p,
    #middle-center td,
    #middle-center th,
    #middle-center a {
        overflow-wrap: anywhere;
    }

    #middle-center table.kosik,
    #middle-center table.artikelliste,
    #middle-center table.liste1,
    #middle-center table.liste2,
    #middle-center table.itemdetails {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table.step2 {
        width: 100% !important;
    }

    table.step2 td {
        padding: 4px;
    }

    input[type="text"],
    input[type="password"],
    input[type="email"],
    input[type="tel"],
    textarea,
    select {
        max-width: 100%;
    }

    textarea {
        width: 100%;
    }

    .order-info-fail {
        width: 100%;
        min-height: 0;
        padding: 11px 12px 11px 46px;
    }

    .order-info-fail::before {
        left: 11px;
    }

    .button,
    input[type="submit"],
    input[type="button"] {
        max-width: 100%;
        min-height: 34px;
    }

    .offerblock {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .offer,
    .links {
        float: none;
        width: calc(50% - 8px);
        min-width: 145px;
        margin: 0;
    }

    .p_image,
    #vertical_scroller,
    .slideshow {
        width: 100%;
        max-width: 100%;
    }

    #middle-center .itemdetails h1,
    #middle-center .itemdetails span {
        float: none;
    }

    .arrows {
        position: static;
    }

    #footer {
        padding: 10px 4px;
    }
}

@media screen and (max-width: 420px) {
    #navi-top li {
        flex-basis: 100%;
    }

    .offer,
    .links {
        width: 100%;
    }

    table.step2,
    table.step2 tbody,
    table.step2 tr,
    table.step2 td {
        display: block;
        width: 100% !important;
    }

    table.step2 td:empty {
        display: none;
    }
}
