@import url('https://fonts.cdnfonts.com/css/sf-pro-display');
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800;900&display=swap');

:root {
    --primary: #000;
    --accent: #0071e3;
    --glass: rgba(255, 255, 255, 0.03);
}

html,
body {
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'SF Pro Display', sans-serif;
    background: #ffffff;
    color: #000;
    overflow-x: hidden;
    scroll-behavior: smooth;
    position: relative;
    /* حل مشكلة الثقل: تحسين ريندر المتصفح */
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

html[lang="ar"] body {
    font-family: 'Tajawal', 'SF Pro Display', sans-serif;
}

/* تسريع الأداء باستخدام الـ GPU */
.bento-card,
.stacked-card,
.analytics-bar {
    will-change: transform, opacity;
}

.bento-card,
.analytics-bar {
    transform: translateZ(0);
}

.bg-grain {
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.0025;
    pointer-events: none;
    z-index: 0;
    transform: translateZ(0);
    will-change: transform;
}

.premium-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(to right, #f5f5f7 1px, transparent 1px),
        linear-gradient(to bottom, #f5f5f7 1px, transparent 1px);
    background-size: 100px 100px;
    z-index: 0;
    opacity: 0.11;
    transform: translateZ(0);
    will-change: transform;
}

@media (max-width: 640px) {
    .premium-grid {
        background-size: 70px 70px;
    }

    .bg-grain {
        opacity: 0.009;
    }

    .premium-grid {
        background-image:
            linear-gradient(to right, rgba(230, 230, 235, 1) 1px, transparent 1px),
            linear-gradient(to bottom, rgba(230, 230, 235, 1) 1px, transparent 1px);
        opacity: 0.3;
    }

    .bg-grain,
    .premium-grid,
    .light-leak {
        position: absolute;
    }

    nav {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.85);
    }
}

.light-leak {
    position: fixed;
    top: -10%;
    left: -10%;
    width: 50%;
    height: 50%;
    background: radial-gradient(circle, rgba(0, 113, 227, 0.005) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
    transform: translateZ(0);
    will-change: transform;
}

nav,
section,
footer {
    position: relative;
    z-index: 1;
}

@media (min-width: 1280px) {
    html[dir="rtl"] .hero-copy {
        text-align: right;
    }

    html[dir="rtl"] #heroBtns {
        justify-content: flex-end;
    }
}

.card-stack {
    position: relative;
    width: min(400px, 90vw);
    height: calc(min(400px, 90vw) * 54 / 85.6) !important;
    min-height: 0 !important;
    overflow: hidden;
    border-radius: 28px;
    perspective: 2000px;
    transform-style: preserve-3d;
    z-index: 5;
    direction: ltr;
}

#mainStack {
    height: calc(min(400px, 90vw) * 54 / 85.6) !important;
    min-height: 0 !important;
}

.stacked-card {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: #000;
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: bottom center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.2);
    padding: 0;
    color: white;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    direction: ltr;
}

@media (min-width: 640px) {
    .card-stack {
        border-radius: 45px;
    }
}

.card-1 {
    z-index: 3;
    overflow: hidden;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    position: absolute !important;
    inset: 0 !important;
    direction: ltr;
}

.card-1::after {
    content: '';
    position: absolute;
    top: -150%;
    left: -150%;
    width: 300%;
    height: 300%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transform: rotate(45deg);
    animation: shine 10s infinite;
}

@keyframes shine {
    0% {
        transform: translate(0, 0) rotate(45deg);
    }

    20% {
        transform: translate(100%, 100%) rotate(45deg);
    }

    100% {
        transform: translate(100%, 100%) rotate(45deg);
    }
}

.card-2 {
    z-index: 2;
    transform: translateY(-20px) scale(0.95);
    opacity: 0.5;
}

.card-3 {
    z-index: 1;
    transform: translateY(-40px) scale(0.9);
    opacity: 0.2;
}

@media (hover: hover) and (pointer: fine) {
    .card-stack:hover .card-2 {
        transform: translate(-80px, -30px) rotate(-10deg) scale(0.95);
        opacity: 0.8;
    }

    .card-stack:hover .card-3 {
        transform: translate(80px, -30px) rotate(10deg) scale(0.95);
        opacity: 0.8;
    }
}

@media (max-width: 1024px) {
    .bg-grain,
    .premium-grid,
    .light-leak {
        display: block;
    }

    .card-stack {
        perspective: none;
        transform-style: flat;
    }

    .stacked-card,
    .card-1 {
        transform-style: flat;
        backface-visibility: visible;
        -webkit-backface-visibility: visible;
    }

    .card-stack,
    .stacked-card {
        opacity: 1 !important;
        visibility: visible !important;
    }

    .card-1 {
        transform: none !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    .card-2 {
        transform: translateY(-12px) scale(0.98) !important;
        opacity: 0.45 !important;
        visibility: visible !important;
    }

    .card-3 {
        transform: translateY(-24px) scale(0.96) !important;
        opacity: 0.2 !important;
        visibility: visible !important;
    }
}

.nfc-chip {
    width: 60px;
    height: 45px;
    background: linear-gradient(135deg, #d4af37 0%, #f9f295 50%, #d4af37 100%);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.nfc-chip::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(90deg, transparent 0, transparent 4px, rgba(0, 0, 0, 0.1) 4px, rgba(0, 0, 0, 0.1) 5px);
}

.hero-title span {
    display: inline-block;
    opacity: 0;
    transform: translateY(50px);
}

.bento-card {
    background: #fbfbfd;
    border: 1px solid #e5e5e7;
    border-radius: 40px;
    padding: 40px;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.bento-card:hover {
    transform: scale(1.02);
    background: #fff;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.05);
}

/* --- تعديل الأعمدة والباكجراوند الأسود --- */
.analytics-dark-bg {
    background: #000 !important;
    border: none !important;
}

.analytics-bar {
    width: 100%;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    transition: height 0.3s ease;
}

.analytics-bar.active {
    background: #ffffff;
    /* حولنا اللون الأزرق لأسود/أبيض فخم على الباكجراوند الأسود */
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* تأثير التوهج الخفيف جوه الكارت الأسود */
.dark-glow {
    position: absolute;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 60%);
    top: -25%;
    left: -25%;
    pointer-events: none;
    animation: moveGlow 8s infinite alternate ease-in-out;
}

@keyframes moveGlow {
    from {
        transform: translate(-10%, -10%);
    }

    to {
        transform: translate(10%, 10%);
    }
}

@keyframes scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

.infinite-scroll {
    display: flex;
    width: calc(250px * 20);
    animation: scroll 40s linear infinite;
}

::-webkit-scrollbar {
    width: 0px;
}

@media (max-width: 640px) {
    .card-stack {
        width: min(400px, 90vw);
        height: calc(min(400px, 90vw) * 54 / 85.6) !important;
        min-height: 0 !important;
        margin-left: auto;
        margin-right: auto;
        left: auto;
        transform: none;
    }
}