/* ==========================================
   1. Base, Reset & جدار حماية التحديد
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent; 
}

html, body {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
body::-webkit-scrollbar {
    display: none;
}

@media (min-width: 900px) {
    body, a, button, .magnetic-btn, .menu-link {
        cursor: none !important;
    }
}

/* الخلفية المائعة المتصلة: تبدأ بالبيج وتتحول للكحلي بسلاسة تامة لتطرد الكآبة */
body {
    background-color: #ebe7dc;
    color: #111827;
    overflow-x: hidden;
    transition: background-color 1s cubic-bezier(0.25, 1, 0.5, 1), color 1s ease;
}

/* كلاس سيتم حقنه تلقائياً بالسكرول لقلب ألوان الموقع بنعومة السائل */
body.navy-mode {
    background-color: #111827;
    color: #ffffff;
}

img, .node-image, .cell-image {
    pointer-events: none;
    -webkit-user-drag: none;
    user-drag: none;
}

/* ==========================================
   2. سكة ومؤشر الشهاب المتساقط (Meteor Scrollbar)
   ========================================== */
.meteor-scroll-track {
    position: fixed;
    top: 0; right: 12px; width: 2px; height: 100vh;
    background: rgba(17, 24, 39, 0.02);
    z-index: 9999999; pointer-events: none;
}
.navy-mode .meteor-scroll-track { background: rgba(255, 255, 255, 0.02); }

.meteor-indicator {
    position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 5px; height: 65px;
    background: linear-gradient(to bottom, transparent, #f08a88, #3a9d91, #ffffff);
    border-radius: 10px; filter: drop-shadow(0 0 5px #3a9d91);
    will-change: transform;
}

/* ==========================================
   3. مؤشر الماوس التفاعلي الذكي (Multiply Multi-State Cursor)
   ========================================== */
.custom-cursor {
    width: 22px; height: 22px; background-color: #3a9d91; border-radius: 50%;
    position: fixed; top: 0; left: 0; pointer-events: none; z-index: 999999;
    mix-blend-mode: difference; /* يقلب لونه تلقائياً ليكون نيون فاقع وواضح فوق البيج وفوق الكحلي */
    box-shadow: 0 0 12px rgba(58, 157, 145, 0.5);
    will-change: transform; transform: translate(-50%, -50%);
    transition: width 0.25s cubic-bezier(0.25, 1, 0.5, 1), height 0.25s cubic-bezier(0.25, 1, 0.5, 1);
}
.custom-cursor.hovering { 
    width: 55px; height: 55px; background-color: transparent;
    border: 2px solid #f08a88; box-shadow: 0 0 15px rgba(240, 138, 136, 0.6);
}

/* ==========================================
   4. شاشة اللودنق الفاخرة البيج (AMD Preloader)
   ========================================== */
.preloader {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 10000;
    display: flex; align-items: center; justify-content: center; overflow: hidden; background-color: transparent;
}
.preloader-grid-bg {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-image: linear-gradient(rgba(17, 24, 39, 0.015) 1px, transparent 1px), linear-gradient(90deg, rgba(17, 24, 39, 0.015) 1px, transparent 1px);
    background-size: 40px 40px; z-index: 2; pointer-events: none;
}
.preloader-core-wrap {
    position: relative; z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 2rem; width: 100%; max-width: 600px; padding: 0 2rem;
}
.loader-massive-num {
    font-size: 10vw; font-weight: 900; color: #111827; display: flex; align-items: center; letter-spacing: -4px; line-height: 1;
}
.load-digit { display: inline-block; will-change: transform, opacity; }
.load-separator { color: #3a9d91; margin: 0 1.5rem; font-size: 6vw; font-weight: 300; opacity: 0.8; }
.load-total { color: rgba(17, 24, 39, 0.15); font-size: 5vw; font-weight: 700; }

.loader-laser-track { width: 100%; height: 1px; background: rgba(17, 24, 39, 0.06); position: relative; overflow: hidden; }
.loader-laser-progress { position: absolute; top: 0; left: 0; height: 100%; width: 0%; background: #3a9d91; box-shadow: 0 0 8px #3a9d91; will-change: width; }

.loader-status-terminal { display: flex; gap: 0.8rem; font-family: 'Courier New', monospace; font-size: 0.85rem; letter-spacing: 2px; }
.terminal-prefix { color: #888888; font-weight: 700; }
.terminal-log { color: #111827; text-transform: uppercase; font-weight: 600; }

.preloader-gates { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; z-index: 1; }
.gate-half { width: 100%; height: 50vh; background-color: #ebe7dc; border-bottom: 1px solid rgba(0, 0, 0, 0.03); will-change: transform; }
.bottom-gate { border-bottom: none; border-top: 1px solid rgba(0, 0, 0, 0.03); }

/* ==========================================
   5. Navbar Layout
   ========================================== */
.navbar { display: flex; justify-content: space-between; align-items: center; padding: 2.5rem 5rem; position: fixed; width: 100%; top: 0; z-index: 100; opacity: 0; transform: translateY(-20px); transition: color 0.5s ease; }
.navy-mode .navbar { color: #ffffff; }
.logo { font-size: 1.8rem; font-weight: 700; letter-spacing: 2px; color: inherit; }
.nav-links { display: flex; gap: 2rem; }
.menu-link { font-size: 1rem; font-weight: 500; letter-spacing: 1px; color: inherit; position: relative; overflow: hidden; }
.menu-link::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 1px; background-color: currentColor; transform: translateX(-100%); transition: transform 0.3s ease; }
.menu-link:hover::after { transform: translateX(0); }

@media (max-width: 768px) {
    .navbar { padding: 1.5rem 2rem; } .logo { font-size: 1.4rem; } .nav-links { gap: 1rem; } .menu-link { font-size: 0.85rem; }
}

/* ==========================================
   6. Hero Section (Illustrator Tech Artboard)
   ========================================== */
.hero-section { height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 0 5rem; position: relative; overflow: hidden; background: transparent; }
#hero-webgl { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; }
.hero-container { position: relative; z-index: 1; pointer-events: none; }
.line-container { overflow: hidden; line-height: 1; margin-bottom: 5px; }
.hero-title { font-size: 7.5rem; font-weight: 800; transform: translateY(100%); text-transform: uppercase; color: #111827; }
.hero-subtitle { margin-top: 2rem; font-size: 1.2rem; max-width: 500px; color: #4b5563; line-height: 1.6; opacity: 0; transform: translateY(20px); }

@media (max-width: 768px) {
    .hero-section { padding: 0 2rem; } .hero-title { font-size: 14vw; } .hero-subtitle { font-size: 1rem; max-width: 100%; margin-top: 1.5rem; }
}

/* ==========================================
   7. سكشن المدار المشرق الصارم (The Vector Core Grid)
   ========================================== */
.dimension-section {
    height: 100vh; width: 100vw; display: flex; align-items: center; justify-content: center; position: relative; z-index: 1; background: transparent;
}
.dimension-container {
    width: 100vw; height: 100vh; position: relative; overflow: hidden; background: transparent;
}
#dimension-orbital-canvas { width: 100%; height: 100%; display: block; z-index: 1; }

.matrix-grid-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background-image: linear-gradient(rgba(58, 157, 145, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(58, 157, 145, 0.03) 1px, transparent 1px);
    background-size: 50px 50px; pointer-events: none; z-index: 2;
}
.technical-ui { position: absolute; bottom: 3rem; left: 5rem; z-index: 4; pointer-events: none; display: flex; flex-direction: column; gap: 0.5rem; transition: color 0.5s ease; }
.navy-mode .technical-ui { color: #ffffff; }
.panel-tag { font-size: 0.85rem; font-weight: 700; color: rgba(17, 24, 39, 0.4); letter-spacing: 4px; text-transform: uppercase; }
.navy-mode .panel-tag { color: rgba(255, 255, 255, 0.3); }

.frame-corners::before, .frame-corners::after {
    content: ''; position: absolute; width: 24px; height: 24px; border: 1.5px solid rgba(58, 157, 145, 0.25); z-index: 5; pointer-events: none;
}
.frame-corners::before { top: 24px; left: 24px; border-right: none; border-bottom: none; }
.frame-corners::after { bottom: 24px; right: 24px; border-left: none; border-top: none; }

/* ==========================================
   8. سيكشن المشاريع (3D Carousel) - يسبح بنعومة في الـ Gradient الداكن
   ========================================== */
.projects-3d-section { 
    height: 100vh; width: 100vw; position: relative; z-index: 1; overflow: hidden; background: transparent;
}
.scene { width: 100vw; height: 100vh; perspective: 1800px; display: flex; align-items: center; justify-content: center; }
.carousel-wrapper { width: 60vw; height: 60vh; transform-style: preserve-3d; transform: translateZ(-50vw); }
.carousel { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; }
.carousel-cell { position: absolute; width: 100%; height: 100%; left: 0; top: 0; transform: rotateY(var(--deg)) translateZ(50vw); opacity: 0.15; filter: grayscale(100%) blur(2px); transition: opacity 0.6s ease, filter 0.6s ease, transform 0.6s ease; }
.carousel-cell.active { opacity: 1; filter: grayscale(0%) blur(0px); }

/* تأثير الـ Parallax 3D الفخم على كروت المشاريع */
.cell-image { 
    width: 100%; height: 100%; background-size: cover; background-position: center; border-radius: 12px; 
    box-shadow: 0 30px 60px rgba(0,0,0,0.3); position: relative;
    transition: transform 0.2s ease-out;
}

.cell-content {
    position: absolute; left: 0; bottom: 8%; width: 100%; padding: 0 4rem; z-index: 10; pointer-events: none; display: flex; flex-direction: column; gap: 0.8rem; transform: translateZ(60px); 
}
.cell-number { font-size: clamp(1.2rem, 2vw, 2rem); color: #3a9d91; font-weight: 700; font-family: 'Courier New', monospace; }
.cell-title { font-size: clamp(2.2rem, 5.5vw, 5.5rem); font-weight: 900; text-transform: uppercase; line-height: 0.95; color: #ffffff; text-shadow: 0 10px 30px rgba(0,0,0,0.5); max-width: 90%; }
.cell-category { font-size: clamp(0.95rem, 1.2vw, 1.15rem); color: #e5e5e5; text-shadow: 0 5px 15px rgba(0,0,0,0.5); white-space: normal; word-wrap: break-word; }

@media (max-width: 768px) {
    .carousel-wrapper { width: 85vw; height: 50vh; transform: translateZ(-70vw); }
    .carousel-cell { transform: rotateY(var(--deg)) translateZ(70vw); }
    .cell-content { padding: 0 2rem; bottom: 6%; gap: 0.5rem; transform: translateZ(40px); }
    .cell-title { font-size: clamp(1.6rem, 8vw, 2.3rem); }
    .cell-category { font-size: 0.85rem; }
}
.cell-image::after {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to top, rgba(17,24,39,0.85) 0%, transparent 100%); pointer-events: none;
}

/* ==========================================
   9. نفق الزمن وبقية الأقسام (تتحول النصوص للأبيض تلقائياً بسلاسة)
   ========================================== */
.timeline-3d-section { height: 100vh; width: 100vw; position: relative; z-index: 1; overflow: hidden; background: transparent; }
.timeline-viewport { width: 100%; height: 100%; perspective: 1200px; display: flex; align-items: center; justify-content: center; }
.timeline-camera { width: 100%; height: 100%; position: absolute; transform-style: preserve-3d; }
.timeline-node { position: absolute; top: 50%; transform: translateY(-50%) translateZ(var(--z-depth)); width: 40vw; display: flex; flex-direction: column; gap: 1rem; opacity: 0; filter: blur(15px); }
.node-image { width: 100%; height: 40vh; background-size: cover; background-position: center; border-radius: 8px; box-shadow: 0 20px 40px rgba(0,0,0,0.3); }
.node-content { background: rgba(255, 255, 255, 0.03); backdrop-filter: blur(15px); border: 1px solid rgba(255,255,255,0.06); padding: 2.5rem; border-radius: 12px; border-left: 4px solid #3a9d91; box-shadow: 0 20px 40px rgba(0,0,0,0.3); }
.final-node .node-content { border-left: none; border-bottom: 4px solid #f08a88; }
.node-year { font-size: 1.1rem; color: #94a3b8; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 0.5rem; }
.node-title { font-size: 3rem; font-weight: 800; margin-bottom: 0.8rem; color: #ffffff; }
.node-desc { font-size: 1.3rem; line-height: 1.6; color: #cbd5e1; }

/* 10. سكشن المعايرة والمختبر (The Lab) */
.lab-section { height: 100vh; width: 100vw; position: relative; overflow: hidden; z-index: 1; background: transparent; }
#lab-webgl { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.lab-ui { position: absolute; bottom: 5rem; left: 5rem; z-index: 10; max-width: 500px; }
.lab-title { font-size: 4rem; font-weight: 900; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 0.5rem; color: #ffffff; }
.lab-subtitle { color: #9ca3af; font-size: 1.1rem; line-height: 1.5; }

/* 11. ترسانة المهارات (Skills Grid) */
.skills-section { min-height: 100vh; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; z-index: 1; background: transparent; }
.marquee-container { position: absolute; top: 50%; left: 0; transform: translateY(-50%) rotate(-5deg); width: 100vw; overflow: hidden; white-space: nowrap; pointer-events: none; opacity: 0.03; z-index: 0; }
.marquee-text { display: inline-block; font-size: 15vw; font-weight: 900; text-transform: uppercase; animation: scrollMarquee 25s linear infinite; color: #3a9d91; }
@keyframes scrollMarquee { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
.skills-content { position: relative; z-index: 2; text-align: center; max-width: 1000px; }
.skills-title { font-size: 3rem; margin-bottom: 4rem; text-transform: uppercase; font-weight: 800; letter-spacing: 2px; color: #ffffff; }
.magnetic-grid { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; }
.magnetic-wrap { padding: 1.5rem; display: inline-block; }
.magnetic-btn { padding: 1.2rem 2.5rem; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 50px; font-size: 1.1rem; font-weight: 600; color: #ffffff; background: rgba(255, 255, 255, 0.03); backdrop-filter: blur(10px); text-decoration: none; display: inline-block; }

/* 12. الفوتر (Grand Footer) */
.grand-footer { min-height: 100vh; width: 100vw; position: relative; z-index: 2; display: flex; align-items: center; padding: 6rem 5rem 7rem 5rem; overflow: hidden; background: transparent; }
.footer-container { width: 100%; display: flex; flex-direction: column; justify-content: space-between; height: 78vh; }
.footer-title-wrap { display: flex; flex-direction: column; width: 100%; margin-top: 1rem; }
.footer-row-scroll { width: 100%; display: flex; will-change: transform; }
.fs-right { justify-content: flex-end; }
.footer-massive-title { font-size: 11vw; font-weight: 900; text-transform: uppercase; line-height: 0.9; letter-spacing: -2px; color: #ffffff; }
.text-stroke { color: transparent; -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.15); }
.footer-links-grid { display: grid; grid-template-columns: 2fr 1.5fr 1fr; border-top: 1px solid rgba(255, 255, 255, 0.08); padding-top: 4rem; margin-bottom: 1.5rem; width: 100%; }
.footer-col { display: flex; flex-direction: column; gap: 1.2rem; }
.justify-end { justify-content: flex-start; align-items: flex-end; text-align: right; }
.col-label { font-size: 0.85rem; font-weight: 600; color: #64748b; letter-spacing: 3px; text-transform: uppercase; }
.footer-link { font-size: 1.5rem; font-weight: 500; color: #e2e8f0; text-decoration: none; transition: color 0.3s ease, transform 0.3s ease; display: inline-block; width: fit-content; }
.social-links { display: flex; flex-direction: column; gap: 0.5rem; }
.social-links .footer-link:hover { color: #3a9d91; transform: translateX(8px); }
.footer-credit { font-size: 1rem; font-weight: 500; color: #475569; }