/**
 * Product Extra Content - Modern Responsive Frontend Styles
 * Designed for optical & eyewear showcases (Compact Small Size)
 */

:root {
    --pec-primary: var(--primary, #8B571F);
    --pec-primary-light: var(--primary-light, rgba(139, 87, 31, 0.08));
    --pec-card-width: 140px;
    --pec-card-radius: 14px;
    --pec-border-default: #e5e7eb;
    --pec-text-dark: var(--text-dark, #1f2937);
    --pec-text-gray: var(--text-gray, #6b7280);
}

/* Container Section */
.pec-extra-content {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin: 20px 0 0;
    padding: 16px 0 0;
    border-top: 1px solid #f0f0f0;
    border-bottom: none;
    border-left: none;
    border-right: none;
    border-radius: 0;
    background: transparent;
    overflow: visible;
}

/* Heading */
.pec-extra-title {
    margin: 0 0 10px;
    font-size: clamp(16px, 1.8vw, 18px);
    font-weight: 700;
    line-height: 1.35;
    color: var(--pec-text-dark);
    letter-spacing: -0.01em;
}

/* Description Text */
.pec-extra-description {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--pec-text-gray);
    margin-bottom: 14px;
    overflow-wrap: anywhere;
}

.pec-extra-description > :first-child { margin-top: 0; }
.pec-extra-description > :last-child { margin-bottom: 0; }

/* Showcase Gallery Container - Compact side-by-side cards */
.pec-extra-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
    align-items: center;
}

/* Individual Card (Small, proportional 366 x 328 ratio) */
.pec-gallery-card {
    position: relative;
    flex: 0 0 var(--pec-card-width);
    width: var(--pec-card-width);
    max-width: 150px;
    aspect-ratio: 366 / 328;
    height: auto;
    background: #ffffff;
    border: 1.5px solid var(--pec-border-default);
    border-radius: var(--pec-card-radius);
    box-sizing: border-box;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

/* Hover state */
.pec-gallery-card:hover {
    border-color: var(--pec-primary);
    box-shadow: 0 6px 16px -2px rgba(139, 87, 31, 0.18), 0 2px 6px rgba(0, 0, 0, 0.04);
    transform: translateY(-2px);
}

/* Active / Selected state (matches card with brand border) */
.pec-gallery-card.is-active {
    border: 2px solid var(--pec-primary);
    box-shadow: 0 4px 14px -2px rgba(139, 87, 31, 0.2);
}

.pec-gallery-card:focus-visible {
    outline: 2px solid var(--pec-primary);
    outline-offset: 3px;
}

/* Inner wrapper for edge-to-edge image containment */
.pec-gallery-card-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    border-radius: inherit;
    background: #ffffff;
}

/* Eyewear Image - Edge to Edge, fully filled, sharp */
.pec-extra-gallery-image {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    display: block;
    margin: 0;
    vertical-align: middle;
    border-radius: inherit;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    pointer-events: none;
    user-select: none;
}

.pec-gallery-card:hover .pec-extra-gallery-image {
    transform: scale(1.05);
}

/* Compact Zoom Button */
.pec-card-zoom-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4b5563;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
    z-index: 3;
    padding: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.pec-card-zoom-btn svg {
    width: 13px;
    height: 13px;
}

.pec-gallery-card:hover .pec-card-zoom-btn,
.pec-gallery-card:focus-within .pec-card-zoom-btn {
    opacity: 1;
    transform: scale(1);
}

.pec-card-zoom-btn:hover {
    background: var(--pec-primary);
    color: #ffffff;
    border-color: var(--pec-primary);
}

/* Lightbox Modal */
.pec-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.pec-lightbox.is-open {
    opacity: 1;
    pointer-events: auto;
}

.pec-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.pec-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2;
}

.pec-lightbox.is-open .pec-lightbox-content {
    transform: scale(1);
}

.pec-lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 14px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    background: #ffffff;
    padding: 16px;
    box-sizing: border-box;
}

.pec-lightbox-close {
    position: absolute;
    top: -46px;
    right: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    font-size: 26px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    outline: none;
}

.pec-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.4);
}

.pec-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.2s;
    outline: none;
    z-index: 5;
}

.pec-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-50%) scale(1.08);
}

.pec-lightbox-prev { left: -56px; }
.pec-lightbox-next { right: -56px; }

.pec-lightbox-nav svg {
    width: 22px;
    height: 22px;
}

body.pec-lightbox-active {
    overflow: hidden;
}

/* Responsive Media Queries */
@media (max-width: 768px) {
    .pec-extra-content {
        margin-top: 16px;
        padding-top: 14px;
    }
    .pec-extra-gallery {
        gap: 10px;
    }
}

@media (max-width: 480px) {
    :root {
        --pec-card-width: 110px;
    }
    .pec-extra-title {
        font-size: 16px;
    }
    .pec-extra-description {
        font-size: 13px;
    }
    .pec-extra-gallery {
        gap: 8px;
    }
    .pec-gallery-card {
        border-radius: 12px;
    }
    .pec-card-zoom-btn {
        opacity: 0.9;
        transform: scale(0.8);
        top: 4px;
        right: 4px;
    }
    .pec-lightbox {
        padding: 14px;
    }
    .pec-lightbox-image {
        padding: 10px;
    }
}
