/* ============================================
   3D HOMEPAGE STYLES — index.html ONLY
   Depends on: styles.css
   ============================================ */

/* ============================================
   3D HERO
   ============================================ */
.hero-3d {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 20px 80px;
    background:
        radial-gradient(circle at 70% 40%, #00305e 0%, #001a33 45%, #000d1a 100%);
    color: #fff;
    overflow: hidden;
    isolation: isolate;
}

/* Subtle moving grid floor for depth */
.hero-3d::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 107, 0, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 107, 0, 0.07) 1px, transparent 1px);
    background-size: 60px 60px;
    transform: perspective(600px) rotateX(60deg) scale(2.2);
    transform-origin: center bottom;
    opacity: 0.6;
    pointer-events: none;
    mask-image: linear-gradient(to top, #000 10%, transparent 70%);
    -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 70%);
}

/* Glow orbs (parallax) */
.hero-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
    z-index: 1;
    will-change: transform;
}
.hero-orb.orb-1 {
    width: 420px; height: 420px;
    background: rgba(255, 107, 0, 0.35);
    top: -80px; right: -60px;
    animation: floatOrb 12s ease-in-out infinite;
}
.hero-orb.orb-2 {
    width: 340px; height: 340px;
    background: rgba(0, 130, 255, 0.25);
    bottom: -100px; left: -60px;
    animation: floatOrb 15s ease-in-out infinite reverse;
}

@keyframes floatOrb {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(30px, -40px); }
}

/* Particles layer (sparks) */
.hero-particles {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #FF6B00;
    box-shadow: 0 0 10px rgba(255, 107, 0, 0.9);
    opacity: 0;
    animation: floatParticle linear infinite;
    will-change: transform, opacity;
}

@keyframes floatParticle {
    0% {
        transform: translate3d(0, 100%, 0) scale(0.4);
        opacity: 0;
    }
    15% { opacity: 0.9; }
    85% { opacity: 0.9; }
    100% {
        transform: translate3d(0, -800%, 0) scale(1);
        opacity: 0;
    }
}

/* Layout inside hero */
.hero-3d-inner {
    position: relative;
    z-index: 5;
    width: 100%;
    max-width: 1200px;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    align-items: center;
    gap: 60px;
}

/* Left content */
.hero-3d-content {
    position: relative;
    z-index: 6;
}

.hero-3d-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 50px;
    background: rgba(255, 107, 0, 0.15);
    border: 1px solid rgba(255, 107, 0, 0.5);
    color: #FF8a2c;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 22px;
    backdrop-filter: blur(6px);
}

.hero-3d-badge i { color: #FF6B00; }

.hero-3d h1 {
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3.6rem);
    line-height: 1.1;
    margin-bottom: 18px;
    color: #fff;
}

.hero-3d h1 .accent {
    color: #FF6B00;
    text-shadow: 0 0 30px rgba(255, 107, 0, 0.6);
}

.hero-3d h2 {
    font-size: clamp(1rem, 2vw, 1.3rem);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 20px;
}

.hero-3d p.hero-3d-lead {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 35px;
    max-width: 520px;
}

.hero-3d-buttons {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 45px;
}

.hero-3d-buttons .btn {
    padding: 14px 32px;
    font-size: 13px;
}

/* Floating mini stats */
.hero-3d-stats {
    display: flex;
    gap: 35px;
    flex-wrap: wrap;
}

.hero-3d-stat {
    position: relative;
}

.hero-3d-stat .num {
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
    font-size: 1.8rem;
    color: #FF6B00;
    line-height: 1;
}

.hero-3d-stat .lbl {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 4px;
}

/* ============================================
   3D ENGINE CANVAS (Three.js mounts here)
   ============================================ */
.engine-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 560px;
    margin: 0 auto;
    perspective: 1200px;
    transform-style: preserve-3d;
}

#engine-canvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    display: block;
    border-radius: 50%;
    cursor: grab;
    touch-action: pan-y;
}

#engine-canvas:active { cursor: grabbing; }

/* Glow ring behind the engine */
.engine-stage::before {
    content: '';
    position: absolute;
    inset: 8%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 107, 0, 0.4), transparent 65%);
    filter: blur(50px);
    z-index: -1;
    animation: engineGlow 4s ease-in-out infinite;
}

@keyframes engineGlow {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50%      { opacity: 1; transform: scale(1.1); }
}

/* Rotating decorative ring around the engine */
.engine-ring {
    position: absolute;
    inset: -4%;
    border-radius: 50%;
    border: 2px dashed rgba(255, 107, 0, 0.35);
    animation: ringRotate 25s linear infinite;
    pointer-events: none;
}

.engine-ring::after {
    content: '';
    position: absolute;
    inset: 14%;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top-color: #FF6B00;
    animation: ringRotate 6s linear infinite reverse;
}

@keyframes ringRotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Engine fallback (if WebGL not supported) */
.engine-fallback {
    display: none;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 6rem;
    color: #FF6B00;
    text-shadow: 0 0 40px rgba(255, 107, 0, 0.6);
    animation: wrenchRotate 3s ease-in-out infinite;
}

/* Scroll indicator */
.hero-scroll {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    animation: bounceDown 2s ease-in-out infinite;
}

.hero-scroll .mouse {
    width: 22px;
    height: 36px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    position: relative;
}

.hero-scroll .mouse::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 6px;
    width: 3px;
    height: 6px;
    background: #FF6B00;
    border-radius: 3px;
    transform: translateX(-50%);
    animation: scrollDot 1.6s ease-in-out infinite;
}

@keyframes scrollDot {
    0%   { transform: translate(-50%, 0); opacity: 1; }
    100% { transform: translate(-50%, 12px); opacity: 0; }
}

@keyframes bounceDown {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50%      { transform: translateX(-50%) translateY(-6px); }
}

/* ============================================
   3D TILT CARDS (Services preview)
   ============================================ */
.tilt-section {
    background: linear-gradient(180deg, #001a33 0%, #00101f 100%);
    color: #fff;
    position: relative;
    overflow: hidden;
    padding: 100px 0;
}

.tilt-section::before {
    content: '';
    position: absolute;
    top: -200px; left: -200px;
    width: 500px; height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 107, 0, 0.15), transparent 70%);
    pointer-events: none;
}

.tilt-section .section-title { color: #fff; }
.tilt-section .section-subtitle { color: rgba(255, 255, 255, 0.65); }

.tilt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 60px;
    perspective: 1400px;
}

.tilt-card {
    position: relative;
    border-radius: 16px;
    padding: 40px 30px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transform-style: preserve-3d;
    transition: transform 0.15s ease-out, box-shadow 0.3s ease;
    will-change: transform;
    overflow: hidden;
}

.tilt-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%),
                rgba(255, 107, 0, 0.25), transparent 45%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.tilt-card:hover::before { opacity: 1; }

.tilt-card:hover {
    box-shadow:
        0 30px 60px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(255, 107, 0, 0.15);
}

.tilt-card-inner {
    transform: translateZ(40px);
    transform-style: preserve-3d;
}

.tilt-icon {
    width: 70px;
    height: 70px;
    border-radius: 18px;
    background: linear-gradient(135deg, #FF6B00, #cc5500);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.9rem;
    margin-bottom: 24px;
    box-shadow:
        0 12px 30px rgba(255, 107, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    transform: translateZ(30px);
    transition: transform 0.4s ease;
}

.tilt-card:hover .tilt-icon { transform: translateZ(60px) rotateY(-10deg); }

.tilt-card h3 {
    font-size: 1.35rem;
    color: #fff;
    margin-bottom: 12px;
    transform: translateZ(30px);
}

.tilt-card p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.6;
    margin-bottom: 22px;
    transform: translateZ(20px);
}

.tilt-card .tilt-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #FF6B00;
    font-weight: 600;
    font-size: 0.9rem;
    transform: translateZ(30px);
    transition: gap 0.3s ease;
}

.tilt-card .tilt-link:hover { gap: 14px; }

/* Shine overlay — moves with cursor */
.tilt-shine {
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background: linear-gradient(
        115deg,
        transparent 30%,
        rgba(255, 255, 255, 0.15) 45%,
        rgba(255, 255, 255, 0.25) 50%,
        rgba(255, 255, 255, 0.15) 55%,
        transparent 70%
    );
    transform: translateX(-120%);
    transition: transform 0.6s ease;
    pointer-events: none;
}

.tilt-card:hover .tilt-shine {
    transform: translateX(120%);
}

/* ============================================
   SCROLL DEPTH SECTION (stats parallax)
   ============================================ */
.depth-section {
    padding: 100px 0;
    background: #f8f9fa;
    position: relative;
    overflow: hidden;
}

.depth-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 30px;
    margin-top: 50px;
    perspective: 1000px;
}

.depth-stat {
    text-align: center;
    padding: 40px 20px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
    transform-style: preserve-3d;
    transform: translateZ(-60px) rotateX(15deg);
    opacity: 0;
    transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.8s ease;
    will-change: transform, opacity;
}

.depth-stat.in-view {
    transform: translateZ(0) rotateX(0);
    opacity: 1;
}

.depth-stat i {
    font-size: 2.2rem;
    color: #FF6B00;
    margin-bottom: 14px;
    display: block;
}

.depth-stat .num {
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
    font-size: 2.4rem;
    color: #003366;
    line-height: 1;
}

.depth-stat .lbl {
    font-size: 0.85rem;
    color: #6c757d;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 8px;
}

/* ============================================
   FLOATING CTA STRIP (3D wavy)
   ============================================ */
.cta-3d {
    position: relative;
    padding: 80px 20px;
    background: linear-gradient(135deg, #FF6B00, #cc5500);
    color: #fff;
    text-align: center;
    overflow: hidden;
}

.cta-3d::before,
.cta-3d::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    pointer-events: none;
}

.cta-3d::before { top: -100px; left: -80px; }
.cta-3d::after  { bottom: -120px; right: -80px; width: 400px; height: 400px; }

.cta-3d h2 {
    font-size: clamp(1.6rem, 3.5vw, 2.4rem);
    margin-bottom: 15px;
    position: relative;
    z-index: 2;
}

.cta-3d p {
    font-size: 1.05rem;
    margin-bottom: 30px;
    opacity: 0.9;
    position: relative;
    z-index: 2;
}

.cta-3d .btn {
    background: #fff;
    color: #FF6B00;
    position: relative;
    z-index: 2;
}

.cta-3d .btn:hover {
    background: #003366;
    color: #fff;
    transform: translateY(-3px) scale(1.03);
}

/* ============================================
   PREVIEW GRID (gallery preview on home)
   ============================================ */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 50px;
}

.preview-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    height: 220px;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.preview-item:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.preview-item:hover img { transform: scale(1.08); }

.preview-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 26, 51, 0.8), transparent 60%);
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.preview-item:hover::after { opacity: 1; }

/* ============================================
   RESPONSIVE — TABLET (≤ 992px)
   ============================================ */
@media (max-width: 992px) {
    .hero-3d-inner {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }

    .hero-3d-content {
        order: 1;
    }

    .hero-3d-buttons { justify-content: center; }
    .hero-3d-stats { justify-content: center; }
    .hero-3d p.hero-3d-lead { margin-left: auto; margin-right: auto; }

    .engine-stage {
        order: 2;
        max-width: 420px;
    }

    .preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   RESPONSIVE — MOBILE (≤ 768px)
   ============================================ */
@media (max-width: 768px) {
    .hero-3d {
        padding: 110px 18px 90px;
        min-height: auto;
    }

    .hero-3d::before {
        background-size: 40px 40px;
        opacity: 0.4;
    }

    .hero-orb.orb-1 { width: 260px; height: 260px; }
    .hero-orb.orb-2 { width: 220px; height: 220px; }

    .hero-3d-badge {
        font-size: 0.72rem;
        padding: 7px 14px;
    }

    .hero-3d-buttons {
        width: 100%;
        flex-direction: column;
        gap: 12px;
    }

    .hero-3d-buttons .btn { width: 100%; }

    .hero-3d-stats {
        gap: 22px;
        justify-content: space-around;
    }

    .hero-3d-stat .num { font-size: 1.5rem; }
    .hero-3d-stat .lbl { font-size: 0.7rem; }

    .engine-stage { max-width: 340px; }

    .hero-scroll { display: none; }

    .tilt-section { padding: 70px 0; }

    .tilt-card {
        padding: 32px 24px;
        /* Disable 3D tilt on touch — smoother */
    }

    .tilt-icon {
        width: 60px;
        height: 60px;
        font-size: 1.6rem;
    }

    .tilt-card h3 { font-size: 1.2rem; }

    .depth-stat { padding: 30px 16px; }
    .depth-stat .num { font-size: 2rem; }

    .cta-3d { padding: 60px 20px; }
}

/* ============================================
   RESPONSIVE — SMALL MOBILE (≤ 480px)
   ============================================ */
@media (max-width: 480px) {
    .hero-3d { padding: 100px 16px 70px; }
    .engine-stage { max-width: 280px; }
    .preview-grid { grid-template-columns: 1fr; gap: 12px; }
    .preview-item { height: 200px; }
}

/* ============================================
   TOUCH DEVICES — Disable hover-dependent 3D
   (still tilts via drag in JS)
   ============================================ */
@media (hover: none) {
    .tilt-card:hover { transform: none !important; }
    .tilt-card::before { opacity: 0 !important; }
    .tilt-shine { display: none; }
    .preview-item:hover { transform: none; }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .hero-orb,
    .particle,
    .engine-ring,
    .hero-scroll,
    .engine-stage::before {
        animation: none !important;
    }
    .tilt-card {
        transform: none !important;
        transition: none !important;
    }
}