/* =========================================================
   شبکه تصاویر داخل گالری
   ========================================================= */

.famad-gallery-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: flex-start;
    width: 100%;
    box-sizing: border-box;
}

.famad-gallery-grid a {
    display: block;
    width: 200px;
    height: 200px;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

.famad-gallery-grid img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.famad-gallery-grid a:hover img {
    transform: scale(1.05);
}


/* =========================================================
   ریسپانسیو شبکه تصاویر داخل گالری
   ========================================================= */

@media (max-width: 768px) {

    .famad-gallery-grid {
        justify-content: center;
    }

    .famad-gallery-grid a {
        width: calc(50% - 15px);
        max-width: 200px;
        margin: 0 auto;
    }

}

@media (max-width: 480px) {

    .famad-gallery-grid {
        justify-content: center;
    }

    .famad-gallery-grid a {
        width: 100%;
        max-width: 250px;
        margin: 0 auto;
    }

}


/* =========================================================
   لیست کارت‌های گالری
   ========================================================= */

.famad-gallery-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 25px;
    width: 100%;
    margin: 30px 0;
    padding: 0;
    box-sizing: border-box;
}


/* =========================================================
   کارت گالری
   ========================================================= */

.famad-gallery-card {
    width: 100%;
    min-width: 0;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    text-align: center;
    transition:
        box-shadow 0.2s ease,
        transform 0.2s ease;
    box-sizing: border-box;
}

.famad-gallery-card:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.05);
}

.famad-gallery-card a {
    display: block;
    width: 100%;
    color: #333;
    text-decoration: none;
    box-sizing: border-box;
}

.famad-gallery-card img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.famad-gallery-card h3 {
    margin: 0;
    padding: 12px;
    font-size: 1rem !important;
    font-weight: bold !important;
    line-height: 1.4 !important;
    text-align: center;
    word-break: break-word;
}


/* =========================================================
   Responsive لیست گالری‌ها
   ========================================================= */

@media (max-width: 1200px) {

    .famad-gallery-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

}

@media (max-width: 800px) {

    .famad-gallery-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

@media (max-width: 500px) {

    .famad-gallery-list {
        grid-template-columns: 1fr;
    }

}


/* =========================================================
   لیست دسته‌بندی‌های گالری
   ========================================================= */

.famad-gallery-category-list {
    display: grid;

    /*
     * تعداد ستون‌ها از متغیر CSS خوانده می‌شود.
     * مقدار پیش‌فرض: 4 ستون
     */
    grid-template-columns: repeat(var(--famad-gallery-columns, 4),
            minmax(0, 1fr));

    gap: 25px;
    width: 100%;
    margin: 30px 0;
    padding: 0;

    box-sizing: border-box;
}


/* =========================================================
   کارت دسته‌بندی گالری
   ========================================================= */

.famad-gallery-category-card {
    width: 100%;
    min-width: 0;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    text-align: center;

    transition:
        box-shadow 0.2s ease,
        transform 0.2s ease;

    box-sizing: border-box;
}

.famad-gallery-category-card:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
}

.famad-gallery-category-card a {
    display: block;
    width: 100%;
    color: #333;
    text-decoration: none;
    box-sizing: border-box;
}

.famad-gallery-category-card img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.famad-gallery-category-card:hover img {
    transform: scale(1.03);
}

.famad-gallery-category-card h3 {
    display: block;
    width: 100%;
    margin: 0;
    padding: 14px 12px;

    color: #333;

    font-size: 1rem !important;
    font-weight: bold !important;
    line-height: 1.4 !important;

    text-align: center;
    word-break: break-word;

    box-sizing: border-box;
}


/* =========================================================
   Responsive دسته‌بندی‌های گالری
   ========================================================= */

@media (max-width: 1200px) {

    .famad-gallery-category-list {
        grid-template-columns: repeat(3,
                minmax(0, 1fr));
    }

}

@media (max-width: 800px) {

    .famad-gallery-category-list {
        grid-template-columns: repeat(2,
                minmax(0, 1fr));
    }

}

@media (max-width: 500px) {

    .famad-gallery-category-list {
        grid-template-columns: 1fr;
    }

}


/* =========================================================
   جلوگیری از بیرون‌زدگی محتوا
   ========================================================= */

.famad-gallery-grid *,
.famad-gallery-list *,
.famad-gallery-category-list *,
.famad-gallery-card *,
.famad-gallery-category-card * {
    box-sizing: border-box;
}

.famad-gallery-grid img,
.famad-gallery-list img,
.famad-gallery-category-list img {
    max-width: 100%;
}
