/*
Theme Name: Afaq Landing Page
Author: Your Name
Description: قالب مخصص لصفحة هبوط تعليمية - آفاق
Version: 3.0
*/

/* ===== CSS Variables ===== */
:root {
    --color-primary:     #041B58;
    --color-accent:      #FFD700;
    --color-accent-glow: rgba(255, 215, 0, 0.40);
    --color-bg:          #f8faff;
    --color-white:       #ffffff;
    --ease-sidebar:      cubic-bezier(0.77, 0, 0.175, 1);
}

/* ===== إعدادات عامة ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Cairo', sans-serif;
    background: var(--color-bg);
    direction: rtl;
    overflow-x: hidden;
    color: var(--color-primary);
    -webkit-font-smoothing: antialiased;
}

/* ===== الهيدر ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    background: rgba(255, 255, 255, 0.97);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 1000;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    will-change: transform;
}

.logo img {
    height: 50px;
    width: auto;
    transition: transform 0.3s ease;
}
.logo img:hover { transform: scale(1.05); }

.whatsapp {
    font-size: 28px;
    color: #25D366;
    transition: color 0.3s ease, transform 0.3s ease;
}
.whatsapp:hover { transform: scale(1.1); }

.menu-toggle {
    font-size: 24px;
    cursor: pointer;
    color: var(--color-primary);
    transition: color 0.3s ease;
}

/* ===== القائمة الجانبية ===== */
/* PERF: transform instead of right property */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 100%;
    background: var(--color-white);
    z-index: 2000;
    transform: translateX(100%);
    transition: transform 0.4s var(--ease-sidebar);
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.1);
    contain: layout style;
}
.sidebar.active { transform: translateX(0); }

.overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(4, 27, 88, 0.4);
    z-index: 1500;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.overlay.active { visibility: visible; opacity: 1; }

.close-btn {
    align-self: flex-start;
    font-size: 30px;
    cursor: pointer;
    margin-bottom: 20px;
    color: var(--color-primary);
    transition: color 0.3s ease, transform 0.3s ease;
}
.close-btn:hover { color: var(--color-accent); transform: rotate(90deg); }

/* ===== روابط الشريط الجانبي ===== */
.sidebar a {
    text-decoration: none;
    color: var(--color-primary);
    font-weight: 700;
    font-size: 18px;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    /* SLOW hover: 0.5s instead of 0.3s, matching original feel */
    transition: color 0.5s ease, padding-right 0.5s ease;
}

/* FIX: hover only on desktop — removed on mobile below */
.sidebar a:hover {
    color: var(--color-accent);
    padding-right: 20px;
}

/*
    آخر رابط في الشريط: "احجز الآن"
    — نبضة قلب مستمرة بلون أصفر
*/
.sidebar a:last-child {
    color: var(--color-primary);
    font-weight: 900;
    background: var(--color-accent);
    border-radius: 30px;
    text-align: center;
    margin-top: 10px;
    padding: 14px 10px;
    border-bottom: none;
    animation: heartbeat 1.6s ease-in-out infinite;
}

/* نبضة القلب — تكبير وتصغير ناعم */
@keyframes heartbeat {
    0%   { transform: scale(1);    box-shadow: 0 0 0   0px rgba(255, 215, 0, 0.4); }
    14%  { transform: scale(1.06); box-shadow: 0 0 10px 4px rgba(255, 215, 0, 0.3); }
    28%  { transform: scale(1);    box-shadow: 0 0 0   0px rgba(255, 215, 0, 0.1); }
    42%  { transform: scale(1.04); box-shadow: 0 0 8px  3px rgba(255, 215, 0, 0.2); }
    70%  { transform: scale(1);    box-shadow: 0 0 0   0px rgba(255, 215, 0, 0); }
    100% { transform: scale(1);    box-shadow: 0 0 0   0px rgba(255, 215, 0, 0); }
}

.sidebar a:last-child:hover {
    animation-play-state: paused; /* pause pulse on hover for a clean feel */
    transform: scale(1.05);
}

/* ===== سكشن الهيرو ===== */
.hero {
    padding: 160px 40px 100px;
    background: var(--color-white);
    position: relative;
}

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 60px;
}

/*
    FIX CHROME RTL: Chrome sometimes misrenders grid with direction:rtl.
    Explicit grid-column assignments fix the column order reliably.
*/
.hero-text  { grid-column: 1; }
.hero-img   { grid-column: 2; }

.hero-text h1 {
    font-size: clamp(28px, 5vw, 48px);
    font-weight: 900;
    line-height: 1.3;
    margin-bottom: 25px;
    color: var(--color-primary);
}

.hero-text p {
    font-size: 19px;
    line-height: 1.8;
    opacity: 0.8;
    margin-bottom: 28px;
    max-width: 500px;
}

/*
    FIX: prevent long-press download popup on mobile.
    -webkit-touch-callout: none  → disables iOS Save Image sheet
    pointer-events: none on img → blocks tap/hold context menu on Android Chrome
    user-select: none            → prevents text/image selection
*/
.hero-img-wrap {
    display: flex;
    justify-content: center;
    -webkit-touch-callout: none;
    user-select: none;
}
.hero-img-wrap img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.10));
    pointer-events: none;      /* blocks right-click / long-press save */
    -webkit-user-drag: none;   /* blocks drag-to-save on desktop */
    user-select: none;
    draggable: false;
}

.cta-btn {
    background: var(--color-accent);
    color: var(--color-primary);
    padding: 18px 40px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 900;
    display: inline-block;
    /* SLOW: 0.5s matches original feel */
    transition: transform 0.5s ease, box-shadow 0.5s ease;
    box-shadow: 0 10px 25px var(--color-accent-glow);
}
.cta-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(255, 215, 0, 0.55);
}

/* ===== FEATURES — 3 أيقونات ===== */
.features {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 32px;
    margin-bottom: 28px;
}

.feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    opacity: 0;
    transform: translateY(18px);
    animation: featureIn 0.55s ease forwards;
}
.feature:nth-child(1) { animation-delay: 0.20s; }
.feature:nth-child(2) { animation-delay: 0.40s; }
.feature:nth-child(3) { animation-delay: 0.60s; }

@keyframes featureIn {
    to { opacity: 1; transform: translateY(0); }
}

.feature i {
    font-size: 28px;
    color: var(--color-accent);
    display: block;
    /* SLOW hover to match original site speed */
    transition: transform 0.5s ease;
}
.feature:hover i {
    transform: translateY(-5px) scale(1.15);
}

.feature span {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-primary);
    white-space: nowrap;
}

/* ===== سكشن الخدمات ===== */
.services-section {
    padding: 100px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.service-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 80px;
    margin-bottom: 100px;
    opacity: 0;
    transform: translateY(60px);
    transition: opacity 1s ease, transform 1s ease;
    will-change: opacity, transform;
    contain: layout style;
}
.service-row.visible { opacity: 1; transform: translateY(0); }

.service-number {
    font-size: 70px;
    font-weight: 900;
    color: var(--color-accent);
    display: block;
    margin-bottom: -10px;
}

.service-image { position: relative; }

.service-image img,
.img-placeholder {
    width: 100%;
    height: 350px;
    border-radius: 30px;
    object-fit: cover;
    background: #eef2f7;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    position: relative;
}

.service-image::after {
    content: '';
    position: absolute;
    width: 160px;
    height: 160px;
    background: var(--color-accent);
    border-radius: 50%;
    z-index: 0;
    bottom: -25px;
    right: -25px;
    opacity: 0.6;
}

.service-row.reversed { direction: ltr; }
.service-row.reversed .service-text { direction: rtl; text-align: right; }

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    .service-row        { transition: none; will-change: auto; opacity: 1; transform: none; }
    .feature            { animation: none; opacity: 1; transform: none; }
    .sidebar a:last-child { animation: none; }
    .cta-btn,
    .sidebar,
    .overlay,
    .close-btn          { transition: none; }
}

/* ===== Tablet ===== */
@media (max-width: 992px) {
    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    /* reset explicit columns for single-column layout */
    .hero-text { grid-column: 1; }
    .hero-img  { grid-column: 1; }

    .hero-text p { max-width: 100%; }
    .features { justify-content: center; }
}

/* ===== Mobile 900px — services ===== */
@media (max-width: 900px) {
    .header { padding: 0 20px; }

    .service-row,
    .service-row.reversed {
        grid-template-columns: 1fr;
        text-align: center;
        direction: rtl;
    }

    /* FIX: remove sidebar hover effects on touch devices */
    .sidebar a:hover {
        color: var(--color-primary);
        padding-right: 10px;
    }
    /* keep last button hover neutral too */
    .sidebar a:last-child:hover {
        transform: none;
        animation-play-state: running;
    }
}

/* ===== Mobile 600px — hero ===== */
@media (max-width: 600px) {
    .hero {
        padding: 100px 16px 50px;
    }

    .hero-container {
        grid-template-columns: 1fr;
        gap: 20px;
        text-align: center;
    }

    /* order: logo (header) → photo → text */
    .hero-img  { order: -1; }
    .hero-text { order:  1; }

    .hero-img-wrap img {
        max-width: 220px;
        width: 65%;
    }

    .hero-text h1 {
        font-size: 21px;
        margin-bottom: 12px;
    }
    .hero-text p {
        font-size: 15px;
        margin-bottom: 18px;
    }

    /* hide features on phones */
    .features { display: none; }

    .cta-btn {
        font-size: 15px;
        padding: 14px 28px;
        width: 100%;
        text-align: center;
    }
}

/* ===== Very small phones ===== */
@media (max-width: 360px) {
    .hero-text h1   { font-size: 19px; }
    .hero-img-wrap img { max-width: 180px; }
    .service-number { font-size: 52px; }
}