/* =========================================================
   ProCode Media CSS
   - Skeleton shimmer visible (image hidden until loaded)
   - aspect-ratio frames
   - Masonry CSS included (so pages outside product look same)
   - Carousel isolated (doesn't touch other Swipers)
========================================================= */

/* Base Item */
.pc-media-item{position:relative;display:flex;align-items:center;justify-content:center;z-index:1;}
.pc-media-frame{position:relative;width:100%;overflow:hidden;background:#f2f2f2;border-radius:15px;}
.pc-media-img, .pc-media-poster{display:block;width:100%;height:100%;border-radius:15px;transition:opacity .18s ease;}
.pc-media-item.pc-loaded .pc-media-img, .pc-media-item.pc-loaded .pc-media-poster{opacity:1;}
.pc-layout-grid .pc-media-img{ object-fit:cover;}
.pc-layout-grid .pc-media-poster{object-fit:cover;}
.pc-layout-carousel .pc-media-img, .pc-layout-carousel .pc-media-poster{object-fit:contain;}

/* Skeleton (Shimmer) */
.pc-skeleton {
    position: absolute;
    inset: 0;
    background: #d9d9d9;
    overflow: hidden;
    pointer-events: none;
    z-index: 2; /* ✅ روی عکس */
}

.pc-skeleton::before {
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
            90deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, .55) 50%,
            rgba(255, 255, 255, 0) 100%
    );
    animation: pcShimmer 1.1s linear infinite;
}

@keyframes pcShimmer { 0% { left: -60%; } 100% { left: 120%; } }

.pc-media-item.pc-loaded .pc-skeleton {
    opacity: 0;
    transition: opacity .18s ease;
}

/* -----------------------------
   Video Play Icon
------------------------------ */
.pc-type-video .pc-play-icon {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 3;
    pointer-events: none;
}

.pc-type-video .pc-play-icon::before {
    content: "";
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(0,0,0,.55);
    box-shadow: 0 8px 20px rgba(0,0,0,.22);
    display: block;
}

.pc-type-video .pc-play-icon::after {
    content: "";
    position: absolute;
    width: 0;
    height: 0;
    border-left: 14px solid rgba(255,255,255,.95);
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    margin-left: 3px;
}

/* -----------------------------
   Grid (همون دیزاین قبلی تو)
------------------------------ */
.pc-layout-grid { position: relative; z-index: 1; }

.pc-layout-grid .pc-media-frame {
    position: relative;
    width: 100%;
    height: 300px; /* همون قبلی */
    overflow: hidden;
    background: #f2f2f2;
    transition: transform 300ms ease, box-shadow 300ms ease, filter 200ms ease, opacity 200ms ease;
}

.pc-layout-grid:hover { z-index: 20; }

.pc-media-grid:hover .pc-media-frame {
    filter: blur(1px);
    opacity: .4;
    transition: all .3s ease;
}

.pc-layout-grid:hover .pc-media-frame {
    filter: blur(0);
    opacity: 1;
    transform: scale(1.2);
    box-shadow: 0 30px 60px rgba(0,0,0,.3);
}

/* -----------------------------
   Masonry (Real Columns)
------------------------------ */
.pc-media-masonry{display:flex;align-items:flex-start;gap:var(--gap,10px);--cols-effective:var(--cols,2);flex-wrap:wrap;}
@media (max-width:768px){.pc-media-masonry{--cols-effective:var(--cols-m,2);}}
@media (max-width:480px){.pc-media-masonry{--cols-effective:var(--cols-s,2);}}

.pc-media-masonry-col{flex:0 0 calc((100% - (var(--cols-effective) - 1) * var(--gap,10px)) / var(--cols-effective));min-width:0;display:flex;flex-direction:column;gap:10px;}
.pc-media-masonry .media-masonry-item{border-radius:15px;overflow:hidden;}

.pc-media-ph{position:relative;width:100%;background:#f2f2f2;overflow:hidden;border-radius:10px;}
.pc-media-ph::before{content:"";display:block;padding-top:var(--ar,100%);}
.pc-media-ph>img.pc-media-img{position:absolute;inset:0;width:100%;height:100%!important;object-fit:cover;display:block;opacity:1!important;visibility:visible!important;transform:translateZ(0);}

.pc-media-loader{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;pointer-events:none;}
.pc-media-loader::after{content:"";width:34px;height:34px;border-radius:50%;border:3px solid rgba(0,0,0,.10);border-top-color:rgba(0,0,0,.35);animation:pcspin .8s linear infinite;}
@keyframes pcspin{to{transform:rotate(360deg);}}
.pc-media-ph.pc-loaded .pc-media-loader{opacity:0;transition:opacity .2s ease;}

.pc-media-badge{position:absolute;left:10px;bottom:10px;background:rgba(0,0,0,.55);color:#fff;font-size:14px;line-height:1;padding:6px 8px;border-radius:8px;pointer-events:none;}
.pc-media-masonry a[data-pc-masonry="1"]{display:block;}

/* Carousel (Scoped) - جدا از بقیه swiper ها */
.pc-media-carousel {border: 1px solid #212121;border-radius: 15px;padding: 6px !important;background: #e3e3d6;position: relative;overflow: hidden;}
.pc-media-carousel .swiper-wrapper {align-items: center;min-height: 420px;}
.pc-media-carousel .swiper-slide {width: clamp(180px, 26vw, 340px) !important;height: auto !important;display: flex !important;justify-content: center !important;transition: transform .45s ease, opacity .45s ease, filter .45s ease;}
.pc-media-carousel .pc-media-frame {width: 100%;height: auto;max-height: 62vh;background: #f2f2f2;border-radius: 15px;overflow: hidden;}
.pc-media-carousel .swiper-slide-active {transform: scale(1.05);opacity: 1;filter: none;z-index: 5;}
.pc-media-carousel .swiper-slide-prev, .pc-media-carousel .swiper-slide-next {transform: scale(.9);opacity: .75;filter: blur(.2px);}
.pc-media-carousel .swiper-slide:not(.swiper-slide-active):not(.swiper-slide-prev):not(.swiper-slide-next) {transform: scale(.78);opacity: .45;filter: blur(.6px);}
.pc-media-carousel .swiper-button-prev, .pc-media-carousel .swiper-button-next {width: 44px;height: 44px;border-radius: 12px;background: rgba(0,0,0,.45);color: #fff;backdrop-filter: blur(6px);}
.pc-media-carousel .swiper-button-prev:after, .pc-media-carousel .swiper-button-next:after {font-size: 16px;}
@media (max-width: 768px) {
    .pc-media-carousel .swiper-wrapper { min-height: 260px; }
    .pc-media-carousel .swiper-slide {width: 78% !important;transform: none !important;opacity: 1 !important;filter: none !important;}
    .pc-type-video .pc-play-icon::before { width: 48px; height: 48px; }
}

/* -----------------------------
   Lightbox
------------------------------ */
.pc-lb {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
}

.pc-lb.pc-open { display: block; }

.pc-lb-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.78);
}

.pc-lb-wrap {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 18px;
}

.pc-lb-media {
    position: relative;
    width: min(1100px, 100%);
    max-height: 92vh;
    border-radius: 14px;
    overflow: hidden;
    background: #0b0c10;
    box-shadow: 0 18px 45px rgba(0,0,0,.45);
    display: grid;
    place-items: center;
}

.pc-lb-media img,
.pc-lb-media video {
    display: block;
    width: 100%;
    height: auto;
    max-height: 92vh;
    object-fit: contain;
    background: #0b0c10;
}

.pc-lb-close,
.pc-lb-prev,
.pc-lb-next {
    position: absolute;
    appearance: none;
    border: none;
    background: rgba(255,255,255,.12);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background .15s ease, transform .15s ease;
    z-index: 2;
}

.pc-lb-close { top: 14px; right: 14px; font-size: 24px; }
.pc-lb-prev { left: 14px; top: 50%; transform: translateY(-50%); font-size: 28px; }
.pc-lb-next { right: 14px; top: 50%; transform: translateY(-50%); font-size: 28px; }

.pc-lb-lock {
    overflow: hidden !important;
    touch-action: none !important;
}

/* Fancybox must stay above the mobile natural-gallery sheet. */
.fancybox__container {
    --fancybox-zIndex: 1000000;
    z-index: 1000000 !important;
}

/* بهینه سازی نمایش ویدیو در لایت‌باکس فنس‌باکس */
.fancybox__content > .fancybox__html5video,
.fancybox__content > .fancybox__iframe {
    width: 100% !important;
    height: 85% !important;
    max-height: 85vh; /* اجازه بده کمی فضا برای دکمه‌ها بماند */
    object-fit: contain; /* برای اینکه ویدیو دفرمه نشود اما تمام ارتفاع را بگیرد */
    background: #000;
}

    .fancybox__slide.has-video .fancybox__content {
        width: 100% !important;
        height: 100% !important;
        aspect-ratio: auto !important;
    }

.fancybox__slide {
    padding: 48px 0 8px 0;
}

/* حذف کادر اضافی که فنس باکس دور ویدیو می‌اندازد */
.fancybox__html5video {
    display: block;
    border-radius: 10px;
    overflow: hidden;
}

/* Inline audio cards do not join image/video lightboxes. */
.pc-media-item.pc-type-audio { flex-direction: column; box-sizing: border-box; padding: 16px 10px; min-width: 0; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; cursor: default; text-align: center; }
.pc-type-audio .pc-audio-icon { display: block; color: #2563eb; font-size: 30px; line-height: 1.3; }
.pc-type-audio .pc-audio-title { margin: 8px 0; overflow-wrap: anywhere; font-size: 14px; }
.pc-media-item.pc-type-audio audio { display: block; width: 100%; max-width: 100%; min-width: 0; height: 40px; }

/* Customer voice: compact audio lists; photographic cards only among photos/videos. */
.pc-type-audio .pc-audio-icon svg { display: block; width: 30px; height: 30px; margin: auto; }
.pc-media-item.pc-type-audio.pc-audio-mixed { position: relative; isolation: isolate; overflow: hidden; aspect-ratio: 4 / 5; min-height: 250px; padding: 20px 12px 14px; border: 0; border-radius: 15px; color: #fff; background: #29333d; }
.pc-audio-mixed::before { content: ""; position: absolute; inset: 0; z-index: -2; background: var(--pc-voice-background, url("customer-voice-background.webp")) center / cover no-repeat; }
.pc-audio-mixed::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(18,29,38,.25), rgba(18,29,38,.42) 45%, rgba(14,23,33,.86)); }
.pc-audio-mixed .pc-audio-icon { display: flex; align-items: center; justify-content: center; width: 62px; height: 62px; margin: auto auto 12px; border: 1px solid rgba(255,255,255,.34); border-radius: 50%; color: #fff; background: rgba(255,255,255,.12); }
.pc-audio-mixed .pc-audio-icon svg { width: 32px; height: 32px; }
.pc-audio-mixed .pc-audio-eyebrow { font-size: 12px; line-height: 1.8; color: #fff; }
.pc-audio-mixed .pc-audio-title { width: 100%; margin: auto 0 12px; padding-top: 22px; color: #fff; font-size: 14px; font-weight: 600; line-height: 1.8; text-shadow: 0 1px 4px rgba(0,0,0,.3); }
.pc-media-item.pc-audio-mixed audio { flex-shrink: 0; border-radius: 20px; }

/* A gentle speaking indicator; respect the visitor's reduced-motion preference. */
.pc-audio-icon svg { animation: pc-voice-bob 2s ease-in-out infinite; }
.pc-audio-mixed .pc-audio-icon { animation: pc-voice-halo 2s ease-out infinite; }
.pc-audio-icon svg path:last-child { transform-box: fill-box; transform-origin: center; animation: pc-voice-wave 1.6s ease-in-out infinite alternate; }
@keyframes pc-voice-bob { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-4px) scale(1.12); } }
@keyframes pc-voice-halo { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.36); } 75%, 100% { box-shadow: 0 0 0 10px rgba(255,255,255,0); } }
@keyframes pc-voice-wave { from { transform: scaleY(.6); opacity: .7; } to { transform: scaleY(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pc-audio-icon svg, .pc-audio-mixed .pc-audio-icon, .pc-audio-icon svg path:last-child { animation: none; } }
.pcsp-single-mobile [data-panel="audio"] .pc-audio-mixed { aspect-ratio: auto; min-height: 260px; }
.pcsp-single-mobile [data-panel="audio"] .pc-media-masonry { --cols: 1 !important; --cols-m: 1 !important; --cols-s: 1 !important; }
.pcsp-single-mobile .pc-tabs[data-tabs="media"] .pc-tab-btn { width: auto; flex: 1; }
.pcsp-voice-preview { position: relative; overflow: hidden; }
.pcsp-voice-preview span { position: absolute; inset: auto 0 0; padding: 10px 4px; background: rgba(15,23,42,.72); color: #fff; font-size: 12px; }
