/* Product Catalog Section Styles - FINAL FIX for gallery expansion */

/* Base Product Section */
.product-catalog-section {
    background: #f8f8f8;
    padding: var(--space-1) 0;
    margin: 0;
}

.product-catalog-section.alt-layout {
    background: #f8f8f8;
}

/* Product Section Header */
.product-section-header {
    text-align: left;
    margin-bottom: var(--space-2);
    padding-bottom: 0;
    border-bottom: none;
    max-width: 600px;
}

.product-section-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 0;
    color: var(--brand-accent, #58c4c0);
    text-transform: uppercase;
}

.product-description {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-2);
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

/* Main Product Layout - LOCKED grid to prevent reflow */

.product-catalog-layout {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
    gap: clamp(12px, 2.5vw, 32px);
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

/* Left Side: Product Images - LOCKED sizing */
.product-images-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-height: 500px;
    /* CRITICAL: Lock width */
    width: 100%;
    min-width: 0; /* Allow shrinking but not growing */
}

/* Right Side: Options Panel - LOCKED sizing */
.product-options-panel {
    background: #f8f8f8;
    backdrop-filter: blur(var(--blur));
    padding: var(--space-3);
    min-height: 500px;
    /* CRITICAL: Lock width to prevent expansion */
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    /* CRITICAL: Allow internal scrolling if needed */
    overflow-y: auto;
    overflow-x: hidden;
    /* Use flexbox for controlled layout */
    display: flex;
    flex-direction: column;
}

/* Main Product Showcase */
.main-product-showcase {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    border: none;
    background: #f8f8f8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-product-showcase img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


.variation-item.active {
    border-color: var(--brand-accent);
}

.options-header {
    text-align: center;
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid #ddd;
    flex-shrink: 0; /* Don't shrink when gallery expands */
}

.options-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: #333;
    margin: 0;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-1);
    margin-bottom: var(--space-1);
    row-gap: 10px;
    aspect-ratio: 2 / 1;
    height: auto;
    flex-shrink: 0;
    align-content: center;
    justify-content: space-evenly;
    align-items: stretch;
    justify-items: stretch;
}


.variation-item img {
    width: 90%;
    height: 70%;
    object-fit: cover;
    transition: transform 300ms ease;
}

.variation-item, .option-item {
    position: relative;
    aspect-ratio: 4/5;
    width: 90%;
    height: auto;
    overflow: hidden;
    border: none;
    background: #f8f8f8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 250ms ease;
}
.variation-item {
    width: 100%;
}


/* Product Variations (Sub Images) */
.product-variations {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-1);
    aspect-ratio: 2/1;
}
/* Align variation thumbnails: first = left, middle = center, last = right */

/* first thumbnail: hug left */
.product-variations .variation-item:first-child {
    justify-self: start;
}

/* middle thumbnail: stay centered */
.product-variations .variation-item:nth-child(2) {
    justify-self: center;
}

/* last thumbnail: hug right */
.product-variations .variation-item:last-child {
    justify-self: end;
}

/* First and last variation: card flush to edges (from earlier) */
.product-variations .variation-item:first-child,
.product-variations .variation-item:last-child {
    width: 100%;          /* fill the grid column */
}

/* First and last variation: image fills the card horizontally */
.product-variations .variation-item:first-child img,
.product-variations .variation-item:last-child img {
    width: 100%;          /* override the 90% just for these two */
}


/* Make variation thumbnails square + keep label visible
   (product-catalog.html -> .product-variations area) */
.product-variations .variation-item {
    /* Let the card be as tall as it needs (image + label) */
    aspect-ratio: auto;          /* overrides 4/5 */
    overflow: visible;           /* don't clip label */
    align-items: stretch;
    justify-content: flex-start;
}

/* Force the thumbnail itself to be a square box */
.product-variations .variation-item img {
    width: 100%;                 /* fill card width */
    height: auto;
    aspect-ratio: 1 / 1;         /* always square visual frame */
    object-fit: contain;         /* no cropping: square image stays intact */
    display: block;
}

/* Keep the label safely below the square image */
.product-variations .variation-label {
    margin-top: 6px;
    max-width: 100%;
    white-space: normal;
    text-align: center;
}



/*
.option-item:hover {
    transform: translateY(-3px);
    border-color: var(--brand-accent);
}

.option-item.selected {
    border-color: var(--brand-accent);
    background: #f8f8f8;
}

.option-item.active-gallery-item {
    border-color: var(--brand-accent);
    background: #f0f9f8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(88, 196, 192, 0.2);
}
*/


.option-item img {
    width: 90%;
    height: 70%;
    object-fit: cover;
    transition: transform 300ms ease;
}


.option-label, .variation-label {
    display: inline-block;      /* allows transform centering */
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #333;
    margin: 5px auto 0 auto;    /* top margin + horizontal auto centering */
    text-align: center;
    padding: 1% 10%;            /* responsive padding */
    border-radius: 3px;
    box-sizing: border-box;      /* include padding in width */
}

/* Product Actions */
.product-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: auto; /* Push to bottom, will adjust when gallery opens */
    padding-top: var(--space-3);
    border-top: 1px solid #eee;
    transition: all 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    border-radius: 8px;
    transition: all 250ms ease;
    position: relative;
    overflow: hidden;
}

.action-btn.primary {
    background: #f8f8f8;
    color: #fff;
    border: 2px solid var(--brand-accent, #58c4c0);
}

.action-btn.secondary {
    background: transparent;
    color: var(--brand-accent, #58c4c0);
    border: 2px solid var(--brand-accent, #58c4c0);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.action-btn.primary:hover {
    background: #4a9d9a;
    border-color: #4a9d9a;
}

.action-btn.secondary:hover {
    background: var(--brand-accent, #58c4c0);
    color: #fff;
}

.btn-arrow {
    font-size: 1.2rem;
    transition: transform 250ms ease;
}

.action-btn:hover .btn-arrow {
    transform: translateX(4px);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .product-catalog-layout {
        grid-template-columns: 1fr;
        gap: var(--space-4);
    }

    .product-options-panel {
        position: relative;
        top: auto;
    }

    .options-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1600px) {
    .product-section-header h2 {
        font-size: 1.2rem;
    }
    .options-header h3 {
        font-size: 1.2rem;
    }
}

@media (max-width: 768px) {
    .product-section-header h2 {
        font-size: 2rem;
    }

    .product-variations {
        grid-template-columns: 1fr;
        gap: var(--space-1);
    }

    .options-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-1);
    }

    .product-options-panel {
        padding: var(--space-3);
    }

    .action-btn {
        padding: 12px 16px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .options-grid {
        grid-template-columns: 1fr;
    }

    .product-actions {
        gap: var(--space-1);
    }
}

/* Placeholder styling for missing images */
.main-product-showcase:empty::before,
.variation-item:empty::before,
.option-item:empty::before {
    content: "(image)";
    color: #f8f8f8;
    font-style: italic;
    font-size: 1.2rem;
}

/* Animation for section reveal */
.product-catalog-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease, transform 600ms ease;
}

.product-catalog-section.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Integration with existing our-services layout */
.services-content .product-catalog-section {
    margin: 0;
}

.services-content .product-catalog-section + .product-catalog-section {
    border-top: 1px solid #eee;
}