.product-page {
    background: #f5f8fc;
    padding: 2.25rem 0 3.5rem;
    overflow-x: hidden;
}

.product-page .section-container {
    max-width: 1200px;
    overflow-x: hidden;
}

.product-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.2fr) minmax(250px, 0.8fr);
    grid-template-areas: "media main aside";
    gap: clamp(1rem, 1.8vw, 1.5rem);
    align-items: start;
    width: 100%;
}

.product-media {
    grid-area: media;
    width: 100%;
    min-width: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: clamp(0.9rem, 2vw, 1.4rem);
    overflow: hidden;
}

.product-media img {
    width: 100%;
    max-width: 520px;
    height: auto;
    max-height: min(62vh, 560px);
    object-fit: contain;
    object-position: center;
    display: block;
    margin: 0 auto;
}

.product-main {
    grid-area: main;
    width: 100%;
    min-width: 0;
    padding: clamp(1rem, 2vw, 1.6rem);
    overflow: hidden;
    text-align: center;
}

.product-title {
    margin: 0;
    color: var(--primary-blue);
    font-size: clamp(1.45rem, 2.15vw, 2.1rem);
    line-height: 1.2;
    text-align: center;
    overflow-wrap: anywhere;
}

.product-description {
    margin-top: 0.9rem;
    text-align: justify;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.product-aside {
    grid-area: aside;
    width: 100%;
    min-width: 0;
    align-self: start;
    overflow: hidden;
}

.product-buy-card {
    width: 100%;
    padding: clamp(0.9rem, 1.5vw, 1.2rem);
    overflow: hidden;
}

.product-buy-card h2 {
    margin: 0 0 0.75rem;
    text-align: center;
}

.product-cta {
    width: 100%;
    max-width: 100%;
    min-height: 46px;
    justify-content: center;
    text-align: center;
    white-space: normal;
}

@media (max-width: 900px) {
    .product-grid {
        grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
        grid-template-areas:
            "main aside"
            "media aside";
    }

    .product-title {
        font-size: clamp(1.35rem, 3.2vw, 1.8rem);
    }

    .product-media img {
        max-height: min(54vh, 460px);
    }
}

@media (max-width: 768px) {
    .product-page {
        padding: 1.3rem 0 2.7rem;
    }

    .product-page .section-container {
        padding: 0 0.9rem;
    }

    .product-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "main"
            "media"
            "aside";
        gap: 1rem;
    }

    .product-main {
        padding: 1rem 0.95rem;
    }

    .product-title {
        font-size: clamp(1.18rem, 5.6vw, 1.7rem);
    }

    .product-media {
        padding: 0.85rem;
    }

    .product-media img {
        max-width: min(100%, 420px);
        max-height: clamp(220px, 54vw, 360px);
    }

    .product-buy-card {
        padding: 0.95rem;
    }
}

@media (max-width: 480px) {
    .product-page {
        padding: 1rem 0 2.3rem;
    }

    .product-page .section-container {
        padding: 0 0.65rem;
    }

    .product-main {
        padding: 0.9rem 0.8rem;
    }

    .product-title {
        font-size: clamp(1.03rem, 6.4vw, 1.3rem);
    }

    .product-media {
        padding: 0.7rem;
    }

    .product-media img {
        max-height: clamp(190px, 60vw, 300px);
    }

    .product-buy-card {
        padding: 0.85rem;
    }

    .product-buy-card h2 {
        font-size: 0.95rem;
    }

    .product-cta {
        font-size: 0.95rem;
        padding: 0.75rem 0.85rem;
    }
}

/* JS layout guard for mobile/tablet; loaded only on product pages. */
body.is-mobile .product-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
        "main"
        "media"
        "aside";
}

body.is-tablet .product-grid {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
    grid-template-areas:
        "main aside"
        "media aside";
}
