/* ========================================
   Eshiofune Ugochukwu — Elite Portfolio
   ======================================== */

/* ---- Preloader ---- */
#preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #090C1A;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#preloader.loaded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-ring {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(249, 97, 103, 0.15);
    border-top-color: #F96167;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ---- Scroll Progress Bar ---- */
#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #F96167, #F9E795);
    z-index: 9998;
    width: 0%;
    transition: width 0.1s linear;
}

/* ---- Custom Cursor ---- */
@media (pointer: fine) {
    .cursor-dot {
        position: fixed;
        width: 8px;
        height: 8px;
        background: #F96167;
        border-radius: 50%;
        pointer-events: none;
        z-index: 9997;
        transform: translate(-50%, -50%);
        transition: transform 0.15s ease, opacity 0.3s ease;
        mix-blend-mode: difference;
    }

    .cursor-ring {
        position: fixed;
        width: 36px;
        height: 36px;
        border: 1.5px solid rgba(249, 97, 103, 0.5);
        border-radius: 50%;
        pointer-events: none;
        z-index: 9996;
        transform: translate(-50%, -50%);
        transition: width 0.3s ease, height 0.3s ease, border-color 0.3s ease;
    }

    .cursor-ring.hovering {
        width: 56px;
        height: 56px;
        border-color: #F9E795;
    }
}

/* ---- Animations ---- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 0.4; }
    100% { transform: scale(1.4); opacity: 0; }
}

@keyframes gradient-x {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Animation classes */
.animate-fade-in { animation: fadeIn 0.8s ease-out both; }
.animate-fade-in-up { animation: fadeInUp 0.8s ease-out both; }
.animate-fade-in-left { animation: fadeInLeft 0.8s ease-out both; }
.animate-fade-in-right { animation: fadeInRight 0.8s ease-out both; }
.animate-scale-in { animation: scaleIn 0.6s ease-out both; }
.animate-float { animation: float 4s ease-in-out infinite; }

.animation-delay-100 { animation-delay: 0.1s; }
.animation-delay-200 { animation-delay: 0.2s; }
.animation-delay-300 { animation-delay: 0.3s; }
.animation-delay-400 { animation-delay: 0.4s; }
.animation-delay-500 { animation-delay: 0.5s; }
.animation-delay-600 { animation-delay: 0.6s; }

/* Reveal on scroll */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-scale.revealed {
    opacity: 1;
    transform: scale(1);
}

/* Staggered children */
.stagger-children > *:nth-child(1) { transition-delay: 0.05s; }
.stagger-children > *:nth-child(2) { transition-delay: 0.10s; }
.stagger-children > *:nth-child(3) { transition-delay: 0.15s; }
.stagger-children > *:nth-child(4) { transition-delay: 0.20s; }
.stagger-children > *:nth-child(5) { transition-delay: 0.25s; }
.stagger-children > *:nth-child(6) { transition-delay: 0.30s; }
.stagger-children > *:nth-child(7) { transition-delay: 0.35s; }
.stagger-children > *:nth-child(8) { transition-delay: 0.40s; }

/* ---- Navigation ---- */
#main-nav {
    background: transparent;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#main-nav.scrolled {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.04);
}

.nav-text-color {
    color: rgba(255, 255, 255, 0.85);
}

#main-nav.scrolled .nav-text-color {
    color: #2F3C7E;
}

#main-nav.scrolled .nav-link:hover {
    background: rgba(47, 60, 126, 0.06);
}

/* ---- Work Tabs ---- */
.work-tab {
    background: transparent;
    color: #6b7280;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.work-tab::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #2F3C7E, #4A5899);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: inherit;
    z-index: -1;
}

.work-tab:hover {
    color: #2F3C7E;
}

.work-tab.active {
    color: white;
    box-shadow: 0 4px 16px rgba(47, 60, 126, 0.35);
}

.work-tab.active::before {
    opacity: 1;
}

/* ---- Work Panel Transition ---- */
.work-panel {
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- Portfolio Items ---- */
.portfolio-item {
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.portfolio-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.portfolio-item .placeholder-icon {
    display: none;
}

.portfolio-item.placeholder-active .placeholder-icon {
    display: flex;
}

.portfolio-item.placeholder-active img {
    display: none;
}

/* Image blur-up loading */
.img-blur-up {
    filter: blur(12px);
    transition: filter 0.6s ease;
}

.img-blur-up.loaded {
    filter: blur(0);
}

/* ---- Lightbox ---- */
#lightbox {
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#lightbox.active {
    display: flex;
}

#lightbox img {
    animation: scaleIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- Magnetic Button Effect ---- */
.magnetic-btn {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- Marquee ---- */
.marquee-track {
    display: flex;
    animation: marquee 30s linear infinite;
    width: max-content;
}

.marquee-track:hover {
    animation-play-state: paused;
}

/* ---- Gradient Text Animation ---- */
.gradient-text-animated {
    background: linear-gradient(270deg, #F96167, #F9E795, #F96167);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-x 4s ease infinite;
}

/* ---- Glassmorphism Cards ---- */
.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ---- Noise Texture Overlay ---- */
.noise-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1;
}

/* ---- Scroll Behavior ---- */
html {
    scroll-behavior: smooth;
}

/* ---- Selection ---- */
::selection {
    background: rgba(249, 97, 103, 0.2);
    color: #2F3C7E;
}

/* ---- Form Focus ---- */
input:focus, textarea:focus {
    box-shadow: 0 0 0 4px rgba(249, 97, 103, 0.1);
}

/* ---- Back to Top ---- */
#back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
    .work-tab {
        font-size: 0.75rem;
        padding: 0.5rem 1rem;
    }

    .work-tab i {
        display: none;
    }

    .cursor-dot, .cursor-ring {
        display: none !important;
    }
}

/* ---- Smooth Image Loading ---- */
img {
    transition: opacity 0.5s ease;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #2F3C7E;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #F96167;
}

/* ---- Stat Counter Animation ---- */
.stat-number {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

/* ---- Tooltip ---- */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #090C1A;
    color: white;
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 100;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ---- Page Transition ---- */
.page-transition-overlay {
    position: fixed;
    inset: 0;
    background: #2F3C7E;
    z-index: 9990;
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.5s cubic-bezier(0.86, 0, 0.07, 1);
}

.page-transition-overlay.active {
    transform: scaleY(1);
    transform-origin: top;
}
