/*
    TechDwar Solutions — Anti-Template Design System
    Asymmetrical Layouts, Broken Grids, Floating Elements, Micro-Animations
    Inspired by: Linear, Vercel, Stripe, Raycast
*/

/* ================================================================
   1. GLOBAL MICRO-ANIMATIONS & MAGNETIC EFFECTS
   ================================================================ */

/* Magnetic hover for buttons */
.btn-primary {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

/* Text shimmer on headings */
.section-title {
    position: relative;
    display: inline-block;
}

.section-title .text-accent {
    position: relative;
    display: inline-block;
}

.section-title .text-accent::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.15), transparent);
    animation: text-shimmer 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes text-shimmer {
    0% { left: -100%; }
    50% { left: 100%; }
    100% { left: 100%; }
}

/* Floating elements bob */
@keyframes float-bob {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    33% { transform: translateY(-8px) rotate(1deg); }
    66% { transform: translateY(-4px) rotate(-0.5deg); }
}

@keyframes float-bob-reverse {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    33% { transform: translateY(-6px) rotate(-1.5deg); }
    66% { transform: translateY(-10px) rotate(0.5deg); }
}

/* Cursor glow on cards */
.card,
.svc-card {
    --mouse-x: 50%;
    --mouse-y: 50%;
}


/* ================================================================
   2. ASYMMETRICAL ABOUT SECTION
   ================================================================ */
@media screen and (min-width: 1024px) {
    #about .grid[style] {
        grid-template-columns: 4fr 8fr !important;
        gap: 5rem !important;
        align-items: start !important;
    }

    #about {
        position: relative;
    }

    /* Floating accent element */
    #about::after {
        content: '';
        position: absolute;
        top: 15%;
        right: -5%;
        width: 300px;
        height: 300px;
        border-radius: 50%;
        background: radial-gradient(circle, rgba(212, 175, 55, 0.04) 0%, transparent 70%);
        filter: blur(40px);
        pointer-events: none;
        animation: float-bob 10s ease-in-out infinite;
    }

    /* Visual block: offset upward */
    #about .grid[style] > div:first-child {
        transform: translateY(-30px) rotate(-2deg);
        transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    }

    #about .grid[style] > div:first-child:hover {
        transform: translateY(-35px) rotate(0deg);
    }

    /* Content side: stagger */
    #about .grid[style] > div:last-child {
        padding-top: 2rem;
    }
}


/* ================================================================
   3. BROKEN BENTO GRID FOR SERVICES
   ================================================================ */
@media screen and (min-width: 1024px) {
    .svc-grid {
        grid-template-columns: repeat(12, 1fr) !important;
        grid-auto-rows: auto;
        gap: 1.5rem !important;
    }

    /* Bento layout: large, medium, small cards */
    .svc-grid .svc-card:nth-child(1) {
        grid-column: span 5;
        min-height: 340px;
    }
    .svc-grid .svc-card:nth-child(2) {
        grid-column: span 4;
        min-height: 340px;
    }
    .svc-grid .svc-card:nth-child(3) {
        grid-column: span 3;
        min-height: 340px;
    }
    .svc-grid .svc-card:nth-child(4) {
        grid-column: span 3;
    }
    .svc-grid .svc-card:nth-child(5) {
        grid-column: span 5;
    }
    .svc-grid .svc-card:nth-child(6) {
        grid-column: span 4;
    }
    .svc-grid .svc-card:nth-child(7) {
        grid-column: span 7;
    }
    .svc-grid .svc-card:nth-child(8) {
        grid-column: span 5;
    }

    /* Slight rotation & offset for broken feel */
    .svc-grid .svc-card:nth-child(odd) {
        transform: translateY(0px);
    }

    .svc-grid .svc-card:nth-child(2) {
        transform: translateY(20px);
    }

    .svc-grid .svc-card:nth-child(5) {
        transform: translateY(-10px);
    }

    .svc-grid .svc-card:nth-child(7) {
        transform: translateY(15px);
    }

    /* Hover lifts out of the broken grid */
    .svc-grid .svc-card {
        transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    }

    .svc-grid .svc-card:hover {
        transform: translateY(-12px) scale(1.02) !important;
        z-index: 10;
    }
}

/* Card inner glowing border on hover */
.svc-card {
    position: relative;
}

.svc-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, 
        rgba(212, 175, 55, 0) 0%, 
        rgba(212, 175, 55, 0.08) 50%, 
        rgba(212, 175, 55, 0) 100%);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
    z-index: 0;
}

.svc-card:hover::before {
    opacity: 1;
}


/* ================================================================
   4. WHY CHOOSE US — ASYMMETRICAL SPLIT
   ================================================================ */
@media screen and (min-width: 1024px) {
    #why-us .grid[style] {
        grid-template-columns: 6fr 5fr !important;
        gap: 8rem !important;
        align-items: start !important;
    }

    /* Offset CTA card */
    #why-us .grid[style] > div:last-child {
        position: sticky;
        top: 120px;
        transform: translateY(40px);
    }

    #why-us .grid[style] > div:last-child .card {
        transform: rotate(1deg);
        transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    }

    #why-us .grid[style] > div:last-child .card:hover {
        transform: rotate(0deg) translateY(-8px);
    }

    /* Floating accent orb behind CTA */
    #why-us {
        position: relative;
    }

    #why-us::before {
        content: '';
        position: absolute;
        top: 20%;
        right: 5%;
        width: 400px;
        height: 400px;
        border-radius: 50%;
        background: radial-gradient(circle, rgba(212, 175, 55, 0.03) 0%, transparent 70%);
        filter: blur(60px);
        pointer-events: none;
        animation: float-bob-reverse 12s ease-in-out infinite;
    }
}


/* ================================================================
   5. FLOATING DECORATIVE ELEMENTS
   ================================================================ */
/* Noise grain overlay for premium texture */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 99990;
    pointer-events: none;
    opacity: 0.018;
    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.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
}

[data-theme='dark'] body::before {
    opacity: 0.03;
}

/* Floating corner accents on sections */
.section-padding {
    position: relative;
}

/* Diagonal section dividers */
.clip-diagonal {
    clip-path: polygon(0 4vw, 100% 0, 100% calc(100% - 4vw), 0 100%);
    padding-top: calc(4vw + 60px) !important;
    padding-bottom: calc(4vw + 60px) !important;
    margin-top: -4vw;
}

.clip-diagonal-reverse {
    clip-path: polygon(0 0, 100% 4vw, 100% 100%, 0 calc(100% - 4vw));
    padding-top: calc(4vw + 60px) !important;
    padding-bottom: calc(4vw + 60px) !important;
    margin-top: -4vw;
}


/* ================================================================
   6. PREMIUM SECTION LABEL WITH ANIMATED LINE
   ================================================================ */
.section-label::before {
    width: 0;
    animation: label-line-grow 0.8s ease-out forwards;
    animation-play-state: paused;
}

.animate-fade .section-label::before,
.section-label.animated::before {
    animation-play-state: running;
}

@keyframes label-line-grow {
    from { width: 0; }
    to { width: 30px; }
}


/* ================================================================
   7. INTERACTIVE CARD SPOTLIGHT EFFECT
   ================================================================ */
.card::before,
.svc-card .svc-card__glow {
    background: radial-gradient(
        600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(212, 175, 55, 0.04) 0%,
        transparent 40%
    ) !important;
}

[data-theme='dark'] .card::before,
[data-theme='dark'] .svc-card .svc-card__glow {
    background: radial-gradient(
        600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(240, 208, 96, 0.06) 0%,
        transparent 40%
    ) !important;
}


/* ================================================================
   8. STAGGERED HERO ANIMATIONS (Cinematic Entrance)
   ================================================================ */
.hero-animate {
    opacity: 0;
    transform: translateY(30px);
    animation: hero-stagger-in 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.hero-animate:nth-child(1) { animation-delay: 0.1s; }
.hero-animate:nth-child(2) { animation-delay: 0.25s; }
.hero-animate:nth-child(3) { animation-delay: 0.4s; }
.hero-animate:nth-child(4) { animation-delay: 0.55s; }
.hero-animate:nth-child(5) { animation-delay: 0.7s; }

@keyframes hero-stagger-in {
    from {
        opacity: 0;
        transform: translateY(30px);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* Hero floating chips: enhanced motion */
.hero-float-chip {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.hero-float-chip:hover {
    transform: translateY(-5px) scale(1.05) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Dashboard 3D parallax depth */
@media screen and (min-width: 1024px) {
    .hero-dashboard {
        transform: rotateY(-12deg) rotateX(6deg) !important;
        filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.4));
    }

    .hero-visual:hover .hero-dashboard {
        transform: rotateY(-3deg) rotateX(2deg) !important;
    }

    /* Floating ring behind dashboard */
    .hero-visual::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 120%;
        height: 120%;
        border-radius: 50%;
        border: 1px solid rgba(212, 175, 55, 0.06);
        animation: ring-rotate 20s linear infinite;
        pointer-events: none;
    }

    .hero-visual::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 140%;
        height: 140%;
        border-radius: 50%;
        border: 1px dashed rgba(212, 175, 55, 0.03);
        animation: ring-rotate 30s linear infinite reverse;
        pointer-events: none;
    }

    @keyframes ring-rotate {
        from { transform: translate(-50%, -50%) rotate(0deg); }
        to { transform: translate(-50%, -50%) rotate(360deg); }
    }
}


/* ================================================================
   9. TRUST BAR — Marquee Animation
   ================================================================ */
#hero + section .flex-center {
    animation: trust-slide 25s linear infinite;
    white-space: nowrap;
}

@keyframes trust-slide {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}


/* ================================================================
   10. LIVE PROJECT TRACKER — Glitch accent on title
   ================================================================ */
.lpt-dash-title span {
    position: relative;
}

.lpt-dash-title span::after {
    content: 'TechDwar Command Center';
    position: absolute;
    left: 0;
    top: 0;
    color: rgba(212, 175, 55, 0.3);
    clip-path: inset(0 0 0 0);
    animation: glitch-text 5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes glitch-text {
    0%, 96%, 100% { clip-path: inset(0 100% 0 0); }
    97% { clip-path: inset(0 0 0 0); transform: translateX(2px); }
    98% { clip-path: inset(0 0 0 0); transform: translateX(-1px); }
    99% { clip-path: inset(0 100% 0 0); }
}


/* ================================================================
   11. CONTACT FORM — Floating card with tilt
   ================================================================ */
@media screen and (min-width: 1024px) {
    .page-hero + section .grid[style*="2fr 3fr"] {
        grid-template-columns: 5fr 7fr !important;
        gap: 6rem !important;
        align-items: start !important;
    }

    .page-hero + section .grid[style*="2fr 3fr"] > div:last-child .card {
        transform: perspective(1000px) rotateY(-1deg) rotateX(0.5deg);
        transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .page-hero + section .grid[style*="2fr 3fr"] > div:last-child .card:hover {
        transform: perspective(1000px) rotateY(0deg) rotateX(0deg) translateY(-5px);
    }

    /* Offset contact info block */
    .page-hero + section .grid[style*="2fr 3fr"] > div:first-child {
        padding-top: 2rem;
        position: sticky;
        top: 120px;
    }
}


/* ================================================================
   12. PREMIUM SCROLL-LINKED PARALLAX
   ================================================================ */
.hero-grid-pattern {
    transform: translateZ(0);
    will-change: transform;
}

/* Sections get subtle perspective on scroll */
.section-padding > .container {
    transform-style: preserve-3d;
}


/* ================================================================
   13. BUTTON MICRO-INTERACTIONS
   ================================================================ */
/* Ripple effect on click */
.btn {
    position: relative;
    overflow: hidden;
}

.btn .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: btn-ripple 0.6s linear;
    pointer-events: none;
}

@keyframes btn-ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Magnetic cursor pull effect hint */
.btn-glow {
    will-change: transform;
}


/* ================================================================
   14. FOOTER — Asymmetrical with floating accent
   ================================================================ */
#main-footer {
    position: relative;
    overflow: hidden;
}

#main-footer::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.03) 0%, transparent 60%);
    filter: blur(80px);
    pointer-events: none;
    animation: float-bob-reverse 15s ease-in-out infinite;
}

#main-footer::after {
    content: '';
    position: absolute;
    bottom: -10%;
    left: -5%;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(96, 165, 250, 0.03) 0%, transparent 60%);
    filter: blur(60px);
    pointer-events: none;
    animation: float-bob 12s ease-in-out infinite 3s;
}


/* ================================================================
   15. SCROLL-TRIGGERED NUMBER COUNTER GLOW
   ================================================================ */
.hero-stat__number,
.lpt-stat-value {
    transition: text-shadow 0.3s;
}

.hero-stat:hover .hero-stat__number,
.lpt-stat:hover .lpt-stat-value {
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}


/* ================================================================
   16. GLASSMORPHISM DEPTH LAYERS
   ================================================================ */
.hero-dashboard-inner {
    position: relative;
}

.hero-dashboard-inner::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(
        135deg,
        rgba(212, 175, 55, 0.08) 0%,
        transparent 30%,
        transparent 70%,
        rgba(96, 165, 250, 0.05) 100%
    );
    pointer-events: none;
    z-index: 0;
}

/* ================================================================
   17. RESPONSIVE: Disable heavy effects on mobile
   ================================================================ */
@media screen and (max-width: 767px) {
    /* Disable broken grid on mobile */
    .svc-grid .svc-card {
        transform: none !important;
    }

    /* Disable rotations */
    #about .grid > div:first-child,
    #why-us .grid > div:last-child .card {
        transform: none !important;
    }

    /* Reduce floating orbs */
    #about::after,
    #why-us::before,
    #main-footer::before,
    #main-footer::after {
        display: none;
    }

    /* Simpler clip paths */
    .clip-diagonal,
    .clip-diagonal-reverse {
        clip-path: none !important;
        margin-top: 0 !important;
        padding-top: 50px !important;
        padding-bottom: 50px !important;
    }

    /* Disable grain on mobile for performance */
    body::before {
        display: none;
    }
}
