/* =========================================
   1. تنظیمات کلی و کانتینر
   ========================================= */
.viraseo-portfolio-wrapper {
    padding: 80px 20px;
    background-color: #f8f9fa;
    direction: rtl;
}

.viraseo-portfolio-grid {
    display: grid;
    gap: 40px;
    margin: 0 auto;
    max-width: 1200px;
}

.viraseo-columns-2 { grid-template-columns: repeat(auto-fill, minmax(450px, 1fr)); }
.viraseo-columns-3 { grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); }
.viraseo-columns-4 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* انیمیشن ورود */
.viraseo-portfolio-item {
    opacity: 0;
    animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.viraseo-portfolio-item:nth-child(1) { animation-delay: 0.1s; }
.viraseo-portfolio-item:nth-child(2) { animation-delay: 0.2s; }
.viraseo-portfolio-item:nth-child(3) { animation-delay: 0.3s; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   2. کارت محصول
   ========================================= */
.portfolio-card {
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    transition: all 0.4s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0,0,0,0.03);
}

/* افکت هاور فقط در دسکتاپ */
@media (min-width: 769px) {
    .portfolio-card:hover {
        transform: translateY(-10px);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    }
}

/* =========================================
   3. بخش تصویر (هسته اصلی)
   ========================================= */
.portfolio-image {
    position: relative;
    overflow: hidden;
    height: 280px; /* ارتفاع پیش‌فرض دسکتاپ */
    background: #f0f2f5;
    border-bottom: 1px solid #eee;
}

.portfolio-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: block;
}

/* --- حالت الف: عکس ساده (غیر اسکرولی) --- */
.portfolio-image:not(.is-scrollable) img {
    height: 100%;
    object-fit: cover;
    object-position: top center;
    transition: transform 0.6s ease;
}

@media (min-width: 769px) {
    .portfolio-card:hover .portfolio-image:not(.is-scrollable) img {
        transform: scale(1.08);
    }
}

/* --- حالت ب: عکس اسکرولی (جادویی برای دسکتاپ) --- */
@media (min-width: 769px) {
    .portfolio-image.is-scrollable img {
        height: auto !important;
        min-height: 100%;
        object-fit: unset !important;
        transform: translateY(0);
        transition: transform 4s ease-in-out;
    }

    .portfolio-card:hover .portfolio-image.is-scrollable img {
        transform: translateY(calc(-100% + 280px)) !important;
    }
}

/* =========================================
   4. استایل مخصوص موبایل (Mobile First UX)
   ========================================= */
@media (max-width: 768px) {
    
    /* افزایش ارتفاع قاب عکس در موبایل برای دید بهتر */
    .portfolio-image {
        height: 320px; 
    }

    /* --- تنظیمات اسکرول لمسی (Swipe) --- */
    .portfolio-image.is-scrollable {
        overflow-y: auto; /* اجازه اسکرول عمودی */
        -webkit-overflow-scrolling: touch; /* نرم کردن اسکرول در آیفون */
        cursor: ns-resize; /* نشانگر موس برای تبلت */
    }

    .portfolio-image.is-scrollable img {
        position: static; /* حذف پوزیشن مطلق برای فعال شدن اسکرول طبیعی */
        height: auto !important;
        min-height: 100%;
        object-fit: unset !important;
        transform: none !important; /* غیرفعال کردن انیمیشن CSS */
    }

    /* اضافه کردن راهنمای متنی روی عکس */
    .portfolio-image.is-scrollable::after {
        content: '👆 برای مشاهده اسکرول کنید';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
        color: #fff;
        font-size: 12px;
        text-align: center;
        padding: 20px 0 10px 0;
        pointer-events: none; /* اجازه کلیک روی عکس را می‌دهد */
        opacity: 0.8;
        transition: opacity 0.3s;
    }
    
    /* وقتی کاربر شروع به اسکرول کرد، متن محو شود (اختیاری) */
    .portfolio-image.is-scrollable:active::after {
        opacity: 0;
    }
}

/* =========================================
   5. سایر اجزا
   ========================================= */
.portfolio-overlay {
    position: absolute;
    inset: 0;
    background: rgba(30, 30, 30, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
    z-index: 10;
}

/* در موبایل اورلی را همیشه نمایش نده، فقط روی دکمه لینک */
@media (min-width: 769px) {
    .portfolio-card:hover .portfolio-overlay { opacity: 1; }
}

.portfolio-link {
    display: inline-flex; align-items: center; gap: 10px; padding: 12px 28px; background: #fff; color: #000; text-decoration: none; border-radius: 50px; font-weight: 700; font-size: 14px; transform: translateY(20px); transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

@media (min-width: 769px) {
    .portfolio-card:hover .portfolio-link { transform: translateY(0); }
}
@media (max-width: 768px) {
    .portfolio-overlay { display: none; } /* مخفی کردن اورلی سیاه در موبایل */
}

.portfolio-link:hover { background: #0073aa; color: #fff; }

.portfolio-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #fff;
    z-index: 11;
}

.portfolio-title { margin: 0 0 10px 0; font-size: 18px; font-weight: 800; color: #2d3436; }

/* تگ‌ها در موبایل کمی کوچک‌تر */
.portfolio-category { position: absolute; top: -12px; right: 20px; background: #0073aa; color: #fff; padding: 4px 12px; border-radius: 20px; font-size: 10px; font-weight: 700; box-shadow: 0 4px 10px rgba(0, 115, 170, 0.3); z-index: 12; }

.portfolio-item[data-category="seo"] .portfolio-category { background: #27ae60; box-shadow: 0 4px 10px rgba(39, 174, 96, 0.3); }
.portfolio-item[data-category="design"] .portfolio-category { background: #2980b9; }
.portfolio-item[data-category="both"] .portfolio-category { background: #8e44ad; box-shadow: 0 4px 10px rgba(142, 68, 173, 0.3); }

.portfolio-description { color: #636e72; font-size: 13px; line-height: 1.6; margin: 0 0 15px 0; flex: 1; }

.portfolio-url { margin-top: auto; padding-top: 12px; border-top: 1px solid #eee; color: #0073aa; text-decoration: none; font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.portfolio-url::after { content: "←"; font-size: 16px; }

/* دکمه موبایل جداگانه برای مشاهده سایت (چون اورلی حذف شد) */
@media (max-width: 768px) {
    .viraseo-portfolio-grid { gap: 25px; padding: 0 10px; grid-template-columns: 1fr; } 
    .viraseo-portfolio-wrapper { padding: 40px 15px; }
    
    /* دکمه شیک برای موبایل */
    .portfolio-mobile-btn {
        display: block;
        margin-top: 10px;
        text-align: center;
        background: #f0f2f5;
        padding: 10px;
        border-radius: 8px;
        color: #333;
        text-decoration: none;
        font-weight: bold;
        font-size: 13px;
    }
}
/* ... کدهای قبلی سر جای خود باشند ... */

/* --- استایل دکمه بارگذاری بیشتر --- */
.viraseo-load-more-container {
    text-align: center;
    margin-top: 50px;
    clear: both;
    width: 100%;
}

.viraseo-btn-load-more {
    background: #fff;
    color: #0073aa;
    border: 2px solid #0073aa;
    padding: 12px 35px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    font-family: inherit; /* ارث‌بری فونت قالب */
}

.viraseo-btn-load-more:hover {
    background: #0073aa;
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 115, 170, 0.2);
}

/* --- استایل لودر (Spinner) --- */
.viraseo-loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
    display: none; /* پیش‌فرض مخفی */
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}