/**
 * CSS optimizado para Core Web Vitals — Salud Método Avanzado
 *
 * Mejoras:
 * - card-glow hover en CSS puro (reemplaza el mousemove JS)
 * - will-change en hero para compositor-thread optimization
 * - Optimización de imágenes y videos
 * - Reduced motion para accesibilidad
 */

/* ═══════════════════════════════════════════════════════════
   OPTIMIZACIÓN DE IMÁGENES
   ═══════════════════════════════════════════════════════════ */

/* Imágenes responsivas con aspect-ratio para evitar CLS */
img,
video,
canvas,
svg {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Aspect ratio container para evitar layout shift */
.aspect-ratio {
    position: relative;
    width: 100%;
    aspect-ratio: attr(data-ratio); /* Fallback: usar width/height nativos */
}

/* Lazy loading visual enhancement */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* HiDPI screens — imágenes más nítidas */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    img[src$=".jpg"],
    img[src$=".jpeg"],
    img[src$=".png"] {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ═══════════════════════════════════════════════════════════
   OPTIMIZACIÓN DE VIDEO
   ═══════════════════════════════════════════════════════════ */

/* Video responsivo con aspect ratio 16:9 */
video {
    width: 100%;
    height: auto;
    max-height: 100vh;
}

.hero-video__player {
    aspect-ratio: 16 / 9;
    object-fit: cover;
    width: 100%;
    height: 100%;
}

/* Poster image optimization */
video[poster] {
    background-color: var(--color-dark, #1a1a1a);
}

/* ═══════════════════════════════════════════════════════════
   ANIMACIONES Y TRANSICIONES
   ═══════════════════════════════════════════════════════════ */

/* Glassmorphism glow — puramente CSS, sin JavaScript */
.card-glow {
    opacity: 0 !important;
    transition: opacity 0.3s ease;
}

.service-card:hover .card-glow,
.testimonial-card:hover .card-glow,
.lead-capture__content:hover .card-glow,
.quiz-step__card:hover .card-glow,
.blog-card:hover .card-glow {
    opacity: 0.5 !important;
}

/* Hero parallax container — compositor thread */
.hero__inner--parallax {
    will-change: transform, opacity;
}

/* Scroll suave solo si el usuario no prefiere reduce-motion */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* ═══════════════════════════════════════════════════════════
   ACCESSIBILITY — Reduced Motion
   ═══════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .reveal {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════
   FORMULARIO DE CONTACTO — Quiz Paso 4
   ═══════════════════════════════════════════════════════════ */

.quiz-contact-form {
    background: linear-gradient(145deg, #ffffff 0%, #fef8f8 100%);
    border: 2px solid #c41e3a;
    border-radius: 20px;
    padding: 2.5rem !important;
    margin: 2rem 0 !important;
    box-shadow: 0 10px 40px rgba(196, 30, 58, 0.12), 0 2px 8px rgba(196, 30, 58, 0.08);
    position: relative;
    overflow: hidden;
}

.quiz-contact-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #c41e3a, #e63950, #c41e3a);
}

.quiz-contact-form h4 {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    color: #1a1a1a !important;
    margin-bottom: 0.75rem !important;
    text-align: center !important;
    letter-spacing: -0.02em !important;
}

.quiz-contact-form__subtitle {
    text-align: center !important;
    color: #6b7280 !important;
    font-size: 1rem !important;
    margin-bottom: 2rem !important;
    line-height: 1.6 !important;
}

.quiz-contact-form__fields {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.5rem !important;
    margin-bottom: 1.75rem !important;
}

.quiz-contact-form__field--full {
    grid-column: 1 / -1 !important;
}

.quiz-contact-form__field {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
}

.quiz-contact-form__field label {
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    color: #374151 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
}

.quiz-contact-form__field label::before {
    content: '•';
    color: #c41e3a;
    font-size: 1.2rem !important;
    line-height: 1 !important;
}

.quiz-contact-form__field input,
.quiz-contact-form__field textarea {
    width: 100% !important;
    padding: 1rem 1.25rem !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 12px !important;
    font-size: 1rem !important;
    font-family: inherit !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    background: #ffffff !important;
    color: #1f2937 !important;
}

.quiz-contact-form__field input:hover,
.quiz-contact-form__field textarea:hover {
    border-color: #d1d5db !important;
    background: #fafafa !important;
}

.quiz-contact-form__field input:focus,
.quiz-contact-form__field textarea:focus {
    outline: none !important;
    border-color: #c41e3a !important;
    box-shadow: 0 0 0 4px rgba(196, 30, 58, 0.1) !important;
    background: #ffffff !important;
}

.quiz-contact-form__field input::placeholder,
.quiz-contact-form__field textarea::placeholder {
    color: #9ca3af !important;
    font-weight: 400 !important;
}

.quiz-contact-form__field textarea {
    resize: vertical !important;
    min-height: 120px !important;
    line-height: 1.6 !important;
}

.quiz-contact-form__checkbox {
    display: flex !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
    margin-bottom: 2rem !important;
    font-size: 0.9rem !important;
    color: #4b5563 !important;
    cursor: pointer !important;
    padding: 1rem !important;
    background: rgba(196, 30, 58, 0.04) !important;
    border-radius: 10px !important;
    border: 1px solid rgba(196, 30, 58, 0.1) !important;
    transition: all 0.2s ease !important;
}

.quiz-contact-form__checkbox:hover {
    background: rgba(196, 30, 58, 0.08) !important;
    border-color: rgba(196, 30, 58, 0.2) !important;
}

.quiz-contact-form__checkbox input[type="checkbox"] {
    margin-top: 0.2rem !important;
    width: 20px !important;
    height: 20px !important;
    cursor: pointer !important;
    accent-color: #c41e3a !important;
}

.quiz-contact-form__checkbox a {
    color: #c41e3a !important;
    text-decoration: underline !important;
    font-weight: 500 !important;
}

.quiz-contact-form__btn {
    width: 100% !important;
    padding: 1.25rem 2rem !important;
    background: linear-gradient(135deg, #c41e3a 0%, #a01830 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 12px !important;
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.75rem !important;
    box-shadow: 0 4px 20px rgba(196, 30, 58, 0.35) !important;
    letter-spacing: 0.01em !important;
    text-transform: none !important;
    position: relative !important;
    overflow: hidden !important;
}

.quiz-contact-form__btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.quiz-contact-form__btn:hover::before {
    left: 100% !important;
}

.quiz-contact-form__btn:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 30px rgba(196, 30, 58, 0.45) !important;
    background: linear-gradient(135deg, #d42444 0%, #b01e38 100%) !important;
}

.quiz-contact-form__btn:active {
    transform: translateY(-1px) !important;
}

.quiz-contact-form__btn svg {
    flex-shrink: 0 !important;
    transition: transform 0.3s ease !important;
}

.quiz-contact-form__btn:hover svg {
    transform: scale(1.1) !important;
}

.quiz-contact-form__success {
    margin-top: 1.75rem !important;
    padding: 1.5rem !important;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%) !important;
    border: 2px solid #6ee7b7 !important;
    border-radius: 12px !important;
    color: #065f46 !important;
    font-weight: 600 !important;
    text-align: center !important;
    font-size: 1rem !important;
    line-height: 1.7 !important;
    box-shadow: 0 4px 15px rgba(110, 231, 183, 0.2) !important;
}

/* Responsive */
@media (max-width: 640px) {
    .quiz-contact-form {
        padding: 1.75rem !important;
        margin: 1.5rem 0 !important;
    }
    
    .quiz-contact-form__fields {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }
    
    .quiz-contact-form h4 {
        font-size: 1.25rem !important;
    }
    
    .quiz-contact-form__btn {
        padding: 1.1rem 1.5rem !important;
        font-size: 1.05rem !important;
    }
}
