/* ════════════════════════════════════════════
   SULTAN'S TECH.AI — Premium Portfolio Enhancements
   3D Tilt Cards, Glow Effects, Stagger Reveals
   ════════════════════════════════════════════ */

/* ── Perspective Container for 3D Tilt ── */
.projects-grid-enchanced {
    perspective: 1000px;
}

/* ── Project Card: 3D Tilt + Glow Base ── */
.project-card {
    transform-style: preserve-3d;
    will-change: transform;
    position: relative;
    overflow: hidden;
}

/* Card Glow Sheen Effect on Hover */
.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent 0%,
        rgba(255,255,255,0.03) 40%,
        rgba(255,255,255,0.07) 50%,
        rgba(255,255,255,0.03) 60%,
        transparent 100%
    );
    transform: skewX(-20deg);
    transition: left 0.8s cubic-bezier(0.23, 1, 0.32, 1);
    pointer-events: none;
    z-index: 5;
}
.project-card:hover::before {
    left: 150%;
}

/* Card Border Glint */
.project-card::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: var(--radius-xl);
    padding: 1px;
    background: conic-gradient(
        from 0deg at 50% 50%,
        transparent 0deg,
        transparent 120deg,
        rgba(99, 102, 241, 0.2) 180deg,
        rgba(139, 92, 246, 0.3) 220deg,
        rgba(99, 102, 241, 0.2) 270deg,
        transparent 360deg
    );
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: 4;
    animation: borderRotate 6s linear infinite;
}
.project-card:hover::after {
    opacity: 1;
}

@keyframes borderRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ── Rainbow Border Glow ── */
.rainbow-border {
    position: relative;
}
.rainbow-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: calc(var(--radius-xl) + 2px);
    background: conic-gradient(
        from var(--angle, 0deg),
        #6366f1, #a855f7, #ec4899, #06b6d4, #10b981, #6366f1
    );
    animation: hueRotate 4s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
    filter: blur(4px);
}
.project-card:hover .rainbow-border::before {
    opacity: 0.5;
}
@keyframes hueRotate {
    0% { --angle: 0deg; }
    100% { --angle: 360deg; }
}
@property --angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

/* ── Mouse-Follow Spotlight ── */
.card-spotlight {
    position: relative;
    --mouse-x: 50%;
    --mouse-y: 50%;
}
.card-spotlight::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-xl);
    background: radial-gradient(
        400px circle at var(--mouse-x) var(--mouse-y),
        rgba(99, 102, 241, 0.06) 0%,
        transparent 60%
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 3;
}
.card-spotlight:hover::after {
    opacity: 1;
}

/* ── Enhanced Project Thumb Animations ── */
.project-thumb {
    position: relative;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.project-thumb::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to top, var(--bg-surface) 0%, transparent 100%);
    opacity: 0.3;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.project-card:hover .project-thumb::after {
    opacity: 0.6;
}

.project-thumb-img {
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1), filter 0.3s ease;
}
.project-card:hover .project-thumb-img {
    transform: scale(1.2) translateY(-8px);
    filter: drop-shadow(0 12px 24px rgba(99, 102, 241, 0.4));
}

/* Floating emoji animation for non-image thumbs */
.project-thumb.emoji-thumb {
    font-size: 3rem;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.project-card:hover .project-thumb.emoji-thumb {
    transform: scale(1.15) translateY(-4px);
}

/* ── Floating Gradient Orbs (Portfolio Page Only) ── */
.portfolio-orbs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.portfolio-orbs .orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: orbFloat 12s ease-in-out infinite;
}
.portfolio-orbs .orb-1 {
    width: 400px;
    height: 400px;
    top: 10%;
    left: -5%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.2), transparent 70%);
    animation-delay: 0s;
}
.portfolio-orbs .orb-2 {
    width: 300px;
    height: 300px;
    top: 50%;
    right: -3%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15), transparent 70%);
    animation-delay: -4s;
    animation-duration: 16s;
}
.portfolio-orbs .orb-3 {
    width: 250px;
    height: 250px;
    bottom: 15%;
    left: 40%;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.12), transparent 70%);
    animation-delay: -8s;
    animation-duration: 20s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* ── Impact Stats (Animated Counters) ── */
.impact-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    position: relative;
    padding: 48px 0;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}
.impact-stat {
    flex: 1;
    text-align: center;
    padding: 20px;
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}
.impact-stat.in-view {
    opacity: 1;
    transform: translateY(0);
}
.impact-stat:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 25%;
    height: 50%;
    width: 1px;
    background: var(--border-subtle);
}
.impact-number {
    font-family: 'Space Grotesk', 'Inter', monospace;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    font-weight: 700;
    background: var(--gradient-hero-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.3;
    margin-bottom: 8px;
    display: inline-block;
    min-width: 8ch;
}
.impact-label {
    font-size: 0.78rem;
    color: var(--text-dim);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* ── Enhanced Accomplishments ── */
.accomplishment-stat {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}
.accomplishment-stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.03), transparent);
    transition: left 0.5s ease;
    pointer-events: none;
}
.accomplishment-stat:hover::before {
    left: 100%;
}
.accomplishment-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
}

/* ── Stagger Entrance Animations ── */
.portfolio-reveal {
    opacity: 0;
    transform: translateY(40px) scale(0.97);
    transition: opacity 0.7s cubic-bezier(0.23, 1, 0.32, 1),
                transform 0.7s cubic-bezier(0.23, 1, 0.32, 1);
}
.portfolio-reveal.in-view {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Stagger delays for grid items */
.portfolio-reveal.stagger-1 { transition-delay: 0.0s; }
.portfolio-reveal.stagger-2 { transition-delay: 0.1s; }
.portfolio-reveal.stagger-3 { transition-delay: 0.2s; }
.portfolio-reveal.stagger-4 { transition-delay: 0.3s; }
.portfolio-reveal.stagger-5 { transition-delay: 0.4s; }
.portfolio-reveal.stagger-6 { transition-delay: 0.5s; }
.portfolio-reveal.stagger-7 { transition-delay: 0.6s; }
.portfolio-reveal.stagger-8 { transition-delay: 0.7s; }

/* ── Shimmer Divider ── */
.section-divider {
    width: 60px;
    height: 2px;
    margin: 16px auto 0;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    border-radius: 2px;
    opacity: 0.5;
}

/* ── Glow Pulse for Featured Section Badge ── */
.pulse-glow {
    animation: glowPulse 2s ease-in-out infinite;
}
@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.15); }
    50% { box-shadow: 0 0 40px rgba(99, 102, 241, 0.3); }
}

/* ── CTA Button Enhanced ── */
.btn-primary-enhanced {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}
.btn-primary-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s ease;
    pointer-events: none;
}
.btn-primary-enhanced:hover::before {
    left: 100%;
}

/* ── Page Header Enhancements ── */
.page-header .section-badge {
    animation: fadeInUp 0.6s ease-out;
}
.page-header h1 {
    animation: fadeInUp 0.6s ease-out 0.1s both;
}
.page-header p {
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

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

/* ── Responsive Adjustments ── */
@media (max-width: 768px) {
    .project-card {
        transform-style: flat;
    }
    .portfolio-orbs .orb {
        opacity: 0.1;
        filter: blur(40px);
    }
    .impact-stat:not(:last-child)::after {
        height: 30%;
    }
    .project-card:hover .project-thumb-img {
        transform: scale(1.1) translateY(-4px);
    }
}

@media (max-width: 480px) {
    .impact-stat:not(:last-child)::after {
        display: none;
    }
    .impact-stats {
        flex-wrap: wrap;
    }
    .impact-stat {
        flex: 0 0 50%;
    }
}
