/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(145deg, #080808 0%, #1A1A1A 100%);
    color: #ECECEC;
    font-family: 'Poppins', sans-serif;
    line-height: 1.8;
    overflow-x: hidden;
    position: relative;
    direction: rtl;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    will-change: transform;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #080808 0%, #1A1A1A 100%);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
    animation: fadeOut 1s ease-out 2s forwards; /* Start fading out after 2 seconds */
}

.loading-text {
    font-size: 3rem;
    font-weight: 800;
    color: #FFFFFF;
    background: linear-gradient(45deg, #00FFC8, #FF00CC);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 4px;
    animation: pulseText 1.5s infinite ease-in-out;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; visibility: hidden; }
}

@keyframes pulseText {
    0% { text-shadow: 0 0 10px rgba(0, 255, 200, 0.6), 0 0 20px rgba(255, 0, 204, 0.4); }
    50% { text-shadow: 0 0 20px rgba(0, 255, 200, 0.9), 0 0 40px rgba(255, 0, 204, 0.6); }
    100% { text-shadow: 0 0 10px rgba(0, 255, 200, 0.6), 0 0 20px rgba(255, 0, 204, 0.4); }
}

/* Parallax Background with Layers */
.parallax-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(0, 255, 200, 0.1) 0%, rgba(0, 0, 0, 0) 70%);
    z-index: -2;
    transform: translateZ(0);
    opacity: 0.85;
    filter: blur(2px);
    animation: bgPulse 10s infinite ease-in-out;
    will-change: opacity, transform;
}

.parallax-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.02),
        rgba(255, 255, 255, 0.02) 10px,
        transparent 10px,
        transparent 20px
    );
    opacity: 0.5;
    z-index: -1;
    animation: textureShift 20s infinite linear;
}

/* Navigation */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(8, 8, 8, 0.95);
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 6px 30px rgba(0, 255, 200, 0.2);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(0, 255, 200, 0.1);
    animation: navSlideIn 0.8s ease-out forwards;
    will-change: transform;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 4rem;
    margin: 0;
}

nav ul li {
    opacity: 0;
    animation: navItemFade 0.6s ease forwards;
}

nav ul li:nth-child(1) { animation-delay: 0.2s; }
nav ul li:nth-child(2) { animation-delay: 0.3s; }
nav ul li:nth-child(3) { animation-delay: 0.4s; }
nav ul li:nth-child(4) { animation-delay: 0.5s; }

nav ul li a {
    color: #ECECEC;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 700;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    padding: 0.5rem 1rem;
}

nav ul li a::before {
    content: '';
    position: absolute;
    width: 0;
    height: 3px;
    bottom: -12px;
    right: 50%;
    background: linear-gradient(90deg, #00FFC8, #FF00CC);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    transform: translateX(50%);
    box-shadow: 0 0 10px rgba(0, 255, 200, 0.5);
}

nav ul li a:hover::before, nav ul li a:focus::before {
    width: 150%;
}

nav ul li a:hover, nav ul li a:focus {
    color: #00FFC8;
    text-shadow: 0 0 15px rgba(0, 255, 200, 0.7);
    transform: translateY(-3px);
    outline: none;
}

/* Mobile Navigation Toggle */
.nav-toggle {
    display: none;
    font-size: 2rem;
    color: #ECECEC;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
}

.nav-toggle:hover, .nav-toggle:focus {
    color: #00FFC8;
    outline: none;
}

/* Section Styling */
section {
    padding: 240px 70px;
    text-align: center;
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, rgba(0, 0, 0, 0.2) 0%, transparent 70%);
    animation: sectionFadeIn 1.2s ease forwards;
}

/* Hero and Header Styling */
h1 {
    font-size: 6rem;
    font-weight: 800;
    color: #FFFFFF;
    background: linear-gradient(45deg, #00FFC8, #FF00CC);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 4px;
    text-transform: uppercase;
    position: relative;
    margin-bottom: 6rem;
    animation: glowPulse 2s infinite alternate, headerRise 1.5s ease-out forwards;
    z-index: 1;
}

h1::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120%;
    height: 120%;
    background: radial-gradient(circle, rgba(0, 255, 200, 0.15) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    z-index: -1;
    opacity: 0.8;
    animation: glowExpand 3s infinite ease-in-out;
}

h1::after {
    content: 'AndxOi';
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.6rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.25);
    letter-spacing: 8px;
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.6s ease;
}

h1:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}

/* Glassmorphism Cards */
.glass-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(25px);
    padding: 55px;
    border-radius: 35px;
    border: 1px solid rgba(0, 255, 200, 0.08);
    position: relative;
    overflow: hidden;
    transition: all 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform-style: preserve-3d;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.25);
}

.glass-card::before {
    content: '';
    position: absolute;
    top: -60%;
    left: -60%;
    width: 220%;
    height: 220%;
    background: linear-gradient(60deg, rgba(0, 255, 200, 0.18), rgba(255, 0, 204, 0.18));
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s ease;
    transform: rotate(45deg);
}

.glass-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
    opacity: 0.7;
    z-index: -1;
    animation: cardGlow 4s infinite ease-in-out;
}

.glass-card:hover, .glass-card:focus-within {
    transform: translateY(-25px) scale(1.04);
    box-shadow: 0 30px 70px rgba(0, 255, 200, 0.4);
}

.glass-card:hover::before, .glass-card:focus-within::before {
    opacity: 1;
    transform: rotate(45deg) scale(1.15);
}

.glass-card h3 {
    font-size: 2.3rem;
    color: #FFFFFF;
    margin-bottom: 2rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: color 0.4s ease, transform 0.4s ease;
}

.glass-card:hover h3, .glass-card:focus-within h3 {
    color: #00FFC8;
    transform: translateY(-5px);
}

.glass-card p {
    font-size: 1.4rem;
    color: #C0C0C0;
    font-weight: 300;
    transition: color 0.4s ease;
}

.glass-card a {
    color: #00FFC8;
    text-decoration: none;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    transition: all 0.4s ease;
}

.glass-card a:hover, .glass-card a:focus {
    color: #FF00CC;
    background: rgba(255, 0, 204, 0.1);
    text-shadow: 0 0 15px rgba(255, 0, 204, 0.7);
    outline: none;
}

/* Grid Layouts */
.contact-grid, .about-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 60px;
    max-width: 1600px;
    margin: 0 auto;
}

.contact-grid .glass-card, .about-content .glass-card {
    text-align: right;
}

/* Button */
.btn {
    display: inline-block;
    padding: 20px 55px;
    background: linear-gradient(135deg, #00FFC8 0%, #FF00CC 100%);
    color: #080808;
    text-decoration: none;
    border-radius: 45px;
    font-size: 1.4rem;
    font-weight: 700;
    position: relative;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 8px 35px rgba(0, 255, 200, 0.6);
    text-transform: uppercase;
    letter-spacing: 2.5px;
    z-index: 1;
    animation: btnPulse 3s infinite ease-in-out;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: -1;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn:hover::before, .btn:focus::before {
    opacity: 1;
}

.btn:hover::after, .btn:focus::after {
    width: 350px;
    height: 350px;
}

.btn:hover, .btn:focus {
    transform: translateY(-10px) scale(1.06);
    box-shadow: 0 15px 50px rgba(255, 0, 204, 0.8);
    outline: none;
}

/* Animations */
.scroll-reveal {
    opacity: 0;
    transform: translateY(150px) scale(0.85);
    transition: all 1.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.scroll-reveal.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

@keyframes bgPulse {
    0% { opacity: 0.85; transform: scale(1); }
    50% { opacity: 0.95; transform: scale(1.02); }
    100% { opacity: 0.85; transform: scale(1); }
}

@keyframes textureShift {
    0% { background-position: 0 0; }
    100% { background-position: 20px 20px; }
}

@keyframes navSlideIn {
    0% { transform: translateY(-100%); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes navItemFade {
    0% { opacity: 0; transform: translateY(-20px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes glowPulse {
    0% { text-shadow: 0 0 12px rgba(0, 255, 200, 0.6), 0 0 25px rgba(255, 0, 204, 0.4); }
    100% { text-shadow: 0 0 25px rgba(0, 255, 200, 0.9), 0 0 50px rgba(255, 0, 204, 0.6); }
}

@keyframes glowExpand {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
    50% { transform: translate(-50%, -50%) scale(1.05); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
}

@keyframes headerRise {
    0% { opacity: 0; transform: translateY(50px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes cardGlow {
    0% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 0.9; transform: scale(1.01); }
    100% { opacity: 0.7; transform: scale(1); }
}

@keyframes btnPulse {
    0% { box-shadow: 0 8px 35px rgba(0, 255, 200, 0.6); }
    50% { box-shadow: 0 8px 45px rgba(0, 255, 200, 0.8); }
    100% { box-shadow: 0 8px 35px rgba(0, 255, 200, 0.6); }
}

@keyframes sectionFadeIn {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Responsive Design */
@media (max-width: 768px) {
    nav {
        padding: 1rem;
    }

    nav ul {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        right: 0;
        width: 100%;
        background: rgba(8, 8, 8, 0.95);
        padding: 1rem 0;
        box-shadow: 0 6px 30px rgba(0, 255, 200, 0.2);
    }

    nav ul.active {
        display: flex;
    }

    nav ul li {
        margin: 0.5rem 0;
        animation: none;
    }

    nav ul li a {
        font-size: 1.1rem;
        padding: 1rem;
        display: block;
        text-align: right;
    }

    nav ul li a::before {
        right: 50%;
        left: auto;
        transform: translateX(50%);
    }

    .nav-toggle {
        display: block;
    }

    section {
        padding: 150px 20px;
    }

    h1 {
        font-size: 4rem;
        margin-bottom: 4rem;
    }

    h1::after {
        font-size: 1.2rem;
        top: -30px;
    }

    .loading-screen {
        backdrop-filter: blur(8px); /* Reduce blur on mobile for performance */
    }

    .loading-text {
        font-size: 2.5rem;
    }

    .glass-card {
        padding: 35px;
    }

    .glass-card h3 {
        font-size: 1.8rem;
    }

    .glass-card p {
        font-size: 1.2rem;
    }

    .btn {
        padding: 15px 40px;
        font-size: 1.2rem;
    }

    .contact-grid, .about-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 3rem;
    }

    h1::after {
        font-size: 1rem;
        top: -25px;
    }

    .loading-screen {
        backdrop-filter: blur(5px); /* Further reduce blur on small screens */
    }

    .loading-text {
        font-size: 2rem;
    }

    .glass-card {
        padding: 25px;
    }

    .glass-card h3 {
        font-size: 1.6rem;
    }

    .glass-card p {
        font-size: 1rem;
    }

    .btn {
        padding: 12px 30px;
        font-size: 1rem;
    }
}

/* UX/UI Enhancements */
html {
    scroll-behavior: smooth;
}

section {
    opacity: 0;
    animation: sectionFadeIn 1.2s ease forwards;
}

/* Accessibility */
:focus-visible {
    outline: 2px solid #00FFC8;
    outline-offset: 4px;
}

a, button {
    -webkit-tap-highlight-color: transparent;
}