/* ==========================================================================
   responsive.css
   Centralized responsive and accessibility-related overrides
   ========================================================================== */

/* ==========================================================================
   Reduced motion (accessibility)
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .desktop-menu .sub-menu,
    .desktop-menu .sub-menu > li {
        transition: none;
    }
}

/* ==========================================================================
   <= 900px (Tablet & Mobile)
   ========================================================================== */

@media (max-width: 900px) {
    /* ------------------------------------------------------------------------
       Shared helpers / grids
       ------------------------------------------------------------------------ */
    .section-grid {
        justify-items: center; /* stop stretching items full width */
    }

    .section-grid .content-card {
        width: 100%;
        max-width: 23rem; /* choose the reading width you want */
    }

    .section-grid,
    .section-grid.section-grid-3 {
        grid-template-columns: 1fr;
    }

    /* ------------------------------------------------------------------------
       Navigation (mobile)
       ------------------------------------------------------------------------ */
    /* Hide desktop menu */
    .desktop-menu {
        display: none;
    }

    .mobile-menu-wrapper {
        display: flex;
        margin-left: auto;
        position: relative;
        z-index: 1200;
    }

    .mobile-menu {
        box-sizing: border-box;
    }

    /* Backdrop when mobile menu is open */
    .full-menu:has(.ham[aria-expanded="true"])::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(240, 240, 240, 0.95);
        z-index: 1100;
    }

    /* Mobile panel positioning when open */
    .full-menu:has(.ham[aria-expanded="true"]) .mobile-menu {
        position: fixed;
        left: 1rem;
        top: 5rem;
        z-index: 1200;
        margin: 0;
        align-items: flex-start;
        overflow-x: hidden;
    }

    /* Wrap long submenu links nicely */
    .mobile-menu .sub-menu a {
        box-sizing: border-box;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    /* ------------------------------------------------------------------------
       Footer (mobile stacking)
       ------------------------------------------------------------------------ */
    .site-footer__inner {
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }

    .site-footer__bottom-inner {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    /* ------------------------------------------------------------------------
       Typography
       ------------------------------------------------------------------------ */
    .headline-big-subpage {
        font-size: 6vh;
        word-break: break-word;
    }

    /* ------------------------------------------------------------------------
       Call to Action
       ------------------------------------------------------------------------ */
    .cta .cta-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 2rem;
        align-items: center;
    }

    .cta .cta-text {
        order: 1;
        text-align: left;
    }

    .cta .cta-visual {
        order: 2;
        display: flex;
        justify-content: center;
    }

    .cta .cta-visual img {
        max-width: 260px;
        width: 100%;
        height: auto;
    }

    /* ------------------------------------------------------------------------
       Video block
       ------------------------------------------------------------------------ */
    .video-block {
        padding: 4rem 1rem;
    }

    .video-block__layout {
        grid-template-columns: 1fr;
    }

    .video-block__media {
        order: 1;
    }

    .video-block__transcript {
        order: 2;
    }

    .video-transkript-wrapper {
        grid-template-columns: 1fr !important;
    }

    body.page_content main > section[aria-labelledby="video-title"] {
        position: sticky;
        top: auto;
    }

    /* ------------------------------------------------------------------------
       Page layouts / content grids
       ------------------------------------------------------------------------ */
    .project-section {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .products {
        grid-template-columns: 1fr;
    }

    body.page_content .content {
        padding-right: 1.5rem;
    }

    .page_content .content-split {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    /* ------------------------------------------------------------------------
       Konfigurator (mobile)
       ------------------------------------------------------------------------ */
    body.page_konfigurator {
        --mobile-actions-height: 110px;
    }

    body.page_konfigurator main {
        padding-bottom: 4rem;
        display: flex;
        flex-direction: column;
    }

    body.page_konfigurator .cart-wrapper-button {
        position: fixed;
        bottom: 0;
        left: 0;
        display: flex;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
        background: white;
        z-index: 20;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
        order: 99;
    }

    body.page_konfigurator #cart {
        max-width: 100vw;
        width: 100%;
        box-sizing: border-box;
        grid-template-columns: 1fr;
    }

    body.page_konfigurator #cart .cart-item {
        max-width: 100vw;
        width: 100%;
        box-sizing: border-box;
        min-width: 0;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    /* Wrapper: from 2 columns to 1 column */
    body.page_konfigurator .wrapper {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Left column (categories) spans full width */
    body.page_konfigurator .categories-wrapper {
        width: 100%;
    }

    body.page_konfigurator .wrapper,
    body.page_konfigurator .products {
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }

    body.page_konfigurator .cart-title {
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    /* Products: single column */
    body.page_konfigurator .products {
        grid-template-columns: 1fr;
    }

    /* Tiles: force full width in grid */
    body.page_konfigurator .product-item {
        grid-column: 1 / -1;
    }

    /* Full-width overlay tile on mobile */
    body.page_konfigurator .product-item.full-width {
        position: fixed;
        inset: 0;
        border-radius: 0;
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 6rem;
        display: flex;
        flex-direction: column;
    }

    /* Left block (title/description/etc.) must scroll with the tile */
    body.page_konfigurator .product-item.full-width .product-item-info,
    body.page_konfigurator .product-item.full-width .product-item-info.sticky {
        position: static !important;
        top: auto !important;
    }

    /* Right block follows below on mobile */
    body.page_konfigurator .product-item.full-width .selection-wrapper,
    body.page_konfigurator
    .product-item.full-width
    .selection-wrapper.active-selection {
        grid-column: auto;
        overflow: visible;
        height: auto;
    }

    /* Selection panel full width */
    body.page_konfigurator .product-item.full-width .selection-wrapper {
        grid-column: 1;
    }

    body.page_konfigurator .product-item.full-width .selection-wrapper.active-selection {
        padding: 1.25rem 1rem 6rem; /* smaller padding + space for buttons */
    }

    body.page_konfigurator .product-item.full-width .buttons-wrapper {
        position: sticky !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        margin-top: auto;
        padding: 1rem;
        background: var(--color-light-grey);
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        z-index: 50;
    }

    body.page_konfigurator .avatar-wrapper {
        display: none;
    }

    /* ------------------------------------------------------------------------
       Home (mobile)
       ------------------------------------------------------------------------ */
    .page_home .headline-big {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        font-size: 10vh;
        line-height: 1.1;
    }

    .page_home .headline-big span {
        display: block;
    }

    .project-title {
        position: static;
        top: auto;
    }

    /* ------------------------------------------------------------------------
       Content pages (mobile)
       ------------------------------------------------------------------------ */
    body.page_content .hero {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        padding-top: 5.5rem;
        max-width: 100%;
        overflow-x: hidden;
    }

    header.hero .teaser__layout {
        grid-template-columns: 1fr;
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    header.hero .teaser__layout > div:last-child {
        order: 2;
        position: static !important;
        margin-top: 1.5rem;
    }

    header.hero .teaser__layout > div:last-child img {
        max-width: 140px;
        margin: 0 auto;
        display: block;
    }

    body.page_content .hero h1 {
        font-size: 3.4rem;
        line-height: 1.15;
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    body.page_content .content-split__title,
    body.page_content .content-split__content {
        min-width: 0;
    }

    body.page_content .content {
        display: grid;
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    body.page_content .content-split {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    body.page_content .content-split__title {
        font-size: 0.9rem;
        line-height: 1.25;
        max-width: 100%;
        overflow-wrap: break-word;
        position: static;
    }

    body.page_content .quote-block {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 2rem 1rem;
        justify-items: center;
        text-align: left;
        margin: 0;
        width: calc(100% - 2rem);
        margin-inline: auto;
    }

    body.page_content .quote-block > p {
        font-size: 2rem !important;
        line-height: 1.2 !important;
    }

    body.page_content .quote-block .small_quote {
        font-size: 0.95rem !important;
        line-height: 1.4;
        opacity: 0.75;
    }

    body.page_content .content-section ul.ul_none_bullet > li {
        min-height: auto;
        padding: 3rem 1rem;
    }

    .content-section .teaser__layout {
        grid-template-columns: 1fr;
    }

    .content-section .teaser__layout img {
        max-width: 120px;
    }

    .content-section .header-subline {
        font-size: 1rem;
        line-height: 1.5;
    }

    body.page_content .bullet-point-list,
    body.page_content .bullet-point-list a,
    body.page_content .bullet-text {
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}
