/* =============================================
   CBG ENGINEERING - CUSTOM STYLES
   ============================================= */

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: auto; }
body { font-family: 'Inter', sans-serif; background: #0E1117; color: #F5F7FA; overflow-x: hidden; }
::selection { background: rgba(0,184,255,0.3); color: #fff; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0E1117; }
::-webkit-scrollbar-thumb { background: #00B8FF; border-radius: 3px; }

/* Preloader */
.preloader { position: fixed; inset: 0; z-index: 9999; background: #0E1117; display: flex; align-items: center; justify-content: center; flex-direction: column; }
.preloader-logo { font-family: 'Space Grotesk'; font-size: 2rem; font-weight: 700; color: #00B8FF; letter-spacing: 0.3em; opacity: 0; }
.preloader-bar { width: 200px; height: 2px; background: #181C24; margin-top: 2rem; border-radius: 1px; overflow: hidden; }
.preloader-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #00B8FF, #00D084); border-radius: 1px; }
.preloader-text { font-family: 'IBM Plex Sans'; font-size: 0.7rem; color: #8A92A6; letter-spacing: 0.2em; margin-top: 1rem; text-transform: uppercase; opacity: 0; }

/* Scroll Progress */
.scroll-progress { position: fixed; top: 0; left: 0; height: 2px; background: linear-gradient(90deg, #00B8FF, #00D084); z-index: 10000; width: 0%; transform-origin: left; }

/* Custom Cursor */
.cursor-dot { position: fixed; width: 6px; height: 6px; background: #00B8FF; border-radius: 50%; pointer-events: none; z-index: 9998; transition: transform 0.1s; mix-blend-mode: difference; }
.cursor-ring { position: fixed; width: 36px; height: 36px; border: 1px solid rgba(0,184,255,0.4); border-radius: 50%; pointer-events: none; z-index: 9997; transition: transform 0.15s ease-out, width 0.3s, height 0.3s, border-color 0.3s; }
.cursor-ring.hovering { width: 56px; height: 56px; border-color: rgba(0,184,255,0.8); }
@media (max-width: 1024px) { .cursor-dot, .cursor-ring { display: none; } }

/* Glass Effects */
.glass { background: rgba(24,28,36,0.6); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.06); }
.glass-light { background: rgba(255,255,255,0.03); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.06); }
.glass-accent { background: rgba(0,184,255,0.05); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(0,184,255,0.12); }

/* 3D Building */
.building-container { perspective: 1200px; perspective-origin: center center; }
.building-3d { transform-style: preserve-3d; position: relative; width: 280px; height: 420px; }
.building-face { position: absolute; backface-visibility: visible; }
.building-front { width: 280px; height: 420px; transform: translateZ(60px); background: linear-gradient(180deg, rgba(0,184,255,0.08) 0%, rgba(0,184,255,0.02) 100%); border: 1px solid rgba(0,184,255,0.15); }
.building-back { width: 280px; height: 420px; transform: rotateY(180deg) translateZ(60px); background: rgba(0,184,255,0.03); border: 1px solid rgba(0,184,255,0.08); }
.building-left { width: 120px; height: 420px; transform: rotateY(-90deg) translateZ(0px); left: -60px; background: linear-gradient(90deg, rgba(0,184,255,0.12) 0%, rgba(0,184,255,0.04) 100%); border: 1px solid rgba(0,184,255,0.1); transform-origin: right center; }
.building-right { width: 120px; height: 420px; transform: rotateY(90deg) translateZ(220px); left: 220px; background: rgba(0,184,255,0.02); border: 1px solid rgba(0,184,255,0.08); transform-origin: left center; }
.building-top { width: 280px; height: 120px; transform: rotateX(90deg) translateZ(0px); top: -60px; background: rgba(0,184,255,0.06); border: 1px solid rgba(0,184,255,0.1); transform-origin: bottom center; }
.building-grid-line-h { position: absolute; width: 100%; height: 1px; background: rgba(0,184,255,0.12); }
.building-grid-line-v { position: absolute; width: 1px; height: 100%; background: rgba(0,184,255,0.08); }
.building-reflection { position: absolute; inset: 0; background: linear-gradient(135deg, transparent 30%, rgba(0,184,255,0.1) 50%, transparent 70%); animation: reflectionSweep 4s ease-in-out infinite; }
@keyframes reflectionSweep { 0%, 100% { transform: translateX(-100%); } 50% { transform: translateX(100%); } }
.building-glow { position: absolute; bottom: -40px; left: 50%; transform: translateX(-50%); width: 300px; height: 80px; background: radial-gradient(ellipse, rgba(0,184,255,0.15) 0%, transparent 70%); filter: blur(20px); }

/* Particles */
.particle { position: absolute; width: 2px; height: 2px; background: rgba(0,184,255,0.4); border-radius: 50%; animation: floatParticle 8s ease-in-out infinite; }
@keyframes floatParticle { 0%, 100% { transform: translateY(0) translateX(0); opacity: 0.4; } 25% { transform: translateY(-30px) translateX(10px); opacity: 0.8; } 50% { transform: translateY(-10px) translateX(-15px); opacity: 0.3; } 75% { transform: translateY(-40px) translateX(5px); opacity: 0.7; } }

/* Light Streak */
.light-streak { position: absolute; width: 200px; height: 1px; background: linear-gradient(90deg, transparent, rgba(0,184,255,0.6), transparent); animation: streakMove 6s linear infinite; opacity: 0; }
@keyframes streakMove { 0% { transform: translateX(-200px) rotate(-15deg); opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { transform: translateX(calc(100vw + 200px)) rotate(-15deg); opacity: 0; } }

/* Marquee */
.marquee-track { display: flex; animation: marqueeScroll 30s linear infinite; width: max-content; }
.marquee-track:hover { animation-play-state: paused; }
@keyframes marqueeScroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/* Button Liquid Hover */
.btn-liquid { position: relative; overflow: hidden; z-index: 1; }
.btn-liquid::before { content: ''; position: absolute; inset: 0; background: #00B8FF; transform: scaleX(0); transform-origin: right; transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1); z-index: -1; }
.btn-liquid:hover::before { transform: scaleX(1); transform-origin: left; }
.btn-liquid-outline::before { background: rgba(0,184,255,0.1); }

/* 3D Card Tilt */
.tilt-card { transform-style: preserve-3d; transition: transform 0.1s ease-out; }
.tilt-card .tilt-content { transform: translateZ(30px); }

/* Reveal Animations */
.reveal-up { opacity: 0; transform: translateY(60px); }
.reveal-left { opacity: 0; transform: translateX(-60px); }
.reveal-right { opacity: 0; transform: translateX(60px); }
.reveal-scale { opacity: 0; transform: scale(0.9); }

/* FAQ */
.faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s; }
.faq-item.active .faq-answer { max-height: 300px; }
.faq-item.active .faq-icon { transform: rotate(45deg); }
.faq-icon { transition: transform 0.3s; }

/* Horizontal scroll */
.horizontal-section { overflow: hidden; }
.horizontal-track { display: flex; will-change: transform; }

/* Project filter */
.project-card { transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1); }
.project-card.hidden-card { opacity: 0; transform: scale(0.8); position: absolute; pointer-events: none; }

/* Product carousel */
.product-carousel { display: flex; gap: 1.5rem; transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1); }

/* Floating elements */
.float-whatsapp { position: fixed; bottom: 2rem; right: 2rem; z-index: 9000; }
.float-call { position: fixed; bottom: 6rem; right: 2rem; z-index: 9000; }
.float-top { position: fixed; bottom: 2rem; left: 2rem; z-index: 9000; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.float-top.visible { opacity: 1; pointer-events: auto; }

/* Mobile sticky CTA */
.mobile-sticky-cta { position: fixed; bottom: 0; left: 0; right: 0; z-index: 8999; padding: 1rem; background: rgba(14,17,23,0.95); backdrop-filter: blur(20px); border-top: 1px solid rgba(0,184,255,0.1); transform: translateY(100%); transition: transform 0.4s; }
.mobile-sticky-cta.visible { transform: translateY(0); }

/* Noise overlay */
.noise-overlay { position: fixed; inset: 0; z-index: 9990; pointer-events: none; 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"); }

/* Nav */
.nav-link { position: relative; }
.nav-link::after { content: ''; position: absolute; bottom: -4px; left: 0; width: 0; height: 1px; background: #00B8FF; transition: width 0.3s; }
.nav-link:hover::after { width: 100%; }

/* Exit intent popup */
.exit-popup { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; background: rgba(14,17,23,0.9); backdrop-filter: blur(10px); opacity: 0; pointer-events: none; transition: opacity 0.4s; }
.exit-popup.active { opacity: 1; pointer-events: auto; }

/* Counter */
.counter-value { font-variant-numeric: tabular-nums; }

/* Cert card hover */
.cert-card { transition: all 0.4s; }
.cert-card:hover { border-color: rgba(0,184,255,0.3); box-shadow: 0 0 30px rgba(0,184,255,0.1); }

/* Mobile menu */
.mobile-menu { transform: translateX(100%); transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1); }
.mobile-menu.open { transform: translateX(0); }

/* Section divider */
.section-divider { height: 1px; background: linear-gradient(90deg, transparent, rgba(0,184,255,0.2), transparent); }

/* Prose for WYSIWYG */
.prose { color: #F5F7FA; max-width: 65ch; }
.prose h2 { font-family: 'Space Grotesk', sans-serif; font-size: 1.5rem; font-weight: 700; margin-bottom: 1rem; margin-top: 2rem; color: #F5F7FA; }
.prose h3 { font-family: 'Space Grotesk', sans-serif; font-size: 1.25rem; font-weight: 600; margin-bottom: 0.75rem; margin-top: 1.5rem; color: #F5F7FA; }
.prose p { margin-bottom: 1rem; line-height: 1.75; color: #8A92A6; }
.prose ul, .prose ol { margin-bottom: 1rem; padding-left: 1.5rem; color: #8A92A6; }
.prose li { margin-bottom: 0.5rem; line-height: 1.6; }
.prose strong { color: #F5F7FA; }
.prose a { color: #00B8FF; text-decoration: underline; }
.prose img { border-radius: 1rem; margin: 1.5rem 0; }

/* Line clamp utility */
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Archive filter active state fix */
.filter-btn.active { border-color: rgba(0,184,255,0.3) !important; background: rgba(0,184,255,0.1) !important; color: #00B8FF !important; }

/* Pagination */
.page-numbers { display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.page-numbers a, .page-numbers span { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 0.5rem; border: 1px solid rgba(255,255,255,0.1); font-size: 0.875rem; transition: all 0.3s; }
.page-numbers a:hover { border-color: rgba(0,184,255,0.3); color: #00B8FF; }
.page-numbers .current { background: rgba(0,184,255,0.1); border-color: rgba(0,184,255,0.3); color: #00B8FF; }

/* Responsive 3D building */
@media (max-width: 768px) {
    .building-3d { width: 180px; height: 270px; }
    .building-front { width: 180px; height: 270px; transform: translateZ(40px); }
    .building-back { width: 180px; height: 270px; transform: rotateY(180deg) translateZ(40px); }
    .building-left { width: 80px; height: 270px; left: -40px; transform: rotateY(-90deg) translateZ(0px); }
    .building-right { width: 80px; height: 270px; left: 140px; transform: rotateY(90deg) translateZ(140px); }
    .building-top { width: 180px; height: 80px; top: -40px; }
}