/* ============================================
   PROYECTOS - CSS COMPLETO OPTIMIZADO
   ============================================ */

:root {
    --primary-blue: #0066FF;
    --light-blue: #00A3FF;
    --sky-blue: #5CC5FF;
    --accent-yellow: #FFD700;
    --accent-green: #10b981;
    --text-dark: #0A1628;
    --text-light: #6B7280;
    --white: #FFFFFF;
    --light-gray: #F8FAFC;
    --dark-gray: #1a1a1a;
    
    /* Responsive optimizations */
    --border-radius: 20px;
    --border-radius-small: 10px;
    --border-radius-full: 50px;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.4s ease;
    --shadow-light: 0 4px 20px rgba(0, 102, 255, 0.08);
    --shadow-medium: 0 10px 30px rgba(0, 102, 255, 0.15);
    --shadow-heavy: 0 20px 60px rgba(0, 102, 255, 0.2);
    --gradient-primary: linear-gradient(135deg, var(--primary-blue), var(--light-blue));
}

/* ============================================
   RESET & BASE OPTIMIZED
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    font-size: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ============================================
   OPTIMIZED LOADER
   ============================================ */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--white);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-circle {
    width: 50px;
    height: 50px;
    border: 3px solid var(--light-blue);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    will-change: transform;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   CAROUSEL OPTIMIZADO PARA RESPONSIVE
   ============================================ */
.carousel-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: var(--border-radius-small);
}

.carousel-images {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    background-color: var(--light-gray);
}

.carousel-slide.active {
    opacity: 1;
}

/* Controles del carrusel optimizados */
.carousel-controls {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 clamp(10px, 2vw, 15px);
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-normal);
    z-index: 10;
}

.project-card:hover .carousel-controls {
    opacity: 1;
}

.carousel-btn {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    width: clamp(35px, 6vw, 40px);
    height: clamp(35px, 6vw, 40px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: all;
    transition: all var(--transition-normal);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.2);
    color: var(--primary-blue);
    font-size: clamp(0.8rem, 1.5vw, 0.9rem);
    font-weight: 600;
}

.carousel-btn:hover {
    background: var(--primary-blue);
    color: white;
    transform: scale(1.1) translateZ(0);
}

.carousel-btn:active {
    transform: scale(0.95) translateZ(0);
}

/* Indicadores (dots) optimizados */
.carousel-dots {
    position: absolute;
    bottom: clamp(10px, 2vw, 15px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: clamp(6px, 1vw, 8px);
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-normal);
    z-index: 10;
}

.project-card:hover .carousel-dots {
    opacity: 1;
}

.carousel-dot {
    width: clamp(8px, 1.5vw, 10px);
    height: clamp(8px, 1.5vw, 10px);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    pointer-events: all;
    transition: all var(--transition-normal);
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.carousel-dot.active {
    background: var(--accent-yellow);
    border-color: white;
    transform: scale(1.2);
}

.carousel-dot:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: scale(1.1);
}

/* Contador de imágenes optimizado */
.carousel-counter {
    position: absolute;
    top: clamp(10px, 2vw, 15px);
    right: clamp(10px, 2vw, 15px);
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    padding: clamp(4px, 1vw, 5px) clamp(8px, 2vw, 10px);
    border-radius: 15px;
    font-size: clamp(0.7rem, 1.5vw, 0.8rem);
    font-weight: 600;
    opacity: 0;
    transition: opacity var(--transition-normal);
    z-index: 10;
}

.project-card:hover .carousel-counter {
    opacity: 1;
}

/* Efecto de carga suave para las imágenes */
.carousel-slide::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid var(--primary-blue);
    border-top-color: transparent;
    border-radius: 50%;
    animation: carousel-loading 1s linear infinite;
    opacity: 0.3;
}

.carousel-slide.loaded::before {
    display: none;
}

@keyframes carousel-loading {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ============================================
   SECCIÓN PROYECTOS OPTIMIZADA
   ============================================ */
.projects-section {
    padding: clamp(6rem, 12vw, 10rem) 0;
    background: var(--light-gray);
}

.section-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 clamp(1rem, 3vw, 2rem);
}

.section-header {
    text-align: center;
    margin-bottom: clamp(3rem, 6vw, 4rem);
}

.section-title {
    font-size: clamp(1.8rem, 5vw, 3rem);
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text-dark);
    line-height: 1.2;
}

.section-title span {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-subtitle {
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

/* ============================================
   FILTROS DE PROYECTOS OPTIMIZADOS
   ============================================ */
.projects-filters {
    display: flex;
    justify-content: center;
    gap: clamp(0.5rem, 2vw, 1rem);
    margin-bottom: clamp(2rem, 4vw, 3rem);
    flex-wrap: wrap;
    padding: 0 1rem;
}

.filter-btn {
    background: white;
    color: var(--text-light);
    border: 2px solid rgba(0, 102, 255, 0.2);
    padding: clamp(0.6rem, 1.5vw, 0.75rem) clamp(1rem, 2.5vw, 1.5rem);
    border-radius: var(--border-radius-full);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-weight: 600;
    font-size: clamp(0.8rem, 1.8vw, 0.9rem);
    white-space: nowrap;
    box-shadow: var(--shadow-light);
    will-change: transform;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--gradient-primary);
    color: white;
    border-color: var(--primary-blue);
    transform: translateY(-2px) translateZ(0);
    box-shadow: var(--shadow-medium);
}

.filter-btn:active {
    transform: translateY(0) translateZ(0);
}

/* ============================================
   GRID DE PROYECTOS OPTIMIZADO
   ============================================ */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: clamp(3rem, 6vw, 4rem);
}

.project-card {
    background: white;
    border-radius: clamp(15px, 3vw, 25px);
    overflow: hidden;
    box-shadow: var(--shadow-light);
    transition: all var(--transition-slow);
    cursor: pointer;
    position: relative;
    will-change: transform;
    border: 1px solid rgba(0, 102, 255, 0.05);
}

.project-card:hover {
    transform: translateY(-10px) translateZ(0);
    box-shadow: var(--shadow-heavy);
    border-color: rgba(0, 102, 255, 0.1);
}

.project-image {
    position: relative;
    height: clamp(200px, 30vw, 250px);
    background-size: cover;
    background-position: center;
    overflow: hidden;
    background-color: var(--light-gray);
}

.project-image::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.8), rgba(0, 163, 255, 0.6));
    opacity: 0;
    transition: opacity var(--transition-normal);
    z-index: 5;
}

.project-card:hover .project-image::before {
    opacity: 1;
}

.project-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-normal);
    color: white;
    text-align: center;
    z-index: 15;
    pointer-events: none;
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.overlay-content {
    transform: translateY(20px);
    transition: transform var(--transition-normal);
    pointer-events: all;
}

.project-card:hover .overlay-content {
    transform: translateY(0);
}

.overlay-content i {
    font-size: clamp(2rem, 4vw, 2.5rem);
    margin-bottom: 1rem;
    display: block;
}

.overlay-content p {
    font-weight: 600;
    font-size: clamp(1rem, 2vw, 1.1rem);
}

/* ============================================
   INFORMACIÓN DEL PROYECTO OPTIMIZADA
   ============================================ */
.project-info {
    padding: clamp(1.5rem, 3vw, 2rem);
}

.project-tags {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.project-tag {
    background: rgba(0, 102, 255, 0.1);
    color: var(--primary-blue);
    padding: clamp(0.3rem, 1vw, 0.4rem) clamp(0.8rem, 2vw, 1rem);
    border-radius: 20px;
    font-size: clamp(0.7rem, 1.5vw, 0.8rem);
    font-weight: 600;
    white-space: nowrap;
}

.project-tag.sector-mineria { 
    background: rgba(255, 193, 7, 0.2); 
    color: #f57c00; 
}

.project-tag.sector-publico { 
    background: rgba(76, 175, 80, 0.2); 
    color: #388e3c; 
}

.project-tag.sector-industrial { 
    background: rgba(156, 39, 176, 0.2); 
    color: #7b1fa2; 
}

.project-tag.sector-comercial { 
    background: rgba(3, 169, 244, 0.2); 
    color: #0277bd; 
}

.project-title {
    font-size: clamp(1.2rem, 2.5vw, 1.4rem);
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    line-height: 1.3;
}

.project-location {
    color: var(--text-light);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.project-description {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    line-height: 1.6;
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.project-specs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: clamp(0.8rem, 2vw, 1rem);
    margin-bottom: 1.5rem;
}

.spec-item {
    text-align: center;
    padding: clamp(0.8rem, 2vw, 1rem);
    background: var(--light-gray);
    border-radius: 12px;
    transition: all var(--transition-normal);
}

.spec-item:hover {
    background: rgba(0, 102, 255, 0.05);
    transform: translateY(-2px);
}

.spec-value {
    font-size: clamp(1.1rem, 2.5vw, 1.3rem);
    font-weight: 800;
    color: var(--primary-blue);
    display: block;
    line-height: 1.2;
}

.spec-label {
    font-size: clamp(0.75rem, 1.5vw, 0.85rem);
    color: var(--text-light);
    margin-top: 0.2rem;
}

.project-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: clamp(0.4rem, 1vw, 0.5rem) clamp(0.8rem, 2vw, 1rem);
    border-radius: 25px;
    font-size: clamp(0.8rem, 1.5vw, 0.9rem);
    font-weight: 600;
}

.status-operativo {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.status-construccion {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.status-desarrollo {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

/* ============================================
   PROYECTO DESTACADO OPTIMIZADO
   ============================================ */
.project-card.featured {
    grid-column: span 2;
    background: var(--gradient-primary);
    color: white;
}

.project-card.featured .project-info {
    color: white;
}

.project-card.featured .project-title,
.project-card.featured .project-location,
.project-card.featured .project-description {
    color: white;
}

.project-card.featured .project-tag {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.project-card.featured .spec-item {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.project-card.featured .spec-value {
    color: white;
}

.project-card.featured .spec-label {
    color: rgba(255, 255, 255, 0.9);
}

/* ============================================
   CTA SECTION OPTIMIZADA
   ============================================ */
.projects-cta {
    background: white;
    padding: clamp(2rem, 4vw, 3rem);
    border-radius: clamp(15px, 3vw, 25px);
    text-align: center;
    box-shadow: var(--shadow-medium);
    margin-top: clamp(2rem, 4vw, 3rem);
    border: 1px solid rgba(0, 102, 255, 0.05);
}

.projects-cta h3 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: 1rem;
    color: var(--text-dark);
    line-height: 1.3;
}

.projects-cta p {
    color: var(--text-light);
    margin-bottom: 2rem;
    font-size: clamp(1rem, 2vw, 1.1rem);
    line-height: 1.6;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.cta-buttons {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    padding: clamp(0.8rem, 2vw, 1rem) clamp(1.5rem, 3vw, 2.5rem);
    border-radius: var(--border-radius-full);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 20px rgba(0, 102, 255, 0.3);
    font-size: clamp(0.9rem, 2vw, 1rem);
    will-change: transform;
    white-space: nowrap;
}

.btn-primary:hover {
    transform: translateY(-3px) translateZ(0);
    box-shadow: 0 6px 30px rgba(0, 102, 255, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-blue);
    padding: clamp(0.8rem, 2vw, 1rem) clamp(1.5rem, 3vw, 2.5rem);
    border-radius: var(--border-radius-full);
    text-decoration: none;
    font-weight: 600;
    border: 2px solid var(--primary-blue);
    transition: all var(--transition-normal);
    font-size: clamp(0.9rem, 2vw, 1rem);
    will-change: transform;
    white-space: nowrap;
}

.btn-secondary:hover {
    background: var(--primary-blue);
    color: white;
    transform: translateY(-3px) translateZ(0);
}

/* ============================================
   ANIMATION CLASSES OPTIMIZED
   ============================================ */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ============================================
   RESPONSIVE DESIGN OPTIMIZADO - MOBILE FIRST
   ============================================ */

/* TABLET GRANDE (1200px+) */
@media (min-width: 1200px) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .project-card.featured {
        grid-column: span 2;
    }
}

/* TABLET (768px - 1024px) */
@media (max-width: 1024px) {
    .project-card.featured {
        grid-column: span 1;
    }
    
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .project-specs {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* MÓVIL GRANDE (481px - 768px) */
@media (max-width: 768px) {
    /* Ajustes específicos para móviles */
    .carousel-controls {
        opacity: 1; /* Siempre visible en móviles */
        padding: 0 10px;
    }
    
    .carousel-dots {
        opacity: 1; /* Siempre visible en móviles */
        bottom: 10px;
    }
    
    .carousel-btn {
        width: 35px;
        height: 35px;
        font-size: 0.8rem;
    }
    
    .carousel-dot {
        width: 8px;
        height: 8px;
    }
    
    /* Grid de proyectos móvil */
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .projects-filters {
        gap: 0.5rem;
        padding: 0 0.5rem;
    }

    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .project-specs {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }

    .cta-buttons {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    /* Proyecto destacado en móvil */
    .project-card.featured {
        grid-column: span 1;
    }
    
    /* Tags en móvil */
    .project-tags {
        gap: 0.3rem;
    }
    
    .project-tag {
        padding: 0.25rem 0.75rem;
        font-size: 0.7rem;
    }
}

/* MÓVIL PEQUEÑO (320px - 480px) */
@media (max-width: 480px) {
    .projects-section {
        padding: 4rem 0;
    }
    
    .section-container {
        padding: 0 1rem;
    }
    
    .projects-grid {
        gap: 1.5rem;
    }
    
    .project-info {
        padding: 1.5rem;
    }
    
    .project-specs {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .spec-item {
        padding: 1rem;
    }
    
    .projects-cta {
        padding: 2rem 1.5rem;
        margin-top: 2rem;
    }
    
    .projects-filters {
        flex-direction: column;
        align-items: center;
        gap: 0.8rem;
    }
    
    .filter-btn {
        min-width: 120px;
        text-align: center;
    }
    
    .project-tags {
        justify-content: center;
    }
}

/* MÓVIL MUY PEQUEÑO (hasta 360px) */
@media (max-width: 360px) {
    html {
        font-size: 14px;
    }
    
    .section-container {
        padding: 0 0.8rem;
    }
    
    .project-info {
        padding: 1.2rem;
    }
    
    .projects-cta {
        padding: 1.5rem 1rem;
    }
    
    .carousel-btn {
        width: 30px;
        height: 30px;
        font-size: 0.7rem;
    }
    
    .carousel-dot {
        width: 6px;
        height: 6px;
    }
    
    .project-specs {
        gap: 0.6rem;
    }
    
    .spec-item {
        padding: 0.8rem;
    }
}

/* LANDSCAPE MÓVIL */
@media (max-height: 500px) and (orientation: landscape) {
    .projects-section {
        padding: 3rem 0;
    }
    
    .project-image {
        height: 180px;
    }
}

/* ============================================
   OPTIMIZACIONES ESPECÍFICAS PARA TOUCH
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Mejor experiencia táctil */
    .filter-btn,
    .carousel-btn,
    .carousel-dot,
    .btn-primary,
    .btn-secondary {
        min-height: 44px; /* Tamaño mínimo para touch */
    }
    
    /* Mostrar controles del carrusel siempre en touch */
    .carousel-controls,
    .carousel-dots,
    .carousel-counter {
        opacity: 1 !important;
    }
    
    /* Ajustar efectos hover en dispositivos táctiles */
    .project-card:hover {
        transform: translateY(-5px) translateZ(0);
    }
    
    .spec-item:hover {
        transform: none;
        background: var(--light-gray);
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Hardware acceleration para elementos animados */
.project-card,
.carousel-btn,
.carousel-dot,
.filter-btn,
.btn-primary,
.btn-secondary,
.spec-item {
    will-change: transform;
    transform: translateZ(0);
}

/* Optimizar renderizado de fonts */
body,
.section-title,
.project-title {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   UTILITIES RESPONSIVAS
   ============================================ */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
    
    .mobile-center {
        text-align: center !important;
    }
    
    .mobile-full-width {
        width: 100% !important;
    }
    
    .mobile-stack {
        flex-direction: column !important;
    }
    
    .mobile-no-gap {
        gap: 0 !important;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    *,
    *::before,
    *::after {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }
    
    .carousel-controls,
    .carousel-dots,
    .carousel-counter,
    .projects-filters,
    .btn-primary,
    .btn-secondary,
    .cta-buttons {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    h1, h2, h3 {
        page-break-after: avoid;
    }
    
    .project-card {
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
    
    .projects-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .project-image {
        height: 150px !important;
    }
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

/* Reduced motion support */
@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;
    }
    
    .carousel-slide {
        transition: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-blue: #0000FF;
        --text-dark: #000000;
        --text-light: #333333;
    }
    
    .btn-primary,
    .filter-btn.active {
        border: 2px solid var(--white) !important;
    }
    
    .project-card {
        border: 2px solid var(--text-dark) !important;
    }
    
    .carousel-btn {
        border: 2px solid var(--primary-blue) !important;
    }
}

/* Focus management for better accessibility */
*:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

.filter-btn:focus,
.carousel-btn:focus,
.carousel-dot:focus,
.btn-primary:focus,
.btn-secondary:focus {
    outline: 3px solid var(--primary-blue);
    outline-offset: 2px;
}

/* Skip to content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-blue);
    color: var(--white);
    padding: 8px;
    text-decoration: none;
    z-index: 10000;
    border-radius: 4px;
}

.skip-link:focus {
    top: 6px;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   OPTIMIZACIONES ADICIONALES PARA MÓVILES
   ============================================ */

/* Prevenir zoom en inputs en iOS */
@media (max-width: 768px) {
    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Mejoras para scroll suave en móviles */
@supports (scroll-behavior: smooth) {
    html {
        scroll-behavior: smooth;
    }
}

/* Optimización para pantallas con notch */
@supports (padding: max(0px)) {
    .section-container {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    .projects-filters {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* Mejoras para dispositivos con densidad de píxeles alta */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .carousel-slide {
        background-size: cover;
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Optimización para conexiones lentas */
@media (prefers-reduced-data: reduce) {
    .carousel-slide {
        background-image: none !important;
        background-color: var(--light-gray);
    }
    
    .carousel-slide::after {
        content: '📷';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 3rem;
        opacity: 0.3;
    }
}

/* ============================================
   DARK MODE SUPPORT (OPCIONAL)
   ============================================ */
@media (prefers-color-scheme: dark) {
    :root {
        --text-dark: #F1F5F9;
        --text-light: #94A3B8;
        --white: #0F172A;
        --light-gray: #1E293B;
        --dark-gray: #F8FAFC;
    }
    
    .project-card {
        background: #1E293B;
        border-color: rgba(148, 163, 184, 0.1);
    }
    
    .spec-item {
        background: #334155;
    }
    
    .projects-cta {
        background: #1E293B;
    }
    
    .filter-btn {
        background: #334155;
        border-color: rgba(148, 163, 184, 0.2);
    }
    
    .carousel-btn {
        background: rgba(30, 41, 59, 0.95);
        color: var(--primary-blue);
    }
}

/* ============================================
   MEJORAS DE INTERACCIÓN MÓVIL
   ============================================ */

/* Área de toque aumentada para elementos pequeños */
@media (max-width: 768px) {
    .carousel-dot {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .carousel-dot::before {
        content: '';
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.6);
        border: 2px solid rgba(255, 255, 255, 0.8);
    }
    
    .carousel-dot.active::before {
        background: var(--accent-yellow);
        border-color: white;
        transform: scale(1.2);
    }
}

/* Feedback táctil mejorado */
@media (hover: none) {
    .filter-btn:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    .carousel-btn:active {
        transform: scale(0.9);
        transition: transform 0.1s ease;
    }
    
    .project-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* ============================================
   OPTIMIZACIONES DE ANIMACIÓN PARA MÓVILES
   ============================================ */

/* Reducir animaciones complejas en móviles de gama baja */
@media (max-width: 480px) {
    .project-card:hover {
        transform: translateY(-5px) translateZ(0);
    }
    
    .carousel-slide {
        transition: opacity 0.3s ease-in-out;
    }
    
    .fade-in {
        transition: all 0.4s ease;
    }
}

/* Optimización para dispositivos con batería baja */
@media (prefers-reduced-motion: reduce) {
    .carousel-slide {
        transition: none;
    }
    
    .project-card,
    .filter-btn,
    .btn-primary,
    .btn-secondary {
        transition: none;
    }
    
    .fade-in {
        opacity: 1;
        transform: none;
    }
}

/* ============================================
   MEJORAS DE CARGA PROGRESIVA
   ============================================ */

/* Skeleton loading para proyectos */
.project-card.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

.project-card.loading .project-info > * {
    background: #e0e0e0;
    border-radius: 4px;
    color: transparent;
}

@keyframes loading-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Lazy loading para imágenes del carrusel */
.carousel-slide:not(.loaded) {
    background-color: var(--light-gray);
    background-image: none;
}

.carousel-slide.loaded {
    background-color: transparent;
}

/* ============================================
   ESTADOS DE ERROR Y VACÍO
   ============================================ */

/* Estado cuando no hay proyectos */
.projects-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
}

.projects-empty i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.projects-empty h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.projects-empty p {
    font-size: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

/* Estado de error de carga */
.project-card.error .project-image::after {
    content: '⚠️ Error al cargar';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(239, 68, 68, 0.9);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
}

/* ============================================
   MICROTRANSICIONES MEJORADAS
   ============================================ */

/* Transiciones más suaves para elementos clave */
.project-tag {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 102, 255, 0.2);
}

.spec-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mejora de la experiencia de scroll en móviles */
@supports (scroll-behavior: smooth) {
    .projects-section {
        scroll-margin-top: 100px;
    }
}

/* Optimización final para muy alta densidad de píxeles */
@media (-webkit-min-device-pixel-ratio: 3), (min-resolution: 288dpi) {
    .project-card {
        border-width: 0.5px;
    }
    
    .carousel-btn {
        border: 0.5px solid rgba(0, 102, 255, 0.2);
    }
}