/* ========================================
   V-FREE.COM - STYLE.CSS (OPTIMIZADO V2)
   Performance (WPO) + Accesibilidad + UX/UI
   ======================================== */

/* ========================================
   1. VARIABLES CSS (TOKENS DE DISEÑO)
   ======================================== */
:root {
    /* Paleta de Colores (Contraste Accesible AA+) */
    --color-primary: #DC0000;
    --color-primary-dark: #b30000; /* Para estados hover */
    --color-black: #111111; /* Negro suavizado para lectura */
    --color-white: #FFFFFF;
    --color-gray: #666666;
    --color-gray-light: #F9F9F9;
    --color-border: #E5E5E5;
    
    /* Tipografía */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --font-size-base: 16px;

    /* Tipografía Fluida (Clamp) */
    --font-h1: clamp(2.5rem, 5vw + 1rem, 4.2rem);
    --font-h2: clamp(1.8rem, 3vw + 1rem, 3rem);
    --font-h3: clamp(1.25rem, 2vw + 0.5rem, 1.75rem);
    --font-body: clamp(1rem, 1vw + 0.2rem, 1.125rem);
    --font-small: 0.875rem;

    /* Espaciado */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: clamp(4rem, 8vw, 8rem);

    /* Layout & UI */
    --max-width: 1240px;
    --header-height: 80px;
    --border-radius: 8px;
    
    /* Transiciones */
    --transition-fast: 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-bounce: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);

    /* Sombras (Elevation System) */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ========================================
   2. RESET Y NORMALIZACIÓN
   ======================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-body);
    line-height: 1.6;
    color: var(--color-black);
    background-color: var(--color-white);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Mejora WPO: content-visibility */
main {
    content-visibility: auto; 
    contain-intrinsic-size: 1000px;
}

/* Imágenes Responsivas y anti-CLS */
img {
    max-width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

ul { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* Utilidades */
.text-highlight { color: var(--color-primary); }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0;
}

/* SKIP LINK (Accesibilidad) */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--color-black);
    color: var(--color-white);
    padding: 1rem;
    z-index: 9999;
    transition: top 0.3s;
    font-weight: bold;
}
.skip-link:focus { top: 0; }

/* ========================================
   3. CONTAINER & LAYOUT
   ======================================== */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}

/* ========================================
   4. HEADER
   ======================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
    transition: all var(--transition-fast);
}

.site-header.scrolled {
    box-shadow: var(--shadow-sm);
    padding-top: 0;
    padding-bottom: 0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
}

.logo img {
    height: 40px;
    width: auto;
}

.main-nav ul {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.main-nav a:not(.btn-cta) {
    font-weight: 500;
    font-size: 1rem;
    position: relative;
}

.main-nav a:not(.btn-cta)::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background-color: var(--color-primary);
    transition: width var(--transition-fast);
}

.main-nav a:not(.btn-cta):hover::after {
    width: 100%;
}

.btn-cta {
    background: var(--color-black);
    color: var(--color-white) !important;
    padding: 0.6rem 1.2rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    transition: transform var(--transition-fast);
}
.btn-cta:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ========================================
   5. HERO SECTION
   ======================================== */
.hero {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl) 0;
    background: radial-gradient(circle at top right, rgba(220,0,0,0.03), transparent 40%),
                radial-gradient(circle at bottom left, rgba(0,0,0,0.02), transparent 40%);
    text-align: center;
}

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

.hero h1 {
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.hero-sub {
    font-size: var(--font-h3);
    color: var(--color-gray);
    margin-bottom: 2.5rem;
    font-weight: 400;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ========================================
   6. UI COMPONENTS: BOTONES
   ======================================== */
.btn-primary, .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    font-weight: 600;
    border-radius: var(--border-radius);
    transition: all var(--transition-fast);
    text-align: center;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-white);
    box-shadow: var(--shadow-md);
    border: 2px solid transparent;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: transparent;
    color: var(--color-black);
    border: 2px solid var(--color-border);
}

.btn-secondary:hover {
    border-color: var(--color-black);
    background: var(--color-black);
    color: var(--color-white);
}

/* ========================================
   7. SERVICES GRID
   ======================================== */
.services-section { padding: var(--spacing-xl) 0; }
.section-header { text-align: center; margin-bottom: var(--spacing-lg); max-width: 700px; margin-left: auto; margin-right: auto; }

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.service-card {
    background: var(--color-white);
    padding: 2.5rem 2rem;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    transition: all var(--transition-fast);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(220, 0, 0, 0.2);
}

.service-card .icon {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    background: var(--color-gray-light);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.service-card h3 { margin-bottom: 0.5rem; font-weight: 700; }
.service-card p { color: var(--color-gray); margin-bottom: 1.5rem; flex-grow: 1; }

.service-link {
    font-weight: 600;
    color: var(--color-primary);
    display: inline-flex;
    align-items: center;
}
.service-link:hover { text-decoration: underline; }

/* Tarjeta Destacada */
.highlight-card {
    border: 2px solid var(--color-primary);
    background: #fff5f5;
}
.card-badge {
    position: absolute; top: 1rem; right: 1rem;
    background: var(--color-primary); color: white;
    font-size: 0.75rem; font-weight: bold; padding: 0.2rem 0.6rem;
    border-radius: 20px;
}

/* ========================================
   8. TOOLS SECTION
   ======================================== */
.tools-section { background: var(--color-gray-light); padding: var(--spacing-xl) 0; }
.tools-intro { text-align: center; margin-bottom: var(--spacing-lg); }

.tools-showcase {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.tool-item {
    background: var(--color-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--color-primary);
    transition: transform var(--transition-fast);
}
.tool-item:hover { transform: scale(1.02); }

/* ========================================
   9. FORMULARIO & CONTACTO
   ======================================== */
.cta-section { padding: var(--spacing-xl) 0; background: var(--color-white); }
.cta-content { max-width: 600px; margin: 0 auto; text-align: center; }

.contact-form {
    margin-top: 2rem;
    text-align: left;
}

.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; font-size: 0.9rem; }

input, textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color var(--transition-fast);
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(220, 0, 0, 0.1);
}

/* Estilos de Error y Mensajes */
.form-error { color: var(--color-primary); font-size: 0.85rem; margin-top: 0.3rem; display: none; }
.form-error.active { display: block; }
input.error, textarea.error { border-color: var(--color-primary); background-color: #fff0f0; }
.form-message { margin-top: 1rem; text-align: center; padding: 1rem; border-radius: 6px; display: none; }
.form-message.success { background: #e6fffa; color: #047857; border: 1px solid #047857; }
.form-message.error { background: #fff5f5; color: #c53030; border: 1px solid #c53030; }

.full-width { width: 100%; }

/* ========================================
   10. FOOTER
   ======================================== */
.site-footer {
    background: var(--color-black);
    color: #e5e5e5;
    padding: 4rem 0 2rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-brand img { margin-bottom: 1rem; opacity: 0.9; }
.footer-column h4 { color: var(--color-white); margin-bottom: 1.2rem; font-size: 1.1rem; }
.footer-column ul li { margin-bottom: 0.8rem; }
.footer-column a:hover { color: var(--color-primary); text-decoration: underline; }

.footer-bottom {
    border-top: 1px solid #333;
    padding-top: 2rem;
    text-align: center;
    font-size: 0.9rem;
    color: #888;
}

/* ========================================
   11. RESPONSIVE (MOBILE)
   ======================================== */
.mobile-menu-toggle { display: none; }

@media (max-width: 768px) {
    .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
    
    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        width: 30px;
        height: 30px;
        gap: 6px;
        z-index: 2000;
        position: relative;
    }
    
    .hamburger, .hamburger::before, .hamburger::after {
        width: 100%; height: 2px; background: var(--color-black);
        transition: all 0.3s ease;
    }

    /* Navegación Móvil (Slide-in) */
    .main-nav {
        position: fixed;
        top: 0; right: -100%;
        width: 80%; max-width: 300px; height: 100vh;
        background: var(--color-white);
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        padding: 5rem 2rem;
        transition: right 0.3s cubic-bezier(0.77, 0.2, 0.05, 1.0);
        z-index: 1500;
    }
    
    .main-nav.active { right: 0; }
    .main-nav ul { flex-direction: column; align-items: flex-start; }
    
    /* Overlay Oscuro */
    body.menu-open::before {
        content: ''; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.5); z-index: 1400;
        backdrop-filter: blur(2px);
    }
}

/* ========================================
   12. ANIMACIONES (Soporte para script.js)
   ======================================== */
.fade-start { 
    opacity: 0; 
    transform: translateY(20px); 
    transition: opacity 0.6s ease, transform 0.6s ease; 
}

.animate-in { 
    opacity: 1; 
    transform: translateY(0); 
}