/* =========================================================================
   SISTEMA DE DISEÑO: CONTRATA (DARK LUXURY)
   ========================================================================= */

:root {
    /* Fondos Globales */
    --bg-primary: #000000;
    --bg-secondary: #09090B;
    --bg-tertiary: #18181B;

    /* Acento Primario: ROJO */
    --primary-50: #fef2f2;
    --primary-100: #fee2e2;
    --primary-200: #fecaca;
    --primary-300: #fca5a5;
    --primary-400: #f87171;
    --primary-500: #dc2626; /* Color Base Seleccionado */
    --primary-600: #b91c1c; /* Botones activos */
    --primary-700: #991b1b;
    --primary-800: #7f1d1d;
    --primary-900: #450a0a;

    --primary-rgb: 220, 38, 38; /* Valores RGB para rgba() */

    /* Textos */
    --text-primary: #FFFFFF;
    --text-secondary: #E4E4E7;
    --text-tertiary: #A1A1AA;
    --text-quaternary: #71717A;

    /* Acentos Secundarios */
    --success: #22C55E;
    --info: #3B82F6;
    --warning: #F59E0B;

    /* Tipografía */
    --font-heading: 'Plus Jakarta Sans', sans-serif;
    --font-body: 'Inter', sans-serif;
}

/* =========================================================================
   RESETEOS BASICOS
   ========================================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
}

/* =========================================================================
   SISTEMA DE PARTICULAS (Fondo)
   ========================================================================= */

#particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary-500);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--primary-500), 0 0 20px var(--primary-500);
    animation: float-particle 20s infinite ease-in-out;
    opacity: 0.4;
}

/* =========================================================================
   TIPOGRAFIA & CONTENEDORES
   ========================================================================= */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-primary);
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    z-index: 10;
    position: relative;
}

/* =========================================================================
   EFECTOS VISUALES / COMPONENTES
   ========================================================================= */

.glass-card {
    background: linear-gradient(
        135deg,
        rgba(var(--primary-rgb), 0.08) 0%,
        rgba(var(--primary-rgb), 0.04) 50%,
        rgba(var(--primary-rgb), 0.08) 100%
    );
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.3),
        0 2px 4px -2px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    border-color: rgba(var(--primary-rgb), 0.35);
    box-shadow: 0 25px 50px -12px rgba(var(--primary-rgb), 0.35);
    transform: translateY(-4px);
}

.glow-text {
    text-shadow: 
        0 0 10px rgba(var(--primary-rgb), 0.8),
        0 0 20px rgba(var(--primary-rgb), 0.6),
        0 0 40px rgba(var(--primary-rgb), 0.4);
}

.btn-primary {
    display: inline-block;
    background: linear-gradient(
        135deg,
        var(--primary-600) 0%,
        var(--primary-500) 30%,
        var(--primary-400) 60%,
        var(--primary-500) 100%
    );
    background-size: 200% 200%;
    animation: gradient-shift 4s ease infinite;
    color: #ffffff;
    font-weight: 600;
    padding: 16px 32px;
    border-radius: 12px;
    border: none;
    box-shadow: 
        0 0 0 1px rgba(var(--primary-rgb), 0.5),
        0 4px 24px rgba(var(--primary-rgb), 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    text-align: center;
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    filter: brightness(1.1);
    box-shadow: 
        0 0 0 2px rgba(var(--primary-rgb), 0.8),
        0 8px 40px rgba(var(--primary-rgb), 0.6);
}

.btn-secondary {
    display: inline-block;
    background: transparent;
    color: var(--text-primary);
    font-weight: 600;
    padding: 14px 30px;
    border-radius: 12px;
    border: 2px solid rgba(var(--primary-rgb), 0.6);
    transition: all 0.3s ease;
    text-align: center;
}

.btn-secondary:hover {
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--primary-500);
    transform: translateY(-2px);
}

/* =========================================================================
   ANIMACIONES KEYFRAMES
   ========================================================================= */

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(2deg); }
    50% { transform: translateY(-10px) rotate(-2deg); }
    75% { transform: translateY(-30px) rotate(1deg); }
}

@keyframes float-particle {
    0%, 100% { transform: translate(0, 0); opacity: 0.4; }
    25% { transform: translate(100px, -100px); opacity: 0.8; }
    50% { transform: translate(-50px, -200px); opacity: 0.6; }
    75% { transform: translate(-100px, -100px); opacity: 0.8; }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 
            0 0 0 1px rgba(var(--primary-rgb), 0.5),
            0 4px 24px rgba(var(--primary-rgb), 0.4),
            0 0 60px rgba(var(--primary-rgb), 0.3);
    }
    50% {
        box-shadow: 
            0 0 0 2px rgba(var(--primary-rgb), 0.8),
            0 8px 40px rgba(var(--primary-rgb), 0.6),
            0 0 80px rgba(var(--primary-rgb), 0.5);
    }
}

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

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fade-in-rotate {
    from {
        opacity: 0;
        transform: translateY(40px) rotateX(-20deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0deg);
    }
}

/* Clases de utilidad para animaciones */
.fade-in-up {
    animation: fade-in-up 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    will-change: transform, opacity;
}

.scale-in {
    animation: scale-in 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
    opacity: 0;
    will-change: transform, opacity;
}

.fade-in-rotate {
    animation: fade-in-rotate 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    will-change: transform, opacity;
}

.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }
.delay-3 { animation-delay: 0.6s; }
.delay-4 { animation-delay: 0.8s; }

/* Para intersection observer */
.observer-target {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.observer-target.visible {
    opacity: 1;
    transform: translateY(0);
}

/* =========================================================================
   Navegacion (Navbar)
   ========================================================================= */

.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 24px 0;
    transition: all 0.3s ease;
}

.navbar.scrolled {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(24px);
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.1);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    padding: 16px 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    height: 48px;
    width: auto;
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 24px;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-link {
    font-weight: 500;
    color: var(--text-secondary);
    position: relative;
    padding-bottom: 4px;
    transition: color 0.3s;
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-500);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

.mobile-menu-toggle span {
    width: 30px;
    height: 2px;
    background-color: var(--text-primary);
    transition: 0.3s;
}

/* =========================================================================
   HERO SECTION
   ========================================================================= */

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    padding-top: 100px; /* offset navbar */
}

.hero-bg-gradient {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 100vh;
    background: radial-gradient(ellipse at top, rgba(var(--primary-rgb), 0.15) 0%, transparent 60%);
    z-index: 0;
    pointer-events: none;
}

.hero-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.hero-content {
    max-width: 600px;
}

.hero-label {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-400);
    margin-bottom: 24px;
}

.hero-title {
    font-size: 64px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 24px;
}

.hero-subtitle {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.hero-ctas {
    display: flex;
    gap: 20px;
}

.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.sphere {
    width: 480px;
    height: 480px;
    position: relative;
    transform-style: preserve-3d;
    animation: float 6s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sphere-inner {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.1) 0%, rgba(var(--primary-rgb), 0.2) 100%);
    border-radius: 50%;
    border: 2px solid rgba(var(--primary-rgb), 0.3);
    box-shadow: 
        0 0 60px rgba(var(--primary-rgb), 0.4),
        0 0 120px rgba(var(--primary-rgb), 0.3),
        inset 0 0 60px rgba(var(--primary-rgb), 0.2);
    backdrop-filter: blur(10px);
    z-index: 1;
}

.hero-image {
    position: relative;
    z-index: 2;
    width: 110%; /* Slightly overlaps the sphere for 3D effect */
    height: auto;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

/* =========================================================================
   SOCIAL PROOF (Métricas)
   ========================================================================= */

.social-proof {
    padding: 60px 0;
    background: var(--bg-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.social-proof-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    text-align: center;
    gap: 30px;
}

.metric-number {
    font-size: 48px;
    color: var(--primary-500);
    margin-bottom: 8px;
    font-weight: 800;
}

.metric-label {
    font-size: 16px;
    color: var(--text-tertiary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* =========================================================================
   SERVICIOS / FLIP CARDS
   ========================================================================= */

.services {
    padding: 120px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 80px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.section-header h2 {
    font-size: 48px;
    margin-bottom: 20px;
}

.section-header p {
    font-size: 20px;
    color: var(--text-secondary);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
}

.service-card-flip {
    background-color: transparent;
    width: 100%;
    height: 400px;
    perspective: 1000px; /* 3D effect */
    position: relative;
    cursor: pointer;
}

/* FIX INF LOOP SAFARI: Create a stationary hit-area that covers the card perfectly */
.service-card-flip::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10;
}

.service-card-inner {
    position: absolute;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1); /* Smooth flip */
    transform-style: preserve-3d;
    pointer-events: none; /* Let the ::after handle pointer events */
}

/* Class triggered via JS for both desktop hover and mobile taps */
.service-card-inner.is-flipped {
    transform: rotateY(180deg);
}

.service-card-front, .service-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 24px;
    overflow: hidden;
    transform: translateZ(0); /* Fix Safari flicker */
}

.service-card-front {
    background-color: var(--bg-tertiary);
}

.service-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.service-card-flip:hover .service-image {
    transform: scale(1.05); /* Zoom on front before/during flip */
}

.service-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 40px 24px 24px;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, transparent 100%);
    text-align: left;
}

.service-title-front {
    font-size: 24px;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.service-card-back {
    transform: rotateY(180deg) translateZ(0); /* Safari fix applied here too */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-align: left;
    padding: 32px;
}

.service-title-back {
    font-size: 24px;
    color: var(--primary-400);
    margin-bottom: 16px;
}

.service-description {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.service-features {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto;
}

.feature-tag {
    background: rgba(var(--primary-rgb), 0.15);
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    color: var(--primary-300);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* =========================================================================
   ABOUT US SECTION
   ========================================================================= */

.about {
    padding: 100px 0;
    background: radial-gradient(circle at center right, rgba(var(--primary-rgb), 0.05) 0%, transparent 50%);
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
}

.about-content h2 {
    font-size: 40px;
    margin-bottom: 24px;
}

.about-content p {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.about-list {
    margin-top: 30px;
}

.about-list li {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 500;
}

/* =========================================================================
   CTA FINAL
   ========================================================================= */

.cta-final {
    padding: 140px 0;
    position: relative;
    text-align: center;
    overflow: hidden;
}

.cta-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(var(--primary-rgb), 0.4) 0%, transparent 70%);
    filter: blur(80px);
    z-index: 0;
    pointer-events: none;
}

.cta-container {
    max-width: 700px;
}

.cta-container h2 {
    font-size: 56px;
    margin-bottom: 20px;
}

.cta-container p {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.cta-btn {
    font-size: 18px;
    padding: 20px 40px;
    animation: pulse-glow 3s ease-in-out infinite;
    margin-bottom: 20px;
}

.urgency-text {
    font-size: 14px;
    color: var(--primary-300);
    font-weight: 500;
}

/* =========================================================================
   FOOTER
   ========================================================================= */

.footer {
    background: var(--bg-secondary);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 80px;
}

.footer-container {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 60px;
    margin-bottom: 60px;
}

.brand-col p {
    color: var(--text-tertiary);
    margin-top: 20px;
    max-width: 300px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 20px;
}

.links-col h4 {
    color: var(--text-primary);
    margin-bottom: 24px;
    font-size: 18px;
}

.links-col ul li {
    margin-bottom: 12px;
}

.links-col ul li a {
    color: var(--text-tertiary);
    transition: color 0.3s;
}

.links-col ul li a:hover {
    color: var(--primary-400);
}

.footer-bottom {
    background: var(--bg-primary);
    padding: 24px 0;
    text-align: center;
    color: var(--text-quaternary);
    font-size: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* =========================================================================
   RESPONSIVE BREAKPOINTS
   ========================================================================= */

/* Desktop XL */
@media (min-width: 1440px) {
    .container { max-width: 1320px; }
}

/* Tablet / Small Desktop */
@media (min-width: 768px) and (max-width: 1023px) {
    .hero-title { font-size: 48px; }
    .hero-container { grid-template-columns: 1fr; text-align: center; }
    .hero-content { margin: 0 auto; }
    .hero-ctas { justify-content: center; }
    .sphere { width: 400px; height: 400px; }
    
    .social-proof-container { grid-template-columns: repeat(2, 1fr); }
    
    .services-grid { grid-template-columns: repeat(2, 1fr); }
    
    .footer-container { grid-template-columns: repeat(2, 1fr); gap: 40px; }
}

/* Mobile */
@media (max-width: 767px) {
    .container { padding: 0 20px; }
    
    .nav-links {
        display: none; /* hidden by default on mobile */
        position: absolute;
        top: 80px;
        left: 0;
        width: 100%;
        background: rgba(0,0,0,0.95);
        flex-direction: column;
        padding: 40px 20px;
        backdrop-filter: blur(20px);
    }

    .nav-links.active {
        display: flex;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .hero-container { grid-template-columns: 1fr; text-align: center; }
    .hero-title { font-size: 40px; }
    .hero-content { margin: 0 auto; }
    .hero-ctas { flex-direction: column; }
    
    .sphere { width: 300px; height: 300px; margin: 0 auto; }
    
    .social-proof-container { grid-template-columns: 1fr;}
    
    .services-grid { grid-template-columns: 1fr; }
    
    .section-header h2 { font-size: 32px; }
    
    .about-content h2 { font-size: 32px; }
    
    .cta-container h2 { font-size: 40px; }
    
    .footer-container { grid-template-columns: 1fr; gap: 40px; }
    
    /* Optimize particles for mobile */
    .particle:nth-child(n+20) { display: none; }
}
