/* ============================================== */
/* SECCIÓN TRIMESTRES - ESTILO ESPACIAL           */
/* ============================================== */

.quarters-section {
    margin-top: 60px;
    padding: 3rem 0 3.5rem 0;
    border-top: 1px solid #30363d;
    position: relative;
    overflow: hidden;
}

/* Fondo de constelaciones */
.quarters-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        /* Estrellas grandes */
        radial-gradient(3px 3px at 10% 20%, #b15bff, transparent),
        radial-gradient(2px 2px at 25% 70%, #58a6ff, transparent),
        radial-gradient(3px 3px at 40% 15%, #8957e5, transparent),
        radial-gradient(2px 2px at 55% 85%, #3b82f6, transparent),
        radial-gradient(3px 3px at 70% 30%, #8b5cf6, transparent),
        radial-gradient(2px 2px at 85% 65%, #58a6ff, transparent),
        radial-gradient(3px 3px at 95% 10%, #b15bff, transparent),
        /* Estrellas pequeñas */
        radial-gradient(1px 1px at 5% 50%, #58a6ff, transparent),
        radial-gradient(1px 1px at 20% 90%, #8957e5, transparent),
        radial-gradient(1px 1px at 35% 40%, #b15bff, transparent),
        radial-gradient(1px 1px at 50% 60%, #3b82f6, transparent),
        radial-gradient(1px 1px at 65% 80%, #8b5cf6, transparent),
        radial-gradient(1px 1px at 80% 45%, #58a6ff, transparent);
    background-size: 100% 100%;
    background-repeat: no-repeat;
    opacity: 0.2;
    pointer-events: none;
    animation: constellation-pulse 5s ease-in-out infinite alternate;
}

/* Nebulosa de fondo */
.quarters-section::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    right: -50%;
    bottom: -50%;
    background: 
        radial-gradient(
            circle at 30% 40%,
            rgba(177, 91, 255, 0.03) 0%,
            transparent 40%
        ),
        radial-gradient(
            circle at 70% 60%,
            rgba(88, 166, 255, 0.03) 0%,
            transparent 40%
        ),
        radial-gradient(
            circle at 50% 80%,
            rgba(137, 87, 229, 0.02) 0%,
            transparent 50%
        );
    pointer-events: none;
    animation: nebula-drift 15s ease-in-out infinite alternate;
}

/* Animación de pulso para constelaciones */
@keyframes constellation-pulse {
    0% {
        opacity: 0.15;
        transform: scale(1);
    }
    50% {
        opacity: 0.3;
    }
    100% {
        opacity: 0.2;
        transform: scale(1.02);
    }
}

/* Animación de deriva para nebulosa */
@keyframes nebula-drift {
    0% {
        transform: translate(0%, 0%) rotate(0deg);
    }
    33% {
        transform: translate(-2%, 1%) rotate(1deg);
    }
    66% {
        transform: translate(1%, -1%) rotate(-0.5deg);
    }
    100% {
        transform: translate(-1%, 2%) rotate(0.5deg);
    }
}

/* ============================================== */
/* TÍTULO DE SECCIÓN                              */
/* ============================================== */
.quarters-section h2 {
    font-size: 2rem;
    margin-bottom: 40px;
    color: #e6edf3;
    text-align: center;
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
    padding-bottom: 12px;
    text-shadow: 0 0 20px rgba(177, 91, 255, 0.4);
    letter-spacing: 1px;
}

/* Línea decorativa con gradiente animado */
.quarters-section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 15%;
    width: 70%;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent, 
        #b15bff, 
        #8957e5, 
        #58a6ff, 
        #8957e5, 
        #b15bff, 
        transparent
    );
    background-size: 200% 100%;
    animation: shimmer 4s linear infinite;
    border-radius: 2px;
}

/* Animación de brillo */
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================== */
/* GRID DE TRIMESTRES                             */
/* ============================================== */
.quarters-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-top: 20px;
    padding: 20px 10px;
    position: relative;
    z-index: 2;
}

/* ============================================== */
/* TARJETAS DE TRIMESTRE - ESTILO CÓSMICO         */
/* ============================================== */
.quarter-card {
    background: linear-gradient(145deg, 
        rgba(22, 27, 34, 0.95), 
        rgba(13, 17, 23, 0.98)
    );
    border: 1px solid rgba(177, 91, 255, 0.2);
    border-radius: 20px;
    padding: 30px 20px 25px;
    text-decoration: none;
    
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    
    /* Efecto de vidrio cósmico */
    backdrop-filter: blur(8px);
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 0 0 1px rgba(177, 91, 255, 0.1);
    
    /* Animación orbital con delay individual */
    animation: cosmic-float 4s ease-in-out infinite;
    animation-delay: var(--delay, 0s);
    
    /* Transición suave */
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    
    will-change: transform, box-shadow, border-color;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

/* Delays individuales para efecto secuencial */
.quarter-card:nth-child(1) { --delay: 0s; }
.quarter-card:nth-child(2) { --delay: 0.6s; }
.quarter-card:nth-child(3) { --delay: 1.2s; }
.quarter-card:nth-child(4) { --delay: 1.8s; }

/* Borde superior brillante */
.quarter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 15%;
    width: 70%;
    height: 2px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(177, 91, 255, 0.5), 
        rgba(137, 87, 229, 0.7), 
        rgba(177, 91, 255, 0.5), 
        transparent
    );
    opacity: 0.4;
    transition: opacity 0.3s ease;
}

/* Efecto de portal/galaxia en hover */
.quarter-card::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(
        circle,
        rgba(177, 91, 255, 0.08) 0%,
        rgba(88, 166, 255, 0.04) 40%,
        transparent 70%
    );
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.5s ease;
    pointer-events: none;
}

/* Hover - Activación del portal */
.quarter-card:hover {
    transform: scale(1.05) translateY(-10px) rotate(-0.5deg);
    border-color: #b15bff;
    box-shadow: 
        0 25px 45px rgba(0, 0, 0, 0.7),
        0 0 40px rgba(177, 91, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 0 1px #b15bff;
    animation-play-state: paused;
}

.quarter-card:hover::before {
    opacity: 1;
    background: linear-gradient(90deg, 
        transparent, 
        #b15bff, 
        #8957e5, 
        #b15bff, 
        transparent
    );
    animation: edge-glow 1.5s ease-in-out infinite alternate;
}

.quarter-card:hover::after {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.5);
}

/* Animación de brillo en borde */
@keyframes edge-glow {
    0% {
        opacity: 0.6;
        background: linear-gradient(90deg, 
            transparent, 
            rgba(177, 91, 255, 0.6), 
            rgba(137, 87, 229, 0.8), 
            rgba(177, 91, 255, 0.6), 
            transparent
        );
    }
    100% {
        opacity: 1;
        background: linear-gradient(90deg, 
            transparent, 
            #b15bff, 
            #8957e5, 
            #b15bff, 
            transparent
        );
    }
}

/* Animación de flotación cósmica */
@keyframes cosmic-float {
    0% {
        transform: translateY(0px);
    }
    25% {
        transform: translateY(-4px) rotate(0.3deg);
    }
    50% {
        transform: translateY(-12px) rotate(0deg);
    }
    75% {
        transform: translateY(-4px) rotate(-0.3deg);
    }
    100% {
        transform: translateY(0px);
    }
}

/* ============================================== */
/* NÚMERO DE TRIMESTRE - GRANDE Y ESTILIZADO      */
/* ============================================== */
.quarter-number {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: -5px;
    background: linear-gradient(135deg, 
        rgba(177, 91, 255, 0.15) 0%, 
        rgba(88, 166, 255, 0.1) 100%
    );
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    text-shadow: 0 0 30px rgba(177, 91, 255, 0.2);
    transition: all 0.3s ease;
    letter-spacing: -1px;
}

.quarter-card:hover .quarter-number {
    background: linear-gradient(135deg, 
        rgba(177, 91, 255, 0.4) 0%, 
        rgba(88, 166, 255, 0.3) 100%
    );
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    text-shadow: 0 0 40px rgba(177, 91, 255, 0.5);
    transform: scale(1.05);
}

/* ============================================== */
/* TÍTULO DEL TRIMESTRE                           */
/* ============================================== */
.quarter-card h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
    color: #e6edf3;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}

.quarter-card:hover h3 {
    background: linear-gradient(135deg, #b15bff 0%, #58a6ff 100%);
    background-size: 200% 200%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    text-shadow: 0 0 20px rgba(177, 91, 255, 0.4);
}

/* ============================================== */
/* DESCRIPCIÓN DEL TRIMESTRE                      */
/* ============================================== */
.quarter-card p {
    font-size: 0.9rem;
    color: #8b949e;
    margin: 0;
    line-height: 1.6;
    transition: color 0.3s ease;
}

.quarter-card:hover p {
    color: #c9d1d9;
}

/* ============================================== */
/* INDICADOR DE ENLACE - FLECHA CÓSMICA           */
/* ============================================== */
.quarter-card::after {
    content: '→';
    position: absolute;
    bottom: 20px;
    right: 20px;
    font-size: 1.2rem;
    color: rgba(177, 91, 255, 0);
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateX(-10px);
}

.quarter-card:hover::after {
    content: '→';
    color: #b15bff;
    opacity: 1;
    transform: translateX(0);
    text-shadow: 0 0 10px rgba(177, 91, 255, 0.8);
}

/* Ajuste para no interferir con el portal */
.quarter-card:hover::before {
    z-index: 1;
}

/* ============================================== */
/* EFECTO DE AGRUPACIÓN GALÁCTICA                 */
/* ============================================== */
.quarters-grid:hover .quarter-card:not(:hover) {
    opacity: 0.7;
    transform: scale(0.97);
    filter: blur(0.5px);
    transition: all 0.3s ease;
}

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

/* Tablets */
@media (max-width: 900px) {
    .quarters-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
    
    .quarters-section h2 {
        font-size: 1.8rem;
    }
    
    .quarter-card {
        padding: 25px 18px 20px;
    }
    
    .quarter-number {
        font-size: 3rem;
    }
    
    .quarter-card h3 {
        font-size: 1.3rem;
    }
}

/* Móviles */
@media (max-width: 600px) {
    .quarters-section {
        margin-top: 40px;
        padding: 2rem 0 2.5rem 0;
    }
    
    .quarters-section h2 {
        font-size: 1.5rem;
        margin-bottom: 25px;
    }
    
    .quarters-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        max-width: 350px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .quarter-card {
        padding: 22px 18px 20px;
        width: 100%;
    }
    
    .quarter-number {
        font-size: 2.8rem;
    }
    
    .quarter-card h3 {
        font-size: 1.2rem;
    }
    
    .quarter-card p {
        font-size: 0.85rem;
    }
    
    /* Ajustar animación para móviles */
    @keyframes cosmic-float {
        0% { transform: translateY(0px); }
        50% { transform: translateY(-6px); }
        100% { transform: translateY(0px); }
    }
}

/* Pantallas muy pequeñas */
@media (max-width: 400px) {
    .quarters-section h2 {
        font-size: 1.3rem;
    }
    
    .quarter-card {
        padding: 20px 15px 18px;
    }
    
    .quarter-number {
        font-size: 2.5rem;
    }
    
    .quarter-card h3 {
        font-size: 1.1rem;
    }
}

/* ============================================== */
/* ACCESIBILIDAD - REDUCCIÓN DE MOVIMIENTO        */
/* ============================================== */
@media (prefers-reduced-motion: reduce) {
    .quarter-card,
    .quarters-section::before,
    .quarters-section::after,
    .quarters-section h2::after,
    .quarter-card::before,
    .quarter-card::after {
        animation: none;
        transition: none;
    }
    
    .quarter-card:hover {
        transform: scale(1.02);
    }
    
    .quarter-card:hover::after {
        transform: scale(1);
    }
}

/* ============================================== */
/* MEJORA DE ACCESIBILIDAD - FOCO VISIBLE         */
/* ============================================== */
.quarter-card:focus-visible {
    outline: 2px solid #b15bff;
    outline-offset: 3px;
    border-radius: 20px;
    box-shadow: 0 0 30px rgba(177, 91, 255, 0.5);
}

/* ============================================== */
/* ESTADO ACTIVO (CLICK)                          */
/* ============================================== */
.quarter-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}