/* Load AFTER index.css, motion.css and work-gallery.css. */
@media (max-width: 767px) {
    /* 02: remove desktop spacing before the shrink destination. */
    #section02 #hero .scene {
        margin-top: 0;
    }
    #section02 #hero .scene .headline {
        margin-top: 0;
        padding-top: 100px;
        padding-bottom: 40px;
    }

    /* 05: closed section follows content; open item animation remains intact. */
    #section05 {
        height: auto;
        min-height: 0;
        padding-top: 40px;
        padding-bottom: 40px;
    }
    #section05 .toggle_area {
        min-height: 0;
    }
    #section05 > .box > p {
        margin-bottom: 32px;
    }

    /* 06: compact normal view, viewport-height expanded view. */
    #section06 {
        height: auto;
        min-height: 0;
    }
    #section06 #gallery {
        display: flow-root; /* prevent the Work label margin collapsing outside */
        height: max(480px, calc(100vw + 140px));
        min-height: 0;
        transition: height 1150ms var(--ease);
    }
    #section06 #gallery.expanded {
        height: 100vh;
        height: 100dvh;
        min-height: 0;
    }
    #section06 #gallery .main-media {
        /* Remove caps during BOTH opening and closing. JS controls actual size. */
        max-width: none;
        max-height: none;
        min-width: 0;
    }
    #section06 #gallery.expanded .main-media .media-layer {
        inset: 0;
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        object-fit: cover;
        object-position: center;
    }
}
@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
    #section06 #gallery { transition: none; }
}
