/* Product project photos: use the viewport width without widening the product grid. */
.wp-block-term-description:has(> .sunpal-project-layout) {
    width: 100%;
    max-width: 1400px !important;
}

.sunpal-project-layout {
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    width: calc(100vw - 128px);
    max-width: 1800px;
    margin: 24px 0;
    grid-template-columns: minmax(0, 1fr) clamp(680px, 48vw, 840px) minmax(0, 1fr);
    align-items: start;
    gap: 24px;
}

.sunpal-project-layout > .sunpal-calculator {
    margin: 0;
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
}

/* Match only the header and input form, never the expanding BOM results. */
.sunpal-project-layout > .sunpal-project-photo {
    box-sizing: border-box;
    position: relative;
    align-self: start;
    width: 100%;
    height: var(--sunpal-project-photo-height, 620px);
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid #d8e1ec;
    border-radius: 16px;
    background: #f3f6fa;
    box-shadow: 0 12px 30px rgba(31, 47, 82, .09);
}

.sunpal-project-layout > .sunpal-project-photo--left {
    grid-column: 1;
    grid-row: 1;
}

.sunpal-project-layout > .sunpal-project-photo--right {
    grid-column: 3;
    grid-row: 1;
}

.sunpal-project-layout .sunpal-project-photo img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    max-width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
    object-fit: cover;
    object-position: center;
}

@media (max-width: 1399px) {
    .sunpal-project-layout {
        position: static;
        left: auto;
        transform: none;
        width: 100%;
        max-width: 920px;
        margin: 24px auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }
    .sunpal-project-layout > .sunpal-calculator {
        grid-column: 1 / -1;
        grid-row: 1;
    }
    .sunpal-project-layout > .sunpal-project-photo {
        height: auto;
        aspect-ratio: 4 / 3;
        grid-row: 2;
    }
    .sunpal-project-layout > .sunpal-project-photo--right {
        grid-column: 2;
    }
}

@media (max-width: 540px) {
    .sunpal-project-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }
    .sunpal-project-layout > .sunpal-project-photo {
        aspect-ratio: auto;
    }
    .sunpal-project-layout .sunpal-project-photo img {
        position: static;
        height: auto;
    }
    .sunpal-project-layout > .sunpal-project-photo--right {
        grid-column: 1;
        grid-row: 3;
    }
}
