/* ==== بداية كود CSS للصفحة الرئيسية المخصصة عبر الإضافة [my_custom_homepage] ==== */

/*
    أنماط أساسية تطبق على body الصفحة التي يتم فيها استخدام الشورت كود.
*/
body.page-template-blank #page,
body.page-template-default #page,
body.my-custom-homepage-active {
    margin: 0 !important;
    padding: 0 !important;
    background-color: #EAEAEA;
    height: 100dvh; /* استخدام dvh لضمان التوافق مع متصفحات الجوال */
    overflow: hidden;
}

html,
body.page-template-blank,
body.page-template-default,
body.my-custom-homepage-active {
    height: 100%;
    width: 100%;
    overflow: hidden;
}

#custom-homepage-container {
    /* زاوية الميلان */
    --mchp-slant-angle: 50px;
    
    /* ملاحظة: متغيرات الألوان (--mchp-cnc-bg-color وغيرها) يتم تعريفها الآن
       تلقائياً عبر كود PHP بناءً على إعدادات لوحة التحكم */

    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100dvh; /* تحديث للجوال */
    overflow: hidden;
    position: relative;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* --- الأيقونة العائمة (أسفل الوسط) --- */
#custom-homepage-container > .mchp-page-icon {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    line-height: 0;
}

#custom-homepage-container .mchp-page-icon img {
    display: block;
    max-width: 100px;
    max-height: 100px;
    height: auto;
}

/* --- الأقسام الرئيسية (مشتركة) --- */
#custom-homepage-container .diag-section {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
    text-decoration: none;
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    will-change: transform;
}

/* --- القسم الأول: CNC --- */
#custom-homepage-container .section-cnc {
    background-color: var(--mchp-cnc-bg-color);
    color: var(--mchp-cnc-text-color);
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--mchp-slant-angle)), 0 100%);
    margin-bottom: calc(-1 * var(--mchp-slant-angle));
    z-index: 3;
}
#custom-homepage-container .section-cnc .diag-icon i {
    display: inline-block;
    color: var(--mchp-cnc-icon-color);
    font-size: 2.5em;
    margin-bottom: 15px;
    animation: mchp-spin 10s linear infinite;
}
#custom-homepage-container .section-cnc .diag-content h2,
#custom-homepage-container .section-cnc .diag-content p {
    color: var(--mchp-cnc-text-color);
}

/* --- القسم الثاني: Digital --- */
#custom-homepage-container .section-digital {
    background-color: var(--mchp-digital-bg-color);
    color: var(--mchp-digital-text-color);
    clip-path: polygon(0 var(--mchp-slant-angle), 100% 0, 100% calc(100% - var(--mchp-slant-angle)), 0 100%);
    margin-top: calc(-1 * var(--mchp-slant-angle));
    margin-bottom: calc(-1 * var(--mchp-slant-angle));
    z-index: 2;
}
#custom-homepage-container .section-digital .diag-icon i {
    color: var(--mchp-digital-icon-color);
    font-size: 2.5em;
    margin-bottom: 15px;
}
#custom-homepage-container .section-digital .diag-content h2,
#custom-homepage-container .section-digital .diag-content p {
    color: var(--mchp-digital-text-color);
}

/* --- القسم الثالث: Learn --- */
#custom-homepage-container .section-learn {
    background-color: var(--mchp-learn-bg-color);
    color: var(--mchp-learn-text-color);
    clip-path: polygon(0 var(--mchp-slant-angle), 100% 0, 100% 100%, 0 100%);
    margin-top: calc(-1 * var(--mchp-slant-angle));
    z-index: 1;
}
#custom-homepage-container .section-learn .diag-icon i {
    color: var(--mchp-learn-icon-color);
    font-size: 2.5em;
    margin-bottom: 15px;
    margin-top: 30px;
}
#custom-homepage-container .section-learn .diag-content h2,
#custom-homepage-container .section-learn .diag-content p {
    color: var(--mchp-learn-text-color);
}

/* --- تنسيق النصوص --- */
#custom-homepage-container .diag-content h2 {
    font-size: 1.8em;
    margin-top: 0;
    margin-bottom: 8px;
    font-weight: 600;
}
#custom-homepage-container .diag-content p {
    font-size: 1em;
    margin-bottom: 0;
    line-height: 1.4;
}

/* --- تأثيرات التحويم (Hover) --- */
#custom-homepage-container .diag-section:hover {
    transform: scale(1.02);
    z-index: 4; /* يرفع القسم فوق الأقسام الأخرى */
}

/* دوران الأيقونة */
@keyframes mchp-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- التجاوب مع الشاشات (Responsive) --- */
@media (max-width: 768px) {
    #custom-homepage-container {
        --mchp-slant-angle: 35px;
    }

    #custom-homepage-container > .mchp-page-icon {
        bottom: 15px;
    }
    #custom-homepage-container .mchp-page-icon img {
        max-width: 80px;
    }

    #custom-homepage-container .diag-icon i {
        font-size: 2.2em !important; /* فرض الحجم */
        margin-bottom: 10px;
    }
    #custom-homepage-container .diag-content h2 {
        font-size: 1.6em;
    }
    #custom-homepage-container .diag-content p {
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    #custom-homepage-container {
        --mchp-slant-angle: 25px;
    }

    #custom-homepage-container > .mchp-page-icon {
        bottom: 10px;
    }
    #custom-homepage-container .mchp-page-icon img {
        max-width: 60px;
    }

    #custom-homepage-container .diag-icon i {
        font-size: 2em !important;
        margin-bottom: 8px;
    }
    #custom-homepage-container .diag-content h2 {
        font-size: 1.4em;
    }
    #custom-homepage-container .diag-content p {
        font-size: 0.85em;
    }
}
/* ==== نهاية كود CSS للصفحة الرئيسية المخصصة ==== */