/* =====================================================================
   Abdalhay Salem (Hadi) — Elegant & Premium Design System
   Color Palette: #FFD600 (Striking Yellow) | #080808 (Deep Black) 
   Typography: Space Grotesk (Headings) | Outfit (UI/Body)
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

:root {
    /* 🎨 Color System */
    --accent: #FFD600;
    --accent-rgb: 255, 214, 0;
    --bg-base: #080808;
    --bg-surface: #121212;
    --bg-elevated: #1a1a1a;
    --text-primary: #FFFFFF;
    --text-secondary: #aaaaaa;
    --text-muted: #666666;
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 214, 0, 0.3);

    /* 🖋️ Typography */
    --font-heading: 'Space Grotesk', sans-serif;
    --font-ui: 'Outfit', sans-serif;

    /* 🪄 Animation & Transitions */
    --transition-smooth: all 0.7s cubic-bezier(0.23, 1, 0.32, 1);
    --transition-fast: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ──────────────────────────────────────────
   0. CINEMATIC OVERLAY (Grain)
   ──────────────────────────────────────────*/
.grain-overlay {
    position: fixed;
    top: -50%; left: -50%; width: 200%; height: 200%;
    background-image: url("https://www.transparenttextures.com/patterns/natural-paper.png");
    opacity: 0.04;
    pointer-events: none;
    z-index: 9999;
    animation: grain 8s steps(10) infinite;
}

@keyframes grain {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-5%, -10%); }
    20% { transform: translate(-15%, 5%); }
    30% { transform: translate(7%, -25%); }
    40% { transform: translate(-5%, 25%); }
    50% { transform: translate(-15%, 10%); }
    60% { transform: translate(15%, 0%); }
    70% { transform: translate(0%, 15%); }
    80% { transform: translate(3%, 35%); }
    90% { transform: translate(-10%, 10%); }
}

/* ──────────────────────────────────────────
   1. RESET & BASE
   ──────────────────────────────────────────*/
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-ui);
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image: url("https://www.transparenttextures.com/patterns/asfalt-dark.png");
    opacity: 0.03;
    pointer-events: none;
    z-index: 1000;
}

html { scroll-behavior: smooth; }
ul { list-style: none; }
a { text-decoration: none; color: inherit; transition: var(--transition-fast); }
img { max-width: 100%; display: block; border-radius: 12px; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

.container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 var(--space-lg, 4rem);
}

@media (max-width: 768px) {
    .container { padding: 0 1.5rem; }
}

/* ──────────────────────────────────────────
   2. NAVBAR
   ──────────────────────────────────────────*/
.navbar {
    position: fixed;
    top: 2rem; left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1200px;
    z-index: 1000;
    background: rgba(18, 18, 18, 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 0.75rem 2rem;
    transition: var(--transition-smooth);
}

.navbar.scrolled {
    top: 0;
    width: 100%;
    border-radius: 0;
    border-top: none;
    border-left: none;
    border-right: none;
    padding: 1rem 2rem; /* Reduced from 4rem for better mobile fit */
}

.nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -1px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo span { color: var(--accent); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.nav-links a {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    position: relative;
    padding: 0.5rem 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0; left: 50%;
    width: 0; height: 2px;
    background: var(--accent);
    transition: var(--transition-fast);
    transform: translateX(-50%);
}

.nav-links a:hover { color: var(--accent); }
.nav-links a:hover::after { width: 100%; }

.nav-socials {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    border-left: 1px solid var(--border);
    padding-left: 1.25rem;
}

.nav-socials a {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.nav-socials a:hover { color: var(--accent); transform: translateY(-2px); }

.hamburger { display: none; }

@media (max-width: 992px) {
    .navbar { width: calc(100% - 2rem); padding: 0.75rem 1.5rem; }
    .nav-links, .nav-socials { display: none; }
    .hamburger { display: flex; flex-direction: column; gap: 6px; }
    .hamburger span { width: 24px; height: 2px; background: white; transition: 0.3s; }
}

/* ──────────────────────────────────────────
   3. HERO SECTION
   ──────────────────────────────────────────*/
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 6rem;
    position: relative;
}

.hero-inner {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    align-items: center;
    gap: 4rem;
}

.hero-content { position: relative; z-index: 2; }

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    background: rgba(255, 214, 0, 0.08);
    border: 1px solid rgba(255, 214, 0, 0.15);
    border-radius: 100px;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hero h1 {
    font-family: var(--font-heading);
    font-size: clamp(3.5rem, 8vw, 6.5rem);
    line-height: 0.95;
    font-weight: 700;
    margin-bottom: 2rem;
    letter-spacing: -4px;
    perspective: 1000px;
}

.hero h1 span.word {
    display: inline-block;
    opacity: 0;
    transform: translateY(40px) rotateX(-20deg);
    transition: var(--transition-smooth);
}

.hero h1.visible span.word {
    opacity: 1;
    transform: translateY(0) rotateX(0);
}

.hero h1 span { color: var(--accent); }

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 540px;
    margin-bottom: 3rem;
}

.hero-cta { display: flex; gap: 1.5rem; align-items: center; }

.btn {
    padding: 1.2rem 2.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-primary { background: var(--accent); color: #000; }
.btn-primary:hover { transform: translateY(-5px); box-shadow: 0 15px 40px rgba(255, 214, 0, 0.25); }

.btn-outline { border: 1px solid var(--border); color: white; }
.btn-outline:hover { background: rgba(255,255,255,0.05); border-color: white; }

.hero-visual { position: relative; display: flex; justify-content: center; align-items: center; }

.profile-container {
    position: relative;
    width: 450px; height: 450px;
}

.profile-main {
    width: 100%; height: 100%;
    border-radius: 50%;
    border: 1px solid var(--border);
    padding: 1rem;
    position: relative;
    z-index: 2;
    background: var(--bg-surface);
}

.profile-main img {
    width: 100%; height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.ring-outer {
    position: absolute;
    top: -20px; left: -20px; right: -20px; bottom: -20px;
    border: 1.5px dashed var(--accent);
    border-radius: 50%;
    opacity: 0.2;
    animation: spin 30s linear infinite;
}

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.floating-card {
    position: absolute;
    background: rgba(18, 18, 18, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    padding: 1rem 1.5rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    z-index: 3;
    animation: float 5s ease-in-out infinite alternate;
}

.card-1 { top: 10%; left: -20%; animation-delay: 0s; }
.card-2 { bottom: 10%; right: -20%; animation-delay: -2s; }

@keyframes float { from { transform: translateY(0); } to { transform: translateY(-20px); } }

@media (max-width: 992px) {
    .hero-inner { grid-template-columns: 1fr; text-align: center; }
    .hero h1 { letter-spacing: -2px; font-size: clamp(2.5rem, 10vw, 4rem); } /* Scaled down for mobile */
    .hero p, .hero-cta { margin-left: auto; margin-right: auto; justify-content: center; }
    .profile-container { width: min(320px, 80vw); height: min(320px, 80vw); }
    
    /* Center floating cards slightly more for mobile to avoid overflow */
    .card-1 { left: -5%; top: 5%; }
    .card-2 { right: -5%; bottom: 5%; }
}

@media (max-width: 600px) {
    .hero-cta { flex-direction: column; width: 100%; }
    .hero-cta .magnetic-wrap, .hero-cta .btn { width: 100%; justify-content: center; }
}

/* ──────────────────────────────────────────
   4. STATS STRIP
   ──────────────────────────────────────────*/
.stats-strip {
    background-color: var(--accent);
    padding: 4rem 0;
    position: relative;
    z-index: 3;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

.stat-item { text-align: center; color: #000; }
.stat-item h2 { font-family: var(--font-heading); font-size: 3.5rem; font-weight: 700; line-height: 1; margin-bottom: 0.5rem; }
.stat-item p { font-weight: 600; text-transform: uppercase; font-size: 0.8rem; letter-spacing: 1px; opacity: 0.8; }

@media (max-width: 768px) { .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 3rem; } }

/* ──────────────────────────────────────────
   5. PORTFOLIO GRID (Mosaic)
   ──────────────────────────────────────────*/
.section { padding: 10rem 0; }
.section-header { margin-bottom: 6rem; max-width: 800px; }
.section-header h2 { font-family: var(--font-heading); font-size: 4rem; margin-bottom: 1.5rem; letter-spacing: -2px; }
.section-header p { font-size: 1.2rem; color: var(--text-secondary); }

.portfolio-mosaic {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-gap: 2rem;
}

.project-card {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    transition: var(--transition-smooth);
    width: 100%; /* Ensure it stays within grid cell */
}

.project-card:hover { border-color: var(--accent); transform: scale(1.02); }

.project-card img {
    width: 100%; height: 100%; object-fit: cover;
    transition: var(--transition-smooth);
    filter: grayscale(0.5);
}

.project-card:hover img { filter: grayscale(0); transform: scale(1.05); }

.project-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 2.5rem;
    opacity: 0;
    transition: var(--transition-smooth);
}

.project-card:hover .project-overlay { opacity: 1; }

.project-overlay span { color: var(--accent); text-transform: uppercase; font-weight: 700; font-size: 0.75rem; letter-spacing: 2px; margin-bottom: 0.5rem; }
.project-overlay h3 { font-family: var(--font-heading); font-size: 1.8rem; margin-bottom: 1rem; }

/* Grid Mapping */
.p-1 { grid-column: span 8; height: 500px; }
.p-2 { grid-column: span 4; height: 500px; }
.p-3 { grid-column: span 4; height: 450px; }
.p-4 { grid-column: span 4; height: 450px; }
.p-5 { grid-column: span 4; height: 450px; }
.p-6 { grid-column: span 6; height: 480px; }
.p-7 { grid-column: span 6; height: 480px; }
.p-8 { grid-column: span 12; height: 550px; }

@media (max-width: 992px) {
    .portfolio-mosaic { grid-gap: 1.5rem; }
    .p-1, .p-2, .p-3, .p-4, .p-5, .p-6, .p-7, .p-8 { grid-column: span 12; height: 400px; }
}

@media (max-width: 480px) {
    .section-header h2 { font-size: 2.2rem; }
    .hero h1 { font-size: 2.5rem; letter-spacing: -1px; }
    .p-1, .p-2, .p-3, .p-4, .p-5, .p-6, .p-7, .p-8 { height: 320px; }
}

/* ──────────────────────────────────────────
   6. CONTACT
   ──────────────────────────────────────────*/
.contact-inner {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 6rem;
}

.contact-visual {
    background: var(--bg-surface);
    padding: 3rem;
    border-radius: 32px;
    border: 1px solid var(--border);
}

.contact-item { margin-bottom: 3rem; }
.contact-item h4 { font-family: var(--font-heading); color: var(--accent); font-size: 1.2rem; margin-bottom: 0.5rem; }
.contact-item p { font-size: 1.1rem; color: var(--text-secondary); }

.contact-form { display: flex; flex-direction: column; gap: 1.5rem; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

.input-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    width: 100%;
}

.input-box:focus { outline: none; border-color: var(--accent); }

textarea.input-box { min-height: 180px; }

@media (max-width: 900px) {
    .contact-inner { grid-template-columns: 1fr; gap: 4rem; }
    .form-row { grid-template-columns: 1fr; }
}

/* ──────────────────────────────────────────
   7. FOOTER
   ──────────────────────────────────────────*/
.footer {
    padding: 6rem 0 3rem;
    border-top: 1px solid var(--border);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-socials { display: flex; gap: 2rem; }
.footer-socials a { font-size: 1.5rem; color: var(--text-muted); }
.footer-socials a:hover { color: var(--accent); }

.copyright { color: var(--text-muted); font-size: 0.9rem; }

@media (max-width: 600px) {
    .footer-inner { flex-direction: column; gap: 2rem; text-align: center; }
}

/* ──────────────────────────────────────────
   8. UTILITIES
   ──────────────────────────────────────────*/
/* Magnetic Interaction Class */
.magnetic-wrap {
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}
.custom-cursor {
    position: fixed;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(255, 214, 0, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 100;
    transform: translate(-50%, -50%);
}
