/* ===== SECCIÓN INSTAGRAM - FONDO MILITAR SOBRE BLANCO ===== */

/* Contenedor principal con base blanca */
.instagram-section {
    position: relative;
    padding: 4rem 0;
    background-color: var(--secondary-color); /* Fondo blanco puro */
    overflow: hidden;
    border-top: 2px solid var(--secondary-color);
    border-bottom: 2px solid var(--secondary-color);
}

/* Patrón de Mimetismo Moderno (Estilo Multicam Alpine/Urban) */
.instagram-bg-pattern {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Manchas orgánicas sutiles en grises, cremas y verdes oliva pálido */
    background-image: 
        /* Manchas Gris Urban */
        radial-gradient(circle at 10% 20%, rgba(180, 185, 190, 0.15) 150px, transparent 300px),
        /* Manchas Crema / Khaki claro */
        radial-gradient(circle at 85% 15%, rgba(220, 215, 200, 0.2) 200px, transparent 350px),
        /* Manchas Verde Táctico pálido */
        radial-gradient(circle at 45% 55%, rgba(165, 175, 145, 0.12) 250px, transparent 450px),
        /* Manchas de contraste oscuro sutil */
        radial-gradient(circle at 75% 85%, rgba(60, 65, 70, 0.05) 100px, transparent 250px),
        /* Mancha central */
        radial-gradient(circle at 30% 80%, rgba(190, 195, 180, 0.15) 180px, transparent 350px);
    background-size: 1000px 1000px;
    filter: blur(30px); /* Suaviza las formas para el efecto camuflaje moderno */
    opacity: 0.8;
    pointer-events: none;
    z-index: 0;
}

/* Trama "Ripstop" (Cuadrícula técnica de uniformes militares) */
.instagram-grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Micro cuadrícula de 4px que imita la tela técnica militar */
    background-image: 
        linear-gradient(to right, rgba(0,0,0,0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0,0,0,0.03) 1px, transparent 1px);
    background-size: 4px 4px; 
    pointer-events: none;
}

/* Capa de grano táctico para textura de tela/uniforme */
.instagram-grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3仿真%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.08;
    mix-blend-mode: overlay;
    pointer-events: none;
}

.instagram-grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(
            circle at 20% 30%,
            rgba(254, 235, 21, 0.05) 0%,
            transparent 40%
        ),
        radial-gradient(
            circle at 80% 70%,
            rgba(254, 235, 21, 0.05) 0%,
            transparent 40%
        );
    pointer-events: none;
}

/* Títulos de sección */
.instagram-section .section-title {
    color: var(--text-light);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 0.5rem;
}

.instagram-section .section-subtitle {
    color: var(--secondary-color);
    font-weight: 400;
    font-size: 1.1rem;
    margin-bottom: 2.5rem;
    opacity: 0.9;
}

/* Grid de posts */
.instagram-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

/* Tarjeta de Instagram */
.instagram-card {
    background: linear-gradient(145deg, 
        rgba(30, 30, 30, 0.9) 0%, 
        rgba(20, 20, 20, 0.95) 100%);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(254, 235, 21, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    border: 1px solid rgba(254, 235, 21, 0.15);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.instagram-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(254, 235, 21, 0.2),
        inset 0 0 0 1px rgba(254, 235, 21, 0.3);
    border-color: var(--secondary-color);
}

.instagram-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--secondary-color) 20%, 
        var(--secondary-color) 80%, 
        transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.instagram-card:hover::before {
    opacity: 1;
}

/* Contenedor de media */
.instagram-media-container {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
    background: #000;
}

.instagram-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.instagram-card:hover .instagram-media {
    transform: scale(1.05);
}

/* Overlay al hacer hover */
.instagram-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to bottom, 
        rgba(0, 0, 0, 0) 0%, 
        rgba(0, 0, 0, 0.8) 100%
    );
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    gap: 1rem;
}

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

.instagram-icon {
    font-size: 2.5rem;
    color: var(--secondary-color);
    transform: translateY(20px);
    transition: transform 0.3s ease 0.1s;
    text-shadow: 0 0 20px rgba(254, 235, 21, 0.5);
}

.instagram-card:hover .instagram-icon {
    transform: translateY(0);
}

.instagram-action {
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.7);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--secondary-color);
    transform: translateY(10px);
    opacity: 0;
    transition: all 0.3s ease 0.2s;
}

.instagram-card:hover .instagram-action {
    transform: translateY(0);
    opacity: 1;
}

/* Fecha de publicación */
.instagram-date {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.8);
    color: rgba(255, 255, 255, 0.8);
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    z-index: 1;
    border: 1px solid rgba(254, 235, 21, 0.2);
}

/* Contenido de la tarjeta */
.instagram-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.6);
}

/* Header con avatar */
.instagram-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    gap: 0.75rem;
}

.instagram-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--secondary-color);
    flex-shrink: 0;
}

.instagram-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.instagram-user {
    flex: 1;
}

.instagram-user strong {
    display: block;
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.95rem;
}

.instagram-user span {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
}

.instagram-badge {
    color: var(--secondary-color);
    font-size: 1rem;
}

/* Caption */
.instagram-caption {
    margin-bottom: 1rem;
    flex: 1;
}

.instagram-caption p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.instagram-hashtags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.instagram-hashtags span {
    color: var(--secondary-color);
    font-size: 0.8rem;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.instagram-hashtags span:hover {
    opacity: 1;
}

/* Stats */
.instagram-stats {
    display: flex;
    gap: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.stat-item:hover {
    color: var(--secondary-color);
}

.stat-item i {
    font-size: 1rem;
}

/* CTA Section */
.instagram-cta {
    background: linear-gradient(135deg, 
        rgba(254, 235, 21, 0.1) 0%, 
        rgba(254, 235, 21, 0.05) 100%);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    text-align: center;
    border: 1px solid rgba(254, 235, 21, 0.2);
    margin-top: 1rem;
}

.cta-content {
    max-width: 500px;
    margin: 0 auto;
}

.cta-icon {
    font-size: 2.5rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.instagram-cta h4 {
    color: var(--text-light);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.instagram-cta p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* Botón Instagram */
.btn-instagram {
    background: linear-gradient(135deg, 
        #833AB4 0%, 
        #FD1D1D 50%, 
        #FCAF45 100%);
    color: white;
    padding: 0.8rem 2rem;
    border-radius: var(--border-radius);
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    text-decoration: none;
}

.btn-instagram:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    color: white;
}

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

.cta-note {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.cta-note small {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.cta-note i {
    color: var(--secondary-color);
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet */
@media (max-width: 992px) {
    .instagram-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .instagram-section {
        padding: 3rem 0;
    }
    
    .instagram-media-container {
        height: 250px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .instagram-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        max-width: 400px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .instagram-section {
        padding: 2.5rem 0;
    }
    
    .instagram-cta {
        padding: 2rem 1.5rem;
    }
    
    .instagram-card:hover {
        transform: translateY(-5px);
    }
}

/* Mobile pequeño */
@media (max-width: 576px) {
    .instagram-section {
        padding: 2rem 0;
    }
    
    .instagram-media-container {
        height: 220px;
    }
    
    .instagram-content {
        padding: 1.25rem;
    }
    
    .instagram-cta {
        padding: 1.5rem 1.25rem;
    }
    
    .instagram-cta h4 {
        font-size: 1.2rem;
    }
    
    .instagram-stats {
        gap: 1rem;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .instagram-card {
        border: 2px solid var(--secondary-color);
    }
    
    .instagram-avatar {
        border: 3px solid var(--secondary-color);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .instagram-card,
    .instagram-media,
    .instagram-icon,
    .instagram-action,
    .btn-instagram {
        transition: none;
    }
    
    .instagram-card:hover {
        transform: none;
    }
    
    .instagram-card:hover .instagram-icon,
    .instagram-card:hover .instagram-action {
        transform: none;
    }
}

/* Dark mode nativo (si aplica) */
@media (prefers-color-scheme: dark) {
    .instagram-section {
        background: linear-gradient(135deg, 
            #111111 0%, 
            #1a1a1a 50%, 
            #111111 100%);
    }
    
    .instagram-card {
        background: linear-gradient(145deg, 
            rgba(40, 40, 40, 0.9) 0%, 
            rgba(30, 30, 30, 0.95) 100%);
    }
}

/* Impresión */
@media print {
    .instagram-section {
        background: white !important;
        border: 1px solid #ddd;
        color: black;
    }
    
    .instagram-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .instagram-media-container {
        display: none;
    }
    
    .btn-instagram {
        display: none;
    }
}