/* ============================================
   DF_137 — ADVANCED VISUAL EFFECTS
   3D, Parallax, Glassmorphism, Glow, Particles
   ============================================ */

/* ============================================
   3D PERSPECTIVE UTILITIES
   ============================================ */
.perspective-1000 { perspective: 1000px; }
.perspective-2000 { perspective: 2000px; }
.preserve-3d { transform-style: preserve-3d; }
.backface-hidden { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.transform-z-0 { transform: translateZ(0); }
.transform-z-50 { transform: translateZ(50px); }
.transform-z-100 { transform: translateZ(100px); }

/* ============================================
   PARALLAX LAYERS
   ============================================ */
.parallax-layer {
    position: absolute;
    inset: 0;
    will-change: transform;
    pointer-events: none;
}

.parallax-bg {
    position: absolute;
    inset: -10%;
    width: 120%;
    height: 120%;
    will-change: transform;
    z-index: 0;
}

.parallax-mid {
    position: relative;
    z-index: 1;
    will-change: transform;
}

.parallax-front {
    position: relative;
    z-index: 2;
    will-change: transform;
}

/* Parallax decorative orbs */
.parallax-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    pointer-events: none;
    will-change: transform;
}

.orb-purple {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(43, 0, 87, 0.6), transparent 70%);
}

.orb-red {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(91, 0, 31, 0.5), transparent 70%);
}

.orb-accent {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(199, 166, 255, 0.15), transparent 70%);
}

/* ============================================
   GLASSMORPHISM
   ============================================ */
.glass {
    background: rgba(28, 13, 42, 0.55);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(199, 166, 255, 0.15);
}

.glass-strong {
    background: rgba(28, 13, 42, 0.75);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(199, 166, 255, 0.2);
}

.glass-card {
    background: rgba(28, 13, 42, 0.5);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(199, 166, 255, 0.12);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.glass-card:hover {
    border-color: rgba(199, 166, 255, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 40px rgba(199, 166, 255, 0.15);
}

/* ============================================
   GLOW / NEON EFFECTS
   ============================================ */
.glow-accent {
    box-shadow: 0 0 20px rgba(199, 166, 255, 0.3), 0 0 40px rgba(199, 166, 255, 0.15);
}

.glow-accent-strong {
    box-shadow: 0 0 30px rgba(199, 166, 255, 0.5), 0 0 60px rgba(199, 166, 255, 0.25), 0 0 90px rgba(199, 166, 255, 0.1);
}

.glow-purple {
    box-shadow: 0 0 30px rgba(43, 0, 87, 0.5), 0 0 60px rgba(43, 0, 87, 0.25);
}

.glow-red {
    box-shadow: 0 0 30px rgba(91, 0, 31, 0.5), 0 0 60px rgba(91, 0, 31, 0.25);
}

.text-glow {
    text-shadow: 0 0 20px rgba(199, 166, 255, 0.4), 0 0 40px rgba(199, 166, 255, 0.2);
}

.text-glow-strong {
    text-shadow: 0 0 30px rgba(199, 166, 255, 0.6), 0 0 60px rgba(199, 166, 255, 0.3), 0 0 90px rgba(199, 166, 255, 0.15);
}

/* Animated glow border */
.glow-border {
    position: relative;
}

.glow-border::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(199, 166, 255, 0.5), transparent, rgba(91, 0, 31, 0.5));
    -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.4s ease;
}

.glow-border:hover::before { opacity: 1; }

/* ============================================
   GRADIENT TEXT
   ============================================ */
.gradient-text {
    background: linear-gradient(135deg, #C7A6FF 0%, #F5F3FF 50%, #5b001f 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% 200%;
    animation: gradientShift 6s ease infinite;
}

.gradient-text-purple {
    background: linear-gradient(135deg, #C7A6FF, #2b0057);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.gradient-text-red {
    background: linear-gradient(135deg, #C7A6FF, #5b001f);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

/* ============================================
   CARD 3D TILT
   ============================================ */
.tilt-card {
    transform-style: preserve-3d;
    transition: transform 0.1s ease;
    will-change: transform;
}

.tilt-card-inner {
    transform: translateZ(40px);
}

.tilt-card-shine {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
        circle at var(--shine-x, 50%) var(--shine-y, 50%),
        rgba(199, 166, 255, 0.15),
        transparent 50%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.tilt-card:hover .tilt-card-shine { opacity: 1; }

/* ============================================
   PARTICLE CANVAS POSITIONING
   ============================================ */
.three-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* Gradient orbs behind canvas */
.canvas-bg-orbs {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.canvas-bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.3;
    animation: orbFloat 20s ease-in-out infinite;
}

.canvas-bg-orb:nth-child(1) {
    top: 10%;
    left: 5%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #2b0057, transparent 70%);
    animation-delay: 0s;
}

.canvas-bg-orb:nth-child(2) {
    bottom: 10%;
    right: 5%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #5b001f, transparent 70%);
    animation-delay: -7s;
}

.canvas-bg-orb:nth-child(3) {
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #4a0149, transparent 70%);
    animation-delay: -14s;
}

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

/* ============================================
   SCROLL REVEAL ANIMATIONS
   ============================================ */
.reveal-up {
    transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-ready .reveal-up:not(.visible) {
    opacity: 0;
    transform: translateY(60px);
}

.reveal-up.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-down {
    transition: opacity 0.8s ease, transform 0.8s ease;
}
.reveal-ready .reveal-down:not(.visible) {
    opacity: 0;
    transform: translateY(-60px);
}

.reveal-down.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    transition: opacity 0.8s ease, transform 0.8s ease;
}
.reveal-ready .reveal-left:not(.visible) {
    opacity: 0;
    transform: translateX(-60px);
}

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

.reveal-right {
    transition: opacity 0.8s ease, transform 0.8s ease;
}
.reveal-ready .reveal-right:not(.visible) {
    opacity: 0;
    transform: translateX(60px);
}

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

.reveal-fade {
    transition: opacity 1s ease;
}
.reveal-ready .reveal-fade:not(.visible) {
    opacity: 0;
}

.reveal-fade.visible { opacity: 1; }

.reveal-scale {
    transition: opacity 0.8s ease, transform 0.8s ease;
}
.reveal-ready .reveal-scale:not(.visible) {
    opacity: 0;
    transform: scale(0.85);
}

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

.reveal-rotate {
    transition: opacity 0.8s ease, transform 0.8s ease;
}
.reveal-ready .reveal-rotate:not(.visible) {
    opacity: 0;
    transform: rotate(-5deg) scale(0.9);
}

.reveal-rotate.visible {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* Stagger delays */
.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.2s; }
.stagger-3 { transition-delay: 0.3s; }
.stagger-4 { transition-delay: 0.4s; }
.stagger-5 { transition-delay: 0.5s; }
.stagger-6 { transition-delay: 0.6s; }

/* ============================================
   HOVER TRANSFORMS
   ============================================ */
.hover-lift {
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
}

.hover-scale {
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-rotate {
    transition: transform 0.4s ease;
}

.hover-rotate:hover {
    transform: rotate(3deg) scale(1.05);
}

/* Magnetic hover effect base */
.hover-magnetic {
    transition: transform 0.2s ease;
    will-change: transform;
}

/* ============================================
   LIGHTBOX
   ============================================ */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: rgba(21, 11, 34, 0.97);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 32px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.open {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.lightbox.open .lightbox-content {
    transform: scale(1);
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 14px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 40px rgba(199, 166, 255, 0.2);
}

.lightbox-close {
    position: absolute;
    top: -20px;
    right: -20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(28, 13, 42, 0.9);
    border: 1px solid rgba(199, 166, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    font-size: 1.5rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.lightbox-close:hover {
    border-color: #C7A6FF;
    color: #C7A6FF;
    transform: rotate(90deg) scale(1.1);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(28, 13, 42, 0.8);
    border: 1px solid rgba(199, 166, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.lightbox-nav:hover {
    border-color: #C7A6FF;
    color: #C7A6FF;
    background: rgba(199, 166, 255, 0.1);
}

.lightbox-prev { left: 24px; }
.lightbox-next { right: 24px; }

/* ============================================
   READING PROGRESS BAR
   ============================================ */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;

    width: 100%;
    transform: scaleX(0);
    transform-origin: 0 50%;
    height: 3px;
    background: linear-gradient(90deg, #C7A6FF, #5b001f);
    z-index: 9999;
    will-change: transform;
    box-shadow: 0 0 15px rgba(199, 166, 255, 0.6), 0 0 30px rgba(199, 166, 255, 0.3);
}

/* ============================================
   ANIMATED BACKGROUNDS
   ============================================ */
.animated-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: linear-gradient(135deg, #150B22, #1C0D2A);
    overflow: hidden;
}

.animated-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(43, 0, 87, 0.3), transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(91, 0, 31, 0.2), transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(74, 1, 73, 0.15), transparent 60%);
    animation: bgShift 15s ease-in-out infinite;
}

@keyframes bgShift {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(2deg); }
}

/* Grid pattern overlay */
.grid-pattern {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(199, 166, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(199, 166, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

/* ============================================
   NOISE TEXTURE
   ============================================ */
.noise-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    pointer-events: none;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    mix-blend-mode: overlay;
}

/* ============================================
   FLOATING ANIMATION
   ============================================ */
.float {
    animation: float 6s ease-in-out infinite;
}

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

.float-delayed {
    animation: float 6s ease-in-out infinite;
    animation-delay: -3s;
}

/* ============================================
   SHIMMER EFFECT
   ============================================ */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(199, 166, 255, 0.1),
        transparent
    );
    transform: translateX(-100%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    100% { transform: translateX(100%); }
}

/* ============================================
   BLINK / TYPEWRITER CURSOR
   ============================================ */
.typewriter-cursor {
    display: inline-block;
    width: 3px;
    height: 1em;
    background: #C7A6FF;
    margin-left: 4px;
    animation: blink 1s step-end infinite;
    vertical-align: text-bottom;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ============================================
   MARQUEE
   ============================================ */
.marquee {
    overflow: hidden;
    white-space: nowrap;
}

.marquee-content {
    display: inline-block;
    animation: marquee 30s linear infinite;
}

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

/* ============================================
   SPOTLIGHT EFFECT
   ============================================ */
.spotlight {
    position: relative;
    overflow: hidden;
}

.spotlight::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at var(--spotlight-x, 50%) var(--spotlight-y, 50%),
        rgba(199, 166, 255, 0.1),
        transparent 40%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.spotlight:hover::before { opacity: 1; }

/* ============================================
   TEXT REVEAL (clip-path)
   ============================================ */
.text-reveal {
    clip-path: inset(0 100% 0 0);
    transition: clip-path 1s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal-ready .text-reveal:not(.visible) {

}

.text-reveal.visible {
    clip-path: inset(0 0 0 0);
}

/* ============================================
   GRADIENT BORDER CARD
   ============================================ */
.gradient-border {
    position: relative;
    background: rgba(28, 13, 42, 0.5);
    border-radius: 24px;
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(199, 166, 255, 0.4), rgba(91, 0, 31, 0.3), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .three-canvas,
    .noise-overlay,
    .canvas-bg-orbs,
    .grid-pattern,
    .animated-bg::before {
        display: none !important;
    }

    .float, .float-delayed, .shimmer::after,
    .marquee-content, .canvas-bg-orb {
        animation: none !important;
    }

    .reveal-up, .reveal-down, .reveal-left, .reveal-right,
    .reveal-fade, .reveal-scale, .reveal-rotate, .text-reveal {
        opacity: 1 !important;
        transform: none !important;
        clip-path: none !important;
    }
}

/* Hide decorative parallax orbs on mobile to prevent overflow & lag */
@media (max-width: 768px) {
    .parallax-orb {
        display: none !important;
    }
}
