/* ==========================================================
   Product Showcase Grid - Styles
   ========================================================== */

.psg-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 0 60px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Banner ---------- */
.psg-banner {
    background-color: #2b2b2b;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    margin-bottom: 40px;
    border-radius: 0 0 6px 6px;
}

.psg-banner-title {
    color: #ffffff;
    font-size: 2.4rem;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.psg-breadcrumb {
    color: #d8d8d8;
    font-size: 0.95rem;
}

.psg-breadcrumb .psg-sep {
    margin: 0 8px;
    color: #aaaaaa;
}

.psg-breadcrumb .psg-current {
    color: #ffffff;
    font-weight: 600;
}

/* ---------- Filter Buttons ---------- */
.psg-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 0 24px;
    margin-bottom: 30px;
}

.psg-filter-btn {
    background: #ffffff;
    border: 1px solid #c9c9c9;
    color: #333333;
    padding: 10px 22px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.psg-filter-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.psg-filter-btn.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

/* ---------- Grid ---------- */
.psg-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    padding: 0 24px;
}

.psg-card {
    border: 1px solid #e2e2e2;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.psg-card:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.psg-card.psg-hidden {
    display: none;
}

/* ---------- Image ---------- */
.psg-image-wrap {
    display: block;
    position: relative;
    width: 100%;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    cursor: pointer;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.psg-image-count {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.65);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    pointer-events: none;
}

.psg-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transition: transform 0.25s ease;
}

.psg-image-wrap:hover .psg-image {
    transform: scale(1.04);
}

/* ---------- Zoom Modal ---------- */
.psg-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Step 1: make the overlay visible (no transition on display itself) */
.psg-modal-overlay.psg-modal-visible {
    display: flex;
}

/* Step 2: added one frame later by JS so the scale/opacity transition
   actually animates instead of jumping straight to its end state */
.psg-modal-overlay.psg-modal-show {
    display: flex;
}

.psg-modal-box {
    background: #ffffff;
    border-radius: 10px;
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.85);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.psg-modal-overlay.psg-modal-show .psg-modal-box {
    transform: scale(1);
    opacity: 1;
}

.psg-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #ffffff;
    border: 1px solid #d8d8d8;
    color: #333333;
    cursor: pointer;
    z-index: 2;
    width: 34px;
    height: 34px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);

    /* Center the "x" glyph perfectly inside the rectangle */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1.4rem;
    line-height: 1;
}

.psg-modal-close:hover {
    color: #ffffff;
    background: #2563eb;
    border-color: #2563eb;
}

.psg-modal-image-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #f7f7f7;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 10px 10px 0 0;
    position: relative;
}

.psg-modal-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Zoom-in animation as the image reveals */
    transform: scale(0.8);
    opacity: 0;
    transition: transform 0.35s ease 0.05s, opacity 0.35s ease 0.05s;
}

.psg-modal-overlay.psg-modal-show .psg-modal-image {
    transform: scale(1);
    opacity: 1;
}

/* ---------- Modal Gallery: prev/next arrows ---------- */
.psg-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #d8d8d8;
    color: #333333;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.psg-modal-nav:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.psg-modal-prev {
    left: 10px;
}

.psg-modal-next {
    right: 10px;
}

/* Hidden automatically (via JS) when a product has only one image */
.psg-modal-nav.psg-hidden,
.psg-modal-thumbs.psg-hidden {
    display: none;
}

/* ---------- Modal Gallery: thumbnail strip ---------- */
.psg-modal-thumbs {
    display: flex;
    gap: 8px;
    padding: 12px 20px 0 20px;
    overflow-x: auto;
}

.psg-modal-thumb {
    width: 52px;
    height: 52px;
    flex: 0 0 auto;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    background: #f7f7f7;
    padding: 0;
}

.psg-modal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.psg-modal-thumb.active {
    border-color: #2563eb;
}

.psg-modal-desc {
    padding: 20px;
    /* Description fades in slightly after the image zoom finishes */
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s ease 0.3s, transform 0.3s ease 0.3s;
}

.psg-modal-overlay.psg-modal-show .psg-modal-desc {
    opacity: 1;
    transform: translateY(0);
}

.psg-modal-title {
    margin: 0 0 8px 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: #1a1a1a;
}

.psg-modal-text {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #555555;
}

body.psg-modal-active {
    overflow: hidden;
}

/* ---------- No Results ---------- */
.psg-no-results {
    text-align: center;
    padding: 40px 24px;
    color: #777777;
    font-size: 1rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .psg-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .psg-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        padding: 0 16px;
    }

    .psg-filters {
        padding: 0 16px;
    }

    .psg-banner-title {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .psg-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .psg-filter-btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
}
