/* ------------------ بخش پایه‌های تحصیلی ------------------ */
.grades-section {
    max-width: 1200px;
    margin: 0 auto 60px;
    padding: 0 40px;
    text-align: center;

}

.section-title {
    text-align: center;
    color: #311b5e;
    font-size: 28px;
    margin-bottom: 40px;
    font-weight: bold;
}

.cards-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* سه ستون هم‌اندازه */
    gap: 30px;
}

.grade-card {
    position: relative;
    background-color: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    /* برای جلوگیری از بیرون زدن عکس هنگام زوم */
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 15px rgba(49, 27, 94, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid #f0edf6;
}

/* رنگ اختصاصیِ هر پایه (نوار بالای کارت + پایه‌ی افکت‌های هاور/انتخاب) */
.grade-card::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 6px;
    background: var(--grade-color, #ffb703);
    transition: height 0.3s ease, box-shadow 0.3s ease;
    z-index: 2;
}
.grade-card:nth-child(1) { --grade-color: #3b82f6; } /* دهم: آبی */
.grade-card:nth-child(2) { --grade-color: #10b981; } /* یازدهم: سبز */
.grade-card:nth-child(3) { --grade-color: #f97316; } /* دوازدهم: نارنجی */

/* افکت هاور مینیمال روی کل کارت - حالا با رنگ خودِ پایه */
.grade-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 25px color-mix(in srgb, var(--grade-color) 30%, rgba(49, 27, 94, 0.12));
    border-color: var(--grade-color);
}

/* کانتینر عکس برای کنترل ابعاد و افکت */
.card-image-wrapper {
    width: 100%;
    height: 200px;
    /* ارتفاع ثابت برای عکس‌های افقی */
    overflow: hidden;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

/* زوم شدن نرم عکس وقتی موس روی کارت میره */
.grade-card:hover .card-image-wrapper img {
    transform: scale(1.05);
}

.card-content {
    padding: 20px;
    text-align: center;
}

.card-content h3 {
    color: #311b5e;
    font-size: 20px;
    margin-bottom: 10px;
    font-weight: bold;
    transition: color 0.3s ease;
}

.grade-card:hover .card-content h3 {
    color: var(--grade-color, #ffb703);
    /* تیتر همرنگ پایه میشه هنگام هاور */
}

.card-content p {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
}

/* =========================================
   تنظیمات ریسپانسیو برای کارت‌های پایه‌های تحصیلی
   ========================================= */

/* تبلت‌ها و مانیتورهای کوچک (عرض کمتر از ۹۹۲ پیکسل) */
@media screen and (max-width: 992px) {
    .cards-container {
        grid-template-columns: repeat(2, 1fr);
        /* تبدیل به دو ستون */
    }
}

/* گوشی‌های موبایل (عرض کمتر از ۷۶۸ پیکسل) */
@media screen and (max-width: 768px) {
    .grades-section {
        padding: 0 20px;
        /* کاهش فاصله از کناره‌های گوشی */
        margin: 50px auto;
    }

    .section-title {
        font-size: 24px;
        /* کوچک‌تر کردن تیتر برای موبایل */
        margin-bottom: 40px;
    }

    .cards-container {
        grid-template-columns: 1fr;
        /* تبدیل به یک ستون (زیر هم) */
        gap: 25px;
    }

    .card-image-wrapper {
        height: 200px;
        /* تنظیم ارتفاع عکس برای موبایل */
    }

    .card-content {
        padding: 20px;
    }

    .card-content h3 {
        font-size: 20px;
    }

    .card-content p {
        font-size: 13px;
        /* خواناتر شدن متن توضیحات */
    }
}

/* افکت کارت فعال - هر پایه با رنگ خودش هایلایت میشه */
.grade-card.active-grade {
    border: 3px solid var(--grade-color, #ffb703) !important;
    transform: translateY(-8px) scale(1.05); /* کمی بالاتر و بزرگتر */
    box-shadow: 0 15px 30px color-mix(in srgb, var(--grade-color, #ffb703) 40%, transparent); /* سایه عمیق و رنگیِ خودِ پایه */
    z-index: 10;
}
.grade-card.active-grade::before {
    height: 9px;
    box-shadow: 0 0 14px 2px var(--grade-color, #ffb703);
}

/* ===== راهنمای انتخاب پایه: تا وقتی هیچ پایه‌ای انتخاب نشده، مخاطب رو دعوت به کلیک می‌کنه ===== */
.grades-hint {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: -18px auto 30px;
    padding: 8px 20px;
    width: fit-content;
    background: rgba(255, 183, 3, 0.1);
    border: 1.5px dashed rgba(255, 183, 3, 0.45);
    border-radius: 50px;
    color: #a9720a;
    font-size: 14px;
    font-weight: 600;
}
.grades-hint .hint-arrow {
    display: inline-block;
    animation: hintBounce 1.3s ease-in-out infinite;
}
@keyframes hintBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px); }
}
/* وقتی پایه‌ای انتخاب شد، راهنما محو میشه و پالسِ دعوت‌کننده روی کارت‌ها متوقف میشه */
.grades-section.grade-chosen .grades-hint {
    display: none;
}
.grades-section:not(.grade-chosen) .grade-card {
    animation: gradeInvite 2.6s ease-in-out infinite;
}
.grades-section.grade-chosen .grade-card {
    animation: none;
}
.grade-card:nth-child(1) { animation-delay: 0s; }
.grade-card:nth-child(2) { animation-delay: 0.3s; }
.grade-card:nth-child(3) { animation-delay: 0.6s; }
@keyframes gradeInvite {
    0%, 100% { box-shadow: 0 4px 15px rgba(49, 27, 94, 0.05); }
    50% { box-shadow: 0 10px 26px color-mix(in srgb, var(--grade-color) 40%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
    .grades-section:not(.grade-chosen) .grade-card,
    .grades-hint .hint-arrow {
        animation: none;
    }
}