:root {
    color-scheme: dark;
}

* {
    font-family: 'Cairo', sans-serif;
}

/* ===== خلفية متحركة ===== */
.gradient-bg {
    background:
        radial-gradient(circle at top, #22d3ee 0, transparent 55%),
        radial-gradient(circle at bottom, #a855f7 0, transparent 60%),
        radial-gradient(circle at left, #f97316 0, transparent 55%),
        radial-gradient(circle at right, #22c55e 0, transparent 55%),
        #020617;
    background-size: 160% 160%;
    animation: gradientMove 12s ease-in-out infinite;
}

@keyframes gradientMove {
    0% {
        background-position: 0% 0%;
    }

    50% {
        background-position: 100% 100%;
    }

    100% {
        background-position: 0% 0%;
    }
}

/* ===== دوائر عائمة في الخلفية ===== */
.floating {
    animation: float 5s ease-in-out infinite;
}

.floating-delayed {
    animation: float 6.5s ease-in-out infinite;
    animation-delay: 1.2s;
}

.floating-slow {
    animation: float 8s ease-in-out infinite;
    animation-delay: 2.5s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) translateX(0);
    }

    50% {
        transform: translateY(-18px) translateX(8px);
    }
}

/* ===== نص متدرج ===== */
.text-gradient {
    background-image: linear-gradient(to left, #22d3ee, #a855f7, #f97316);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ===== حروف العنوان المتحركة ===== */
.letter-bounce {
    display: inline-block;
    animation: bounceLetter 1.6s ease-in-out infinite;
}

.letter-bounce:nth-child(2) {
    animation-delay: .08s;
}

.letter-bounce:nth-child(3) {
    animation-delay: .16s;
}

.letter-bounce:nth-child(4) {
    animation-delay: .24s;
}

.letter-bounce:nth-child(5) {
    animation-delay: .32s;
}

.letter-bounce:nth-child(6) {
    animation-delay: .40s;
}

.letter-bounce:nth-child(7) {
    animation-delay: .48s;
}

@keyframes bounceLetter {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

/* ===== نبض زر ===== */
.pulse-ring {
    position: relative;
}

.pulse-ring::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    border: 2px solid rgba(56, 189, 248, .5);
    animation: pulse 1.8s ease-out infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

/* ===== القائمة الجانبية ===== */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 50;
}

@media (min-width: 769px) {
    .nav-menu {
        position: absolute;
        top: 0;
        right: -4rem;
        /* مسافة بسيطة عن البطاقة */
    }
}

.nav-item {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(8px);
    border: 1px border rgba(71, 85, 105, 0.4);
    border-radius: 12px;
    color: #94a3b8;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.nav-item:hover,
.nav-item.active {
    color: #22d3ee;
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(34, 211, 238, 0.4);
    box-shadow: 0 0 15px rgba(34, 211, 238, 0.15);
    transform: translateX(-4px);
}

.nav-item .nav-tooltip {
    position: absolute;
    right: 110%;
    background: #0f172a;
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s;
    border: 1px border rgba(71, 85, 105, 0.4);
}

.nav-item:hover .nav-tooltip {
    opacity: 1;
    transform: translateX(-5px);
}

/* ===== الأقسام (Tabs) ===== */
.tab-content {
    display: none;
    animation: slideInUp 0.5s ease-out forwards;
}

.tab-content.active {
    display: block;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        flex-direction: row;
        justify-content: space-around;
        background: rgba(2, 6, 23, 0.98);
        backdrop-filter: blur(16px);
        padding: 0.8rem 0.5rem;
        padding-bottom: calc(0.8rem + env(safe-area-inset-bottom));
        border-radius: 24px 24px 0 0;
        border: 0;
        border-top: 1px solid rgba(71, 85, 105, 0.4);
        box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.5);
    }

    .nav-item {
        width: auto;
        height: auto;
        flex: 1;
        background: transparent;
        border: 0;
        box-shadow: none;
        flex-direction: column;
        gap: 5px;
    }

    .nav-item:hover,
    .nav-item.active {
        background: transparent;
        border: 0;
        box-shadow: none;
        transform: translateY(-4px);
        color: #22d3ee;
    }

    .nav-item .nav-tooltip {
        position: static;
        opacity: 1;
        background: transparent;
        border: 0;
        font-size: 10px;
        padding: 0;
        font-weight: 600;
        transform: none !important;
        color: inherit;
    }
}

span.letter-bounce.text-gradient {
    height: 50px;
    display: inline-flex;
    align-items: center;
}

@media (max-width: 768px) {
    aside.hide-on-mobile {
        display: none !important;
    }
}

p.text-xs.\30 .font-mono {
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== glow ===== */
.glow-cyan {
    box-shadow: 0 0 40px rgba(34, 211, 238, .35);
}

.glow-purple {
    box-shadow: 0 0 40px rgba(168, 85, 247, .35);
}

/* ===== بطاقة مشروع ===== */
.project-card {
    transition: transform .3s ease, box-shadow .3s ease;
}

.project-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(34, 211, 238, .15);
}

/* ===== Scrollbar مخصص ===== */
.custom-scroll::-webkit-scrollbar {
    width: 6px;
}

.custom-scroll::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, .6);
    border-radius: 9999px;
}

.custom-scroll::-webkit-scrollbar-thumb {
    background: rgba(34, 211, 238, .4);
    border-radius: 9999px;
}

.custom-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(34, 211, 238, .7);
}

/* ===== Fade-in عند الظهور ===== */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity .7s ease, transform .7s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== ارتفاع ثابت للحاوية (للشاشات الكبيرة فقط) ===== */
@media (min-width: 768px) {
    .card-container {
        height: min(88vh, 820px);
    }
}

/* ===== روابط التواصل ===== */
.social-pill {
    transition: background .25s, transform .25s, box-shadow .25s;
}

.social-pill:hover {
    transform: translateY(-3px);
}

/* ===== دائرة قوس القزح ===== */
#cursor-ring {
    position: fixed;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    opacity: 0;
    background: rgba(255, 255, 255, 0.10);
    border: 1.5px solid rgba(255, 255, 255, 0.30);
    filter: blur(0.5px);
    box-shadow:
        0 0 10px 3px rgba(255, 255, 255, .15),
        0 0 22px 8px rgba(255, 255, 255, .07);
    transition: opacity .25s ease;
}

/* ===== Lightbox ===== */
#image-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(2, 6, 23, 0.9);
    backdrop-filter: blur(12px);
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#image-lightbox.active {
    display: flex;
    opacity: 1;
}

#image-lightbox img {
    max-width: 90%;
    max-height: 85vh;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: default;
}

#image-lightbox.active img {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

#cursor-ring.active {
    opacity: .75;
}

.cursor-particle {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%);
    animation: pFade .65s ease-out forwards;
}

@keyframes pFade {
    0% {
        opacity: .95;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0) translateY(-12px);
    }
}
