/**
 * Products gallery — loaded only on the products page.
 * Uses CSS variables set inline: --product-max-w, --product-max-h (pixels).
 */

.product-page-hero {
    padding-bottom: 20px;
}

.product-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 28px;
}

.product-filter-btn {
    font-size: 0.85rem;
    padding: 10px 18px;
}

.product-filter-btn--active {
    background-color: var(--surface-blue);
    color: var(--text-color);
    box-shadow: 4px 4px 0 var(--accent-orange);
}

.product-category-title {
    font-size: 1.75rem;
    margin: 36px 0 16px;
    padding-bottom: 8px;
    border-bottom: var(--border-width) solid var(--accent-blue-soft);
}

.product-category-title:first-of-type {
    margin-top: 0;
}

/* Grid: responsive columns; each card scales down — frame uses max dimensions from PHP (see inline vars) */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
    gap: 24px;
    margin-bottom: 48px;
    justify-items: center;
}

.product-card {
    margin-top: 0;
    padding: 0;
    overflow: hidden;
    text-align: left;
    width: 100%;
    max-width: min(100%, var(--product-max-w, 1200px));
}

.product-card:hover {
    transform: rotate(-0.5deg);
}

/* Frame sized to fit the largest image’s aspect ratio; images scale inside without cropping */
.product-card-visual {
    width: 100%;
    max-width: var(--product-max-w, 800px);
    margin-inline: auto;
    aspect-ratio: var(--product-ar-w, 1) / var(--product-ar-h, 1);
    background: var(--accent-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: var(--border-width) solid var(--text-color);
}

.product-card-visual img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.product-card-caption {
    margin: 0;
    padding: 12px 14px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border-top: none;
    background: var(--surface-orange);
}

.product-empty-card code {
    font-size: 0.85em;
}
