/* ABG v8: Mobile-Layout-Fix gegen horizontale Verschiebungen und überbreite Produktkarten */
html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

img,
svg,
video {
    max-width: 100%;
    height: auto;
}

.site-header,
main,
footer,
.content-wrapper,
.home-content,
.home-content-bigger,
.product-results,
.result-products {
    max-width: 100vw;
}

@media (max-width: 900px) {
    body {
        overflow-x: hidden;
        min-width: 0;
    }

    main {
        overflow-x: hidden;
        width: 100%;
    }

    header.site-header {
        min-height: 78px;
        padding: 0.55rem 1rem;
        gap: 0.55rem;
    }

    header.site-header .logo {
        width: 76px;
        max-width: 28vw;
    }

    .mobile-header-cta {
        width: auto !important;
        max-width: 56vw;
        min-height: 44px;
        padding: 0 1.1rem;
        font-size: 0.95rem;
        line-height: 1;
        flex: 0 0 auto;
    }

    .content-wrapper {
        width: min(calc(100% - 1.25rem), 720px) !important;
        max-width: calc(100vw - 1.25rem) !important;
        margin-left: auto !important;
        margin-right: auto !important;
        min-width: 0;
    }

    .result-page,
    .home-content.result-page {
        gap: 1.15rem;
    }

    .result-hero,
    .calculation-summary,
    .notice-box,
    .product-results,
    .result-products,
    .advice-cta {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .result-header.w-100.flex-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem;
    }

    .result-header h2 {
        font-size: clamp(1.75rem, 8vw, 2.4rem);
        line-height: 1.12;
        overflow-wrap: break-word;
    }

    .result-header .link-button {
        width: 100%;
    }

    .result-products.flex-row {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        gap: 1.05rem !important;
        padding: 0.9rem !important;
        overflow: hidden;
    }

    .result-products .product-link-container,
    a.product-link-container.w-30 {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        flex: 0 0 auto !important;
        overflow: hidden;
        padding: 1rem !important;
        background: #fff;
    }

    .product-label {
        display: inline-flex;
        align-self: flex-start;
        width: auto;
        max-width: 100%;
        margin-bottom: 0.65rem;
        border-radius: 8px;
        padding: 0.45rem 0.65rem;
        font-size: 0.95rem;
        line-height: 1.1;
        white-space: normal;
    }

    img.result-image {
        display: block;
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: 220px;
        object-fit: contain;
        object-position: center;
        margin: 0 auto 0.75rem;
    }

    .product-title {
        font-size: clamp(1.12rem, 5.2vw, 1.35rem);
        line-height: 1.24;
        margin: 0.3rem 0;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    .product-meta {
        font-size: clamp(0.95rem, 4vw, 1.05rem);
        line-height: 1.45;
        color: #617384;
        overflow-wrap: break-word;
    }

    .product-link-container .btn {
        margin-top: 0.85rem;
        border-radius: 16px;
        min-height: 56px;
    }

    .calculation-summary,
    .formula-box,
    .calculation-line {
        max-width: 100%;
        overflow-wrap: break-word;
    }

    .formula-box,
    .calculation-line {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .advice-cta {
        margin-left: 0;
        margin-right: 0;
        padding: 1.25rem;
        overflow: hidden;
    }

    .advice-cta h2 {
        font-size: clamp(1.8rem, 8vw, 2.4rem);
        line-height: 1.12;
    }

    .advice-cta p {
        font-size: 1.05rem;
        line-height: 1.6;
    }

    .site-footer,
    .footer-inner,
    .footer-brand,
    .footer-links {
        max-width: 100%;
        overflow: hidden;
    }

    .footer-brand a,
    .footer-links a {
        overflow-wrap: anywhere;
    }
}

@media (max-width: 420px) {
    .content-wrapper {
        width: calc(100% - 1rem) !important;
        max-width: calc(100vw - 1rem) !important;
    }

    header.site-header {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    header.site-header .logo {
        width: 72px;
    }

    .mobile-header-cta {
        max-width: 58vw;
        font-size: 0.86rem;
        padding: 0 0.95rem;
    }

    img.result-image {
        max-height: 200px;
    }

    .result-products.flex-row {
        padding: 0.75rem !important;
    }
}
